Project rail composition and readiness
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 4s

This commit is contained in:
codex 2026-07-26 13:34:56 +02:00
parent 9af9ee3e72
commit 4fcfee0479
7 changed files with 238 additions and 4 deletions

View file

@ -117,6 +117,9 @@ kind: execution-rail
rail_id: rail-kubernetes
repo: rail-kubernetes
ownership_repo: railiance-cluster
contract_version: 1.0.0
composition_kind: base
readiness_state: verified
""".lstrip(),
encoding="utf-8",
)
@ -153,6 +156,10 @@ reef_id: reef-railiance
hosted_rails:
- rail_id: rail-kubernetes
role: primary
readiness_state: declared
contract_version: 1.0.0
evidence:
- evidence/admission/rail-kubernetes-baseline.json
""".lstrip(),
encoding="utf-8",
)
@ -211,6 +218,9 @@ bound_rapps:
assert reef_record["path"] == str(reef_repo.resolve())
assert reef_record["declaration_paths"] == [str((reef_repo / "declarations" / "reef.yaml").resolve())]
assert nodes["repo:reef-railiance"]["attributes"]["source_path"].endswith("declarations/reef.yaml")
assert nodes["repo:rail-kubernetes"]["attributes"]["contract_version"] == "1.0.0"
assert nodes["repo:rail-kubernetes"]["attributes"]["composition_kind"] == "base"
assert nodes["repo:rail-kubernetes"]["attributes"]["readiness_state"] == "verified"
assert (
edges[("repo:rail-kubernetes", "governed_by", "repo:railiance-cluster")]["canonical_type"]
== "governed_by"
@ -219,10 +229,13 @@ bound_rapps:
edges[("repo:rapp-openbao", "supports_rail", "repo:rail-kubernetes")]["canonical_type"]
== "depends_on"
)
assert (
edges[("repo:reef-railiance", "hosts_rail", "repo:rail-kubernetes")]["canonical_type"]
== "deploys"
)
reef_rail = edges[("repo:reef-railiance", "hosts_rail", "repo:rail-kubernetes")]
assert reef_rail["canonical_type"] == "deploys"
assert reef_rail["attributes"]["readiness_state"] == "declared"
assert reef_rail["attributes"]["contract_version"] == "1.0.0"
assert reef_rail["attributes"]["readiness_evidence"] == [
"evidence/admission/rail-kubernetes-baseline.json"
]
reef_binding = edges[("repo:reef-railiance", "binds_rapp", "repo:rapp-openbao")]
assert reef_binding["canonical_type"] == "deploys"
assert any(
@ -231,6 +244,48 @@ bound_rapps:
)
def test_registry_projects_derived_rail_base_dependency(tmp_path: Path) -> None:
store = RegistryStore(tmp_path / "registry.sqlite3")
store.init_schema()
base_repo = tmp_path / "rail-kubernetes"
derived_repo = tmp_path / "rail-knative"
(base_repo / "declarations").mkdir(parents=True)
(derived_repo / "declarations").mkdir(parents=True)
(base_repo / "declarations" / "rail.yaml").write_text(
"rail_id: rail-kubernetes\nownership_repo: railiance-cluster\n",
encoding="utf-8",
)
(derived_repo / "declarations" / "rail.yaml").write_text(
"""
rail_id: rail-knative
ownership_repo: railiance-cluster
contract_version: 1.0.0
composition_kind: derived
base_rail: rail-kubernetes
base_rail_contract: 1.0.0
readiness_state: declared
""".lstrip(),
encoding="utf-8",
)
for slug, path in (("rail-kubernetes", base_repo), ("rail-knative", derived_repo)):
store.upsert_repository(
{
"slug": slug,
"name": slug,
"path": str(path),
"repo_family": "rail",
"declaration_paths": [str(path / "declarations" / "rail.yaml")],
}
)
combined = store.combined_graph()
nodes = {node["id"]: node for node in combined["nodes"] if node["kind"] == "Repository"}
edges = {(edge["from"], edge["type"], edge["to"]): edge for edge in combined["edges"]}
assert nodes["repo:rail-knative"]["attributes"]["base_rail"] == "rail-kubernetes"
assert nodes["repo:rail-knative"]["attributes"]["base_rail_contract"] == "1.0.0"
dependency = edges[("repo:rail-knative", "base_rail", "repo:rail-kubernetes")]
assert dependency["canonical_type"] == "depends_on"
def test_registry_http_service_serves_queries(tmp_path: Path) -> None:
store = RegistryStore(tmp_path / "registry.sqlite3")
store.init_schema()