KB-164A

O8D Mac patch / deploy / multi-gap proof — 04-code-patch-summary

5 min read Revision 1
dieu44iu-cutterv0.6o8dmac-patchcode-patchmulti-gap-proof

O8D Report 04 — Code patch summary (G3)

  • macro: v0.6-o8d-mac-patch-deploy-multigap-proof
  • date_utc: 2026-05-21
  • gate covered: G3 code patch
  • result: G3 PASS — 3 in-scope patches applied; F3 packaged (not patched)

P1 — milestone / version ratification

cutter_agent/orchestrator/__init__.py:

__version__   = "0.6.0-O8B-live-execution-wiring"   # was 0.6.0-O4-…
__milestone__ = "O8B"                               # was "O4"
__live_wiring__ = "O8B-deployed-703559c"            # was "O8A-authoring-staging"
__execution_enabled__ = False                       # UNCHANGED
KNOWN_MILESTONES = ("O1".."O8D")  # new tuple + load-time membership assert

3 test files made milestone-agnostic (future bumps need no test edits): test_orchestrator_o1_state_machine.py, test_orchestrator_o2_e2e.py, test_orchestrator_o4_live_dryrun.py — each now assertIn(__milestone__, KNOWN_MILESTONES).

P2 — psycopg2 → psycopg3 connection shim

cutter_agent/orchestrator/live_execution.py — new class Psycopg2ConnectionShim: wraps a psycopg2 connection (cursor-only) and presents the psycopg v3 .execute(sql, params) -> cursor / .commit() / .rollback() / .close() surface that ProductionLiveExecutionAdapter expects. Owns NO secret / DSN / host — wraps a connection the caller already opened. Refuses a None connection. Faithful transaction pass-through (BEGIN via .execute, end via .commit/.rollback).

P3 — F2 cutplan content-contract enrichment

  • discover.py MarkRow: + body: str = "", title: str = "".
  • discover.py CutplanRow: + body, title, owner_ref, parent_ref (optional/defaulted; not in writer_digestcontent_hash already represents content).
  • InMemoryDiscoverer.cutplan_rebuild: propagates body/title from MarkRow.
  • LiveDryRunDiscoverer._shadow_mark_rows: carries deterministic, clearly-labelled placeholder body/title (real Constitution text sourcing = the F2 residual).
  • phases/cutplan.py: serialises body/title/owner_ref/parent_ref into the cutplan_rows pin.
  • live_execution.py cut_leg_a guard: extended from body/title-only to body + title + unit_kind + section_type — content-incomplete rows fail fast, before any DB connect.
  • tests/_orchestrator_o2_harness.py: seeds MarkRow body/title so the in-memory E2E exercises the enriched contract.

New tests

tests/test_orchestrator_o8d_patch.py — 18 tests across milestone ratification, the psycopg2 shim (incl. end-to-end through the adapter), and F2 enrichment + the extended guard.

Not patched — F3

F3 (LegB/Verify generalisation off N=60) was not patched: it is not localised — it touches the v0.5-ratified ledger_v2_canonical_* files and a hardcoded key name body_hash_match_60. Per the G2 rule it is packaged as a next command package (Report 09).

Files changed (commit cad989a)

cutter_agent/orchestrator/__init__.py        | 22 +++--
cutter_agent/orchestrator/discover.py        | 35 ++++++-
cutter_agent/orchestrator/live_execution.py  | 91 +++++++++++++++--
cutter_agent/orchestrator/phases/cutplan.py  |  7 +-
tests/_orchestrator_o2_harness.py            |  4 +
tests/test_orchestrator_o1_state_machine.py  | 10 +-
tests/test_orchestrator_o2_e2e.py            |  8 +-
tests/test_orchestrator_o4_live_dryrun.py    |  9 +-
tests/test_orchestrator_o8d_patch.py         | NEW
9 files changed, 440 insertions(+), 20 deletions(-)

Known cosmetic residue

The __milestone__ inline comment still reads "Contabo artifact 703559c" while the deployed O8D artifact is cad989a. This is a non-load-bearing code comment (the manifest + __version__ carry the precise identity); flagged for a trivial future cleanup, not re-committed within O8D.

G3 verdict

p1_milestone_ratify:    applied
p2_psycopg_shim:        applied
p3_f2_enrichment:       applied
f3_generalisation:      packaged (not patched — needs architecture ruling)
production_approval:    NOT touched
real_crypto:            NOT touched (StubSigning unchanged)
state_machine_redesign: NOT done
g3:                     PASS
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-o8d-mac-patch-deploy-multigap-proof/04-code-patch-summary.md