# Plugin Rehearsal Durable Outbox And Release Gate Implementation Plan **Goal:** Move local H2 rehearsal execution out of HTTP requests and produce a comparable, integrity-verified release decision. **Tech Stack:** Java 8, Spring Boot 2.5, MyBatis, H2 MySQL mode, JUnit 4, Vue 2, Element UI. ### Task 1: Durable Command Ledger - [x] Add one Outbox row per Attempt with a unique foreign key. - [x] Persist lease owner, private token, deadline, heartbeat, delivery count, availability, error, and terminal time. - [x] Insert Attempt, six Receipts, and PENDING Outbox in one transaction. - [x] Return from the start API without opening H2. ### Task 2: Lease Worker - [x] Atomically claim due PENDING and expired PROCESSING commands. - [x] Fence every mutation with the current lease token. - [x] Renew before state transitions and periodically during scenario execution. - [x] Keep target execution outside Spring transactions. - [x] Remove the legacy unleased Attempt start Mapper path. ### Task 3: Recovery - [x] Rebuild H2 and replay all six scenarios after takeover. - [x] Reset only non-terminal Attempt evidence before replay. - [x] Reject manual takeover while a lease is active. - [x] Requeue an expired lease for normal Worker claim. - [x] Abort open Attempt, Receipts, and Outbox atomically. ### Task 4: Comparison And Gate - [x] Compare only complete successful Attempts. - [x] Preserve raw evidence SHA-256 verification. - [x] Exclude volatile transport identity from semantic fingerprints. - [x] Block release on latest Attempt state, Outbox state, missing evidence, tampering, or semantic drift. - [x] Let the first successful delivered Attempt establish a baseline. ### Task 5: API And Workspace - [x] Add reconcile, comparison, and release-gate endpoints under `generator:delivery:verify`. - [x] Poll PENDING/RUNNING Attempts from the delivery report. - [x] Show Outbox status, delivery count, Worker, heartbeat, and lease deadline. - [x] Add semantic comparison and release-gate views. - [x] Keep lease token and local H2 connection identity out of REST responses. ### Task 6: Regression - [x] Run 29 focused rehearsal and schema tests with no failures. - [x] Run 193 Plugin tests with no failures. - [x] Run 836 generator tests with the exact 18 known failures and 38 admin tests with no failures. - [x] Run frontend contract tests. - [x] Run the production frontend build.