R-315: wire-contract gate checks mirrored roots field-by-field and prints each root's check kind
The escrow/retained and escrow-ACK wires are now compared path-by-path against the receiver's named mirror type, so the measured mutation (agent renames superseded_at, the old name still a local-API map key) convicts. Decoy pair in test_gate_decoys.py, seen failing with the mirror removed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -55,7 +55,9 @@ COVERS = {
|
||||
"decoy-coverage": "a gate registered in a runner with no decoy and no exemption (its red-proof)",
|
||||
"wire-contract": ("R-555: an emitted tag whose name the receiver carries ONLY in a // and a /* */ comment "
|
||||
"must convict (it passed for months as `language` did); the genuine article — the same "
|
||||
"name in a struct tag beside a `//` inside a string literal — must pass"),
|
||||
"name in a struct tag beside a `//` inside a string literal — must pass; and R-315: the "
|
||||
"agent RENAMING its mirror's `superseded_at` tag (the old name still occurs as a local-API "
|
||||
"map key) must convict on the field-by-field mirror check"),
|
||||
"stands": ("R-819: a stand citing a register id that exists in NEITHER register, and a stand "
|
||||
"marked 'walked' whose only source is a register row (a green dot from a label); "
|
||||
"plus the genuine article — a stand citing only a CLOSED row, which must PASS"),
|
||||
@@ -525,6 +527,43 @@ for _mode, _want in (("comment", 10), ("genuine", 0)):
|
||||
print(" ok %-20s %s" % ("wire-contract/" + _mode,
|
||||
"decoy rejected" if _want else "genuine accepted"))
|
||||
|
||||
# ── wire-contract mirror check (R-315) ───────────────────────────────────────────────────────────
|
||||
#
|
||||
# The measured R-315 mutation: the AGENT renames its mirror's `superseded_at` tag. The name check passed
|
||||
# it, because `superseded_at` also occurs in the agent as a local-API map key. The rename is applied to
|
||||
# the parsed mirror body only (no copy of the agent tree), so the token set still holds the old name —
|
||||
# exactly the shape that fooled the gate. The genuine article (no rename) must pass.
|
||||
_WCM = r"""
|
||||
import os, sys
|
||||
sys.path.insert(0, "scripts")
|
||||
import wire_contract_gate as g
|
||||
mode = sys.argv[1]
|
||||
orig, agent = g.build_index, os.path.abspath(g.REPOS["agent"])
|
||||
def patched(root):
|
||||
by_dir, by_name = orig(root)
|
||||
if mode == "renamed" and os.path.abspath(root) == agent:
|
||||
k = ("internal/hub", "RetainedEscrowPackage")
|
||||
assert 'json:"superseded_at"' in by_dir[k], "mutation target missing"
|
||||
by_dir[k] = by_dir[k].replace('json:"superseded_at"', 'json:"superseded_at_RENAMED"')
|
||||
by_name["RetainedEscrowPackage"] = [(d, by_dir[k] if d == k[0] else b)
|
||||
for d, b in by_name["RetainedEscrowPackage"]]
|
||||
return by_dir, by_name
|
||||
g.build_index = patched
|
||||
rc, conv = g.run(quiet=True)
|
||||
hit = any(d == "packages.superseded_at" for _, _, m in conv for _, d in m)
|
||||
print("rc=%d convicted=%s" % (rc, hit))
|
||||
sys.exit(0 if rc == 0 else (10 if hit else 11))
|
||||
"""
|
||||
for _mode, _want in (("renamed", 10), ("genuine", 0)):
|
||||
ran += 1
|
||||
_p = subprocess.run([sys.executable, "-c", _WCM, _mode], cwd=ROOT, capture_output=True, text=True)
|
||||
if _p.returncode != _want:
|
||||
fails.append("wire-contract-mirror/%s: rc=%d, want %d (10 = the renamed mirror tag convicted, 0 = passed)\n%s"
|
||||
% (_mode, _p.returncode, _want, (_p.stdout + _p.stderr)[-500:]))
|
||||
else:
|
||||
print(" ok %-20s %s" % ("wire-mirror/" + _mode,
|
||||
"decoy rejected" if _want else "genuine accepted"))
|
||||
|
||||
# ── stands (R-819) ───────────────────────────────────────────────────────────────────────────────
|
||||
#
|
||||
# check_stands.py was red and in no runner. Its decoys are stand files written as a session would write
|
||||
|
||||
Reference in New Issue
Block a user