generated from coulomb/repo-seed
feat: canonicalize duplicate repo identities
This commit is contained in:
@@ -99,6 +99,59 @@ def test_deployable_identity_ignores_generic_filename_alias_ambiguity(tmp_path:
|
||||
assert all("ambiguous_aliases" not in candidate.get("attributes", {}) for candidate in deployables)
|
||||
|
||||
|
||||
def test_repository_identity_canonicalizes_duplicate_manifest_paths(tmp_path: Path) -> None:
|
||||
repo = tmp_path / "canonical-repo"
|
||||
repo.mkdir()
|
||||
registry_manifest = tmp_path / "local-repos.yaml"
|
||||
registry_manifest.write_text(
|
||||
"""
|
||||
apiVersion: railiance.fabric/v1alpha1
|
||||
kind: RegistryOnboardingManifest
|
||||
repositories:
|
||||
- slug: stale-repo
|
||||
name: stale-repo
|
||||
path: {repo}
|
||||
default_branch: main
|
||||
- slug: canonical-repo
|
||||
name: canonical-repo
|
||||
path: {repo}
|
||||
default_branch: main
|
||||
remote_url: gitea-remote:coulomb/canonical-repo.git
|
||||
""".format(repo=repo),
|
||||
encoding="utf-8",
|
||||
)
|
||||
manifest_path = _minimal_manifest(
|
||||
tmp_path,
|
||||
"""
|
||||
- id: root.fixture.registry
|
||||
type: registry_manifest
|
||||
status: active
|
||||
fabric_id: fabric.fixture.primary
|
||||
owner_actor_id: actor.fixture.lord
|
||||
source:
|
||||
manifest_path: {registry_manifest}
|
||||
safe_discovery: local_files
|
||||
evidence_scope:
|
||||
- repo_inventory
|
||||
- repository_identity
|
||||
""".format(registry_manifest=registry_manifest),
|
||||
)
|
||||
manifest = load_accountability_root_manifest(manifest_path)
|
||||
|
||||
projection = build_identity_projection(collect_accountability_root_evidence(manifest_path), manifest)
|
||||
repository_candidates = [
|
||||
candidate
|
||||
for candidate in projection["identity_candidates"]
|
||||
if candidate["identity_type"] == "Repository"
|
||||
]
|
||||
|
||||
assert [candidate["stable_key"] for candidate in repository_candidates] == [
|
||||
"identity:repository:canonical-repo"
|
||||
]
|
||||
assert "stale-repo" in repository_candidates[0]["aliases"]
|
||||
assert "ambiguous_aliases" not in repository_candidates[0].get("attributes", {})
|
||||
|
||||
|
||||
def test_deployment_evidence_skips_dependency_cache_noise(tmp_path: Path) -> None:
|
||||
workspace = tmp_path / "workspace"
|
||||
(workspace / "service").mkdir(parents=True)
|
||||
|
||||
Reference in New Issue
Block a user