|
oc_chat
|
Classes | |
| class | Region |
| class | Check |
Functions | |
| list[str] | evaluate (str text, Check check) |
| list[str] | _manifest_problems () |
| str|None | read_source (str rel_path, bool worktree) |
| str|None | read_plan (bool worktree) |
| int | run (bool worktree) |
| int | main (list[str]|None argv=None) |
Variables | |
| _REPO = Path(__file__).resolve().parent.parent | |
| str | PLAN = "oc_chat/plans/completed/151-monorepo-migration.md" |
| str | DEFERRED = "tools/151_deferred_sol20_tooling.md" |
| dict | _SOURCES = {"plan": PLAN, "deferred": DEFERRED} |
| int | _REGION_MAX = 20000 |
| _T8_CLOSE = Region("T8 close order", "close order (ONE canonical list", "Pin the mechanism as") | |
| _T1_STEP3 = Region("T1 step 3 (fetch)", "OC_MIGRATION_BRANCH=<pinned>", "**⚠️") | |
| _T2_D4 = Region("T2 D4 step", "D4 — distribution-SUPPLY fix", "D5 — ONE") | |
| _T0_LEDGER = Region("§2.1 ledger schema", "ledger_schema_version, tranche", "**") | |
| _S24_ROLLBACK = Region("§2.4 rollback", "rollback of the structural move", "###") | |
| _T1_REHEARSAL = Region("T1 rehearsal Gate", "the rehearsal runs on a MERGED", "**") | |
| _T0_GATE = Region("T0 Gate", "each anchor tag (`pre-oc-chat-merge`", "free-space PER-VOLUME BUDGET receipt") | |
| _T8_MIRROR | |
| _AC22_ATOMIC = Region("AC row 22 (T8 close)", "| 22 | **T8 (close):**", "| T8 report;") | |
| _S10_VARS = Region("§1.0 canonical vars", "ACTIVE_FREEZE_PATH = <dispatch-pinned", "```") | |
| _T2_GATE = Region("T2 Gate (workspaces row)", "the scm `root`-DEPTH re-derivation recorded", "report-T2.") | |
| _T8_FAILPATH | |
| _T8_GATE_BLOCKED | |
| _S7_V = Region("§7(v) fold-evidence protocol", "(v) THE MECHANICAL FOLD-LANDING GATE", "| # | Check |") | |
| tuple | _BLOCKED_WINDOW |
| tuple | _MANIFEST_WINDOW |
| _AC11 = Region("AC row 11 (runtime-state boundary)", "| 11 | **Runtime-state boundary", "| 12 |") | |
| _AC18 = Region("AC row 18 (T2 D5 + settings)", "| 18 | **T2 D5 + settings", "| 19 |") | |
| dict | MANIFEST |
| list | CHECKS |
Fold-landing gate for review-hardened plans (built for plan 151).
Purpose
-------
What this is — and, honestly, what it is NOT (2026-07-15, reviews 151/R17+R18).
This is a **region-scoped exact-substring checker**. For each folded finding it
asserts:
* NEW — the new mechanism's literal appears INSIDE the finding's executing
region (a bounded span between two anchor strings — a step, a Gate,
an AC row), **not merely somewhere in the document**. This is the
capability whose absence let the v1 gate certify step-landings that
were only in prose (Opus R18 O18-P0-1: the `/save` check passed while
the T8 step had no `/save`).
* GONE — the retired literal and its listed paraphrases appear nowhere outside
the sanctioned historical narrative.
It is **NOT** semantic paraphrase detection. The ``gone`` lists are a hand-curated
exact-substring denylist, case-sensitive; an unforeseen rewording is not caught.
The v1 tool over-claimed "concept-aware"; that claim is RETRACTED. A deterministic
checker cannot prove a concept is gone — so a MANDATORY HUMAN CONCEPT AUDIT remains
part of the fold procedure (plan §7(iii)); this gate is the mechanical floor under
it, not a replacement for it.
It is also NOT a completeness proof. ``CHECKS`` is reconciled against ``MANIFEST``
(the review-finding IDs it must cover) so the denominator cannot silently shrink by
deleting a check — but a finding nobody added to the manifest is still uncovered.
V30 (Sol R25 SOL25-03): the R24 lifecycle literals are the smallest complete OPERATIVE
contracts (the T8 custody phrase with its ledger-hash equality; the freeze-marker
baseline comparison) instead of bare tokens — Sol executed two single-leg mutations
that deleted the safety action while keeping the token, and the V29 checks stayed
green; both are now pinned regression tests. The three T8 blocked-path surfaces
(step / Gate / AC 22) are checked per-surface, and the receipt enumerates every
audited source. Still a phrase floor, not a lifecycle proof.
V31 (operator re-scope directive 2026-07-16 + Fable/Sol R26): the plan's evidence-layer
dispatch gates were retired by operator directive (threat-matched for a sole-operator,
local, reversible migration), so SOL25-01/SOL25-01-probe/SOL25-01-vars (the
authenticated-ledger dispatch gate), TERRA22-04 (the SOL20-04 pre-dispatch commit at
AC 22), and S23-P1-3 (the retired section-1.0 commit variable) are RETIRED from
CHECKS+MANIFEST — their anchor text no longer exists in the plan. SOL25-04 is
RETARGETED to the simple one-commit receipt form of section 7 clause v, and the
SOL25-02 blocked-path window is WIDENED over the two new close items. New checks:
F26-01 (the T2 PRESERVE equality oracle), F26-02-step/-gate/-ac22 (the terminal
artifact manifest blocked-path item, per surface), F26-03 (the rollback-copy and
DACL-save blocked-path items), R25-01-root (the durable-root declaration — Sol R26
mutation C, executed false-green at V30, now red), and V31-T8-RECONCILE (the kept T8
terminal-transition contract at AC 22). The V30 claim that each new check carried a
single-leg adversarial test was FALSE for five of the nine (Sol R26 SOL26-05); the
test suite now carries a META-TEST mapping every manifest fid to a named test or the
documented untested-phrase-floor list, failing on drift.
Usage
-----
python tools/plan_fold_gate.py # gate the committed HEAD blob (authoritative)
python tools/plan_fold_gate.py --worktree # gate the working tree (iterating a fold)
Responsibilities
----------------
- :class:`Region` — a bounded span of the plan, located between two anchor strings.
- :class:`Check` — one finding: its ``new`` literal + the ``region`` it must land in,
plus whole-document ``gone`` literals.
- :data:`CHECKS` / :data:`MANIFEST` — the fold set and the review IDs it must cover.
- :func:`evaluate` — THE single production predicate: returns the problems for one
check against the plan text (the tests call this — they do not re-implement it).
- :func:`read_plan` / :func:`run` / :func:`main`.
Exit codes
----------
- 0 — every check passed and the manifest is covered.
- 1 — a finding did not land at its region, a retired literal survived, or the
manifest/checks disagree.
- 2 — the plan file could not be read.
Diagnostics
-----------
Domain: OC_CHAT.MAIN
Levels:
L2 — lifecycle events (the pass/fail tally)
L3 — semantic details
L4 — deep tracing
Contracts
---------
- The committed blob (``git show HEAD:<plan>``) is authoritative; ``--worktree`` is
only for iterating a fold before committing.
- Historical-scope decision (Opus R17 O17-P1-4): ``gone`` targets a retired concept's
OPERATIVE phrasing; a dated statement of fact ("renamed from X", "branch Y is merged
and deleted") is allowed, which is why ``gone`` lists operative phrasings not bare
nouns.
Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)
|
protected |
Return problems if CHECKS and MANIFEST have drifted (a required finding uncovered, or a check not in the manifest).
Definition at line 392 of file plan_fold_gate.py.
| list[str] plan_fold_gate.evaluate | ( | str | text, |
| Check | check ) |
THE production predicate. Return the problems for ``check`` against ``text`` (empty list == pass). Tests call THIS — they do not re-implement it (SOL18-01).
Definition at line 356 of file plan_fold_gate.py.
| int plan_fold_gate.main | ( | list[str] | None | argv = None | ) |
CLI entry point.
Definition at line 459 of file plan_fold_gate.py.
| str | None plan_fold_gate.read_plan | ( | bool | worktree | ) |
Return the plan text (back-compat shim over :func:`read_source`).
Definition at line 418 of file plan_fold_gate.py.
| str | None plan_fold_gate.read_source | ( | str | rel_path, |
| bool | worktree ) |
Return a source file's text: the committed HEAD blob (authoritative) or the worktree. Generalizes ``read_plan`` so a CROSS-FILE check can gate a second file (V29 SOL24-03).
Definition at line 403 of file plan_fold_gate.py.
| int plan_fold_gate.run | ( | bool | worktree | ) |
Evaluate every check, print the labelled receipt, return the process exit code.
Definition at line 423 of file plan_fold_gate.py.
|
protected |
Definition at line 206 of file plan_fold_gate.py.
|
protected |
Definition at line 207 of file plan_fold_gate.py.
|
protected |
Definition at line 170 of file plan_fold_gate.py.
|
protected |
Definition at line 195 of file plan_fold_gate.py.
|
protected |
Definition at line 201 of file plan_fold_gate.py.
|
protected |
Definition at line 120 of file plan_fold_gate.py.
|
protected |
Definition at line 113 of file plan_fold_gate.py.
|
protected |
Definition at line 173 of file plan_fold_gate.py.
|
protected |
Definition at line 163 of file plan_fold_gate.py.
|
protected |
Definition at line 183 of file plan_fold_gate.py.
Definition at line 119 of file plan_fold_gate.py.
|
protected |
Definition at line 167 of file plan_fold_gate.py.
|
protected |
Definition at line 162 of file plan_fold_gate.py.
|
protected |
Definition at line 164 of file plan_fold_gate.py.
|
protected |
Definition at line 160 of file plan_fold_gate.py.
|
protected |
Definition at line 161 of file plan_fold_gate.py.
|
protected |
Definition at line 174 of file plan_fold_gate.py.
|
protected |
Definition at line 159 of file plan_fold_gate.py.
|
protected |
Definition at line 178 of file plan_fold_gate.py.
|
protected |
Definition at line 180 of file plan_fold_gate.py.
|
protected |
Definition at line 168 of file plan_fold_gate.py.
| list plan_fold_gate.CHECKS |
Definition at line 241 of file plan_fold_gate.py.
| str plan_fold_gate.DEFERRED = "tools/151_deferred_sol20_tooling.md" |
Definition at line 115 of file plan_fold_gate.py.
| dict plan_fold_gate.MANIFEST |
Definition at line 210 of file plan_fold_gate.py.
| str plan_fold_gate.PLAN = "oc_chat/plans/completed/151-monorepo-migration.md" |
Definition at line 114 of file plan_fold_gate.py.