-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpacket.py
More file actions
113 lines (96 loc) · 5.14 KB
/
Copy pathpacket.py
File metadata and controls
113 lines (96 loc) · 5.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
"""Render — the dated conformance packet, and the test matrix (a derived view).
The packet separates what v0 actually verified (static) from what it declared
not-run (chaos), so a reader can never mistake "not measured" for "passed."
"""
from __future__ import annotations
from datetime import datetime, timezone
from .obligations import OBLIGATIONS
MARK = {"PASS": "✓ PASS", "PARTIAL": "~ PARTIAL", "FAIL": "✗ FAIL", "NOT_RUN": "· NOT-RUN", "NA": "– NA"}
def _today() -> str:
return datetime.now(timezone.utc).strftime("%Y-%m-%d")
def _render_non_deployment(s: dict) -> str:
"""A repo with no driver loop is not a deployment — render the verdict + cited
evidence, never a level. Honest: show WHAT the kit looked for and why the six-box
ladder does not apply, instead of floor-bumping to a meaningless L1."""
out: list[str] = []
out.append(f"# Conformance packet — {s['deployment']}")
out.append(f"_Kit {s['kit_version']} · static/structural · {_today()} · shape: {s.get('shape', 'machine')} · against {s['spec']}_\n")
out.append(f"## {s['confirmed_level_name']}")
out.append(f"> {s['classification_reason']}.")
out.append("> The six-box ladder describes a long-running agent: durable state · a deterministic "
"driver loop · fresh workers · verify-at-a-gate. A signing library, a web-protocol "
"spec, or the standard itself is not a deployment, so the kit declines to assign it a "
"level rather than report a meaningless 'Machine L1'. Score a *wiring* of The Machine.\n")
out.append("### What the kit looked for (evidence-cited)")
out.append("| Status | L | Obligation | Evidence |")
out.append("|---|---|---|---|")
for o, r in s["rows"]:
if r.status == "NOT_RUN":
continue
ev = r.evidence.replace("|", "\\|")
out.append(f"| {MARK[r.status]} | L{o.level} | {o.title} | {ev} |")
out.append("")
out.append("_Classification is deterministic from repo content; re-running yields the same verdict._")
return "\n".join(out)
def render_packet(s: dict) -> str:
if not s.get("is_deployment", True):
return _render_non_deployment(s)
L = s["confirmed_level"]
out: list[str] = []
out.append(f"# Conformance packet — {s['deployment']}")
out.append(f"_Kit {s['kit_version']} · static/structural · {_today()} · against {s['spec']}_\n")
out.append(f"## Confirmed level: **{s['confirmed_level_name']}**")
out.append("> Strict: the highest level at which every *static* obligation ≤ that level is a clean PASS. "
"PARTIAL/FAIL cap the level and are listed as blockers. Chaos checks are NOT-RUN in v0.\n")
# vNext deltas headline
out.append("**vNext deltas (the obligations the 2026-06-14 ratification added):**")
for oid in ("delta1_reversibility", "gov_override", "gov_contract_enforce", "delta3_heartbeat", "delta3_anomaly"):
if oid in s["vnext"]:
o, r = s["vnext"][oid]
out.append(f"- {MARK[r.status]} — {o.title}")
out.append("")
# per-level tally
out.append("| Level | PASS | PARTIAL | FAIL | NOT-RUN |")
out.append("|---|---|---|---|---|")
for lvl in sorted(s["tally"]):
t = s["tally"][lvl]
out.append(f"| L{lvl} | {t['PASS']} | {t['PARTIAL']} | {t['FAIL']} | {t['NOT_RUN']} |")
out.append("")
# blockers to next level
if s["blockers"]:
out.append(f"### To reach {s['next_level_name']} — clear these")
for o, r in s["blockers"]:
out.append(f"- {MARK[r.status]} **{o.title}** — {r.evidence}")
out.append("")
# full evidence table
out.append("### Full obligation results (evidence-cited)")
out.append("| Status | L | Obligation | Evidence |")
out.append("|---|---|---|---|")
for o, r in s["rows"]:
if r.status == "NOT_RUN":
continue
ev = r.evidence.replace("|", "\\|")
tag = " ·Δ" if o.vnext else ""
out.append(f"| {MARK[r.status]} | L{o.level} | {o.title}{tag} | {ev} |")
out.append("")
# not-run (no silent gaps)
out.append("### Declared NOT-RUN in v0 (need a live deployment — chaos/replay)")
for o, r in s["not_run"]:
out.append(f"- · **{o.title}** — {r.evidence}")
out.append("")
out.append("_Score is deterministic from repo content; re-running yields the same level. "
"Only this packet's date moves._")
return "\n".join(out)
def render_matrix() -> str:
out = ["# The Machine — Conformance Test Matrix",
"_Derived view of `kit/obligations.py` (single source of truth). "
"Regenerate: `python -m kit matrix`._\n",
"| ID | Obligation | Plane | Level | Kind | Δ | What passing looks like |",
"|---|---|---|---|---|---|---|"]
for o in OBLIGATIONS:
d = "Δ" if o.vnext else ""
ev = o.evidence.replace("|", "\\|")
out.append(f"| `{o.id}` | {o.title} | {o.plane} | L{o.level} | {o.kind} | {d} | {ev} |")
out.append("\n**Kind:** `static` = the v0 runner checks it now · `chaos` = needs a live "
"deployment, declared NOT-RUN in v0 (never faked).")
return "\n".join(out)