generated from coulomb/repo-seed
advanced the review workflow
This commit is contained in:
@@ -206,6 +206,43 @@ def test_approve_candidate_graph_publishes_ability_map_once(tmp_path):
|
||||
assert candidate_graph.abilities[0].status == "approved"
|
||||
|
||||
|
||||
def test_reject_candidate_ability_excludes_it_from_approval(tmp_path):
|
||||
source = tmp_path / "repo"
|
||||
source.mkdir()
|
||||
(source / "README.md").write_text("# Rejectable\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="Rejectable", url=str(source))
|
||||
summary = service.analyze_repository(repository.id)
|
||||
graph = service.candidate_graph(repository.id, summary.analysis_run.id)
|
||||
candidate = graph.abilities[0]
|
||||
|
||||
rejected_graph = service.reject_candidate_ability(
|
||||
repository.id,
|
||||
summary.analysis_run.id,
|
||||
candidate.id,
|
||||
notes="Too generic.",
|
||||
)
|
||||
ability_map = service.approve_candidate_graph(
|
||||
repository.id,
|
||||
summary.analysis_run.id,
|
||||
)
|
||||
|
||||
assert service.get_repository(repository.id).status == "reviewing"
|
||||
assert rejected_graph.abilities[0].status == "rejected"
|
||||
assert rejected_graph.abilities[0].capabilities[0].status == "rejected"
|
||||
assert rejected_graph.abilities[0].capabilities[0].features[0].status == "rejected"
|
||||
assert ability_map.abilities == []
|
||||
|
||||
|
||||
def test_analyze_repository_failure_is_recorded(tmp_path):
|
||||
service = make_service(tmp_path)
|
||||
repository = service.register_repository(
|
||||
|
||||
@@ -138,6 +138,20 @@ def test_api_analysis_run_loop(tmp_path):
|
||||
assert candidate_graph["abilities"][0]["name"] == (
|
||||
"Review Frontend Repository Usefulness"
|
||||
)
|
||||
candidate_ability_id = candidate_graph["abilities"][0]["id"]
|
||||
|
||||
reject_response = client.post(
|
||||
f"/repos/{repository_id}/analysis-runs/"
|
||||
f"{run['analysis_run']['id']}/candidate-abilities/"
|
||||
f"{candidate_ability_id}/reject",
|
||||
json={"notes": "Reject once to exercise review correction."},
|
||||
)
|
||||
assert reject_response.status_code == 200
|
||||
assert reject_response.json()["abilities"][0]["status"] == "rejected"
|
||||
|
||||
run_response = client.post(f"/repos/{repository_id}/analysis-runs", json={})
|
||||
assert run_response.status_code == 201
|
||||
run = run_response.json()
|
||||
|
||||
approve_response = client.post(
|
||||
f"/repos/{repository_id}/analysis-runs/"
|
||||
|
||||
Reference in New Issue
Block a user