generated from coulomb/repo-seed
Fix path-scoped duplicate detection
This commit is contained in:
@@ -80,6 +80,28 @@ def test_reconciliation_dedupes_diffs_and_tombstones_by_scope() -> None:
|
||||
assert any(tombstone["stable_key"].endswith("ancient-api") for tombstone in reconciled["tombstones"])
|
||||
|
||||
|
||||
def test_reconciliation_keeps_distinct_path_scoped_lockfiles_separate() -> None:
|
||||
scope = _scope("lockfiles", "file", "var/checkouts", "replacement")
|
||||
uv_a = "discovery:fixture-repo:lockfile:var-checkouts-a-uv.lock"
|
||||
uv_b = "discovery:fixture-repo:lockfile:var-checkouts-b-uv.lock"
|
||||
|
||||
current = _snapshot(
|
||||
replacement_scopes=[scope],
|
||||
nodes=[
|
||||
_node(uv_a, "Lockfile", "uv.lock", scope["id"], source_path="var/checkouts/a/uv.lock"),
|
||||
_node(uv_b, "Lockfile", "uv.lock", scope["id"], source_path="var/checkouts/b/uv.lock"),
|
||||
],
|
||||
)
|
||||
|
||||
reconciled = reconcile_discovery_snapshots(None, current, retired_at="2026-05-19T00:00:00Z")
|
||||
|
||||
assert reconciled["reconciliation"]["conflicts"] == []
|
||||
assert reconciled["reconciliation"]["diff"]["conflicted"] == []
|
||||
nodes = {node["stable_key"]: node for node in reconciled["candidates"]["nodes"]}
|
||||
assert nodes[uv_a]["review_state"] == "candidate"
|
||||
assert nodes[uv_b]["review_state"] == "candidate"
|
||||
|
||||
|
||||
def test_scan_cli_reconciles_against_previous_snapshot(tmp_path: Path, capsys) -> None:
|
||||
repo = tmp_path / "fixture-repo"
|
||||
repo.mkdir()
|
||||
@@ -231,8 +253,9 @@ def _node(
|
||||
review_state: str = "candidate",
|
||||
aliases: list[str] | None = None,
|
||||
attributes: dict[str, object] | None = None,
|
||||
source_path: str = "README.md",
|
||||
) -> dict[str, object]:
|
||||
anchor = _anchor("file", "README.md")
|
||||
anchor = _anchor("file", source_path)
|
||||
return {
|
||||
"stable_key": stable_key,
|
||||
"kind": kind,
|
||||
|
||||
Reference in New Issue
Block a user