Recover repo-scoping native candidate families

This commit is contained in:
2026-05-15 18:28:25 +02:00
parent e2f378be90
commit 4706291a03
3 changed files with 413 additions and 2 deletions

View File

@@ -561,7 +561,94 @@ def test_candidate_generator_does_not_promote_owned_provider_vocabulary_to_capab
capability_names = {capability.name for capability in graph[0].capabilities}
assert "Route LLM Requests Across Providers" not in capability_names
assert "Expose Repository Interface" in capability_names
assert "Scan Repositories Into Observed Facts" in capability_names
def test_candidate_generator_recovers_repo_scoping_native_candidate_families():
repository = Repository(
id=1,
name="repo-scoping",
url="/tmp/repo-scoping",
description="Maps repositories into reviewable capability graphs.",
branch="main",
status="analyzed",
)
facts = [
fact(1, "documentation", "README", "README.md"),
fact(2, "documentation", "api-contract.md", "docs/api-contract.md"),
fact(
3,
"documentation",
"characteristic-evidence-model.md",
"docs/characteristic-evidence-model.md",
),
fact(4, "documentation", "scope-md-spec.md", "docs/scope-md-spec.md"),
fact(
5,
"documentation",
"dependency-aware-scope-propagation.md",
"docs/dependency-aware-scope-propagation.md",
),
fact(
6,
"documentation",
"repo-scope-context-response.json",
"docs/schemas/repo-scope-context-response.json",
),
fact(7, "test", "test_git_ingestion.py", "tests/test_git_ingestion.py"),
fact(
8,
"test",
"test_repository_metadata.py",
"tests/test_repository_metadata.py",
),
fact(
9,
"test",
"test_repository_scanner.py",
"tests/test_repository_scanner.py",
),
fact(10, "test", "test_content_indexing.py", "tests/test_content_indexing.py"),
fact(11, "test", "test_candidate_graph.py", "tests/test_candidate_graph.py"),
fact(12, "test", "test_llm_extraction.py", "tests/test_llm_extraction.py"),
fact(13, "test", "test_registry_service.py", "tests/test_registry_service.py"),
fact(14, "test", "test_scope_generator.py", "tests/test_scope_generator.py"),
fact(15, "test", "test_web_api.py", "tests/test_web_api.py"),
fact(16, "test", "test_scope_context_api.py", "tests/test_scope_context_api.py"),
fact(
17,
"interface",
"python route decorator",
"src/repo_registry/web_api/app.py",
'@app.post("/repos")',
),
]
graph = CandidateGraphGenerator().generate(repository, facts)
capability_names = {capability.name for capability in graph[0].capabilities}
assert {
"Register And Track Repositories",
"Scan Repositories Into Observed Facts",
"Index Source Content With Provenance",
"Generate Reviewable Candidate Characteristics",
"Review And Approve Candidate Characteristics",
"Search Compare And Export Approved Profiles",
"Generate And Maintain SCOPE.md",
"Explore Dependency And Impact Graphs",
"Provide Scope Context To Downstream Agents",
} <= capability_names
assert "Route LLM Requests Across Providers" not in capability_names
scanning = next(
capability
for capability in graph[0].capabilities
if capability.name == "Scan Repositories Into Observed Facts"
)
assert scanning.primary_class == "analysis"
assert {"deterministic", "facts", "provenance", "utility-owned"} <= set(
scanning.attributes
)
assert all(ref.path.startswith(("docs/", "tests/", "src/")) for ref in scanning.source_refs)
def test_candidate_generator_excludes_mention_only_providers_from_promoted_capability():