Skip to content

Commit 221053b

Browse files
V36 Gate 9: Prove local staging Exchange rehearsal
Add package-owned ExchangeRehearsal canon, deterministic source-safe artifact generation, Gate 9 checker, protocol tests, workflow wiring, and V36 spec/docs parity for local and staging-testnet Exchange rehearsal coverage. Validation: pnpm run check:v36-exchange-rehearsal; pnpm run check:v36-gate1..check:v36-gate9; pnpm --filter @bitcode/protocol typecheck; pnpm --filter @bitcode/protocol test; V36 spec family and canon posture checks; git diff --check.
1 parent 242b018 commit 221053b

18 files changed

Lines changed: 2488 additions & 3 deletions

.bitcode/v36-exchange-rehearsal.json

Lines changed: 1430 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/bitcode-canon-quality.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ jobs:
9494
if [ -f scripts/check-v36-gate8-exchange-ux-proof.mjs ]; then
9595
node scripts/check-v36-gate8-exchange-ux-proof.mjs --skip-branch-check
9696
fi
97+
if [ -f scripts/check-v36-gate9-exchange-rehearsal.mjs ]; then
98+
node scripts/check-v36-gate9-exchange-rehearsal.mjs --skip-branch-check
99+
fi
97100
fi
98101
else
99102
echo "Unexpected BITCODE_SPEC.txt pointer: $POINTER" >&2

.github/workflows/bitcode-gate-quality.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ jobs:
222222
if [ -f scripts/check-v36-gate8-exchange-ux-proof.mjs ]; then
223223
node scripts/check-v36-gate8-exchange-ux-proof.mjs --skip-branch-check
224224
fi
225+
if [ -f scripts/check-v36-gate9-exchange-rehearsal.mjs ]; then
226+
node scripts/check-v36-gate9-exchange-rehearsal.mjs --skip-branch-check
227+
fi
225228
fi
226229
else
227230
echo "Unexpected BITCODE_SPEC.txt pointer: $POINTER" >&2
@@ -284,6 +287,7 @@ jobs:
284287
pnpm --dir packages/protocol exec node --test --test-force-exit test/v36-exchange-settlement-reconciliation.test.js
285288
pnpm --dir packages/protocol exec node --test --test-force-exit test/v36-exchange-dispute-repair-revenue-route.test.js
286289
pnpm --dir packages/protocol exec node --test --test-force-exit test/v36-exchange-ux-proof.test.js
290+
pnpm --dir packages/protocol exec node --test --test-force-exit test/v36-exchange-rehearsal.test.js
287291
pnpm --filter @bitcode/api exec jest --config jest.config.cjs --runTestsByPath src/routes/__tests__/btd-crypto.test.ts --runInBand
288292
pnpm --filter @bitcode/api exec jest --config jest.config.cjs --runTestsByPath src/routes/__tests__/auxillaries-contract.test.ts --runInBand
289293
pnpm --dir packages/executions-mcp/src/mcp-server run test:mcp -- --runTestsByPath src/__tests__/unit/auth.test.ts --runInBand

BITCODE_SPEC_V36.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,25 @@ protected source, unpaid AssetPack source, wallet private material, provider
225225
tokens, protected prompts, protected model responses, buyer private repository
226226
payloads, or secret values.
227227

228+
## V36 Gate 9 ExchangeRehearsal canon
229+
230+
Gate 9 implements `ExchangeRehearsal` as the package-owned contract binding
231+
local and staging-testnet Exchange rehearsals to generated proof.
232+
233+
`ExchangeRehearsal` proves that local and staging-testnet rehearsals exercise list, bid, ask, cancel, accept, settle, repair, and history flows.
234+
It proves that rehearsal logs/screenshots are source-safe.
235+
It also proves that ledger/database synchronization and value-bearing mainnet blocking are visible.
236+
237+
Gate 9 emits `.bitcode/v36-exchange-rehearsal.json` with
238+
`source-safe-exchange-rehearsal-metadata`.
239+
The artifact may expose rehearsal ids, lane ids, flow ids, event ids, proof
240+
roots, ledger/database synchronization checks, validation commands, redacted
241+
log/screenshot roots, source evidence, and summary counts; it must not expose
242+
protected source, unpaid AssetPack source, wallet private material, private
243+
payment credentials, object-storage private bytes, provider tokens, protected
244+
prompts, protected model responses, buyer private repository payloads, or secret
245+
values.
246+
228247
## Canonical Bitcode executive summary
229248

230249
Bitcode measures technical knowledge, finds deposits that fit reviewed Reads, synthesizes source-bearing AssetPacks, and settles read rights in BTC with BTD range and rights receipts.

BITCODE_SPEC_V36_DELTA.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,12 @@ Gate 9 proves Exchange locally and in staging-testnet.
161161

162162
Closure acceptance:
163163

164+
- `ExchangeRehearsal` is package-owned by `@bitcode/protocol`;
164165
- local and staging-testnet rehearsals exercise list, bid, ask, cancel, accept, settle, repair, and history flows;
165166
- rehearsal logs/screenshots are source-safe;
166-
- ledger/database synchronization and value-bearing mainnet blocking are visible.
167+
- ledger/database synchronization and value-bearing mainnet blocking are visible;
168+
- `.bitcode/v36-exchange-rehearsal.json` is generated from the package-owned `ExchangeRehearsal` builder with `source-safe-exchange-rehearsal-metadata`;
169+
- `pnpm run check:v36-gate9` validates package source, artifact freshness, package tests, docs, workflow wiring, local lane flow coverage, staging-testnet lane flow coverage, source-safe logs/screenshots, ledger/database synchronization checks, proof roots, and blocked value-bearing mainnet posture.
167170

168171
### Gate 10: V36 Promotion Readiness
169172

BITCODE_SPEC_V36_NOTES.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,22 @@ not protected source, unpaid AssetPack source, wallet private material, provider
169169
tokens, protected prompts, protected model responses, buyer private repository
170170
payloads, or secret values.
171171

172+
## Gate 9 closure notes
173+
174+
Gate 9 closes when `ExchangeRehearsal` is package-owned and generated through
175+
`.bitcode/v36-exchange-rehearsal.json`.
176+
The generated artifact carries `source-safe-exchange-rehearsal-metadata`.
177+
`ExchangeRehearsal` proves that local and staging-testnet rehearsals exercise list, bid, ask, cancel, accept, settle, repair, and history flows.
178+
It proves that rehearsal logs/screenshots are source-safe.
179+
It also proves that ledger/database synchronization and value-bearing mainnet blocking are visible.
180+
Exchange rehearsal artifacts remain source-safe: they expose rehearsal ids,
181+
lane ids, flow ids, event ids, proof roots, ledger/database synchronization
182+
checks, validation commands, redacted log/screenshot roots, source evidence,
183+
and summary counts, not protected source, unpaid AssetPack source, wallet
184+
private material, private payment credentials, object-storage private bytes,
185+
provider tokens, protected prompts, protected model responses, buyer private
186+
repository payloads, or secret values.
187+
172188
## Accepted boundaries
173189

174190
- V36 owns deeper Exchange.

BITCODE_SPEC_V36_PARITY_MATRIX.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ No `_legacy/` source is active source truth.
6161
| Settlement reconciliation | Gate 6 | `ExchangeSettlementReceipt`, `.bitcode/v36-exchange-settlement-reconciliation.json`, observers, repair tests, and `check:v36-gate6` | closed | Payment observation, finality state, rights-transfer receipt, ledger root, database projection root, object storage root, delivery state, repair id, observer jobs, and repair jobs reconcile. |
6262
| Dispute repair revenue routes | Gate 7 | `ExchangeDisputeRepairCase`, `ExchangeRevenueRoute`, `.bitcode/v36-exchange-dispute-repair-revenue-route.json`, tests, and `check:v36-gate7` | closed | Disputes, repairs, revenue routes, conservation proofs, runbooks, and escalation paths exist. |
6363
| Exchange UX and Terminal integration | Gate 8 | `ExchangeUxProof`, `/exchange`, Terminal handoff, public docs, telemetry dashboards, `.bitcode/v36-exchange-ux-proof.json`, tests, and `check:v36-gate8` | closed | Master-detail UX, filters, order history, rights-transfer review, pricing quote, settlement state, repair state, Terminal navigation, collapsed status, and source-safe expanded detail are validated. |
64-
| Local staging rehearsal | Gate 9 | `.bitcode/v36-exchange-rehearsal.json`, local/staging logs, proof roots, and `check:v36-gate9` | draft-required | Local and staging-testnet list/bid/ask/cancel/accept/settle/repair/history flows are rehearsed. |
64+
| Local staging rehearsal | Gate 9 | `.bitcode/v36-exchange-rehearsal.json`, local/staging logs, proof roots, and `check:v36-gate9` | closed | Local and staging-testnet list/bid/ask/cancel/accept/settle/repair/history flows are rehearsed. |
6565
| Promotion readiness | Gate 10 | `.bitcode/v36-promotion-readiness-report.json`, promotion workflow, generated proof support, and `check:v36-gate10` | draft-required | V36 can promote only after all Exchange gates pass and generated canon remains source-safe. |
6666

6767
## V36 implementation checklist
@@ -185,6 +185,17 @@ No `_legacy/` source is active source truth.
185185
| Telemetry binding is source-safe | `source-safe-exchange-ux-proof-metadata`; Exchange telemetry dashboards remain source-safe and proof-rooted | closed |
186186
| Workflow, package, and UI tests are wired | `packages/protocol/test/v36-exchange-ux-proof.test.js`, `uapi/tests/exchangePageClient.test.tsx`, `uapi/tests/exchangeTerminalHandoff.test.ts`, `scripts/check-v36-gate8-exchange-ux-proof.mjs`, `.github/workflows/bitcode-gate-quality.yml` | closed |
187187

188+
## Gate 9 Parity
189+
190+
| Requirement | Source evidence | Current V36 judgment |
191+
| --- | --- | --- |
192+
| `ExchangeRehearsal` is package-owned | `packages/protocol/src/canonical/exchange-rehearsal.js`, `packages/protocol/src/index.js`, `packages/protocol/src/index.d.ts` | closed |
193+
| Generated Exchange rehearsal artifact exists | `.bitcode/v36-exchange-rehearsal.json`, `scripts/generate-v36-exchange-rehearsal.mjs`, `pnpm run check:v36-exchange-rehearsal` | closed |
194+
| Local and staging-testnet flows are complete | local and staging-testnet rehearsals exercise list, bid, ask, cancel, accept, settle, repair, and history flows | closed |
195+
| Rehearsal evidence is source-safe | rehearsal logs/screenshots are source-safe through redacted screenshot/log roots and `source-safe-exchange-rehearsal-metadata` | closed |
196+
| Ledger/database synchronization is visible | ledger/database synchronization and value-bearing mainnet blocking are visible through sync checks, projection roots, and blocked mainnet row posture | closed |
197+
| Workflow and package tests are wired | `packages/protocol/test/v36-exchange-rehearsal.test.js`, `scripts/check-v36-gate9-exchange-rehearsal.mjs`, `.github/workflows/bitcode-gate-quality.yml`, `.github/workflows/bitcode-canon-quality.yml` | closed |
198+
188199
## V36 accepted boundaries
189200

190201
- V36 owns deeper Exchange.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ Terminal can hand off to Exchange without losing transaction context.
6363
collapsed UI gives readable status and expanded UI exposes source-safe detail.
6464
Exchange telemetry dashboards remain source-safe and proof-rooted.
6565
The source-safe verdict is `source-safe-exchange-ux-proof-metadata`.
66+
V36 Gate 9 anchors Exchange rehearsal through package-owned
67+
`ExchangeRehearsal` and the source-safe generated artifact
68+
`.bitcode/v36-exchange-rehearsal.json`.
69+
`ExchangeRehearsal` proves that local and staging-testnet rehearsals exercise list, bid, ask, cancel, accept, settle, repair, and history flows.
70+
It proves that rehearsal logs/screenshots are source-safe.
71+
It also proves that ledger/database synchronization and value-bearing mainnet blocking are visible.
72+
The source-safe verdict is `source-safe-exchange-rehearsal-metadata`.
6673
Promoted V35 closure owns telemetry and documentation depth over promoted V34:
6774
internal codebase docs, public `/docs`, telemetry taxonomy, dashboards, alert
6875
runbooks, incident response, operator escalation, documentation QA, developer

SPECIFICATIONS_ROADMAP.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Current active canonical pointer: `BITCODE_SPEC.txt` -> `V35`
66
- Current active canon: `BITCODE_SPEC_V35.md`
77
- Current draft target: `BITCODE_SPEC_V36.md`
8-
- Current working gate: V36 Gate 9 Local Staging Exchange Rehearsal And Proof Coverage, following V36 Gate 8 Exchange UX and Terminal navigation closure.
8+
- Current working gate: V36 Gate 10 Promotion Readiness, following V36 Gate 9 local/staging Exchange rehearsal closure.
99
- Latest closed version: V35 Telemetry And Documentation Depth, which promoted documentation surfaces, telemetry taxonomy, public docs, dashboards, alert runbooks, incident response, operator escalation, documentation QA, onboarding, local/staging telemetry rehearsal, and V35 promotion readiness.
1010
- Recent V35 closure anchor: V35 Gate 10 Promotion Readiness generated V35 proof support, promoted `BITCODE_SPEC.txt` to `V35`, prepared V35 active / V36 draft runtime posture, and closed telemetry/documentation-depth canon.
1111
- V34 Gate 2 closure anchor: deployment-depth now owns package-backed `DeploymentHostCapabilityCatalog` and `EnvironmentLaneContract` source, deterministic `.bitcode/v34-deployment-host-capability-catalog.json` and `.bitcode/v34-environment-lane-contracts.json`, and visible `value-bearing-mainnet` blocking through `blocked_future_canon_required`.
@@ -35,6 +35,7 @@
3535
- V36 Gate 6 closure anchor: Exchange depth now owns package-backed `ExchangeSettlementReceipt` source, deterministic `.bitcode/v36-exchange-settlement-reconciliation.json`, `source-safe-exchange-settlement-reconciliation-metadata`, payment observation, finality state, rights transfer receipt, ledger root, database projection root, object storage root, delivery state, repair id, observer jobs, repair jobs, proof roots, event ids, package tests, workflow wiring, and `check:v36-gate6`; observers and repair jobs reconcile database projections to ledger truth, and settlement finality and delivery are auditable.
3636
- V36 Gate 7 closure anchor: Exchange depth now owns package-backed `ExchangeDisputeRepairCase` and `ExchangeRevenueRoute` source, deterministic `.bitcode/v36-exchange-dispute-repair-revenue-route.json`, `source-safe-exchange-dispute-repair-revenue-route-metadata`, stale owner, cancelled order replay, underpayment, overpayment, projection drift, source leakage, delivery mismatch, depositor, reader, treasury, fee, BTC route, BTD right route, conservation proof, source-safe proof-rooted runbooks, repair commands, verification commands, escalation paths, proof roots, event ids, package tests, workflow wiring, and `check:v36-gate7`.
3737
- V36 Gate 8 closure anchor: Exchange depth now owns package-backed `ExchangeUxProof` source, deterministic `.bitcode/v36-exchange-ux-proof.json`, `source-safe-exchange-ux-proof-metadata`, market-wide master-detail, filters, order history, rights-transfer review, pricing quote, settlement state, repair state, Terminal context handoff, collapsed readable status, expanded source-safe detail, source-safe proof-rooted telemetry dashboards, route preservation tests, package tests, workflow wiring, and `check:v36-gate8`.
38+
- V36 Gate 9 closure anchor: Exchange depth now owns package-backed `ExchangeRehearsal` source, deterministic `.bitcode/v36-exchange-rehearsal.json`, `source-safe-exchange-rehearsal-metadata`, local and staging-testnet rehearsals exercise list, bid, ask, cancel, accept, settle, repair, and history flows, rehearsal logs/screenshots are source-safe, ledger/database synchronization and value-bearing mainnet blocking are visible, package tests, workflow wiring, and `check:v36-gate9`.
3839
- Purpose: concise running index of Bitcode/ENGI specification history, current work, and planned work.
3940

4041
This roadmap is not an active system specification.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@
206206
"generate:v36-exchange-ux-proof": "node scripts/generate-v36-exchange-ux-proof.mjs",
207207
"check:v36-exchange-ux-proof": "node scripts/generate-v36-exchange-ux-proof.mjs --check",
208208
"check:v36-gate8": "node scripts/check-v36-gate8-exchange-ux-proof.mjs",
209+
"generate:v36-exchange-rehearsal": "node scripts/generate-v36-exchange-rehearsal.mjs",
210+
"check:v36-exchange-rehearsal": "node scripts/generate-v36-exchange-rehearsal.mjs --check",
211+
"check:v36-gate9": "node scripts/check-v36-gate9-exchange-rehearsal.mjs",
209212
"check:spec-quality": "node scripts/run-bitcode-spec-quality.mjs --mode basic",
210213
"check:spec-quality:title": "node scripts/run-bitcode-spec-quality.mjs --mode strict-from-title",
211214
"check:spec-quality:v24": "node scripts/run-bitcode-spec-quality.mjs --mode strict-version --version V24",

0 commit comments

Comments
 (0)