generated from coulomb/repo-seed
Candidate support/evidence acceptance
This commit is contained in:
@@ -878,6 +878,52 @@ def test_accept_candidate_feature_promotes_parent_context_once(tmp_path):
|
||||
}
|
||||
|
||||
|
||||
def test_accept_candidate_evidence_promotes_parent_context(tmp_path):
|
||||
source = tmp_path / "repo"
|
||||
source.mkdir()
|
||||
(source / "README.md").write_text(
|
||||
"# Support Accept\nDocuments an HTTP health interface.\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(source / "tests").mkdir()
|
||||
(source / "tests" / "test_health.py").write_text(
|
||||
"def test_health(): pass\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(source / "app.py").write_text(
|
||||
"from fastapi import FastAPI\n"
|
||||
"app = FastAPI()\n"
|
||||
'@app.get("/health")\n'
|
||||
"def health():\n"
|
||||
" return {}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
service = make_service(tmp_path)
|
||||
repository = service.register_repository(name="Support Accept", url=str(source))
|
||||
summary = service.analyze_repository(repository.id)
|
||||
graph = service.candidate_graph(repository.id, summary.analysis_run.id)
|
||||
candidate_evidence = graph.abilities[0].capabilities[0].evidence[0]
|
||||
|
||||
ability_map = service.accept_candidate_evidence(
|
||||
repository.id,
|
||||
summary.analysis_run.id,
|
||||
candidate_evidence.id,
|
||||
)
|
||||
graph_after_accept = service.candidate_graph(
|
||||
repository.id,
|
||||
summary.analysis_run.id,
|
||||
)
|
||||
|
||||
approved_evidence = ability_map.abilities[0].capabilities[0].evidence[0]
|
||||
assert approved_evidence.reference == candidate_evidence.reference
|
||||
assert approved_evidence.target_kind == "capability"
|
||||
assert graph_after_accept.abilities[0].capabilities[0].evidence[0].status == (
|
||||
"approved"
|
||||
)
|
||||
decisions = service.list_review_decisions(repository.id, summary.analysis_run.id)
|
||||
assert decisions[0].action == "accept_candidate_evidence"
|
||||
|
||||
|
||||
def test_analysis_run_diff_keeps_approved_map_stable_until_change_approval(tmp_path):
|
||||
source = tmp_path / "repo"
|
||||
source.mkdir()
|
||||
|
||||
@@ -1205,6 +1205,18 @@ def test_ui_register_analyze_and_approve_loop(tmp_path):
|
||||
assert pending_candidate_listing.status_code == 200
|
||||
assert "Accept" in pending_candidate_listing.text
|
||||
|
||||
pending_support_listing = client.get(
|
||||
f"/ui/repos/{repository_id}/elements",
|
||||
params={
|
||||
"scope": "candidate",
|
||||
"analysis_run_id": first_run_id,
|
||||
"type": "supports",
|
||||
},
|
||||
)
|
||||
assert pending_support_listing.status_code == 200
|
||||
assert "Candidate Supports" in pending_support_listing.text
|
||||
assert "Accept" in pending_support_listing.text
|
||||
|
||||
approve_response = client.post(
|
||||
f"{run_path}/candidate-graph/approve",
|
||||
follow_redirects=False,
|
||||
|
||||
Reference in New Issue
Block a user