generated from coulomb/repo-seed
Repo stats and features as aggregates
This commit is contained in:
@@ -267,7 +267,6 @@ def test_search_filters_by_status_language_and_framework(tmp_path):
|
||||
" return {}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
service = make_service(tmp_path)
|
||||
repository = service.register_repository(name="Filterable", url=str(source))
|
||||
summary = service.analyze_repository(repository.id)
|
||||
@@ -327,7 +326,7 @@ def test_fixture_breadth_python_cli_repo_extracts_reviewable_cli_claims(tmp_path
|
||||
assert summary.analysis_run.status == "completed"
|
||||
assert capability.name == "Expose Repository Interface"
|
||||
assert capability.features[0].type == "CLI"
|
||||
assert capability.features[0].name == "CLI command main"
|
||||
assert capability.features[0].name.startswith("CLI command surface:")
|
||||
assert capability.evidence[0].reference == "tests/test_cli.py"
|
||||
assert service.ability_map(repository.id).abilities == []
|
||||
|
||||
@@ -523,7 +522,6 @@ def test_analyze_repository_records_snapshot_and_observed_facts(tmp_path):
|
||||
" return {}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
service = make_service(tmp_path)
|
||||
repository = service.register_repository(
|
||||
name="Example",
|
||||
@@ -660,6 +658,13 @@ def test_approve_candidate_graph_publishes_ability_map_once(tmp_path):
|
||||
" return {}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(source / "cli.py").write_text(
|
||||
"import click\n\n"
|
||||
"@click.command()\n"
|
||||
"def health():\n"
|
||||
" click.echo('ok')\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
service = make_service(tmp_path)
|
||||
repository = service.register_repository(name="Example", url=str(source))
|
||||
@@ -1150,6 +1155,13 @@ def test_merge_candidate_feature_and_evidence_omits_duplicate_leaves(tmp_path):
|
||||
" return {}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(source / "cli.py").write_text(
|
||||
"import click\n\n"
|
||||
"@click.command()\n"
|
||||
"def health():\n"
|
||||
" click.echo('ok')\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
service = make_service(tmp_path)
|
||||
repository = service.register_repository(name="Merge Leaves", url=str(source))
|
||||
@@ -1224,6 +1236,36 @@ def test_analyze_repository_clones_git_url_before_scanning(tmp_path):
|
||||
assert ("framework", "pytest", "requirements.txt") in fact_names
|
||||
|
||||
|
||||
def test_analyze_repository_can_use_cached_checkout_without_fetching(tmp_path, monkeypatch):
|
||||
service = make_service(tmp_path)
|
||||
url = "https://example.com/private/repo.git"
|
||||
cached = tmp_path / "checkouts" / "repo-b5d250ec3c59"
|
||||
cached.mkdir(parents=True)
|
||||
(cached / "README.md").write_text("# Cached Repo\n", encoding="utf-8")
|
||||
|
||||
def fail_run_git(*args, **kwargs):
|
||||
raise AssertionError("cached analysis should not run git")
|
||||
|
||||
monkeypatch.setattr(service.ingestion, "_run_git", fail_run_git)
|
||||
repository = service.register_repository(
|
||||
name="Cached",
|
||||
url=url,
|
||||
description="Already cloned.",
|
||||
)
|
||||
|
||||
summary = service.analyze_repository(
|
||||
repository.id,
|
||||
use_cached_checkout=True,
|
||||
)
|
||||
|
||||
assert summary.analysis_run.status == "completed"
|
||||
assert summary.snapshot is not None
|
||||
assert str(cached) == summary.snapshot.source_path
|
||||
assert ("documentation", "README", "README.md") in {
|
||||
(fact.kind, fact.name, fact.path) for fact in summary.facts
|
||||
}
|
||||
|
||||
|
||||
def test_operational_logging_records_analysis_and_review_events(caplog, tmp_path):
|
||||
source = tmp_path / "repo"
|
||||
source.mkdir()
|
||||
|
||||
Reference in New Issue
Block a user