Cross repo isolation

This commit is contained in:
2026-05-02 21:55:35 +02:00
parent a462827eda
commit bf2dc4ae98
10 changed files with 695 additions and 14 deletions

View File

@@ -50,6 +50,58 @@ def chunk():
)
def test_llm_prompt_filters_derived_scope_and_labels_source_roles():
adapter = FakeAdapter('{"abilities": []}')
extractor = LLMCandidateExtractor(adapter)
chunks = [
ContentChunk(
id=1,
repository_id=1,
analysis_run_id=1,
snapshot_id=1,
path="SCOPE.md",
kind="scope",
start_line=1,
end_line=3,
text="# SCOPE\n\nOld approved LLM routing entry.",
metadata={"source_role": "derived_scope"},
),
ContentChunk(
id=2,
repository_id=1,
analysis_run_id=1,
snapshot_id=1,
path="INTENT.md",
kind="intent",
start_line=1,
end_line=3,
text="# INTENT\n\nProvide lightweight IAM.",
metadata={"source_role": "intent_summary"},
),
ContentChunk(
id=3,
repository_id=1,
analysis_run_id=1,
snapshot_id=1,
path="CLAUDE.md",
kind="documentation",
start_line=1,
end_line=2,
text="# CLAUDE\n\nAgent guidance.",
metadata={"source_role": "agent_guidance"},
),
]
extractor.extract(repository(), chunks)
assert "Source: INTENT.md" in adapter.last_prompt
assert "source_role=intent_summary" in adapter.last_prompt
assert "Source: SCOPE.md" not in adapter.last_prompt
assert "Old approved LLM routing entry" not in adapter.last_prompt
assert "Source: CLAUDE.md" not in adapter.last_prompt
assert "Do not use SCOPE.md" in adapter.last_prompt
def test_llm_candidate_extractor_parses_structured_response():
adapter = FakeAdapter(
"""