generated from coulomb/repo-seed
baseline repo characteristics no longer crowd the candidate graph
This commit is contained in:
@@ -15,6 +15,7 @@ from tests.fixtures import (
|
||||
write_javascript_typescript_package_repo,
|
||||
write_key_cape_like_repo,
|
||||
write_llm_connect_like_repo,
|
||||
write_ops_bridge_like_repo,
|
||||
write_misleading_docs_repo,
|
||||
write_python_cli_repo,
|
||||
write_readme_only_repo,
|
||||
@@ -27,6 +28,32 @@ def make_service(tmp_path):
|
||||
return RegistryService(store, ingestion=GitIngestionService(tmp_path / "checkouts"))
|
||||
|
||||
|
||||
def add_candidate_capability(service, repository_id, analysis_run_id, ability_id, name):
|
||||
with service.store.connect() as connection:
|
||||
cursor = connection.execute(
|
||||
"""
|
||||
INSERT INTO candidate_capabilities
|
||||
(repository_id, analysis_run_id, ability_id, name, description,
|
||||
inputs, outputs, primary_class, attributes, confidence, source_refs)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
""",
|
||||
(
|
||||
repository_id,
|
||||
analysis_run_id,
|
||||
ability_id,
|
||||
name,
|
||||
"Review target capability inserted for review workflow tests.",
|
||||
"[]",
|
||||
"[]",
|
||||
"test-capability",
|
||||
json.dumps(["test-review-target"]),
|
||||
0.5,
|
||||
"[]",
|
||||
),
|
||||
)
|
||||
return int(cursor.lastrowid)
|
||||
|
||||
|
||||
class FakeLLMExtractor:
|
||||
def __init__(self, abilities):
|
||||
self.abilities = abilities
|
||||
@@ -298,12 +325,12 @@ def test_search_filters_by_status_language_and_framework(tmp_path):
|
||||
service.approve_candidate_graph(repository.id, summary.analysis_run.id)
|
||||
|
||||
results = service.search(
|
||||
"repository",
|
||||
"health",
|
||||
status="indexed",
|
||||
language="Python",
|
||||
framework="FastAPI",
|
||||
ability="Support Filterable",
|
||||
capability="Repository Structure",
|
||||
capability="Repository Interface",
|
||||
)
|
||||
wrong_language_results = service.search(
|
||||
"repository",
|
||||
@@ -380,7 +407,6 @@ def test_fixture_breadth_javascript_typescript_package_extracts_structure_and_ap
|
||||
assert ("framework", "React", "package.json") in fact_names
|
||||
assert ("framework", "Vitest", "package.json") in fact_names
|
||||
assert "Expose Repository Interface" in capability_names
|
||||
assert "Describe Repository Structure" in capability_names
|
||||
assert "API" in feature_types
|
||||
assert service.ability_map(repository.id).abilities == []
|
||||
|
||||
@@ -468,10 +494,36 @@ def test_regression_dependency_only_repo_keeps_libraries_as_context(tmp_path):
|
||||
for capability in ability.capabilities
|
||||
}
|
||||
assert "Route LLM Requests Across Providers" not in capability_names
|
||||
assert capability_names == {"Describe Repository Structure"}
|
||||
structure = graph.abilities[0].capabilities[0]
|
||||
assert "utility-dependency" in structure.attributes
|
||||
assert "review-required-structural-context" in structure.attributes
|
||||
assert capability_names == set()
|
||||
assert any(fact.kind == "manifest" for fact in summary.facts)
|
||||
|
||||
|
||||
def test_regression_ops_bridge_like_repo_is_it_operations_not_llm_provider(tmp_path):
|
||||
source = write_ops_bridge_like_repo(tmp_path)
|
||||
service = make_service(tmp_path)
|
||||
repository = service.register_repository(name="Ops Bridge Marketing Name", url=str(source))
|
||||
|
||||
summary = service.analyze_repository(repository.id, use_llm_assistance=False)
|
||||
graph = service.candidate_graph(repository.id, summary.analysis_run.id)
|
||||
|
||||
ability = graph.abilities[0]
|
||||
capability_names = {
|
||||
capability.name
|
||||
for candidate_ability in graph.abilities
|
||||
for capability in candidate_ability.capabilities
|
||||
}
|
||||
facts = {(fact.kind, fact.name, fact.path) for fact in summary.facts}
|
||||
assert ability.name == "Manage SSH Reverse Tunnel Connectivity"
|
||||
assert ability.primary_class == "it-operations"
|
||||
assert {"remote-access", "connectivity", "operations"} <= set(ability.attributes)
|
||||
assert "repository" not in ability.attributes
|
||||
assert "llm-provider" not in ability.attributes
|
||||
assert "Route LLM Requests Across Providers" not in capability_names
|
||||
assert "Maintain Continuous Connectivity Between Remote Systems And Central Hub" in capability_names
|
||||
assert "Make Connectivity Observable Auditable And Controllable" in capability_names
|
||||
assert "Expose CLI And MCP Accessible Service" in capability_names
|
||||
assert ("llm_provider", "Claude", "scripts/register_mcp.py") not in facts
|
||||
assert ("llm_provider", "Claude", "workplans/BRIDGE-WP-0003.md") not in facts
|
||||
|
||||
|
||||
def test_fixture_breadth_empty_repo_produces_no_candidate_claims(tmp_path):
|
||||
@@ -933,20 +985,14 @@ def test_analyze_repository_can_trusted_auto_approve_candidates(tmp_path):
|
||||
for capability in graph.abilities[0].capabilities
|
||||
}
|
||||
assert statuses_by_capability["Expose Repository Interface"] == "approved"
|
||||
assert statuses_by_capability["Describe Repository Structure"] == "candidate"
|
||||
assert ability_map.abilities[0].name == "Report Health Over HTTP"
|
||||
assert decisions[0].action == "trusted_auto_approve_candidate_graph"
|
||||
assert "deterministic candidate generation" in decisions[0].notes
|
||||
assert "Auto-approved 1 safe candidate capability(s); left 1 for review." in decisions[0].notes
|
||||
assert "Auto-approved 1 safe candidate capability(s); left 0 for review." in decisions[0].notes
|
||||
assert (
|
||||
"Approved: Expose Repository Interface: owned interface with sufficient confidence."
|
||||
in decisions[0].notes
|
||||
)
|
||||
assert (
|
||||
"Skipped: Describe Repository Structure: structural/dependency context "
|
||||
"requires curator review."
|
||||
in decisions[0].notes
|
||||
)
|
||||
|
||||
|
||||
def test_rebuild_characteristics_dry_run_preserves_approved_map(tmp_path):
|
||||
@@ -1523,6 +1569,14 @@ def test_relink_candidate_feature_and_evidence_to_another_capability(tmp_path):
|
||||
repository = service.register_repository(name="Relink Leaves", url=str(source))
|
||||
summary = service.analyze_repository(repository.id)
|
||||
graph = service.candidate_graph(repository.id, summary.analysis_run.id)
|
||||
add_candidate_capability(
|
||||
service,
|
||||
repository.id,
|
||||
summary.analysis_run.id,
|
||||
graph.abilities[0].id,
|
||||
"Review Target Capability",
|
||||
)
|
||||
graph = service.candidate_graph(repository.id, summary.analysis_run.id)
|
||||
source_capability = graph.abilities[0].capabilities[0]
|
||||
target_capability = graph.abilities[0].capabilities[1]
|
||||
feature = source_capability.features[0]
|
||||
@@ -1625,6 +1679,14 @@ def test_merge_candidate_capability_moves_children_to_target(tmp_path):
|
||||
repository = service.register_repository(name="Merge Capability", url=str(source))
|
||||
summary = service.analyze_repository(repository.id)
|
||||
graph = service.candidate_graph(repository.id, summary.analysis_run.id)
|
||||
add_candidate_capability(
|
||||
service,
|
||||
repository.id,
|
||||
summary.analysis_run.id,
|
||||
graph.abilities[0].id,
|
||||
"Review Target Capability",
|
||||
)
|
||||
graph = service.candidate_graph(repository.id, summary.analysis_run.id)
|
||||
source_capability = graph.abilities[0].capabilities[0]
|
||||
target_capability = graph.abilities[0].capabilities[1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user