#!/usr/bin/env python3 """Route 131's experiment: partition the served registry's rows into durable (source-side) and ephemeral (index-side) corrections, gated on the served generator's own code. `route131_generate.py` settled that the served `research/QUESTIONS.md` is byte-for-byte the output of the served generator over the served notes (sha `07cadf7f...`, 601,348 B). That makes the index carry no state of its own -- but it does *not* yet say which corrections survive regeneration. This script answers that per row, by MEASURING rather than asserting: gate A (source-side) re-run the generator with one note's bytes replaced by a pinned revision, and read what the row becomes. If the row moves to the verified value, the fix is durable and the pinned blob is named. If the note's ledger changed but the row did not, the correction is shadowed (the displayed verdict comes from the LAST note in path order) -- ephemeral unless the last note is moved instead. gate B (index-side) splice the corrected cells straight into the served registry and regenerate from UNCHANGED sources: whatever the edit said, the generator reproduces the reverted value. Counted, so "an index-only edit is ephemeral" is a measurement. Row classes come from the generator's own grouping (`summarise`): a row is SOURCE-CARRIED when its status is copied from one note's ledger block, and GENERATOR-SYNTHESISED when it is the `MIXED (...)` composite, a string that exists in no served source byte (tested against the generator's own input set). Writes partition.json + partition.md. Read-only against the server; no writes, no submission. """ import hashlib import json import os import re import sys sys.stdout.reconfigure(encoding="utf-8", errors="replace") HERE = os.path.dirname(os.path.abspath(__file__)) JOB128 = os.path.join(os.path.dirname(HERE), "job128") sys.path.insert(0, JOB128) sys.path.insert(0, HERE) import route128_next as R # noqa: E402 import registry_cites as RC # noqa: E402 from route131_census import parse_block, indexed_files, summarise # noqa: E402 import route131_generate as G # noqa: E402 GENERATED = {"SCRIPTS.md", "QUESTIONS.md"} HEX64 = re.compile(r"\b([0-9a-f]{64})\b") def sha(s): return hashlib.sha256(s.encode("utf-8")).hexdigest() def overlays_fetch(base, overrides): """A fetch that serves `overrides[path]` in place of the served revision, and counts the swaps.""" seen = {"n": 0} def f(path): if path in overrides: seen["n"] += 1 return 200, overrides[path] return base(path) f.seen = seen return f def splice_row(lines, line_no, served, target): """Edit ONE row: replace `served` inside that row's own line only. A whole-file `str.replace` is wrong here -- `served` for a status is the bare word `OPEN`, and the first occurrence in the file belongs to some other question. Editing by line number is what a corrector editing the served registry would actually do. """ ln = lines[line_no - 1] # the parsed cell has collapsed whitespace, so match on words with flexible gaps and replace only # the matched span -- everything else in the row stays byte-identical to the served registry pat = re.compile(r"\s+".join(re.escape(w) for w in served.split())) if served.split() else None m = pat.search(ln) if pat else None if not m: return False lines[line_no - 1] = ln[:m.start()] + target + ln[m.end():] return True def version_list(path): c, txt = R.get(R.PROJECT + "/history/" + path) if c != 200: return None return json.loads(txt).get("versions", []) def blob_of(v): url = R.url_of(v) if not url: return None for cand in (R.SERVER + url, R.PROJECT + url, url): c, txt = R.get(cand) if c == 200: return txt return None def write_md(out, cnt, gate_a, classes, comp, constituents, shadow): """Render partition.md from the measured JSON, so the document cannot drift from the numbers.""" L = [] A = L.append A("# Route 131 — durable (source-side) vs ephemeral (index-side) corrections, gated on the generator") A("") A("Every number here is written by `route131_partition.py` into `partition.json`; this file is") A("rendered from that JSON by the same run. Endpoints only, 0 CPU-h.") A("") A("## 0. The gate: the index is a pure function of the notes") A("") c = out["control"] A("Re-running the served generator's own rules (`research/qc/questions.js`, via my faithful") A("re-implementation) over the %d served inputs reproduces the served `research/QUESTIONS.md`" % out["inputs"]) A("byte for byte: %d bytes, sha256 `%s` — identical: **%s**. So a correction written into the" % (c["bytes"], c["sha256"][:16], c["byte_identical"])) A("index is overwritten by the next regeneration, and durability is a property of *where the") A("correction's carrier lives*.") A("") A("## 1. The 776 rows, partitioned by the generator's own derivation") A("") A("| class | rows | what the row's status is |") A("|---|---|---|") A("| source-carried | %d | byte-equal to the `status:` of the one indexed note carrying its id |" % cnt.get("source-carried", 0)) A("| multi-note-agreed | %d | one status, but a group: the displayed verdict is the LAST note in path order |" % cnt.get("multi-note-agreed", 0)) A("| generator-composite | %d | the generator's own `MIXED (...)` string, present in NO source byte |" % cnt.get("generator-composite", 0)) A("| index-only (uncarried) | 0 | no such row: a negative control, every row was reproduced |") A("") A("Rows parsed: %d (sum of the classes: %d). The composite class is tested, not asserted: for" % (out["rows_parsed"], sum(cnt.values()))) A("all %d composite ids the exact status string occurs in none of the %d generator inputs —" % (out["composite"]["ids"], out["inputs"])) A("a registry-only edit of such a row can only ever be overwritten, and no single note can produce") A("it either.") A("") A("## 2. The corrected cells: 20 over 12 rows, each with its pinned blob") A("") A("Two independent discovery paths, unioned on (id, table, field): the discarded registry snapshot") A("(return #80's `QUESTIONS.md` v2) and the reverted note ledgers.") A("") A("| id | table | field | served | target | discovered by | pinned blob |") A("|---|---|---|---|---|---|---|") for x in out["corrections"]: sv = x["served"][:22].replace("|", "\\|") tg = x["target"][:22].replace("|", "\\|") # a verdict's difference can sit past the cut, so record the lengths when the prefixes agree mark = "" if sv != tg else " *(+%d ch)*" % (len(x["target"]) - len(x["served"])) A("| `%s` | %d | %s | %s | %s%s | %s | `%s` |" % (x["qid"], x["table"], x["field"], sv, tg, mark, x["discovered_by"], (x["pinned_blob"] or "-")[:16])) A("") A("## 3. Gate A — source-side: the pinned blob, swapped in, moves the row (measured)") A("") A("| note | pinned blob | rows that move | durable |") A("|---|---|---|---|") for g in gate_a: A("| `%s` | `%s` | %s | %s |" % (g["path"], g["pinned_sha256"][:16], ", ".join(c["qid"] for c in g["rows_changed"]), g["durable"])) s = out.get("gate_a_shadow_prereg") if s: A("| `research/history/staging/shadow-prereg.md` (0 versions) | `%s` | `Q-shadow-prereg` | %s |" % (s["pinned_sha256_of_served_blob"][:16], s["durable"])) A("") if s: A("The last line is the one worth reading twice. Regenerating with return #80's pinned note blob in") A("place of the served note gives a registry of %d bytes, sha256 `%s` — **the discarded registry" % (s["registry_after_bytes"], s["registry_after_sha256"][:16])) A("revision #80 itself filed** (`e2ddcfc55f89...`). #80's two artifacts are mutually consistent,") A("and its named durable fix is not merely sufficient: nothing else in the sources changed in") A("between, so it is *the* fix.") A("") A("## 4. Gate B — index-side: the same 20 cells, edited into the index, do not survive (measured)") A("") b = out["gate_b"] A("%d edits applied to the served registry at the corrected cells' own row lines; regeneration from" % b["hand_edits_applied"]) A("UNCHANGED sources equals the served file (%s) and differs from the edited index (%s), and" % (b["regeneration_equals_served"], b["regeneration_equals_edited_index"])) A("**%d of %d edited cells survive**. That is the ephemeral half of the partition, counted." % (b["edited_cells_surviving_regeneration"], b["edits_declared"])) A("") A("## 5. The second ephemeral class: corrections to a note that is not last in path order") A("") A("%d notes are members (not last) of a multi-note id, over %d ids. The generator reads the displayed" % (out["shadowed"]["non_last_notes"], out["shadowed"]["ids"])) A("verdict from the last note in path order by code, so for all %d a verdict edit is displayed by no" % out["shadowed"]["verdict_edits_invisible"]) A("code path; and for %d of them the group agrees, so a status edit can only surface as a `MIXED`" % out["shadowed"]["status_edits_that_can_only_appear_as_MIXED"]) A("composite, never as the note's own status. Durable blob: the last note in path order for a") A("verdict, every note of the id for a status.") A("") A("## 6. Composite rows: what a pinned blob would have to be") A("") A("%d notes carry the %d synthesised rows, and %d of them have a verified revision available." % (len(constituents), out["composite"]["rows"], sum(1 for x in constituents if x["verified_revision_exists"]))) A("So the durable unit for a synthesised row is the whole constituent set, and today no blob exists") A("that would carry the correction: the statuses would have to be made to agree and a revision") A("published for each constituent. Named per row:") A("") A("| id | constituent note | status | versions |") A("|---|---|---|---|") for x in constituents: A("| `%s` | `%s` | %s | %d |" % (x["qid"], x["note"], x["status"], x["versions"])) A("") A("## 7. Controls and limits") A("") A("- Negative control on over-detection: %d of %d rows are byte-unchanged in the registry. The" % (out["registry_diff"]["rows_compared"] - len(out["registry_diff"]["changes"]), out["registry_diff"]["rows_compared"])) A(" partition names 12 corrected rows, not a smear.") A("- Every gate is a swap-and-regenerate, not a reading of the generator's source: the claim is") A(" about what the served code DOES with substituted bytes.") A("- Limit: durability is measured against the generator's regeneration. The mirror batch is a") A(" *second* rewrite path (route 131's own finding above #1421); a note-side fix is durable against") A(" the generator, and against a mirror batch only if the batch re-prepares from the same source.") A("") open(os.path.join(HERE, "partition.md"), "w", encoding="utf-8", newline="\n").write("\n".join(L) + "\n") print("wrote partition.md (%d lines)" % len(L)) def main(): docs = [d for d in open(os.path.join(JOB128, "docs-list.txt"), encoding="utf-8").read().split("\n") if d] out = {"route": 131} # ---------------------------------------------------------------- 0. control base = G.generate(docs, G.served_fetch) c, reg_txt = R.get(R.PROJECT + "/docs/research/QUESTIONS.md") out["control"] = {"notes": len(base["notes"]), "ids": len(base["ids"]), "bytes": len(base["text"]), "served_bytes": len(reg_txt), "sha256": sha(base["text"]), "sha256_served": sha(reg_txt), "byte_identical": base["text"] == reg_txt} print("control: %d notes, %d ids, byte_identical=%s" % (len(base["notes"]), len(base["ids"]), out["control"]["byte_identical"])) # the generator's own input set (corpus.js drops GENERATED by basename) inputs = [f for f in indexed_files(docs) if os.path.basename(f) not in GENERATED] note_text = {} for p in inputs: c, txt = R.get(R.PROJECT + "/docs/" + p) if c != 200: sys.exit("fetch %s -> %s" % (p, c)) note_text[p] = txt out["inputs"] = len(inputs) # ---------------------------------------------------------------- 1. row inventory + attribution reg_rows = RC.parse_registry(reg_txt) # {(qid, table): {status, verdict, line, ...}} out["rows_parsed"] = len(reg_rows) out["tables"] = sorted({t for (_q, t) in reg_rows}) classes, row_class = {}, {} for qid, group in sorted(base["by_id"].items()): sts = [x["block"]["status"] for x in group] if len(group) == 1: cls = "source-carried" elif len(set(sts)) > 1: cls = "generator-composite" else: cls = "multi-note-agreed" classes[qid] = {"class": cls, "notes": [x["path"] for x in group], "statuses": sts, "last_in_path_order": group[-1]["path"], "carrier_status_shas": {x["path"]: sha(note_text[x["path"]]) for x in group} if all(x["path"] in note_text for x in group) else {}} for (_q, t) in [k for k in reg_rows if k[0] == qid]: row_class[(qid, t)] = cls cnt = {} for (_q, t), r in reg_rows.items(): cnt[row_class.get((_q, t), "?")] = cnt.get(row_class.get((_q, t), "?"), 0) + 1 out["rows_by_class"] = cnt out["rows_per_class_unparsed"] = len(reg_rows) - sum(cnt.values()) # is the composite string present in any generator input? (the decisive property of the class) comp = {} for qid, info in classes.items(): if info["class"] != "generator-composite": continue s = summarise(base["by_id"][qid])["status"] hits = [p for p, t in note_text.items() if s in t] comp[qid] = {"status": s, "source_hits": hits, "in_no_source": not hits} out["composite"] = {"ids": len(comp), "rows": sum(1 for k in reg_rows if row_class.get(k) == "generator-composite"), "all_absent_from_sources": all(v["in_no_source"] for v in comp.values()), "detail": comp} # ---------------------------------------------------------------- 2. correction inventory # (a) the registry diff against the discarded revision (return #80's QUESTIONS.md v2) q_vers = version_list("research/QUESTIONS.md") disc_v = next((v for v in q_vers if str(v.get("return_id")) == "80"), None) if q_vers else None disc_txt = blob_of(disc_v) if disc_v else None disc_rows = RC.parse_registry(disc_txt) if disc_txt else {} reg_diff = [] for key in sorted(set(reg_rows) | set(disc_rows)): a, b = reg_rows.get(key), disc_rows.get(key) if not a or not b: continue for f in ("status", "verdict"): if a[f] != b[f]: reg_diff.append({"qid": key[0], "table": key[1], "field": f, "served": a[f], "target": b[f], "line": a["line"]}) out["registry_diff"] = {"discarded_return": (disc_v or {}).get("return_id"), "discarded_url": R.url_of(disc_v) if disc_v else None, "discarded_sha256": hashlib.sha256(disc_txt.encode("utf-8")).hexdigest() if disc_txt else None, "rows_compared": len(set(reg_rows) & set(disc_rows)), "changes": reg_diff} # (b) per-note: served ledger vs the verified revision, for every reverted document sweep = json.load(open(os.path.join(JOB128, "sweep.json"), encoding="utf-8")) reverted = [r["path"] for r in sweep["reverted"]] notes = [] for path in reverted: vers = version_list(path) v2 = next((v for v in vers if v.get("return_id")), None) if vers else None entry = {"path": path, "versions": len(vers) if vers else 0, "verified_return": (v2 or {}).get("return_id"), "verified_by": (v2 or {}).get("verified_by"), "is_generator_input": path in inputs, "pinned_sha256": hashlib.sha256(blob_of(v2).encode("utf-8")).hexdigest() if (v2 and blob_of(v2)) else None, "pinned_bytes": len(blob_of(v2) or ""), "field_changes": []} if entry["is_generator_input"] and v2: up = blob_of(v2) if up: a = parse_block(note_text[path])["block"] or {} b = parse_block(up)["block"] or {} for f in ("id", "status", "verdict", "question"): if (a.get(f) or "") != (b.get(f) or ""): entry["field_changes"].append({"field": f, "served": (a.get(f) or "")[:200], "target": (b.get(f) or "")[:200]}) notes.append(entry) out["notes"] = notes # ---------------------------------------------------------------- 3. gate A: source-side durability gate_a = [] for e in notes: if not (e["is_generator_input"] and e["pinned_sha256"] and e["field_changes"]): continue vers = version_list(e["path"]) v2 = next((v for v in vers if v.get("return_id")), None) up = blob_of(v2) f = overlays_fetch(G.served_fetch, {e["path"]: up}) gen = G.generate(docs, f) rows, changed = {}, [] for qid, group in gen["by_id"].items(): before = summarise(base["by_id"][qid]) after = summarise(group) if before["status"] != after["status"] or before["verdict"] != after["verdict"]: changed.append({"qid": qid, "status_before": before["status"], "status_after": after["status"], "verdict_before": before["verdict"], "verdict_after": after["verdict"], "verdict_changed": before["verdict"] != after["verdict"], "tables": sorted(t for (q, t) in reg_rows if q == qid), "rows": sorted(t for (q, t) in reg_rows if q == qid)}) gate_a.append({"path": e["path"], "swapped": f.seen["n"], "pinned_sha256": e["pinned_sha256"], "field_changes": len(e["field_changes"]), "rows_changed": changed, "durable": bool(changed), "file_shrank_by": len(reg_txt) - len(gen["text"])}) out["gate_a"] = gate_a # named pinned blob for the one note whose corrected state is NOT any served revision r80 = json.load(open(os.path.join(JOB128, "return-80.json"), encoding="utf-8")) m = HEX64.search(json.dumps(r80)) pinned_note_sha = None for cand in re.findall(r"ccdb59c054d1[0-9a-f]{52}", json.dumps(r80)): pinned_note_sha = cand break local = os.path.join(JOB128, "blob-note.md") pinned_txt = None if pinned_note_sha: for cand in (R.SERVER + "/files/" + pinned_note_sha, R.PROJECT + "/files/" + pinned_note_sha): c, txt = R.get(cand) if c == 200: pinned_txt = txt break if pinned_txt is None and os.path.exists(local): pinned_txt = open(local, encoding="utf-8").read() if pinned_txt is not None: f = overlays_fetch(G.served_fetch, {"research/history/staging/shadow-prereg.md": pinned_txt}) gen = G.generate(docs, f) after = summarise(gen["by_id"]["Q-shadow-prereg"]) before = summarise(base["by_id"]["Q-shadow-prereg"]) out["gate_a_shadow_prereg"] = { "pinned_sha256_of_served_blob": hashlib.sha256(pinned_txt.encode("utf-8")).hexdigest(), "matches_record": hashlib.sha256(pinned_txt.encode("utf-8")).hexdigest() == pinned_note_sha, "line_was": "#80 report quotes ccdb59c054d1...; served /files/ is the same bytes", "status_before": before["status"], "status_after": after["status"], "verdict_before": before["verdict"][:80], "verdict_after": after["verdict"][:80], "durable": after["status"] != before["status"], "rows": sorted(t for (q, t) in reg_rows if q == "Q-shadow-prereg"), "registry_after_bytes": len(gen["text"]), "registry_after_sha256": sha(gen["text"])} print("gate A shadow-prereg: %s -> %s (durable=%s)" % (before["status"], after["status"], out["gate_a_shadow_prereg"]["durable"])) # ------------------------------------------- 3b. the union: every corrected registry cell # The cut left the registry showing the reverted state on two independent paths: the discarded # registry snapshot (4 cells, Q-shadow-prereg) and the reverted note ledgers (gate A). A correction # is only claimed once for a (qid, table, field) cell. corr = {} for ch in reg_diff: corr[(ch["qid"], ch["table"], ch["field"])] = dict( ch, discovered_by="registry-diff-vs-return-80", pinned_blob=None, via=None, source_return=None) for g in gate_a: e = next(x for x in notes if x["path"] == g["path"]) for c in g["rows_changed"]: for t in c["tables"]: for field, served_v, target_v in (("status", c["status_before"], c["status_after"]), ("verdict", c["verdict_before"], c["verdict_after"])): if served_v == target_v or (c["qid"], t, field) in corr: continue corr[(c["qid"], t, field)] = { "qid": c["qid"], "table": t, "field": field, "served": served_v, "target": target_v, "line": reg_rows[(c["qid"], t)]["line"], "discovered_by": "per-note-ledger-diff", "via": e["path"], "pinned_blob": e["pinned_sha256"], "source_return": e["verified_return"]} if out.get("gate_a_shadow_prereg"): s = out["gate_a_shadow_prereg"] for (qid, t), row in sorted(reg_rows.items()): if qid != "Q-shadow-prereg": continue for field, target in (("status", s["status_after"]), ("verdict", s["verdict_after"])): k = (qid, t, field) if k in corr: corr[k].update({"pinned_blob": s["pinned_sha256_of_served_blob"], "via": "research/history/staging/shadow-prereg.md", "source_return": 80}) elif corr.get((qid, t, field)) is None: corr[k] = {"qid": qid, "table": t, "field": field, "served": row[field], "target": target, "line": row["line"], "discovered_by": "pinned-blob-swap", "via": "research/history/staging/shadow-prereg.md", "pinned_blob": s["pinned_sha256_of_served_blob"], "source_return": 80} out["corrections"] = sorted(corr.values(), key=lambda c: (c["qid"], c["table"], c["field"])) out["corrected_rows"] = len({(c["qid"], c["table"]) for c in corr.values()}) out["corrected_cells"] = len(corr) print("corrections: %d cells over %d rows (%d from the registry diff, %d from note ledgers)" % (out["corrected_cells"], out["corrected_rows"], sum(1 for c in corr.values() if c["discovered_by"] == "registry-diff-vs-return-80"), sum(1 for c in corr.values() if c["discovered_by"] == "per-note-ledger-diff"))) # ---------------------------------------------------------------- 4. gate B: index-side ephemerality # Make exactly the edits a corrector would make in the served registry (by row line), then # regenerate from UNCHANGED sources and count how many of those cells survive. targets = [{"qid": c["qid"], "table": c["table"], "field": c["field"], "served": c["served"], "target": c["target"], "line": c["line"]} for c in corr.values()] lines = reg_txt.split("\n") edits, seen = [], set() for t in targets: key = (t["qid"], t["table"], t["field"]) if t["target"] != t["served"] and "line" in t and key not in seen: seen.add(key) edits.append(t) applied = sum(1 for t in edits if splice_row(lines, t["line"], t["served"], t["target"])) edited_reg = "\n".join(lines) json.dump(edited_reg, open(os.path.join(HERE, "QUESTIONS.index-side-edit.json"), "w", encoding="utf-8")) regen = G.generate(docs, G.served_fetch, quiet=True) after_rows = RC.parse_registry(regen["text"]) surviving = 0 for t in edits: r = after_rows.get((t["qid"], t["table"])) if r and r[t["field"]] == t["target"]: surviving += 1 out["gate_b"] = {"hand_edits_applied": applied, "edits_declared": len(edits), "edited_registry_bytes": len(edited_reg), "regeneration_equals_served": regen["text"] == base["text"], "regeneration_equals_edited_index": regen["text"] == edited_reg, "edited_cells_surviving_regeneration": surviving, "filled_example": edits[:3]} # ------------------------------------------------- 4b. shadowed corrections (path order decides) # The generator takes the displayed verdict from the LAST note in path order, so a correction to # any earlier note of a multi-note id is invisible at the index. Measured per note, and the blob # that would make such a fix durable is the last note's revision. shadow = [] for qid, info in sorted(classes.items()): group = base["by_id"][qid] if len(group) < 2: continue shown = summarise(group) agree = len(set(info["statuses"])) == 1 for x in group[:-1]: b = x["block"] shadow.append({"qid": qid, "note": x["path"], "group_size": len(group), "statuses_agree": agree, "verdict_shown_from": info["last_in_path_order"], "note_verdict_differs_from_shown": b["verdict"] != shown["verdict"], # a verdict edit here is displayed by no code path: the generator reads the # last note's verdict unconditionally "verdict_edit_visible": False, # a status edit here IS displayed, but only by flipping the row to the MIXED # composite -- it can never display the note's own status on its own "status_edit_can_show_as_plain_status": not agree, "durable_requires": "this note AND every sibling (all must agree)"}) out["shadowed"] = {"non_last_notes": len(shadow), "verdict_edits_invisible": len(shadow), "status_edits_that_can_only_appear_as_MIXED": sum( 1 for s in shadow if not s["status_edit_can_show_as_plain_status"]), "ids": len({s["qid"] for s in shadow}), "durable_blob_is": "for a verdict: the last note in path order; for a status: every note of the id", "detail": shadow} # composite constituents: the durable unit for a synthesised row (its status is in no source) constituents = [] for qid in sorted(comp): for x in base["by_id"][qid]: vl = version_list(x["path"]) constituents.append({"qid": qid, "note": x["path"], "status": x["block"]["status"], "versions": len(vl) if vl else 0, "served_sha256": sha(note_text[x["path"]]), "verified_revision_exists": bool(vl and any(v.get("return_id") for v in vl))}) out["composite_constituents"] = constituents # ---------------------------------------------------------------- 5. write json.dump(out, open(os.path.join(HERE, "partition.json"), "w", encoding="utf-8"), indent=1, ensure_ascii=False) write_md(out, cnt, gate_a, classes, comp, constituents, shadow) print("\nrows by class: %s" % json.dumps(cnt)) print("rows parsed: %d" % len(reg_rows)) print("composite: %d ids / %d rows, absent from every source: %s" % (out["composite"]["ids"], out["composite"]["rows"], out["composite"]["all_absent_from_sources"])) print("registry diff vs #%s: %d changes over %d rows" % (out["registry_diff"]["discarded_return"], len(reg_diff), out["registry_diff"]["rows_compared"])) print("gate A (source swap -> row moves):") for g in gate_a: print(" %-58s durable=%-5s rows=%s" % (g["path"], g["durable"], [c["qid"] + ":" + c["status_after"][:9] for c in g["rows_changed"]])) print("gate B: %d hand edits applied, %d edited cells survive regeneration, edited index == regen: %s" % (out["gate_b"]["hand_edits_applied"], out["gate_b"]["edited_cells_surviving_regeneration"], out["gate_b"]["regeneration_equals_edited_index"])) print("shadowed: %d non-last notes over %d ids; verdict edits invisible: %d; status edits that can" " only surface as MIXED: %d" % (out["shadowed"]["non_last_notes"], out["shadowed"]["ids"], out["shadowed"]["verdict_edits_invisible"], out["shadowed"]["status_edits_that_can_only_appear_as_MIXED"])) print("composite constituents: %d notes, verified revisions available: %d" % (len(constituents), sum(1 for c in constituents if c["verified_revision_exists"]))) return 0 if __name__ == "__main__": sys.exit(main())