Skip to content

Commit 87267ef

Browse files
Merge pull request #140 from engineeredsoftware/v39/gate-5-read-fits-finding-runtime-ranking-replay
V39 Gate 5: ReadFitsFinding Runtime Replay
2 parents 7f74ded + 08eb0d2 commit 87267ef

25 files changed

Lines changed: 2214 additions & 13 deletions

.bitcode/v39-read-fits-finding-runtime.json

Lines changed: 534 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
@@ -193,6 +193,9 @@ jobs:
193193
if [ -f scripts/check-v39-gate4-read-need-review-resynthesis.mjs ]; then
194194
node scripts/check-v39-gate4-read-need-review-resynthesis.mjs --skip-branch-check --skip-package-tests --skip-uapi-tests
195195
fi
196+
if [ -f scripts/check-v39-gate5-read-fits-finding-runtime.mjs ]; then
197+
node scripts/check-v39-gate5-read-fits-finding-runtime.mjs --skip-branch-check --skip-package-tests
198+
fi
196199
fi
197200
else
198201
echo "Unexpected BITCODE_SPEC.txt pointer: $POINTER" >&2

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ jobs:
322322
if [ -f scripts/check-v39-gate4-read-need-review-resynthesis.mjs ]; then
323323
node scripts/check-v39-gate4-read-need-review-resynthesis.mjs --skip-branch-check --skip-package-tests --skip-uapi-tests
324324
fi
325+
if [ -f scripts/check-v39-gate5-read-fits-finding-runtime.mjs ]; then
326+
node scripts/check-v39-gate5-read-fits-finding-runtime.mjs --skip-branch-check --skip-package-tests
327+
fi
325328
fi
326329
else
327330
echo "Unexpected BITCODE_SPEC.txt pointer: $POINTER" >&2

BITCODE_SPEC_V39.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ blockers; only `acceptReadNeed` may produce Finding Fits admission.
134134
Gate 5 makes `ReadFitsFindingSynthesis` search the whole available Depository for many candidate deposits.
135135
It must execute inference-derived query planning, lexical/symbolic/path/metadata/measurement/vector/provider channels, threshold ranking, verification, selected-fit provenance, replay receipts, and repair paths over the accepted Need.
136136
The active vector policy remains OpenAI `text-embedding-3-small`, 1536 dimensions, cosine similarity, and `match_deliverable_vectors` until a tested migration is specified.
137+
The implementation basis is `ReadFitsFindingRuntime`, exported from
138+
`packages/pipelines/asset-pack/src/read-fits-finding-runtime.ts`. It wraps
139+
the depository search result with `ReadFitsFindingReplayReceipt`,
140+
`ReadFitsFindingStorageRecord`, `ReadFitsFindingTelemetryReceipt`, and
141+
`ReadFitsFindingRepairPosture` projections so an accepted Need can replay the
142+
source-safe query plan, ranking root, selected-fit provenance root, embedding
143+
policy, and candidate counts without exposing protected source or unpaid
144+
AssetPack source. The generated source-safe proof artifact is
145+
`.bitcode/v39-read-fits-finding-runtime.json`, checked by
146+
`pnpm run check:v39-gate5`.
137147

138148
### Gate 6: AssetPack Preview, Quote, And Disclosure Boundary
139149

@@ -248,8 +258,8 @@ Current canonical objects and emitted artifacts: query receipts, search channel
248258
Current algorithms and derivation rules: inference-derived queries search lexical, symbolic, path, metadata, measurement, embedding/vector, and provider-specific channels before ranking.
249259
Current invariants and fail-closed conditions: no-survivor asset pack and unsupported vector policy fail closed.
250260
Current proof obligations: Selection-and-materialization, Verification-decisions, and Disclosure-boundary proofs.
251-
Current source-bearing implementation basis: `depository-search.ts`, `embedding-config.ts`, and depository-search tools.
252-
Current validating commands and parity basis: V39 Gate 7 checks and later Gate 8 handoff checks.
261+
Current source-bearing implementation basis: `depository-search.ts`, `read-fits-finding-runtime.ts`, `embedding-config.ts`, and depository-search tools.
262+
Current validating commands and parity basis: V39 Gate 5 checks, Gate 7 checks, and later Gate 8 handoff checks.
253263
Current accepted boundaries: source-safe preview before settlement, full source only after paid rights transfer.
254264

255265
### Selection and materialization

BITCODE_SPEC_V39_DELTA.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,16 @@ Closure acceptance:
145145

146146
Closure implementation:
147147

148-
- Pending Gate 5 work must define runtime search artifacts, active embedding policy checks, and many-candidate replay evidence.
148+
- Gate 5 defines package-backed `ReadFitsFindingRuntime` source,
149+
deterministic `.bitcode/v39-read-fits-finding-runtime.json`, package tests
150+
for many-fit search, blocked admission, storage projection, replay, and
151+
source-safe summaries, and protocol tests for the generated proof artifact.
152+
Runtime payloads include `ReadFitsFindingReplayReceipt`,
153+
`ReadFitsFindingStorageRecord`, `ReadFitsFindingTelemetryReceipt`, and
154+
`ReadFitsFindingRepairPosture`. The runtime binds accepted-Need admission,
155+
source-safe query plan, ranking evidence, selected-fit provenance, active
156+
embedding policy, and repair posture without exposing protected source or
157+
unpaid AssetPack source.
149158

150159
### Gate 6: AssetPack Preview, Quote, And Disclosure Boundary
151160

BITCODE_SPEC_V39_NOTES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,14 @@ without accidentally admitting Finding Fits.
211211
## Gate 5 implementation notes
212212

213213
Gate 5 closes `ReadFitsFindingSynthesis` as a runtime many-candidate search pipeline with replayable query, ranking, threshold, and selected-fit provenance receipts across lexical, symbolic, path, metadata, measurement, vector, and provider-specific channels.
214+
The package-owned runtime is `ReadFitsFindingRuntime`. It persists
215+
source-safe storage records for accepted-Need admission, query plan, search
216+
channels, candidate ranking, selected-fit provenance, fit result, telemetry,
217+
repair posture, and source-safe replay receipt. The source-safe replay receipt
218+
verifies query-plan, query, ranking, selected-fit provenance, embedding policy,
219+
and candidate-count roots so an operator can diagnose blocked or no-worthy
220+
Finding Fits runs without raw source, raw provider responses, credentials,
221+
wallet private material, settlement payloads, or unpaid AssetPack source.
214222

215223
## Gate 6 implementation notes
216224

BITCODE_SPEC_V39_PARITY_MATRIX.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ No `_legacy/` source is active source truth.
7373
| Depository supply indexing | Gate 2 | `packages/pipelines/asset-pack/src/depository-supply-index.ts`, `.bitcode/v39-depository-supply-indexing.json`, `packages/pipelines/asset-pack/src/__tests__/depository-supply-index.test.ts`, `packages/protocol/test/v39-depository-supply-indexing.test.js` | implemented | Deposited source becomes measurable, indexable, rights-aware, searchable, and repairable through source-safe `DepositorySupplyIndex` records. |
7474
| Enterprise Reading UX state machine | Gate 3 | `uapi/app/terminal/terminal-enterprise-reading-ux-state.ts`, `TerminalDepositReadWorkbench.tsx`, Conversation handoff, Terminal route query, `.bitcode/v39-enterprise-reading-ux-state.json`, focused UAPI tests, opt-in browser proof workflow | implemented | The five-step enterprise Reading UX is implemented with low-detail defaults, expandable source-safe detail, route-state handoff, rich execution stream integration, and source-safe disclosure proof. |
7575
| ReadNeed review and resynthesis | Gate 4 | `packages/pipelines/asset-pack/src/read-need-review-resynthesis.ts`, `.bitcode/v39-read-need-review-resynthesis.json`, package tests, route tests, protocol tests | implemented | Finding Fits remains blocked until a reviewed Need is accepted; rejected Needs preserve feedback and stay blocked. |
76-
| ReadFitsFinding runtime and replay | Gate 5 | `ReadFitsFindingSynthesis`, search tools, embeddings, ranking, selected-fit provenance, replay receipts | pending | Finding Fits searches the whole available Depository for many above-threshold candidates. |
76+
| ReadFitsFinding runtime and replay | Gate 5 | `packages/pipelines/asset-pack/src/read-fits-finding-runtime.ts`, `depository-search.ts`, `.bitcode/v39-read-fits-finding-runtime.json`, package tests, protocol tests | implemented | Finding Fits searches the whole available Depository for many above-threshold candidates and persists source-safe replay, storage, telemetry, and repair receipts. |
7777
| AssetPack preview and quote boundary | Gate 6 | AssetPack preview tests, quote tests, disclosure leak scans, proof roots | pending | Preview is commercially sufficient without exposing source-bearing AssetPack content. |
7878
| Settlement, BTD rights, and delivery | Gate 7 | BTC settlement receipt, BTD rights transfer, source-to-shares, ledger/database/storage, PR delivery | pending | Payment unlocks rights and delivery; repair paths are auditable. |
7979
| Operational telemetry and repair | Gate 8 | stream events, operator readback, runbook hooks, proof roots, repair commands | pending | Reading is observable and repairable end to end. |
@@ -95,7 +95,7 @@ No `_legacy/` source is active source truth.
9595
| Depository supply indexing | Deposits become measurable, embedded, indexable, rights-aware, searchable, and repairable | implemented |
9696
| Enterprise Reading UX | Terminal implements request read, review Need, request Finding Fits, review preview, buy and settle | implemented |
9797
| ReadNeed runtime | `ReadNeedComprehensionSynthesis` persists reviewable Needs, feedback, resynthesis, measurements, accepted-Need admission, and rejected-Need posture | implemented |
98-
| ReadFitsFinding runtime | `ReadFitsFindingSynthesis` searches many above-threshold deposits with replayable query, ranking, threshold, and selected-fit provenance receipts | pending |
98+
| ReadFitsFinding runtime | `ReadFitsFindingSynthesis` searches many above-threshold deposits with replayable query, ranking, threshold, and selected-fit provenance receipts | implemented |
9999
| Preview and quote | AssetPack preview is source-safe and quote is deterministic before settlement | pending |
100100
| Settlement and delivery | BTC settlement, BTD rights transfer, source-to-shares compensation, ledger/database/storage sync, and delivery are auditable | pending |
101101
| Telemetry and repair | Reading emits source-safe rich stream events and operator readback with proof roots and repair posture | pending |
@@ -165,16 +165,29 @@ No `_legacy/` source is active source truth.
165165

166166
## Later Gate Parity
167167

168-
Later V39 gates must add gate-specific parity sections when their implementation begins. Gates 1 through 4 intentionally do not claim closure for Finding Fits runtime, preview/quote, settlement/delivery, telemetry/repair, interface parity, rehearsal, or promotion readiness.
168+
Later V39 gates must add gate-specific parity sections when their implementation begins. Gates 1 through 5 intentionally do not claim closure for preview/quote, settlement/delivery, telemetry/repair, interface parity, rehearsal, or promotion readiness.
169169

170170
## accepted boundaries and reopen conditions
171171

172172
V39 Gate 1 accepts only draft-family, roadmap, workflow, branch, and documentation posture closure.
173173
V39 Gate 2 accepts only Depository supply indexing, source-safe search document, vector projection, storage readback posture, rights boundary, repair posture, and Finding Fits handoff closure.
174174
V39 Gate 3 accepts only enterprise Reading UX state, source-safe route handoff/readback, low-detail/expandable Terminal rendering, rich stream-log integration, opt-in browser proof wiring, and generated UX proof artifact closure.
175175
V39 Gate 4 accepts only ReadNeed review runtime storage projection, feedback/resynthesis lineage, accepted-Need admission, rejected-Need posture, source-safe telemetry receipts, route actions, and generated review proof artifact closure.
176+
V39 Gate 5 accepts only ReadFitsFinding runtime storage projection, many-candidate depository search, source-safe query/ranking/provenance evidence, replay receipts, repair posture, active embedding policy, and generated runtime proof artifact closure.
176177
Later gate scope is intentionally pending and must be reopened into gate-specific parity sections before implementation starts.
177178

179+
## Gate 5 Parity
180+
181+
V39 Gate 5 is implemented when `ReadFitsFindingRuntime` wraps the accepted-Need
182+
depository search with source-safe runtime, storage, telemetry, replay, and
183+
repair records. The parity source is
184+
`packages/pipelines/asset-pack/src/read-fits-finding-runtime.ts`; it must not
185+
expose protected source, raw protected prompts, raw provider responses,
186+
credentials, wallet private material, settlement private payloads, or unpaid
187+
AssetPack source. The generated proof artifact is
188+
`.bitcode/v39-read-fits-finding-runtime.json` and the gate check is
189+
`pnpm run check:v39-gate5`.
190+
178191
## completion condition
179192

180-
V39 Gate 4 is complete when `check:v39-gate4`, focused ReadNeed package and route tests, V39 draft spec-family validation, V38/V39 canon-posture drift validation, and promoted V38 spec-family validation all pass on a `v39/gate-4-*` branch.
193+
V39 Gate 5 is complete when `check:v39-gate5`, focused ReadFitsFinding package tests, V39 draft spec-family validation, V38/V39 canon-posture drift validation, and promoted V38 spec-family validation all pass on a `v39/gate-5-*` branch.

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,14 @@ PipelineExecution-compatible storage records. Finding Fits remains blocked
275275
until an accepted Need is present. Use
276276
`pnpm run generate:v39-read-need-review-resynthesis` and
277277
`pnpm run check:v39-gate4` before closing the gate.
278+
V39 Gate 5 adds the package-owned `ReadFitsFindingRuntime` and source-safe
279+
generated artifact `.bitcode/v39-read-fits-finding-runtime.json`.
280+
ReadFitsFindingSynthesis now projects accepted-Need admission, source-safe
281+
query plans, seven search channels, many-candidate ranking, selected-fit
282+
provenance, active embedding policy, replay receipts, repair posture, and
283+
telemetry receipts into PipelineExecution-compatible storage records. Use
284+
`pnpm run generate:v39-read-fits-finding-runtime` and
285+
`pnpm run check:v39-gate5` before closing the gate.
278286
V36 Gate 2 anchors market-wide activity through the package-owned
279287
`ExchangeActivityBook` and the source-safe generated artifact
280288
`.bitcode/v36-exchange-activity-book.json`, including listing, bid, ask,
@@ -437,7 +445,10 @@ For V39, Gate 1 opens `version/v39` and the gate-quality posture through
437445
artifacts and the V39 promotion workflow.
438446
V39 Gate 2 is wired through `pnpm run check:v39-gate2`; V39 Gate 3 is wired
439447
through `pnpm run check:v39-gate3` and its generated
440-
`.bitcode/v39-enterprise-reading-ux-state.json` artifact.
448+
`.bitcode/v39-enterprise-reading-ux-state.json` artifact. V39 Gate 4 is wired
449+
through `pnpm run check:v39-gate4`; V39 Gate 5 is wired through
450+
`pnpm run check:v39-gate5` and its generated
451+
`.bitcode/v39-read-fits-finding-runtime.json` artifact.
441452
V38 Gates 1 through 11 are wired through `pnpm run check:v38-gate1`,
442453
`pnpm run check:v38-gate2`, `pnpm run check:v38-gate3`,
443454
`pnpm run check:v38-gate4`, `pnpm run check:v38-gate5`,

SPECIFICATIONS_ROADMAP.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
- Current active canonical pointer: `BITCODE_SPEC.txt` -> `V38`
66
- Current active canon: `BITCODE_SPEC_V38.md`
77
- Current draft target: `BITCODE_SPEC_V39.md`.
8-
- Current working gate: V39 Gate 4 ReadNeed Review, Resynthesis, And Admission Runtime.
9-
- Next queued gate after V39 Gate 4 closure: V39 Gate 5 ReadFitsFinding Runtime, Ranking, And Replay.
8+
- Current working gate: V39 Gate 5 ReadFitsFinding Runtime, Ranking, And Replay.
9+
- Next queued gate after V39 Gate 5 closure: V39 Gate 6 AssetPack Preview, Quote, And Disclosure Boundary.
1010
- Latest closed version: V38 Inference Correctness, which promoted pipeline execution call-stack law, PTRR/Failsafe/Thricified parity, prompt and PromptPart benchmarking, source-safe inference telemetry, ReadNeedComprehensionSynthesis hardening, ReadFitsFindingSynthesis search and embeddings, AssetPack economic traceability, local/staging inference rehearsal, and V38 promotion readiness.
1111
- Recent V38 closure anchor: V38 Gate 11 Promotion Readiness generated V38 proof support, promoted `BITCODE_SPEC.txt` to `V38`, prepared V38 active / V39 draft runtime posture, and closed inference correctness canon.
1212
- 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`.
@@ -64,6 +64,7 @@
6464
- V39 Gate 2 closure anchor: Commercial Reading readiness now owns package-backed `DepositorySupplyIndex` source, deterministic `.bitcode/v39-depository-supply-indexing.json`, source-safe Depository supply records, lexical/metadata/measurement/vector search documents, active OpenAI embedding/vector projection, Supabase storage readback posture, depositor/Reader settlement boundary, repair actions, Finding Fits handoff, package tests, protocol tests, workflow wiring, and `check:v39-gate2`.
6565
- V39 Gate 3 closure anchor: Commercial Reading readiness now owns package-backed `TerminalEnterpriseReadingUxState` source, deterministic `.bitcode/v39-enterprise-reading-ux-state.json`, five-step Reading state, source-safe `readingStage` Conversation handoff and Terminal readback, low-detail defaults, expandable source-safe detail, rich execution stream integration, component/route tests, opt-in browser proof workflow wiring, and `check:v39-gate3`.
6666
- V39 Gate 4 closure anchor: Commercial Reading readiness now owns package-backed `ReadNeedReviewResynthesisRuntime` source, deterministic `.bitcode/v39-read-need-review-resynthesis.json`, Read Request persistence, synthesized Need storage, feedback/resynthesis lineage, Need measurement storage, accepted-Need admission, rejected-Need posture, source-safe telemetry receipts, route/runtime storage projection tests, workflow wiring, and `check:v39-gate4`.
67+
- V39 Gate 5 closure anchor: Commercial Reading readiness now owns package-backed `ReadFitsFindingRuntime` source, deterministic `.bitcode/v39-read-fits-finding-runtime.json`, accepted-Need-only Finding Fits admission, source-safe query plans, seven search channels, many-candidate ranking, selected-fit provenance roots, active OpenAI embedding policy, replay receipts, repair posture, package tests, protocol tests, workflow wiring, and `check:v39-gate5`.
6768
- Purpose: concise running index of Bitcode/ENGI specification history, current work, and planned work.
6869

6970
This roadmap is not an active system specification.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@
224224
"generate:v39-read-need-review-resynthesis": "node scripts/generate-v39-read-need-review-resynthesis.mjs",
225225
"check:v39-read-need-review-resynthesis": "node scripts/generate-v39-read-need-review-resynthesis.mjs --check",
226226
"check:v39-gate4": "node scripts/check-v39-gate4-read-need-review-resynthesis.mjs",
227+
"generate:v39-read-fits-finding-runtime": "node scripts/generate-v39-read-fits-finding-runtime.mjs",
228+
"check:v39-read-fits-finding-runtime": "node scripts/generate-v39-read-fits-finding-runtime.mjs --check",
229+
"check:v39-gate5": "node scripts/check-v39-gate5-read-fits-finding-runtime.mjs",
227230
"generate:v38-inference-surface-inventory": "node scripts/generate-v38-inference-surface-inventory.mjs",
228231
"check:v38-inference-surface-inventory": "node scripts/generate-v38-inference-surface-inventory.mjs --check",
229232
"check:v38-gate2": "node scripts/check-v38-gate2-inference-surface-inventory.mjs",

0 commit comments

Comments
 (0)