generated from coulomb/repo-seed
Implement scope-derived candidate review infrastructure
This commit is contained in:
@@ -182,6 +182,115 @@ def test_candidate_generator_prefers_intent_over_derived_scope_for_ability_name(
|
||||
assert graph[0].name == "Provide A Provider-agnostic LLM Connector"
|
||||
|
||||
|
||||
def test_candidate_generator_uses_scope_one_liner_over_template_readme():
|
||||
repository = Repository(
|
||||
id=1,
|
||||
name="ops-warden",
|
||||
url="/tmp/ops-warden",
|
||||
description=None,
|
||||
branch="main",
|
||||
status="analyzed",
|
||||
)
|
||||
facts = [
|
||||
fact(1, "documentation", "README", "README.md"),
|
||||
fact(2, "scope", "SCOPE", "SCOPE.md", metadata={"source_role": "derived_scope"}),
|
||||
]
|
||||
chunks = [
|
||||
chunk(
|
||||
1,
|
||||
"documentation",
|
||||
"README.md",
|
||||
"# repo-seed\nA git repository template to bootstrap coulomb projects from.",
|
||||
end_line=2,
|
||||
),
|
||||
chunk(
|
||||
2,
|
||||
"scope",
|
||||
"SCOPE.md",
|
||||
"# SCOPE\n\n## One-liner\n"
|
||||
"SSH Certificate Authority and credential issuance for the ops fleet.\n",
|
||||
end_line=4,
|
||||
),
|
||||
]
|
||||
chunks[1].metadata["source_role"] = "derived_scope"
|
||||
|
||||
graph = CandidateGraphGenerator().generate(repository, facts, chunks)
|
||||
|
||||
assert graph[0].name == "SSH Certificate Authority And Credential Issuance For The Ops Fleet"
|
||||
assert "repo-seed" not in graph[0].description
|
||||
|
||||
|
||||
def test_candidate_generator_extracts_current_capabilities_from_scope_blocks():
|
||||
repository = Repository(
|
||||
id=1,
|
||||
name="railiance-apps",
|
||||
url="/tmp/railiance-apps",
|
||||
description=None,
|
||||
branch="main",
|
||||
status="analyzed",
|
||||
)
|
||||
facts = [
|
||||
fact(1, "scope", "SCOPE", "SCOPE.md", metadata={"source_role": "derived_scope"}),
|
||||
]
|
||||
chunks = [
|
||||
chunk(
|
||||
1,
|
||||
"scope",
|
||||
"SCOPE.md",
|
||||
"# SCOPE\n\n## One-liner\n"
|
||||
"S5 Workloads and Experience layer of the Railiance OAS Stack.\n\n"
|
||||
"## Provided Capabilities\n\n"
|
||||
"```capability\n"
|
||||
"type: infrastructure\n"
|
||||
"title: Application workload deployment\n"
|
||||
"description: Deploy and manage user-facing applications as Helm releases.\n"
|
||||
"keywords: [gitea, helm, application]\n"
|
||||
"```\n",
|
||||
end_line=12,
|
||||
),
|
||||
]
|
||||
chunks[0].metadata["source_role"] = "derived_scope"
|
||||
|
||||
graph = CandidateGraphGenerator().generate(repository, facts, chunks)
|
||||
|
||||
ability = graph[0]
|
||||
assert ability.name == "S5 Workloads And Experience Layer Of The Railiance OAS Stack"
|
||||
capability = ability.capabilities[0]
|
||||
assert capability.name == "Application workload deployment"
|
||||
assert capability.primary_class == "infrastructure"
|
||||
assert {"scope-derived", "current-state", "review-required-scope"} <= set(
|
||||
capability.attributes
|
||||
)
|
||||
assert capability.features[0].name == "Application workload deployment"
|
||||
assert capability.features[0].location == "SCOPE.md"
|
||||
assert capability.evidence[0].reference == "SCOPE.md"
|
||||
|
||||
|
||||
def test_candidate_generator_adds_fact_derived_capability_when_no_stronger_layers():
|
||||
repository = Repository(
|
||||
id=1,
|
||||
name="railiance-empty-layer",
|
||||
url="/tmp/railiance-empty-layer",
|
||||
description=None,
|
||||
branch="main",
|
||||
status="analyzed",
|
||||
)
|
||||
facts = [
|
||||
fact(1, "config", "sops config", ".sops.yaml"),
|
||||
fact(2, "manifest", "pyproject.toml", "pyproject.toml"),
|
||||
]
|
||||
|
||||
graph = CandidateGraphGenerator().generate(repository, facts)
|
||||
|
||||
capability = graph[0].capabilities[0]
|
||||
assert capability.name == "Manage Repository Configuration"
|
||||
assert capability.primary_class == "fact-derived"
|
||||
assert {feature.type for feature in capability.features} == {
|
||||
"configuration",
|
||||
"manifest",
|
||||
}
|
||||
|
||||
|
||||
def test_candidate_generator_enriches_descriptions_from_content_chunks():
|
||||
repository = Repository(
|
||||
id=1,
|
||||
|
||||
Reference in New Issue
Block a user