generated from coulomb/repo-seed
additive candidate confidence scoring
This commit is contained in:
@@ -54,6 +54,7 @@ def test_candidate_generator_builds_review_seed_from_observed_facts():
|
||||
assert ability.source_refs[0].path == "README.md"
|
||||
interface_capability = ability.capabilities[0]
|
||||
assert interface_capability.name == "Expose Repository Interface"
|
||||
assert interface_capability.confidence == 0.75
|
||||
assert interface_capability.features[0].type == "API"
|
||||
assert interface_capability.features[0].location == "app.py"
|
||||
assert interface_capability.evidence[0].strength == "strong"
|
||||
@@ -94,3 +95,48 @@ def test_candidate_generator_enriches_descriptions_from_content_chunks():
|
||||
|
||||
assert "MailRouter. Routes incoming customer email" in graph[0].description
|
||||
assert '@app.post("/classify")' in graph[0].capabilities[0].description
|
||||
|
||||
|
||||
def test_candidate_confidence_scoring_stays_conservative_for_weak_facts():
|
||||
repository = Repository(
|
||||
id=1,
|
||||
name="WeakDocs",
|
||||
url="/tmp/weak-docs",
|
||||
description=None,
|
||||
branch="main",
|
||||
status="analyzed",
|
||||
)
|
||||
|
||||
graph = CandidateGraphGenerator().generate(
|
||||
repository,
|
||||
[fact(1, "documentation", "README", "README.md")],
|
||||
)
|
||||
|
||||
assert graph[0].confidence == 0.45
|
||||
assert graph[0].capabilities == []
|
||||
|
||||
|
||||
def test_candidate_confidence_scoring_increases_with_supporting_facts():
|
||||
repository = Repository(
|
||||
id=1,
|
||||
name="Supported",
|
||||
url="/tmp/supported",
|
||||
description=None,
|
||||
branch="main",
|
||||
status="analyzed",
|
||||
)
|
||||
facts = [
|
||||
fact(1, "documentation", "README", "README.md"),
|
||||
fact(2, "interface", "python route decorator", "app.py", '@app.get("/health")'),
|
||||
fact(3, "test", "test_app.py", "tests/test_app.py"),
|
||||
fact(4, "example", "client.py", "examples/client.py"),
|
||||
fact(5, "framework", "FastAPI", "requirements.txt"),
|
||||
fact(6, "language", "Python"),
|
||||
fact(7, "manifest", "requirements.txt", "requirements.txt"),
|
||||
]
|
||||
|
||||
graph = CandidateGraphGenerator().generate(repository, facts)
|
||||
|
||||
assert graph[0].confidence == 1.0
|
||||
assert graph[0].capabilities[0].confidence == 0.85
|
||||
assert graph[0].capabilities[1].confidence == 0.75
|
||||
|
||||
Reference in New Issue
Block a user