.py · 1 sections · 6983 characters
workbench:Research Packages/Fintech and Private Rails/Tokenization Entity and Control Map 2026-09-01/build_sec_crypto_custody_change_map.py
Source SHA-256: 409efe690a65e74c21e1ef77ee4657a4c24d3c65fae1a68a64aae94811e0daeb
Evidence cutoffs by research owner: {"artifact:ea6b10d2f78a96d2": ""}
Saved source text, not a new finding. Markdown notation and table delimiters are retained.
Lines 1–158 · Section 1 of 1
"""Validate and render the SEC custody proposal-to-final baseline map."""
from future import annotations
import json import os import sys import tempfile
HERE = os.path.dirname(os.path.abspath(file)) DATA_PATH = os.path.join(HERE, "SEC_CRYPTO_CUSTODY_PROPOSAL_TO_FINAL_BASELINE_2026-10-01.json") OUT_PATH = os.path.join(HERE, "SEC_CRYPTO_CUSTODY_PROPOSAL_TO_FINAL_CHANGE_MAP_2026-10-01.md")
def load_and_validate(): with open(DATA_PATH, encoding="utf-8") as handle: data = json.load(handle)
if data.get("schema_version") != "1.0":
raise SystemExit("unsupported schema_version")
layer_ids = [layer["id"] for layer in data.get("layers", [])]
if len(layer_ids) != len(set(layer_ids)):
raise SystemExit("duplicate layer id")
provisions = data.get("provisions", [])
provision_ids = [item["id"] for item in provisions]
if len(provision_ids) != len(set(provision_ids)):
raise SystemExit("duplicate provision id")
if len(provisions) < 30:
raise SystemExit("baseline is unexpectedly small")
valid_dispositions = set(data["comparison_contract"]["dispositions"])
for item in provisions:
if item["layer_id"] not in layer_ids:
raise SystemExit(f"unknown layer for {item['id']}")
final = item.get("final_rule", {})
if final.get("disposition") not in valid_dispositions:
raise SystemExit(f"invalid final disposition for {item['id']}")
if data["rulemaking"]["final_rule_status"] == "not_issued":
if final.get("status") != "not_issued" or final.get("disposition") != "pending":
raise SystemExit(f"premature final state for {item['id']}")
known = set(provision_ids)
map_ids = []
for view in data.get("observatory_maps", []):
map_ids.append(view["id"])
missing = set(view.get("provision_ids", [])) - known
if missing:
raise SystemExit(f"unknown provision in {view['id']}: {sorted(missing)}")
if len(map_ids) != len(set(map_ids)):
raise SystemExit("duplicate Observatory map id")
return data
def esc(text): return str(text).replace("|", "\|").replace("\n", " ")
def render(data):
lines = [
"---",
"title: SEC Crypto Custody Proposal-to-Final Rule Change Map",
"status: current",
f"cutoff: {data['cutoff']}",
"artifact_role: evidence_index",
"research_ids:",
" - tokenization-entity-control-map",
" - crypto-infrastructure-comparatives",
" - private-monetary-stack",
"---",
"",
"# SEC Crypto Custody Proposal-to-Final Rule Change Map",
"",
"## Comparison contract",
"",
"This freezes the October 1, 2026 proposal baseline for File S7-2026-35, Release Nos. IA-7023 / IC-36353. It is not a final-rule forecast. Stable provision IDs must not be renamed or overwritten when the final rule arrives. Each final provision must be classified as retained, narrowed, broadened, modified, removed, new in final, deferred, or unresolved, with final text, authority, effective date, compliance date and later operating receipt kept on separate clocks.",
"",
f"Frozen baseline: {len(data['provisions'])} provisions across {len(data['layers'])} constitutional layers; {len(data['observatory_maps'])} Observatory comparison maps.",
"",
"## Constitutional layers",
"",
]
by_layer = {layer["id"]: [] for layer in data["layers"]}
for item in data["provisions"]:
by_layer[item["layer_id"]].append(item)
for layer in data["layers"]:
lines += [
f"### {layer['label']}",
"",
f"Question: {layer['question']}",
"",
"| Stable ID | Proposed baseline | Proposed object | Why the Observatory tracks it | Future final disposition |",
"|---|---|---|---|---|",
]
for item in by_layer[layer["id"]]:
lines.append(
"| {} | {} | {} · pp. {} | {} | pending |".format(
esc(item["id"]), esc(item["proposed_baseline"]), esc(item["rule_or_form_ref"]),
esc(item["proposal_pages"]), esc(item["observatory_significance"])
)
)
lines.append("")
lines += [
"## Observatory maps",
"",
"| Map | Governing question | Cross-project join | Stable provision IDs |",
"|---|---|---|---|",
]
for view in data["observatory_maps"]:
lines.append(
f"| {esc(view['label'])} | {esc(view['question'])} | {esc(view['join'])} | "
+ ", ".join(f"{esc(pid)}" for pid in view["provision_ids"])
+ " |"
)
lines += [
"",
"## Final-rule replay sequence",
"",
"1. Preserve this proposal baseline unchanged.",
"2. Save and hash the final Commission release and Federal Register text.",
"3. Populate every final_rule object in the JSON, including provisions apparently omitted from the final text.",
"4. Classify each stable ID using the controlled disposition vocabulary.",
"5. Add stable IDs only for genuinely new final-rule objects.",
"6. Redline CFR clauses and forms separately from narrative explanation and economic assumptions.",
"7. Record effective, compliance, transition, form-availability and first-use dates as independent clocks.",
"8. Rebuild this Markdown map and the Crypto Hub visual, then validate Registry, Catalog and Research Rooms membership.",
"",
"## State boundary",
"",
"At this cutoff every final-rule field is deliberately pending. The proposal changes no current actor permission, custody qualification, filing obligation or operating state.",
"",
]
return "\n".join(lines)
def main(): data = load_and_validate() rendered = render(data) old = open(OUT_PATH, encoding="utf-8").read() if os.path.exists(OUT_PATH) else None changed = old != rendered if "--check" in sys.argv: print(json.dumps({"provisions": len(data["provisions"]), "layers": len(data["layers"]), "observatory_maps": len(data["observatory_maps"]), "would_change": changed}, indent=2)) return 1 if changed else 0 if changed: fd, tmp = tempfile.mkstemp(prefix="sec-custody-change-map-", suffix=".md", dir=HERE) try: with os.fdopen(fd, "w", encoding="utf-8") as handle: handle.write(rendered) os.replace(tmp, OUT_PATH) finally: if os.path.exists(tmp): os.unlink(tmp) print(json.dumps({"provisions": len(data["provisions"]), "layers": len(data["layers"]), "observatory_maps": len(data["observatory_maps"]), "written": changed}, indent=2)) return 0
if name == "main": raise SystemExit(main())