Skip to content

Commit 5e44e74

Browse files
committed
fix: make audited Nuvio registry the ref source of truth
1 parent 6db8f0f commit 5e44e74

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

scripts/export_nuvio_client_refs.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/usr/bin/env python3
2-
"""Export the exact Nuvio client commits accepted by the release guard.
2+
"""Export the exact Nuvio client commits accepted by the canonical runtime guard.
33
4-
Native proofs must exercise the same official client revisions that NiakVIO's
5-
upstream compatibility fence accepted. Keeping SHAs in one generated state
6-
(`sources.json`) prevents native workflows from silently testing stale clients.
4+
The audited client registry in ``automation/nuvio-client-upstreams.json`` is the
5+
single source of truth for client refs. ``sources.json`` may retain historical
6+
accepted-ref diagnostics, but native proofs must never derive their checkout SHA
7+
from that mutable/reporting state.
78
"""
89
from __future__ import annotations
910

@@ -13,6 +14,7 @@
1314
from pathlib import Path
1415

1516
ROOT = Path(__file__).resolve().parents[1]
17+
REGISTRY = ROOT / "automation" / "nuvio-client-upstreams.json"
1618
SHA = re.compile(r"^[0-9a-f]{40}$")
1719
ENV_NAMES = {
1820
"nuvio-desktop": "NUVIO_DESKTOP_SHA",
@@ -23,33 +25,29 @@
2325

2426
def resolve_refs(path: Path) -> dict[str, str]:
2527
payload = json.loads(path.read_text(encoding="utf-8"))
26-
clients = (
27-
payload.get("nuvio_client_compatibility", {}).get("clients", {})
28-
if isinstance(payload, dict)
29-
else {}
30-
)
28+
clients = payload.get("clients", {}) if isinstance(payload, dict) else {}
3129
result: dict[str, str] = {}
3230
for client, env_name in ENV_NAMES.items():
3331
row = clients.get(client)
3432
if not isinstance(row, dict):
35-
raise RuntimeError(f"missing accepted Nuvio client state: {client}")
36-
ref = str(row.get("accepted_ref") or "").strip().lower()
33+
raise RuntimeError(f"missing audited Nuvio client registry row: {client}")
34+
ref = str(row.get("verified_ref") or "").strip().lower()
3735
if not SHA.fullmatch(ref):
38-
raise RuntimeError(f"invalid accepted ref for {client}: {ref!r}")
36+
raise RuntimeError(f"invalid verified ref for {client}: {ref!r}")
3937
result[env_name] = ref
4038
if len(set(result.values())) != len(result):
4139
# Different repositories may technically have identical SHA-1s, but that
4240
# is sufficiently unexpected here to catch copy/paste state corruption.
43-
raise RuntimeError("Nuvio client accepted refs unexpectedly collide")
41+
raise RuntimeError("Nuvio client verified refs unexpectedly collide")
4442
return result
4543

4644

4745
def main() -> int:
4846
parser = argparse.ArgumentParser()
49-
parser.add_argument("--sources", type=Path, default=ROOT / "sources.json")
47+
parser.add_argument("--registry", type=Path, default=REGISTRY)
5048
parser.add_argument("--json", action="store_true")
5149
args = parser.parse_args()
52-
refs = resolve_refs(args.sources.resolve())
50+
refs = resolve_refs(args.registry.resolve())
5351
if args.json:
5452
print(json.dumps(refs, sort_keys=True))
5553
else:

0 commit comments

Comments
 (0)