Skip to content

Commit 44cedbb

Browse files
Merge pull request #12 from engineeredsoftware/v28/gate-7-reading-pipeline-coverage
Gate 7 reading pipeline coverage criteria
2 parents 8179229 + 2f80ea9 commit 44cedbb

69 files changed

Lines changed: 3278 additions & 317 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BITCODE_SPEC_V28.md

Lines changed: 301 additions & 67 deletions
Large diffs are not rendered by default.

BITCODE_SPEC_V28_NOTES.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The active QA scenario is therefore single-deposit:
9999

100100
- data-space: the latest deposited repository revision row, currently exercised
101101
with the `engineeredsoftware/ENGI` fixture, with repository, branch, commit,
102-
signer, wallet authorization, and asset candidate evidence;
102+
signer, wallet authorization, and asset fit deposit evidence;
103103
- Read: determine whether the deposited repository contains a complete
104104
Terminal-backed path from wallet/GitHub readiness through Deposit, Read/Fit,
105105
AssetPack evidence, proof/finality readback, and Supabase/ledger
@@ -148,7 +148,7 @@ The runner must also terminate itself before caller timeout by emitting a
148148
`PipelineHarnessTimeoutError` blocked-readiness artifact with the last
149149
execution and stream events.
150150

151-
The minimum commercial telemetry record for a Read/Fit pipeline execution is:
151+
The minimum commercial telemetry record for a Read/Fit pipeline run is:
152152

153153
- one run row in `pipeline_runs` or `deliverable_pipeline_runs`;
154154
- event rows in `execution_events`, `stream_logs`, or
@@ -161,7 +161,7 @@ The minimum commercial telemetry record for a Read/Fit pipeline execution is:
161161
generation context;
162162
- tool rows in `deliverable_pipeline_tool_executions`, including input, output,
163163
error, timing, phase, and agent context;
164-
- fit/depository output carrying `depositorySearch`, candidate ranking,
164+
- fit/depository output carrying `depositorySearch`, fit deposit ranking,
165165
`fitResult`, `queryRoot`, `rankingRoot`, selected candidate asset ids, and the
166166
embedding policy.
167167

@@ -512,6 +512,18 @@ The minimum useful V28 gate plan is Protocol/Terminal-MVP-first:
512512
7. **Gate 7: Terminal Operations And Testnet Readiness**
513513
- Regtest/signet harness, telemetry sinks, alert panels, upgrade readiness, and rollback posture become Terminal-operated.
514514
- Taproot/PSBT/BTC remains the V28 crypto lane; BSC/opBNB/Binance/BitVM bridge work is future bridge/distribution readiness unless proof-bound artifacts exist.
515+
- Terminal operational health now reads from package BTD primitives through
516+
`terminal-operational-health.ts`, then renders lane approval, telemetry,
517+
upgrade, generated type refresh, VCS, settlement-network, and synthetic
518+
testnet mint/reconciliation state in Terminal.
519+
- Reading pipeline test coverage becomes a gate contract: Read-Need,
520+
Finding Fits, depository search, embedding/vector search, sandbox harness,
521+
route preflight, Terminal stream adaptation, and demonstration local
522+
fit-finding suites must pass together.
523+
- Valid mocks must carry the same typed phase/agent/tool/PTRR/ThricifiedGeneration,
524+
prompt/context, parsed-output, usage/timing, and fail-closed envelopes as
525+
live Reading pipeline telemetry. Placeholder mocks are not acceptance
526+
evidence.
515527

516528
8. **Gate 8: V28 Promotion Proof**
517529
- SPEC, DELTA, NOTES, PARITY, and PROVEN exist.

BITCODE_SPEC_V28_PARITY_MATRIX.md

Lines changed: 38 additions & 14 deletions
Large diffs are not rendered by default.

BITCODE_V28_QA.md

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ Automated verification after this implementation pass:
549549
- `pnpm -C uapi run test:e2e:commercial-mvp`: 50 passed after Conversations streaming, Conversations exit, and Terminal transaction-search stabilization.
550550
- `npm --prefix protocol-demonstration run test:integration`: 58 passed after standalone demonstration/package-boundary cleanup.
551551
- `npm --prefix protocol-demonstration run test:v27-crypto`: 9 passed after standalone demonstration/package-boundary cleanup.
552-
- `npm --prefix protocol-demonstration run test:v28-mvp-qa`: 13 passed after adding the boundary-separation and local Need-Fit witness checks.
552+
- `npm --prefix protocol-demonstration run test:v28-mvp-qa`: 13 passed after adding the boundary-separation and local Finding Fits witness checks.
553553
- `pnpm -C uapi exec jest --runInBand tests/demonstrationWitnessMount.test.tsx tests/demonstrationWitnessScopedStylesRoute.test.ts tests/terminalPreservedShellSurface.test.tsx tests/terminalShellBridge.test.tsx tests/marketingLandingPage.test.tsx tests/api/readReviewProtocolParity.test.ts tests/api/bitcodeAppContextOptions.test.ts tests/protocolCommercialBoundary.test.ts`: 18 passed after the formal protocol package split.
554554
- `node --test --test-force-exit protocol-demonstration/test/v28-boundary-separation.test.js`: 2 passed after the formal package split.
555555
- `pnpm -C packages/protocol test`: 2 passed after the formal package split and protocol runtime-source deployment fix.
@@ -1024,9 +1024,9 @@ Manual steps:
10241024
5. Record the measured Read. Capture the `/api/executions/history` request and
10251025
response; expected status is `201`, and the page must remain in the Read
10261026
chain with a `measured` next-state message.
1027-
6. Admit the measured Read for fit search. Capture the `/api/executions/history`
1027+
6. Admit the measured Read for Finding Fits. Capture the `/api/executions/history`
10281028
request and response; expected status is `201` with
1029-
`fitSearchAdmission.admitted=true`.
1029+
`findingFitsAdmission.admitted=true`.
10301030
7. Record Fit result posture. Capture the `/api/executions/history` request and
10311031
response; expected status is `201`.
10321032
8. If a branch, AssetPack, BTC fee, ledger anchor, or settlement control becomes
@@ -1093,7 +1093,7 @@ Blockers:
10931093
reasons, or explicit blocker.
10941094
- Negative controls produce a confident AssetPack instead of no-worthy-fit or
10951095
clarification.
1096-
- Fit search proceeds before Read review/admission.
1096+
- Finding Fits proceeds before Read review/admission.
10971097
- Pipeline output lacks `fit.resultState`, `fit.resultReasons`, query root, or
10981098
ranking root after the AssetPack pipeline entrypoint reports completion.
10991099
- Pipeline output uses an embedding model or dimensions that do not match the
@@ -1325,7 +1325,7 @@ Pass criteria:
13251325
- For the staging-testnet pass, generation rows must be non-zero
13261326
because `BITCODE_ASSET_PACK_REAL_INFERENCE=1` is required. A completed run
13271327
with zero generation rows is only deterministic bring-up evidence.
1328-
- Parsed/cast generation output is stored when a ThriceifiedGeneration parser
1328+
- Parsed/cast generation output is stored when a ThricifiedGeneration parser
13291329
runs, so operators can compare raw model text with typed Fit/search evidence.
13301330
- Query 03 still shows no AssetPack range, BTC fee, ledger anchor, settlement,
13311331
or finality claim without matching projection rows.
@@ -1357,8 +1357,8 @@ a synchronous route, raw-prompt Read, or source-leaking preview model.
13571357
13581358
| Gate | Scope | Acceptance boundary |
13591359
| --- | --- | --- |
1360-
| Need synthesis review | Split "What is the need?" from Fit search. The Read request enters a Need pipeline, producing requirements, closure criteria, failure modes, target artifact kinds, proof expectations, pricing measurement inputs, and a Need measurement root. | User can accept the Need or request resynthesis with feedback. No Fit search, source preview, BTC fee, or BTD settlement is allowed before Need acceptance. The accepted Need id, feedback history, telemetry, and measurement root become the only valid input to Fit search. |
1361-
| Need-Fit search and synthesis | Input is the accepted Read-Need, not raw prompt text. The AssetPack synthesis pipeline searches deposited supply, ranks candidates, measures Fit against the Need, and synthesizes the candidate AssetPack. | Result is `worthy_fit`, `no_worthy_fit`, or `blocked_readiness` with query root, ranking root, selected ids, proof/measurement posture, embedding policy, model/tool telemetry, and a source-safe candidate AssetPack id. |
1360+
| Need synthesis review | Split "What is the need?" from Finding Fits. The Read request enters a Need pipeline, producing requirements, closure criteria, failure modes, target artifact kinds, proof expectations, pricing measurement inputs, and a Need measurement root. | User can accept the Need or request resynthesis with feedback. No Finding Fits, source preview, BTC fee, or BTD settlement is allowed before Need acceptance. The accepted Need id, feedback history, telemetry, and measurement root become the only valid input to Finding Fits. |
1361+
| ReadFindingFitsSynthesis | Input is the accepted Read-Need, not raw prompt text. The AssetPack synthesis pipeline searches deposited supply, ranks candidates, measures Fit against the Need, and synthesizes the candidate AssetPack. | Result is `worthy_fit`, `no_worthy_fit`, or `blocked_readiness` with query root, ranking root, selected ids, proof/measurement posture, embedding policy, model/tool telemetry, and a source-safe candidate AssetPack id. |
13621362
| Source-safe preview | Show enough proof to decide whether to pay without leaking source. | Preview may show Need/Fit measurements, score bands, roots, candidate ids, proof posture, ownership boundary, settlement boundary, and BTC quote. It must not expose protected AssetPack source before settlement. |
13631363
| Settle and unlock | Deterministic Share-to-Fee and BTD settlement. | Price is derived from `sum(measurement_weight * measurement_volume * admitted_fit_quality)` and the staging fee schedule. Reader pays BTC fee, BTD range/ownership/license/journal/anchor rows are written and read back, then full AssetPack source/right surface is unlocked. |
13641364
| Full-profile async pipeline | Run the full PTRR profile for long-running audits. | Vercel Sandbox execution may run for dozens of minutes and must push completion artifacts to a server-side stream/socket handler or durable queue; the push is run-id correlated, authenticated, idempotent, and durable before sandbox stop. Terminal can reattach and read final state without the starter route waiting. |
@@ -1370,16 +1370,16 @@ a synchronous route, raw-prompt Read, or source-leaking preview model.
13701370
failure modes, target artifact kinds, source constraints, proof
13711371
expectations, pricing measurement inputs, review state, and feedback
13721372
history.
1373-
- Strict Need-Fit search blocks before depository candidate recall unless an
1373+
- Strict Need-Finding Fits blocks before depository Finding Fits discovery unless an
13741374
accepted Need is present. The blocked state is explicit
13751375
`blocked_readiness` with `accepted_read_need_missing`.
13761376
- The depository search path consumes accepted Need source constraints and
1377-
measurement roots as the Fit search input, rather than raw prompt text, when
1377+
measurement roots as the Finding Fits input, rather than raw prompt text, when
13781378
`acceptedReadNeed` is supplied.
13791379
- The Vercel Sandbox harness now lists Need stages in the manifest and
13801380
synthesizes plus accepts a Need before invoking the existing source-bound
13811381
AssetPack pipeline. This preserves the current proven staging-testnet path
1382-
while Terminal is split into user-visible Need review and Need-Fit execution
1382+
while Terminal is split into user-visible Need review and ReadFindingFitsSynthesis
13831383
steps.
13841384
- `buildShareToFeePreview` provides the initial source-safe quote shape from
13851385
accepted Need measurement vector and admitted Fit quality:
@@ -1388,7 +1388,7 @@ a synchronous route, raw-prompt Read, or source-leaking preview model.
13881388
`resynthesize_read_need`, and `accept_read_need` actions. The synthesis
13891389
response includes prompt input, interpolated source context, parsed Need,
13901390
measurement root, review state, feedback, and telemetry; the acceptance
1391-
response returns the only admissible `acceptedReadNeed` for Need-Fit search.
1391+
response returns the only admissible `acceptedReadNeed` for Need-Finding Fits.
13921392
- Terminal live harness requests now include `acceptedReadNeed` and
13931393
`requireAcceptedReadNeed=true`. The live fit button remains blocked until a
13941394
typed accepted Need is present, even when Deposit and admitted-Read activity
@@ -1450,7 +1450,7 @@ Later staging-testnet evidence on 2026-05-17 after the no-overlay deployment:
14501450
`engineeredsoftware/ENGI@main:ee1481634c985afbc349f8d8b837cd1c43a254ac`
14511451
reached real model-backed setup execution. Umbrella pipeline run
14521452
`44a05fd7-f337-42cf-ad3c-d4a607d54a2b` and deliverable pipeline run
1453-
`b1b04a2d-0376-4200-b08c-7936076f2566` failed before candidate recall or
1453+
`b1b04a2d-0376-4200-b08c-7936076f2566` failed before Finding Fits discovery or
14541454
AssetPack synthesis.
14551455
- Database readback showed real execution progress: 2 setup phase delegation
14561456
rows, 16 agent-step rows, 72 model-generation rows, 1634 deliverable pipeline
@@ -1521,7 +1521,7 @@ manifest-bound Deposit evidence root fixes:
15211521
flags, with no manual `BITCODE_SANDBOX_DEPOSIT_*_ROOT` overrides. The harness
15221522
materialized manifest-bound `proofRoot`, `measurementRoot`, and
15231523
`reconciliationReadbackRoot` values before pipeline execution.
1524-
- Pipeline run `3b3339b4-5695-46fa-9ce4-2163c7eb1f11` reached candidate recall,
1524+
- Pipeline run `3b3339b4-5695-46fa-9ce4-2163c7eb1f11` reached Finding Fits discovery,
15251525
model-backed setup, model-backed Read comprehension, model-backed synthesis,
15261526
`pipeline-complete`, and `ledger-settlement-readback`.
15271527
- The pipeline selected the proof-bearing candidate `manual-deposit-qa`,
@@ -1743,6 +1743,47 @@ manifest-bound Deposit evidence root fixes:
17431743
overlay evidence exists in the harness input, manifest, execution context, or
17441744
`BITCODE_PIPELINE_SOURCE_OVERLAY_APPLIED=1`.
17451745
1746+
2026-05-19 local validation refresh for the same Gate 7 evidence:
1747+
1748+
- Root `.env.local` remains the local staging-testnet source for local
1749+
application deployment and points REST and DB readback at project
1750+
`tkpyosihuouusyaxtbau`. The OpenAI generation lane is pinned to
1751+
`gpt-4.1-mini`, and the embedding lane is pinned to
1752+
`text-embedding-3-small` with 1536 dimensions.
1753+
- Direct OpenAI validation succeeded for both chat generation and embeddings.
1754+
The embedding response returned a 1536-dimensional vector for the configured
1755+
AssetPack depository policy.
1756+
- Live local `/api/read-review` `synthesize_read_need` completed through the
1757+
`ReadNeedComprehensionSynthesis` route using real OpenAI inference. The
1758+
response carried `thricified-generation` mode, `success` status, provider
1759+
`openai`, model `gpt-4.1-mini`, parsed reasoning, parsed judgment, parsed
1760+
structured output, a measured `ReadNeed`, and a `sha256:` measurement root.
1761+
- Local `/terminal` browser validation against `pnpm -C uapi dev:staging`
1762+
rendered all five Reading steps with no error overlay, console errors, or
1763+
page errors: `Request Read`, `Review synthesized Need`, `Request Fit`,
1764+
`Review synthesized AssetPack`, and `Buy AssetPack, settle`. The same page
1765+
rendered both pipeline names,
1766+
`ReadNeedComprehensionSynthesis` and `ReadFindingFitsSynthesis`.
1767+
- Real-model parsing now tolerates common non-contract surface variance without
1768+
weakening typed output: scalar list fields are normalized to arrays, and
1769+
nonnumeric PTRR confidence/quality labels fail closed to score `0` instead
1770+
of crashing the route. The typed `ReadNeed` and bounded structured inference
1771+
tests cover this behavior.
1772+
- `pnpm qa:v28:pipeline-readback -- --env-file .env.local --expected-host
1773+
tkpyosihuouusyaxtbau.supabase.co --lookback-hours 72` returned
1774+
`ready_for_v28_result_review` through REST readback: 11 pipeline rows, 8513
1775+
deliverable events, 123 phase delegations, 418 agent steps, 122 generations,
1776+
14 tool executions, and nonzero BTD range, BTC fee, journal, anchor,
1777+
ownership, read-license, and crypto telemetry rows.
1778+
- `pnpm qa:v28:pipeline-readback -- --env-file .env.local --expected-host
1779+
tkpyosihuouusyaxtbau.supabase.co --readback-source db --lookback-hours 72`
1780+
also returned `ready_for_v28_result_review`. The latest deliverable run is
1781+
`c38a98cf-403e-4fc7-9c9e-ba615d4af024`, status `completed`, with 695
1782+
events, 13 phase delegations, 42 agent steps, 5 generations, and 4 tools.
1783+
The remaining warning is the accepted substitution for the absent generic
1784+
`phase_executions` table because the canonical deliverable phase hierarchy is
1785+
populated.
1786+
17461787
Pass 2C prompt-to-artifact closure audit:
17471788
17481789
| Requirement | Current artifact/evidence | Gate state |
@@ -1760,7 +1801,7 @@ Pass 2C prompt-to-artifact closure audit:
17601801
| Clean deployed no-overlay run writes and rereads pipeline rows from the populated staging-testnet database. | Latest source-bound run `c38a98cf-403e-4fc7-9c9e-ba615d4af024` completed without source overlay and wrote/read back umbrella pipeline run `13bc9a38-0f94-446f-98d7-14474d13467a`, deliverable stream rows, phases, agent steps, generation rows, and structured tool rows. | closed for current gate |
17611802
| Settlement writes and rereads BTD range, BTC fee, ownership/license, journal, anchor, and crypto telemetry rows. | AssetPack `asset-pack-c38a98cf-403e-4fc7-9c9e-ba615d4af024` was settled with BTD range `[5, 6)`, 546 sat reader BTC fee prepared without server custody, confirmed ledger anchor, depositor ownership event, reader license, crypto telemetry, and four Terminal journal rows. | closed for current gate |
17621803
| Full-profile inference may run for dozens of minutes without route wait. | Scoped as a subsequent V28 gate requiring sandbox-pushed async completion to a server-side stream/socket handler or durable queue. The push must be run-id correlated, authenticated, idempotent, and durable before sandbox stop. | intentionally out of current gate |
1763-
| Demonstration remains a self-contained minimal Reading witness. | `protocol-demonstration/src/local-fit-finding.js` now models Need synthesis, Need acceptance, Need-Fit ranking, source-safe preview, and deterministic BTC fee quote without importing product pipeline code. `npm --prefix protocol-demonstration run test:v28-mvp-qa` passes 13 tests. | implemented and tested |
1804+
| Demonstration remains a self-contained minimal Reading witness. | `protocol-demonstration/src/local-fit-finding.js` now models Need synthesis, Need acceptance, Finding Fits ranking, source-safe preview, and deterministic BTC fee quote without importing product pipeline code. `npm --prefix protocol-demonstration run test:v28-mvp-qa` passes 13 tests. | implemented and tested |
17641805
17651806
## 2026-05-13 Staging Deployment Readiness Gate
17661807

packages/btd/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ This package owns:
1111
- contributor allocation, access evaluation, ancestry review, and revenue routing
1212
- wallet-signed BTC fee receipts, ledger anchors, Exchange rights transfers,
1313
Terminal journals, reconciliation, telemetry, and upgrade receipts
14+
- Terminal operational health reads that compose deployment lanes, telemetry,
15+
upgrade posture, provider readiness, settlement-network posture, synthetic
16+
testnet minting, journal rows, ledger anchors, and reconciliation state
1417

1518
`$BTD` is not a fungible fee token. BTC pays fees. `$BTD` represents a
1619
non-fungible AssetPack share/read-right and the measured Bitcode amount in
@@ -34,3 +37,10 @@ import {
3437
readBtdHoldings,
3538
} from '@bitcode/btd';
3639
```
40+
41+
Terminal should consume the operational-health subpath when it needs the
42+
client-safe read model without importing storage-backed package entry points:
43+
44+
```ts
45+
import { buildTerminalOperationalHealthRead } from '@bitcode/btd/terminal-operational-health';
46+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export const supabaseAdmin = {
2+
from: jest.fn(() => {
3+
const query = {
4+
select: jest.fn(),
5+
eq: jest.fn(),
6+
maybeSingle: jest.fn().mockResolvedValue({ data: null, error: null }),
7+
};
8+
query.select.mockImplementation(() => query);
9+
query.eq.mockImplementation(() => query);
10+
return query;
11+
}),
12+
};

0 commit comments

Comments
 (0)