|
1 | 1 | #!/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. |
3 | 3 |
|
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. |
7 | 8 | """ |
8 | 9 | from __future__ import annotations |
9 | 10 |
|
|
13 | 14 | from pathlib import Path |
14 | 15 |
|
15 | 16 | ROOT = Path(__file__).resolve().parents[1] |
| 17 | +REGISTRY = ROOT / "automation" / "nuvio-client-upstreams.json" |
16 | 18 | SHA = re.compile(r"^[0-9a-f]{40}$") |
17 | 19 | ENV_NAMES = { |
18 | 20 | "nuvio-desktop": "NUVIO_DESKTOP_SHA", |
|
23 | 25 |
|
24 | 26 | def resolve_refs(path: Path) -> dict[str, str]: |
25 | 27 | 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 {} |
31 | 29 | result: dict[str, str] = {} |
32 | 30 | for client, env_name in ENV_NAMES.items(): |
33 | 31 | row = clients.get(client) |
34 | 32 | 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() |
37 | 35 | 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}") |
39 | 37 | result[env_name] = ref |
40 | 38 | if len(set(result.values())) != len(result): |
41 | 39 | # Different repositories may technically have identical SHA-1s, but that |
42 | 40 | # 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") |
44 | 42 | return result |
45 | 43 |
|
46 | 44 |
|
47 | 45 | def main() -> int: |
48 | 46 | parser = argparse.ArgumentParser() |
49 | | - parser.add_argument("--sources", type=Path, default=ROOT / "sources.json") |
| 47 | + parser.add_argument("--registry", type=Path, default=REGISTRY) |
50 | 48 | parser.add_argument("--json", action="store_true") |
51 | 49 | args = parser.parse_args() |
52 | | - refs = resolve_refs(args.sources.resolve()) |
| 50 | + refs = resolve_refs(args.registry.resolve()) |
53 | 51 | if args.json: |
54 | 52 | print(json.dumps(refs, sort_keys=True)) |
55 | 53 | else: |
|
0 commit comments