generated from coulomb/repo-seed
Ability naming builds on INTENT.md
This commit is contained in:
@@ -135,6 +135,53 @@ def test_candidate_generator_extracts_intended_capability_blocks_from_intent_chu
|
||||
assert [ref.path for ref in intent_capability.source_refs] == ["INTENT.md"]
|
||||
|
||||
|
||||
def test_candidate_generator_prefers_intent_over_derived_scope_for_ability_name():
|
||||
repository = Repository(
|
||||
id=1,
|
||||
name="LLMConnect",
|
||||
url="/tmp/llm-connect",
|
||||
description=None,
|
||||
branch="main",
|
||||
status="analyzed",
|
||||
)
|
||||
facts = [
|
||||
fact(
|
||||
1,
|
||||
"intent",
|
||||
"INTENT",
|
||||
"INTENT.md",
|
||||
metadata={"source_role": "intent_summary"},
|
||||
),
|
||||
fact(
|
||||
2,
|
||||
"documentation",
|
||||
"SCOPE",
|
||||
"SCOPE.md",
|
||||
metadata={"source_role": "derived_scope"},
|
||||
),
|
||||
]
|
||||
chunks = [
|
||||
chunk(
|
||||
1,
|
||||
"documentation",
|
||||
"SCOPE.md",
|
||||
"# SCOPE\n\nA stale first paragraph copied from another repository.",
|
||||
),
|
||||
chunk(
|
||||
2,
|
||||
"intent",
|
||||
"INTENT.md",
|
||||
"# INTENT\n\nProvide a provider-agnostic LLM connector.",
|
||||
),
|
||||
]
|
||||
chunks[0].metadata["source_role"] = "derived_scope"
|
||||
chunks[1].metadata["source_role"] = "intent_summary"
|
||||
|
||||
graph = CandidateGraphGenerator().generate(repository, facts, chunks)
|
||||
|
||||
assert graph[0].name == "Provide A Provider-agnostic LLM Connector"
|
||||
|
||||
|
||||
def test_candidate_generator_enriches_descriptions_from_content_chunks():
|
||||
repository = Repository(
|
||||
id=1,
|
||||
|
||||
@@ -4,7 +4,11 @@ import subprocess
|
||||
|
||||
from repo_registry.core.logging import LOGGER_NAME
|
||||
from repo_registry.core.service import RegistryService
|
||||
from repo_registry.llm_extraction import ExtractedAbility, ExtractedCapability
|
||||
from repo_registry.llm_extraction import (
|
||||
ExtractedAbility,
|
||||
ExtractedCapability,
|
||||
ExtractedFeature,
|
||||
)
|
||||
from repo_registry.repo_ingestion.git import GitIngestionService
|
||||
from repo_registry.semantic import HashingEmbeddingProvider
|
||||
from repo_registry.storage.sqlite import NotFoundError, RegistryStore
|
||||
@@ -522,6 +526,15 @@ def test_regression_ops_bridge_like_repo_is_it_operations_not_llm_provider(tmp_p
|
||||
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
|
||||
cli_capability = next(
|
||||
capability
|
||||
for candidate_ability in graph.abilities
|
||||
for capability in candidate_ability.capabilities
|
||||
if capability.name == "Expose CLI And MCP Accessible Service"
|
||||
)
|
||||
assert {feature.name for feature in cli_capability.features} == {
|
||||
"CLI command surface: CLI command up"
|
||||
}
|
||||
assert ("llm_provider", "Claude", "scripts/register_mcp.py") not in facts
|
||||
assert ("llm_provider", "Claude", "workplans/BRIDGE-WP-0003.md") not in facts
|
||||
|
||||
@@ -759,7 +772,7 @@ def test_analyze_repository_can_use_optional_llm_extractor(tmp_path):
|
||||
}
|
||||
|
||||
|
||||
def test_analyze_repository_keeps_deterministic_candidates_when_llm_returns_stale_entries(tmp_path):
|
||||
def test_analyze_repository_folds_llm_capabilities_when_ability_comes_from_scope(tmp_path):
|
||||
source = tmp_path / "repo"
|
||||
source.mkdir()
|
||||
(source / "INTENT.md").write_text(
|
||||
@@ -773,6 +786,10 @@ def test_analyze_repository_keeps_deterministic_candidates_when_llm_returns_stal
|
||||
"# SCOPE\n\nOld approved entry: route LLM provider requests.\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(source / "providers.py").write_text(
|
||||
"provider_registry = {'openrouter': object()}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
store = RegistryStore(tmp_path / "registry.sqlite3")
|
||||
store.initialize()
|
||||
extractor = FakeLLMExtractor(
|
||||
@@ -783,9 +800,17 @@ def test_analyze_repository_keeps_deterministic_candidates_when_llm_returns_stal
|
||||
source_paths=["SCOPE.md"],
|
||||
capabilities=[
|
||||
ExtractedCapability(
|
||||
name="Route LLM Provider Requests",
|
||||
description="Old scope reuse.",
|
||||
source_paths=["SCOPE.md"],
|
||||
name="Configure OpenRouter Adapter",
|
||||
description="Source-linked provider adapter.",
|
||||
source_paths=["providers.py"],
|
||||
features=[
|
||||
ExtractedFeature(
|
||||
name="OpenRouter provider registry",
|
||||
type="backend",
|
||||
location="providers.py",
|
||||
source_paths=["providers.py"],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
@@ -807,7 +832,9 @@ def test_analyze_repository_keeps_deterministic_candidates_when_llm_returns_stal
|
||||
for ability in graph.abilities
|
||||
for capability in ability.capabilities
|
||||
}
|
||||
assert "Route LLM Provider Requests" in capability_names
|
||||
ability_names = {ability.name for ability in graph.abilities}
|
||||
assert "Old LLM Routing" not in ability_names
|
||||
assert "Configure OpenRouter Adapter" in capability_names
|
||||
assert "Enforce OIDC PKCE Profiles" in capability_names
|
||||
assert decisions[0].action == "llm_extraction_used"
|
||||
assert "llm+deterministic candidate generation" in decisions[0].notes
|
||||
|
||||
Reference in New Issue
Block a user