KB-5C97
Orchestrator O2 · 04 In-Memory E2E Test Result
8 min read Revision 1
dot-iu-cutterv0.6orchestrator-o2-phase-body-e2e-authoringin-memory-e2e-testg4-g6-pass359-of-359no-regressiondieu442026-05-20
Orchestrator O2 · 04 In-Memory E2E Test Result
doc 4 of 7 · 2026-05-20 · G4 + G6 gates
phase : G4 — E2E test authoring + G6 — full pytest discover outcome : G4 PASS · G6 PASS — 359/359 production_mutation : NONE
1. New test surface
tests/_orchestrator_o2_harness.py : 119 LOC — shared harness
- DOC_ID / SD_ID / SV_ID constants
- seed_discoverer(n_candidates=12) → fully-seeded InMemoryDiscoverer
- build_runner(tmpdir, n_candidates) → (runner, disc, store, kb)
- write_sg1_approval(td, run_id, …) → SG_1 KB approval doc
- write_sg2_approval(td, run_id, …) → SG_2 KB approval doc (with
embedded review_decision_id)
tests/test_orchestrator_o2_e2e.py : 12 tests
TestKillSwitchOff (3) — milestone tag O2, killswitch False,
Mode.LIVE refused
TestE2EHappyPath (2) — full walk through both sovereign
gates → closeout; resume idempotency
TestApprovalRequiredOnResume (3)
— no-approval / wrong-gate / stale
TestApprovalConsumedExactlyOnce (1)
— replay refused (design doc 03 §7)
TestUnknownDocumentStop (1) — STOP_DOCUMENT_UNKNOWN routing
TestKBArtifactsWrittenForEachPhase (1)
— 11 phase + 2 sovereign-request docs
+ runs-index entry present
TestStopDriftOnResume (1) — source_version drift mid-pause →
STOP_DRIFT
tests/test_orchestrator_o2_gate_invariants.py : 18 tests
(catalogued in doc 03 §4)
tests/test_orchestrator_o2_phase_bodies.py : 21 tests
TestSourcePinPhase (1), TestMarkPhase (2), TestCutplanPhase (1),
TestBackupPhase (2), TestGrantProbePhase (2), TestCutLegAPhase (3),
TestLegBPhase (2), TestWriteVerifyPhase (2),
TestLifecycleEnactPhase (3), TestStructuralVerifyPhase (1),
TestCloseoutPhase (2)
total_new_tests : 51 (12 + 18 + 21)
total_o2_test_loc : 627
shared_harness_loc : 119
2. Pytest full-discover output
============================= test session starts ==============================
platform darwin -- Python 3.11.6, pytest-9.0.2, pluggy-1.6.0
rootdir: /Users/nmhuyen/iu-cutter-build/repo/iu-cutter
plugins: anyio-4.12.1
collected 359 items
tests/test_cutplan_snapshot.py ............... [ 4%]
tests/test_cutwrite_snapshot.py ...................... [ 10%]
tests/test_dryrun_snapshot_mark.py ..................... [ 16%]
tests/test_idempotency.py ....... [ 18%]
tests/test_ledger_v2_canonical_cut.py ..................... [ 23%]
tests/test_ledger_v2_canonical_verify.py .............................. [ 32%]
tests/test_orchestrator_o1_approval_and_batch.py ........... [ 35%]
tests/test_orchestrator_o1_run_context.py ....... [ 37%]
tests/test_orchestrator_o1_runner.py ........... [ 40%]
tests/test_orchestrator_o1_state_machine.py .............. [ 44%]
tests/test_orchestrator_o2_e2e.py ............ [ 47%]
tests/test_orchestrator_o2_gate_invariants.py .................. [ 52%]
tests/test_orchestrator_o2_phase_bodies.py ..................... [ 58%]
tests/test_phase_contracts.py ........... [ 61%]
tests/test_prod_iu_adapter.py ..................................... [ 71%]
tests/test_prod_iu_adapter_canonical.py ........................... [ 79%]
tests/test_real_postgres_adapter.py .................................... [ 89%]
........... [ 92%]
tests/test_security_boundaries.py ............ [ 95%]
tests/test_state_machine.py ............... [100%]
============================= 359 passed in 0.36s ==============================
3. Baseline comparison
baseline_o1 : 308/308 PASS (KB v0.6-orchestrator-o1-authoring/doc 04)
o2_full_discover : 359/359 PASS
delta_tests : +51 (12 E2E + 18 gate-invariants + 21 phase bodies)
v0_5_regressions : 0
runtime_total_seconds : 0.36 s
4. Happy-path walk — invariants captured
The test_full_walk_through_two_sovereign_gates_to_closeout test
exercises the complete state machine. At each checkpoint the sidecar
is asserted to carry the expected pins:
after_initial_cut (stop at SG_1):
state : AWAITING_CUT_AUTHORIZATION
stop_code : STOP_APPROVAL_REQUIRED
phases_passed : source_pin, mark, cutplan,
pre_write_backup, grant_probe
context_pins (subset asserted) : manifest_digest, region_sha,
writer_digest
after_resume_with_sg1 (stop at SG_2):
state : AWAITING_LIFECYCLE_AUTHORIZATION
stop_code : STOP_APPROVAL_REQUIRED
phases_passed (added) : cut_leg_a, structural_verify,
leg_b_record, write_verify
context_pins (added) : change_set_id, manifest_envelope_id,
verify_result_id
after_resume_with_sg2 (closeout):
state : CLOSEOUT_REPORTED
stop_code : None
phases_passed : ALL 11
context_pins (subset asserted) : lifecycle_enacted=True,
lifecycle_enacted_count==12,
all_phase_docs_uploaded=True,
sidecar_state_final=='success'
5. Forbidden-paths — assertions per design
TestKillSwitchOff.test_kill_switch_remains_off_in_o2:
- assertFalse(__execution_enabled__)
TestKillSwitchOff.test_live_mode_refused_in_o2:
- runner.cut(mode=Mode.LIVE) raises ProductionExecutionNotAuthorized
TestApprovalRequiredOnResume.test_resume_without_approval_at_sg1_raises:
- runner.resume(approval_kb_id=None) raises StopApprovalRequired
TestApprovalConsumedExactlyOnce.test_same_approval_kb_id_refused_on_second_use:
- second consume of same approval_kb_id raises ApprovalConsumedAlready
TestUnknownDocumentStop.test_unknown_document_stops_with_clean_code:
- unknown document_id → STOP_DOCUMENT_UNKNOWN, no traceback leak
TestStopDriftOnResume.test_drift_in_source_version_id_is_detected:
- mutating SourceVersion.id between cut and resume → STOP_DRIFT
6. Verdict
g4_outcome : PASS (51 new tests; 12 E2E + 18 gate-invariants
+ 21 phase bodies)
g6_outcome : PASS (359/359 full discover; +51 tests; 0 regressions)
production_mutation : NONE
live_db_connect : 0