type: narrow example and authoring test payloads
This commit is contained in:
@@ -240,23 +240,31 @@ async def test_lda_report_workflow_artifact_interrupt_resume_path(
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert started["status"] == "interrupted"
|
assert started["status"] == "interrupted"
|
||||||
assert started["interrupt"]["kind"] == "issue_review"
|
interrupt = started["interrupt"]
|
||||||
assert started["interrupt"]["typed"] is True
|
assert interrupt is not None
|
||||||
assert set(started["interrupt"]["request_schema"]["required"]) == {
|
assert interrupt["kind"] == "issue_review"
|
||||||
|
assert interrupt["typed"] is True
|
||||||
|
request_required = interrupt["request_schema"].get("required")
|
||||||
|
assert isinstance(request_required, list)
|
||||||
|
assert set(request_required) == {
|
||||||
"report_markdown",
|
"report_markdown",
|
||||||
"proposed_issues",
|
"proposed_issues",
|
||||||
}
|
}
|
||||||
assert set(started["interrupt"]["resume_schema"]["required"]) == {
|
resume_required = interrupt["resume_schema"].get("required")
|
||||||
|
assert isinstance(resume_required, list)
|
||||||
|
assert set(resume_required) == {
|
||||||
"approved",
|
"approved",
|
||||||
"selected_issue_ids",
|
"selected_issue_ids",
|
||||||
}
|
}
|
||||||
proposed_ids = [
|
proposed_ids = [
|
||||||
issue["id"] for issue in started["interrupt"]["payload"]["proposed_issues"]
|
issue["id"] for issue in interrupt["payload"]["proposed_issues"]
|
||||||
]
|
]
|
||||||
assert proposed_ids
|
assert proposed_ids
|
||||||
|
started_run_id = started["run_id"]
|
||||||
|
assert isinstance(started_run_id, str)
|
||||||
|
|
||||||
resumed = await server.api.resume_run(
|
resumed = await server.api.resume_run(
|
||||||
run_id=started["run_id"],
|
run_id=started_run_id,
|
||||||
resume_payload={
|
resume_payload={
|
||||||
"approved": True,
|
"approved": True,
|
||||||
"selected_issue_ids": proposed_ids[:2],
|
"selected_issue_ids": proposed_ids[:2],
|
||||||
@@ -267,10 +275,12 @@ async def test_lda_report_workflow_artifact_interrupt_resume_path(
|
|||||||
|
|
||||||
assert resumed["status"] == "completed"
|
assert resumed["status"] == "completed"
|
||||||
assert resumed["outcome"] == "completed"
|
assert resumed["outcome"] == "completed"
|
||||||
assert resumed["output"]["approved"] is True
|
output = resumed["output"]
|
||||||
assert resumed["output"]["created_issues"]
|
assert output is not None
|
||||||
assert resumed["output"]["created_issues"][0]["id"] == "ISSUE-001"
|
assert output["approved"] is True
|
||||||
assert resumed["output"]["markdown"].startswith(
|
assert output["created_issues"]
|
||||||
|
assert output["created_issues"][0]["id"] == "ISSUE-001"
|
||||||
|
assert output["markdown"].startswith(
|
||||||
"# lda.chat Thesis And Project Readiness Report"
|
"# lda.chat Thesis And Project Readiness Report"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -312,9 +322,11 @@ async def test_lda_report_workflow_cancelled_resume_path(tmp_path: Path) -> None
|
|||||||
deployment_id="lda_report_cancel_case.default",
|
deployment_id="lda_report_cancel_case.default",
|
||||||
workflow_input=run_input,
|
workflow_input=run_input,
|
||||||
)
|
)
|
||||||
|
started_run_id = started["run_id"]
|
||||||
|
assert isinstance(started_run_id, str)
|
||||||
|
|
||||||
resumed = await server.api.resume_run(
|
resumed = await server.api.resume_run(
|
||||||
run_id=started["run_id"],
|
run_id=started_run_id,
|
||||||
resume_payload={
|
resume_payload={
|
||||||
"approved": False,
|
"approved": False,
|
||||||
"selected_issue_ids": [],
|
"selected_issue_ids": [],
|
||||||
@@ -325,5 +337,7 @@ async def test_lda_report_workflow_cancelled_resume_path(tmp_path: Path) -> None
|
|||||||
|
|
||||||
assert resumed["status"] == "completed"
|
assert resumed["status"] == "completed"
|
||||||
assert resumed["outcome"] == "cancelled"
|
assert resumed["outcome"] == "cancelled"
|
||||||
assert resumed["output"]["approved"] is False
|
output = resumed["output"]
|
||||||
assert "Revision Requested" in resumed["output"]["markdown"]
|
assert output is not None
|
||||||
|
assert output["approved"] is False
|
||||||
|
assert "Revision Requested" in output["markdown"]
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from wf_api.authoring_contracts import (
|
|||||||
project_authoring_step_contract,
|
project_authoring_step_contract,
|
||||||
schema_path_options,
|
schema_path_options,
|
||||||
)
|
)
|
||||||
|
from wf_api.models import AuthoringPathOptionPayload, AuthoringStepContractPayload
|
||||||
|
|
||||||
|
|
||||||
def test_schema_path_options_is_parent_first_and_schema_derived() -> None:
|
def test_schema_path_options_is_parent_first_and_schema_derived() -> None:
|
||||||
@@ -255,7 +256,7 @@ def test_schema_path_options_returns_empty_schema_for_unconstrained_property() -
|
|||||||
|
|
||||||
|
|
||||||
def test_project_authoring_contract_inventory_composes_pure_inputs() -> None:
|
def test_project_authoring_contract_inventory_composes_pure_inputs() -> None:
|
||||||
context_entry = {
|
context_entry: AuthoringPathOptionPayload = {
|
||||||
"path": "context.loop_item",
|
"path": "context.loop_item",
|
||||||
"label": "Loop Item",
|
"label": "Loop Item",
|
||||||
"origin": "runtime_context",
|
"origin": "runtime_context",
|
||||||
@@ -265,7 +266,7 @@ def test_project_authoring_contract_inventory_composes_pure_inputs() -> None:
|
|||||||
"uses": ["step_input"],
|
"uses": ["step_input"],
|
||||||
"reason": "Only available inside the foreach body.",
|
"reason": "Only available inside the foreach body.",
|
||||||
}
|
}
|
||||||
step_input_target = {
|
step_input_target: AuthoringPathOptionPayload = {
|
||||||
"path": "step.input.query",
|
"path": "step.input.query",
|
||||||
"label": "Query",
|
"label": "Query",
|
||||||
"origin": "step_input",
|
"origin": "step_input",
|
||||||
@@ -274,7 +275,7 @@ def test_project_authoring_contract_inventory_composes_pure_inputs() -> None:
|
|||||||
"availability": "available",
|
"availability": "available",
|
||||||
"uses": ["step_input"],
|
"uses": ["step_input"],
|
||||||
}
|
}
|
||||||
step_output_source = {
|
step_output_source: AuthoringPathOptionPayload = {
|
||||||
"path": "step.output.answer",
|
"path": "step.output.answer",
|
||||||
"label": "Answer",
|
"label": "Answer",
|
||||||
"origin": "step_output",
|
"origin": "step_output",
|
||||||
@@ -283,7 +284,7 @@ def test_project_authoring_contract_inventory_composes_pure_inputs() -> None:
|
|||||||
"availability": "available",
|
"availability": "available",
|
||||||
"uses": ["step_output_source", "workflow_output"],
|
"uses": ["step_output_source", "workflow_output"],
|
||||||
}
|
}
|
||||||
entry_step = {
|
entry_step: AuthoringStepContractPayload = {
|
||||||
"step_id": "fetch",
|
"step_id": "fetch",
|
||||||
"label": "Fetch",
|
"label": "Fetch",
|
||||||
}
|
}
|
||||||
@@ -372,8 +373,10 @@ def test_authoring_paths_exclude_incompatible_binding_roles() -> None:
|
|||||||
state_source = inventory["readable_sources"][0]
|
state_source = inventory["readable_sources"][0]
|
||||||
assert state_source["path"] == "state.answer"
|
assert state_source["path"] == "state.answer"
|
||||||
assert "step_output_source" not in state_source["uses"]
|
assert "step_output_source" not in state_source["uses"]
|
||||||
assert step_contract["output_sources"][0]["path"] == "step_output.answer"
|
output_sources = step_contract.get("output_sources")
|
||||||
assert "workflow_output" not in step_contract["output_sources"][0]["uses"]
|
assert output_sources is not None
|
||||||
|
assert output_sources[0]["path"] == "step_output.answer"
|
||||||
|
assert "workflow_output" not in output_sources[0]["uses"]
|
||||||
|
|
||||||
|
|
||||||
def test_context_path_options_are_step_input_only() -> None:
|
def test_context_path_options_are_step_input_only() -> None:
|
||||||
@@ -393,11 +396,12 @@ def test_context_path_options_are_step_input_only() -> None:
|
|||||||
assert options[0]["origin"] == "runtime_context"
|
assert options[0]["origin"] == "runtime_context"
|
||||||
assert options[0]["uses"] == ["step_input"]
|
assert options[0]["uses"] == ["step_input"]
|
||||||
assert options[0]["availability"] == "conditional"
|
assert options[0]["availability"] == "conditional"
|
||||||
assert options[0]["reason"] == "Only available inside the foreach body."
|
reason = options[0].get("reason")
|
||||||
|
assert reason == "Only available inside the foreach body."
|
||||||
|
|
||||||
|
|
||||||
def test_project_inventory_does_not_offer_context_for_workflow_output() -> None:
|
def test_project_inventory_does_not_offer_context_for_workflow_output() -> None:
|
||||||
context_entry = {
|
context_entry: AuthoringPathOptionPayload = {
|
||||||
"path": "context.item",
|
"path": "context.item",
|
||||||
"label": "Item",
|
"label": "Item",
|
||||||
"origin": "runtime_context",
|
"origin": "runtime_context",
|
||||||
|
|||||||
Reference in New Issue
Block a user