generated from coulomb/repo-seed
Run diagnostics panel
This commit is contained in:
@@ -1167,6 +1167,8 @@ def test_ui_register_analyze_and_approve_loop(tmp_path):
|
||||
|
||||
run_detail = client.get(run_path)
|
||||
assert run_detail.status_code == 200
|
||||
assert "Run Diagnostics" in run_detail.text
|
||||
assert "Analysis completed with reviewable results." in run_detail.text
|
||||
assert "Candidate Graph" in run_detail.text
|
||||
assert "1 abilities" in run_detail.text
|
||||
assert "2 capabilities" in run_detail.text
|
||||
@@ -1538,6 +1540,64 @@ def test_ui_element_listing_hides_rejected_candidates_by_default(tmp_path):
|
||||
app.dependency_overrides.clear()
|
||||
|
||||
|
||||
def test_ui_analysis_run_diagnostics_explain_failures_and_empty_results(tmp_path):
|
||||
empty_source = tmp_path / "empty-repo"
|
||||
empty_source.mkdir()
|
||||
|
||||
def override_settings():
|
||||
return Settings(
|
||||
database_path=str(tmp_path / "ui-diagnostics.sqlite3"),
|
||||
checkout_root=str(tmp_path / "ui-diagnostics-checkouts"),
|
||||
)
|
||||
|
||||
app.dependency_overrides[get_settings] = override_settings
|
||||
client = TestClient(app)
|
||||
try:
|
||||
create_response = client.post(
|
||||
"/repos",
|
||||
json={
|
||||
"url": str(empty_source),
|
||||
"name": "Diagnostics Repo",
|
||||
"description": "Used for UI diagnostics.",
|
||||
"branch": "main",
|
||||
},
|
||||
)
|
||||
assert create_response.status_code == 201
|
||||
repository_id = create_response.json()["id"]
|
||||
|
||||
failed_run = client.post(
|
||||
f"/ui/repos/{repository_id}/analysis-runs",
|
||||
data={
|
||||
"source_path": str(tmp_path / "missing-repo"),
|
||||
"use_llm_assistance": "",
|
||||
},
|
||||
follow_redirects=False,
|
||||
)
|
||||
assert failed_run.status_code == 303
|
||||
failed_detail = client.get(failed_run.headers["location"])
|
||||
assert failed_detail.status_code == 200
|
||||
assert "Run Diagnostics" in failed_detail.text
|
||||
assert "Analysis failed." in failed_detail.text
|
||||
assert "Verify the local path or Git URL" in failed_detail.text
|
||||
|
||||
empty_run = client.post(
|
||||
f"/ui/repos/{repository_id}/analysis-runs",
|
||||
data={
|
||||
"source_path": "",
|
||||
"use_llm_assistance": "",
|
||||
},
|
||||
follow_redirects=False,
|
||||
)
|
||||
assert empty_run.status_code == 303
|
||||
empty_detail = client.get(empty_run.headers["location"])
|
||||
assert empty_detail.status_code == 200
|
||||
assert "No observed facts were found." in empty_detail.text
|
||||
assert "0 facts" in empty_detail.text
|
||||
assert "0 abilities" in empty_detail.text
|
||||
finally:
|
||||
app.dependency_overrides.clear()
|
||||
|
||||
|
||||
def test_ui_register_and_explore_lands_on_analysis_result(tmp_path):
|
||||
source = tmp_path / "explore-repo"
|
||||
source.mkdir()
|
||||
@@ -1715,6 +1775,21 @@ def test_ui_manual_registry_entry_loop(tmp_path):
|
||||
)
|
||||
assert evidence_response.status_code == 303
|
||||
|
||||
upward_support_response = client.post(
|
||||
f"{repository_path}/evidence",
|
||||
data={
|
||||
"capability_id": str(capability_id),
|
||||
"target_kind": "feature",
|
||||
"target_id": "999",
|
||||
"type": "review-smell",
|
||||
"reference": "Manual Capability",
|
||||
"reference_kind": "capability",
|
||||
"strength": "weak",
|
||||
},
|
||||
follow_redirects=False,
|
||||
)
|
||||
assert upward_support_response.status_code == 303
|
||||
|
||||
detail_response = client.get(repository_path)
|
||||
assert "Manual Ability" in detail_response.text
|
||||
assert "Manual Capability" in detail_response.text
|
||||
@@ -1723,6 +1798,7 @@ def test_ui_manual_registry_entry_loop(tmp_path):
|
||||
assert "supports capability" in detail_response.text
|
||||
assert "references source" in detail_response.text
|
||||
assert "downward support" in detail_response.text
|
||||
assert "upward support review" in detail_response.text
|
||||
assert "ID " in detail_response.text
|
||||
assert "Save Ability" in detail_response.text
|
||||
|
||||
@@ -1789,6 +1865,21 @@ def test_ui_manual_registry_entry_loop(tmp_path):
|
||||
assert f"references feature #{feature_id}" in detail_response.text
|
||||
assert "downward support" in detail_response.text
|
||||
|
||||
upward_support_listing = client.get(
|
||||
f"/ui/repos/{repository_id}/elements",
|
||||
params={
|
||||
"scope": "all",
|
||||
"entry_filter": "approved",
|
||||
"type": "supports",
|
||||
"support_orientation_filter": "upward support review",
|
||||
},
|
||||
)
|
||||
assert upward_support_listing.status_code == 200
|
||||
assert "Support orientation" in upward_support_listing.text
|
||||
assert "1 of 2 shown" in upward_support_listing.text
|
||||
assert "review-smell" in upward_support_listing.text
|
||||
assert "tests/test_manual.py" not in upward_support_listing.text
|
||||
|
||||
delete_feature_response = client.post(
|
||||
f"{repository_path}/features/{feature_id}/delete",
|
||||
follow_redirects=False,
|
||||
|
||||
Reference in New Issue
Block a user