generated from coulomb/repo-seed
Improved datamodel and deterministic generation
This commit is contained in:
@@ -52,13 +52,19 @@ def test_candidate_generator_builds_purpose_seed_from_observed_facts():
|
||||
ability = graph[0]
|
||||
assert ability.name == "Route Incoming Customer Email To The Right Team"
|
||||
assert "Usefulness" not in ability.name
|
||||
assert ability.primary_class == "developer-tooling"
|
||||
assert "interface" in ability.attributes
|
||||
assert ability.source_refs[0].path == "README.md"
|
||||
interface_capability = ability.capabilities[0]
|
||||
assert interface_capability.name == "Expose Repository Interface"
|
||||
assert interface_capability.primary_class == "interface"
|
||||
assert {"surface", "api"} <= set(interface_capability.attributes)
|
||||
assert interface_capability.confidence == 0.75
|
||||
assert interface_capability.inputs == ["HTTP request"]
|
||||
assert interface_capability.outputs == ["HTTP response"]
|
||||
assert interface_capability.features[0].type == "API"
|
||||
assert interface_capability.features[0].primary_class == "API"
|
||||
assert {"API", "surface", "http"} <= set(interface_capability.features[0].attributes)
|
||||
assert interface_capability.features[0].name == "POST /classify"
|
||||
assert interface_capability.features[0].location == "app.py"
|
||||
assert interface_capability.evidence[0].strength == "strong"
|
||||
@@ -273,8 +279,18 @@ def test_candidate_generator_maps_llm_provider_facts_to_capability():
|
||||
for capability in graph[0].capabilities
|
||||
if capability.name == "Route LLM Requests Across Providers"
|
||||
)
|
||||
assert graph[0].primary_class == "ai-integration"
|
||||
assert capability.primary_class == "llm-integration"
|
||||
assert {"llm-provider", "openrouter", "claude", "fallback-policy"} <= set(
|
||||
capability.attributes
|
||||
)
|
||||
feature_names = {feature.name for feature in capability.features}
|
||||
assert {"Use OpenRouter Models", "Use Claude Models"} <= feature_names
|
||||
assert "Configure LLM Provider Credentials" in feature_names
|
||||
assert "Maintain LLM Provider Registry" in feature_names
|
||||
assert "Apply LLM Provider Fallback Policy" in feature_names
|
||||
openrouter_feature = next(
|
||||
feature for feature in capability.features if feature.name == "Use OpenRouter Models"
|
||||
)
|
||||
assert openrouter_feature.primary_class == "integration"
|
||||
assert {"llm-provider", "openrouter"} <= set(openrouter_feature.attributes)
|
||||
|
||||
@@ -813,13 +813,33 @@ def test_approve_candidate_graph_publishes_ability_map_once(tmp_path):
|
||||
assert len(ability_map.abilities) == 1
|
||||
assert len(second_approval.abilities) == 1
|
||||
assert ability_map.abilities[0].name == "Support Example"
|
||||
assert ability_map.abilities[0].primary_class == "developer-tooling"
|
||||
assert ability_map.abilities[0].attributes == ["interface"]
|
||||
assert ability_map.abilities[0].capabilities[0].primary_class == "interface"
|
||||
assert ability_map.abilities[0].capabilities[0].features[0].location == "app.py"
|
||||
assert ability_map.abilities[0].capabilities[0].features[0].primary_class == "API"
|
||||
assert ability_map.abilities[0].capabilities[0].features[0].attributes == [
|
||||
"API",
|
||||
"surface",
|
||||
"http",
|
||||
]
|
||||
assert ability_map.abilities[0].capabilities[0].features[0].source_refs
|
||||
assert ability_map.abilities[0].capabilities[0].features[0].source_refs[0].line == 3
|
||||
assert ability_map.abilities[0].capabilities[0].evidence[0].source_refs
|
||||
|
||||
candidate_graph = service.candidate_graph(repository.id, summary.analysis_run.id)
|
||||
assert candidate_graph.abilities[0].status == "approved"
|
||||
assert candidate_graph.abilities[0].primary_class == "developer-tooling"
|
||||
assert candidate_graph.abilities[0].capabilities[0].primary_class == "interface"
|
||||
assert (
|
||||
candidate_graph.abilities[0].capabilities[0].features[0].primary_class
|
||||
== "API"
|
||||
)
|
||||
assert candidate_graph.abilities[0].capabilities[0].features[0].attributes == [
|
||||
"API",
|
||||
"surface",
|
||||
"http",
|
||||
]
|
||||
decisions = service.list_review_decisions(repository.id, summary.analysis_run.id)
|
||||
assert decisions[0].action == "approve_candidate_graph"
|
||||
assert decisions[0].notes == "Looks good for the first pass."
|
||||
|
||||
@@ -22,6 +22,16 @@ def test_initialize_is_idempotent_and_applies_expected_columns(tmp_path):
|
||||
feature_columns = {
|
||||
row[1] for row in connection.execute("PRAGMA table_info(approved_features)")
|
||||
}
|
||||
ability_columns = {
|
||||
row[1] for row in connection.execute("PRAGMA table_info(approved_abilities)")
|
||||
}
|
||||
capability_columns = {
|
||||
row[1]
|
||||
for row in connection.execute("PRAGMA table_info(approved_capabilities)")
|
||||
}
|
||||
candidate_feature_columns = {
|
||||
row[1] for row in connection.execute("PRAGMA table_info(candidate_features)")
|
||||
}
|
||||
evidence_columns = {
|
||||
row[1] for row in connection.execute("PRAGMA table_info(approved_evidence)")
|
||||
}
|
||||
@@ -33,6 +43,10 @@ def test_initialize_is_idempotent_and_applies_expected_columns(tmp_path):
|
||||
}
|
||||
|
||||
assert "source_refs" in feature_columns
|
||||
assert {"primary_class", "attributes"} <= ability_columns
|
||||
assert {"primary_class", "attributes"} <= capability_columns
|
||||
assert {"primary_class", "attributes"} <= feature_columns
|
||||
assert {"primary_class", "attributes"} <= candidate_feature_columns
|
||||
assert "source_refs" in evidence_columns
|
||||
assert {
|
||||
"target_kind",
|
||||
|
||||
@@ -1723,6 +1723,8 @@ def test_ui_manual_registry_entry_loop(tmp_path):
|
||||
data={
|
||||
"name": "Manual Ability",
|
||||
"description": "Curated by hand.",
|
||||
"primary_class": "repository-intelligence",
|
||||
"attributes": "review, curation",
|
||||
"confidence": "0.95",
|
||||
},
|
||||
follow_redirects=False,
|
||||
@@ -1740,6 +1742,8 @@ def test_ui_manual_registry_entry_loop(tmp_path):
|
||||
"description": "Curated capability.",
|
||||
"inputs": "request, context",
|
||||
"outputs": "response",
|
||||
"primary_class": "review",
|
||||
"attributes": "ui, workflow",
|
||||
"confidence": "0.9",
|
||||
},
|
||||
follow_redirects=False,
|
||||
@@ -1755,6 +1759,8 @@ def test_ui_manual_registry_entry_loop(tmp_path):
|
||||
"capability_id": str(capability_id),
|
||||
"name": "Manual API",
|
||||
"type": "REST endpoint",
|
||||
"primary_class": "api",
|
||||
"attributes": "integration, review",
|
||||
"location": "src/manual.py",
|
||||
"confidence": "0.88",
|
||||
},
|
||||
@@ -1807,6 +1813,8 @@ def test_ui_manual_registry_entry_loop(tmp_path):
|
||||
data={
|
||||
"name": "Edited Manual Ability",
|
||||
"description": "Edited by hand.",
|
||||
"primary_class": "workflow-automation",
|
||||
"attributes": "manual, curation",
|
||||
"confidence": "0.8",
|
||||
},
|
||||
follow_redirects=False,
|
||||
@@ -1820,6 +1828,8 @@ def test_ui_manual_registry_entry_loop(tmp_path):
|
||||
"description": "Edited capability.",
|
||||
"inputs": "ticket",
|
||||
"outputs": "decision",
|
||||
"primary_class": "decisioning",
|
||||
"attributes": "workflow, review",
|
||||
"confidence": "0.75",
|
||||
},
|
||||
follow_redirects=False,
|
||||
@@ -1835,6 +1845,8 @@ def test_ui_manual_registry_entry_loop(tmp_path):
|
||||
data={
|
||||
"name": "Edited Manual API",
|
||||
"type": "HTTP endpoint",
|
||||
"primary_class": "ui",
|
||||
"attributes": "api, review",
|
||||
"location": "src/edited.py",
|
||||
"confidence": "0.7",
|
||||
},
|
||||
@@ -1865,6 +1877,32 @@ 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
|
||||
|
||||
ability_map = client.get(f"/repos/{repository_id}/ability-map").json()
|
||||
edited_ability = ability_map["abilities"][0]
|
||||
edited_capability = edited_ability["capabilities"][0]
|
||||
edited_feature = edited_capability["features"][0]
|
||||
assert edited_ability["primary_class"] == "workflow-automation"
|
||||
assert edited_ability["attributes"] == ["manual", "curation"]
|
||||
assert edited_capability["primary_class"] == "decisioning"
|
||||
assert edited_capability["attributes"] == ["workflow", "review"]
|
||||
assert edited_feature["primary_class"] == "ui"
|
||||
assert edited_feature["attributes"] == ["api", "review"]
|
||||
|
||||
filtered_feature_listing = client.get(
|
||||
f"/ui/repos/{repository_id}/elements",
|
||||
params={
|
||||
"scope": "all",
|
||||
"entry_filter": "approved",
|
||||
"type": "features",
|
||||
"class_filter": "ui",
|
||||
"attribute_filter": "api",
|
||||
},
|
||||
)
|
||||
assert filtered_feature_listing.status_code == 200
|
||||
assert "Attribute" in filtered_feature_listing.text
|
||||
assert "Edited Manual API" in filtered_feature_listing.text
|
||||
assert "1 of 1 shown" in filtered_feature_listing.text
|
||||
|
||||
upward_support_listing = client.get(
|
||||
f"/ui/repos/{repository_id}/elements",
|
||||
params={
|
||||
|
||||
Reference in New Issue
Block a user