generated from coulomb/repo-seed
first review workflow slice
This commit is contained in:
@@ -144,6 +144,43 @@ def test_analyze_repository_records_snapshot_and_observed_facts(tmp_path):
|
||||
assert "Expose Repository Interface" in capability_names
|
||||
|
||||
|
||||
def test_approve_candidate_graph_publishes_ability_map_once(tmp_path):
|
||||
source = tmp_path / "repo"
|
||||
source.mkdir()
|
||||
(source / "README.md").write_text("# Example\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="Example", url=str(source))
|
||||
summary = service.analyze_repository(repository.id)
|
||||
|
||||
ability_map = service.approve_candidate_graph(
|
||||
repository.id,
|
||||
summary.analysis_run.id,
|
||||
notes="Looks good for the first pass.",
|
||||
)
|
||||
second_approval = service.approve_candidate_graph(
|
||||
repository.id,
|
||||
summary.analysis_run.id,
|
||||
)
|
||||
|
||||
assert service.get_repository(repository.id).status == "indexed"
|
||||
assert len(ability_map.abilities) == 1
|
||||
assert len(second_approval.abilities) == 1
|
||||
assert ability_map.abilities[0].name == "Review Example Repository Usefulness"
|
||||
assert ability_map.abilities[0].capabilities[0].features[0].location == "app.py"
|
||||
|
||||
candidate_graph = service.candidate_graph(repository.id, summary.analysis_run.id)
|
||||
assert candidate_graph.abilities[0].status == "approved"
|
||||
|
||||
|
||||
def test_analyze_repository_failure_is_recorded(tmp_path):
|
||||
service = make_service(tmp_path)
|
||||
repository = service.register_repository(
|
||||
|
||||
@@ -112,6 +112,22 @@ def test_api_analysis_run_loop(tmp_path):
|
||||
"Review Frontend Repository Usefulness"
|
||||
)
|
||||
|
||||
approve_response = client.post(
|
||||
f"/repos/{repository_id}/analysis-runs/"
|
||||
f"{run['analysis_run']['id']}/candidate-graph/approve",
|
||||
json={"notes": "Approved in API test"},
|
||||
)
|
||||
assert approve_response.status_code == 200
|
||||
ability_map = approve_response.json()
|
||||
assert ability_map["repository"]["status"] == "indexed"
|
||||
assert ability_map["abilities"][0]["name"] == (
|
||||
"Review Frontend Repository Usefulness"
|
||||
)
|
||||
|
||||
search_response = client.get("/search", params={"q": "structure"})
|
||||
assert search_response.status_code == 200
|
||||
assert search_response.json()
|
||||
|
||||
facts_response = client.get(f"/repos/{repository_id}/observed-facts")
|
||||
assert facts_response.status_code == 200
|
||||
fact_names = {
|
||||
|
||||
Reference in New Issue
Block a user