Index workplan flavor and omit residuals from default views.
STATE-WP-0092: persist flavor from files, treat depends_on as the C-20 canonical edge, exclude flavor=residual from summary/next_steps/deps unless include_residuals is set. Live primary still needs the alembic revision applied. Assistant: grok Assistant-Session: 01a09dc1-b21e-77e1-919e-fcad2f82b267
This commit is contained in:
parent
ea11451e9c
commit
ddc3338541
18 changed files with 852 additions and 25 deletions
|
|
@ -1328,6 +1328,173 @@ class TestC20DependencyDetection:
|
|||
|
||||
assert "C-20" not in [issue.check_id for issue in report.issues]
|
||||
|
||||
def test_depends_on_alias_satisfies_workplan_dependency(self, tmp_path, monkeypatch):
|
||||
repo = tmp_path / "repo"
|
||||
workplans = repo / "workplans"
|
||||
workplans.mkdir(parents=True)
|
||||
(workplans / "STATE-WP-0001-base.md").write_text(
|
||||
"---\n"
|
||||
"id: STATE-WP-0001\n"
|
||||
"title: Base\n"
|
||||
"domain: financials\n"
|
||||
"repo: demo-repo\n"
|
||||
"status: active\n"
|
||||
"state_hub_workstream_id: \"base-ws\"\n"
|
||||
"---\n\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(workplans / "STATE-WP-0002-dependent.md").write_text(
|
||||
"---\n"
|
||||
"id: STATE-WP-0002\n"
|
||||
"title: Dependent\n"
|
||||
"domain: financials\n"
|
||||
"repo: demo-repo\n"
|
||||
"status: active\n"
|
||||
"state_hub_workstream_id: \"dependent-ws\"\n"
|
||||
"depends_on:\n"
|
||||
" - STATE-WP-0001\n"
|
||||
"---\n\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
def fake_get(_api_base, path, params=None, **_kwargs):
|
||||
if path == "/repos/demo-repo":
|
||||
import socket
|
||||
|
||||
return {
|
||||
"id": "repo-1",
|
||||
"slug": "demo-repo",
|
||||
"local_path": str(repo),
|
||||
"host_paths": {socket.gethostname(): str(repo)},
|
||||
"domain_slug": "financials",
|
||||
}
|
||||
if path == "/workplans/base-ws":
|
||||
return {"id": "base-ws", "repo_id": "repo-1", "slug": "state-wp-0001", "title": "Base", "status": "active"}
|
||||
if path == "/workplans/dependent-ws":
|
||||
return {"id": "dependent-ws", "repo_id": "repo-1", "slug": "state-wp-0002", "title": "Dependent", "status": "active"}
|
||||
if path == "/tasks" and params and params.get("workstream_id") in {"base-ws", "dependent-ws"}:
|
||||
return []
|
||||
if path == "/workplans/base-ws/dependencies":
|
||||
return []
|
||||
if path == "/workplans/dependent-ws/dependencies":
|
||||
return [
|
||||
{
|
||||
"id": "dep-1",
|
||||
"from_workplan_id": "dependent-ws",
|
||||
"to_workplan_id": "base-ws",
|
||||
"to_task_id": None,
|
||||
"relationship_type": "blocks",
|
||||
}
|
||||
]
|
||||
if path == "/workplans" and params == {"repo_id": "repo-1"}:
|
||||
return []
|
||||
return []
|
||||
|
||||
monkeypatch.setattr("consistency_check._api_get", fake_get)
|
||||
|
||||
report = check_repo("http://unused", "demo-repo")
|
||||
|
||||
assert "C-20" not in [issue.check_id for issue in report.issues]
|
||||
|
||||
|
||||
class TestFlavorChecks:
|
||||
def test_unknown_flavor_warns_c36(self, tmp_path, monkeypatch):
|
||||
repo = tmp_path / "repo"
|
||||
workplans = repo / "workplans"
|
||||
workplans.mkdir(parents=True)
|
||||
(workplans / "STATE-WP-0001-odd.md").write_text(
|
||||
"---\n"
|
||||
"id: STATE-WP-0001\n"
|
||||
"title: Odd\n"
|
||||
"domain: financials\n"
|
||||
"repo: demo-repo\n"
|
||||
"status: active\n"
|
||||
"flavor: sidetrack\n"
|
||||
"state_hub_workstream_id: \"odd-ws\"\n"
|
||||
"---\n\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
def fake_get(_api_base, path, params=None, **_kwargs):
|
||||
if path == "/repos/demo-repo":
|
||||
import socket
|
||||
|
||||
return {
|
||||
"id": "repo-1",
|
||||
"slug": "demo-repo",
|
||||
"local_path": str(repo),
|
||||
"host_paths": {socket.gethostname(): str(repo)},
|
||||
"domain_slug": "financials",
|
||||
}
|
||||
if path == "/workplans/odd-ws":
|
||||
return {
|
||||
"id": "odd-ws",
|
||||
"repo_id": "repo-1",
|
||||
"slug": "state-wp-0001",
|
||||
"title": "Odd",
|
||||
"status": "active",
|
||||
}
|
||||
if path == "/tasks":
|
||||
return []
|
||||
if path.endswith("/dependencies"):
|
||||
return []
|
||||
if path == "/workplans":
|
||||
return []
|
||||
return []
|
||||
|
||||
monkeypatch.setattr("consistency_check._api_get", fake_get)
|
||||
report = check_repo("http://unused", "demo-repo")
|
||||
assert "C-36" in [issue.check_id for issue in report.issues]
|
||||
|
||||
def test_residual_without_origin_warns_c37(self, tmp_path, monkeypatch):
|
||||
repo = tmp_path / "repo"
|
||||
workplans = repo / "workplans"
|
||||
workplans.mkdir(parents=True)
|
||||
(workplans / "STATE-WP-0001-left.md").write_text(
|
||||
"---\n"
|
||||
"id: STATE-WP-0001\n"
|
||||
"title: Left\n"
|
||||
"domain: financials\n"
|
||||
"repo: demo-repo\n"
|
||||
"status: active\n"
|
||||
"flavor: residual\n"
|
||||
"state_hub_workstream_id: \"left-ws\"\n"
|
||||
"---\n\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
def fake_get(_api_base, path, params=None, **_kwargs):
|
||||
if path == "/repos/demo-repo":
|
||||
import socket
|
||||
|
||||
return {
|
||||
"id": "repo-1",
|
||||
"slug": "demo-repo",
|
||||
"local_path": str(repo),
|
||||
"host_paths": {socket.gethostname(): str(repo)},
|
||||
"domain_slug": "financials",
|
||||
}
|
||||
if path == "/workplans/left-ws":
|
||||
return {
|
||||
"id": "left-ws",
|
||||
"repo_id": "repo-1",
|
||||
"slug": "state-wp-0001",
|
||||
"title": "Left",
|
||||
"status": "active",
|
||||
"flavor": "residual",
|
||||
}
|
||||
if path == "/tasks":
|
||||
return []
|
||||
if path.endswith("/dependencies"):
|
||||
return []
|
||||
if path == "/workplans":
|
||||
return []
|
||||
return []
|
||||
|
||||
monkeypatch.setattr("consistency_check._api_get", fake_get)
|
||||
report = check_repo("http://unused", "demo-repo")
|
||||
assert "C-37" in [issue.check_id for issue in report.issues]
|
||||
|
||||
|
||||
class TestC06WorkstreamCreation:
|
||||
def test_fix_repo_bootstraps_legacy_ids_only_into_empty_projection(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue