fix: opt draft storage into real callers

This commit is contained in:
lda
2026-08-31 14:07:53 +07:00 Verified
parent ce7e3ed761
commit b377311a6e
21 changed files with 194 additions and 50 deletions
+2 -2
View File
@@ -131,7 +131,7 @@ def _artifact_api(
)
service.register_specs("demo.personal", echo_tool)
context = context_from_service(service)
return WorkflowArtifactApi(context), service
return WorkflowArtifactApi(context, drafts=True), service
@pytest.mark.asyncio
@@ -454,7 +454,7 @@ def _api(root: Path) -> WorkflowApi:
artifact_store=FileWorkflowArtifactStore(root),
draft_workspace_store=FileDraftWorkspaceStore(mcp_root),
)
return WorkflowApi(context_from_service(service))
return WorkflowApi(context_from_service(service), drafts=True)
@pytest.mark.asyncio
+15 -3
View File
@@ -10,18 +10,30 @@ from wf_artifacts import (
)
def test_file_workflow_stores_constructs_all_three_file_stores(tmp_path: Path) -> None:
def test_file_workflow_stores_skips_draft_store_by_default(tmp_path: Path) -> None:
root = tmp_path / "wf_api_file_workflow_stores"
stores = file_workflow_stores(root)
assert isinstance(stores, WorkflowStores)
assert isinstance(stores.artifact_store, FileWorkflowArtifactStore)
assert isinstance(stores.draft_workspace_store, FileDraftWorkspaceStore)
assert stores.draft_workspace_store is None
assert isinstance(stores.run_store, FileRunStore)
assert stores.artifact_store.root == root
assert stores.draft_workspace_store.root == root
assert stores.run_store.root == root
assert not (root / "draft_workspaces").exists()
def test_file_workflow_stores_constructs_draft_store_when_explicitly_enabled(
tmp_path: Path,
) -> None:
root = tmp_path / "wf_api_file_workflow_stores_drafts"
stores = file_workflow_stores(root, drafts=True)
assert isinstance(stores.draft_workspace_store, FileDraftWorkspaceStore)
assert stores.draft_workspace_store.root == root
assert (root / "draft_workspaces").is_dir()
def test_wf_api_exports_workflow_stores() -> None: