Add repo-family metadata to Fabric registry
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 3s

This commit is contained in:
codex 2026-07-25 18:08:57 +02:00
parent 3240b78185
commit 0ea99a73d8
15 changed files with 189 additions and 32 deletions

View file

@ -34,6 +34,7 @@ def test_collect_accountability_root_evidence_from_manifest(tmp_path: Path) -> N
registered_repo = next(item for item in evidence if item["evidence_type"] == "registered_repository")
assert registered_repo["attributes"]["state_hub_repo_id"] == "fixture-state-hub-id"
assert registered_repo["attributes"]["repo_family"] == "ownership"
secret_root = next(item for item in evidence if item["evidence_type"] == "secret_root")
assert "secret-value" not in json.dumps(secret_root)
@ -420,6 +421,7 @@ repositories:
default_branch: main
state_hub_repo_id: fixture-state-hub-id
remote_url: gitea-remote:coulomb/fixture-repo.git
repo_family: ownership
""".format(repo=repo),
encoding="utf-8",
)

View file

@ -42,7 +42,7 @@ def test_local_fabric_registry_connector_adds_separate_registry_evidence(tmp_pat
_validate_schema("discovery-snapshot.schema.yaml", snapshot)
assert snapshot["connector_runs"][0]["status"] == "success"
assert snapshot["connector_runs"][0]["candidate_counts"] == {"nodes": 1, "edges": 1, "attributes": 8}
assert snapshot["connector_runs"][0]["candidate_counts"] == {"nodes": 1, "edges": 1, "attributes": 9}
assert any(scope["source_kind"] == "fabric_registry" for scope in snapshot["replacement_scopes"])
registry_node = next(node for node in snapshot["candidates"]["nodes"] if node["kind"] == "FabricRegistryEntry")
@ -50,6 +50,7 @@ def test_local_fabric_registry_connector_adds_separate_registry_evidence(tmp_pat
assert registry_node["review_state"] == "candidate"
assert registry_node["replacement_scope"].startswith("scope:fixture-repo:local-fabric-registry:fabric_registry")
assert registry_node["attributes"]["state_hub_repo_id"] == "state-hub-id"
assert registry_node["attributes"]["repo_family"] == "ownership"
assert any(edge["edge_type"] == "cataloged_as" for edge in snapshot["candidates"]["edges"])
registry_attributes = {
attribute["name"]: attribute
@ -136,6 +137,7 @@ repositories:
default_branch: main
state_hub_repo_id: state-hub-id
remote_url: gitea-remote:coulomb/fixture-repo.git
repo_family: ownership
declaration_paths:
- /tmp/fixture-repo
""".lstrip(),

View file

@ -27,6 +27,7 @@ def test_graph_explorer_manifest_and_payload_validate() -> None:
"slug": "railiance-fabric",
"name": "Railiance Fabric",
"state_hub_repo_id": "2c0de614-e468-4eb6-8157-470649ac8c05",
"repo_family": "ownership",
},
{
"slug": "registered-only",
@ -73,6 +74,7 @@ def test_graph_explorer_manifest_and_payload_validate() -> None:
assert registered_only["data"]["reviewState"] == "candidate"
assert registered_only["data"]["unresolved"] is True
assert nodes_by_id["repo:railiance-fabric"]["data"]["repoFamily"] == "ownership"
assert deployment["data"]["layer"] == "deployment"
assert server["data"]["layer"] == "server"
assert ":" not in server["data"]["label"]
@ -358,6 +360,7 @@ def test_registry_serves_graph_explorer_exports(tmp_path: Path) -> None:
"slug": "railiance-fabric",
"name": "Railiance Fabric",
"state_hub_repo_id": "2c0de614-e468-4eb6-8157-470649ac8c05",
"repo_family": "ownership",
}
)
store.upsert_repository({"slug": "registered-only", "name": "Registered Only"})

View file

@ -35,6 +35,7 @@ def test_registry_accepts_snapshot_and_queries_graph(tmp_path: Path) -> None:
"slug": "railiance-fabric",
"name": "Railiance Fabric",
"remote_url": "https://example.invalid/railiance-fabric.git",
"repo_family": "ownership",
}
)
@ -78,6 +79,7 @@ def test_registry_accepts_snapshot_and_queries_graph(tmp_path: Path) -> None:
libraries = store.ingest_cyclonedx("railiance-fabric", _cyclonedx_bom())
assert snapshot["repo_slug"] == "railiance-fabric"
assert store.get_repository("railiance-fabric")["repo_family"] == "ownership"
assert changed_snapshot["commit"] == "test-commit-2"
assert artifact["artifact_type"] == "openapi"
assert libraries["component_count"] == 2
@ -469,6 +471,7 @@ def test_registry_sync_manifest_registers_multiple_repos(tmp_path: Path) -> None
" name: Railiance Fabric",
f" path: {Path('.').resolve()}",
" commit: manifest-commit",
" repo_family: ownership",
f" sbom: {sbom_path.name}",
" - slug: missing-repo",
" name: Missing Repo",
@ -491,6 +494,7 @@ def test_registry_sync_manifest_registers_multiple_repos(tmp_path: Path) -> None
repositories = {repo["slug"]: repo for repo in store.list_repositories()}
assert set(repositories) == {"missing-repo", "railiance-fabric"}
assert repositories["railiance-fabric"]["repo_family"] == "ownership"
assert store.latest_snapshot("railiance-fabric")["commit"] == "manifest-commit"
assert store.list_snapshots("missing-repo") == []
assert store.list_libraries(repo_slug="railiance-fabric")[0]["name"] == "jsonschema"