Skip to content

Commit 8ef218b

Browse files
wip v28
1 parent 896a590 commit 8ef218b

16 files changed

Lines changed: 613 additions & 112 deletions

File tree

BITCODE_SPEC_V28.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,9 @@ Acceptance criteria:
318318
- access policy id/hash is shown before mint or licensed-read commitment.
319319
- ledgerized synthesis uses protocol-specified models and configuration; Terminal must not expose user-driven model selection for Fit, AssetPack, measurement, measuremint, proof, journal, or settlement behavior.
320320

321-
#### Single-deposit commercial Reading QA
321+
#### Single-deposit Reading QA
322322

323-
The first commercially meaningful V28 Read/Fit QA scenario runs against the
323+
The first value-producing V28 Read/Fit QA scenario runs against the
324324
smallest real Bitcode data-space: one deposited repository revision.
325325
The current staging fixture happens to use `engineeredsoftware/ENGI`, but
326326
Terminal implementation must remain repository-, owner-, branch-, and
@@ -351,6 +351,12 @@ Acceptance criteria:
351351
root, selected candidate ids, rejected/blocker reasons, proof/measurement
352352
posture, embedding policy, and result state under the execution evidence
353353
tree;
354+
- Fit evidence must include a compact selection trace for operator review:
355+
selected, blocked, and ranked candidates; source binding; use tier; score
356+
channels; selected unit hashes; proof/measurement evidence; provider recall;
357+
blockers; warnings; and rejection reasons. The full depository search result
358+
can retain candidate payloads, but the Fit result must expose this bounded
359+
trace directly for Terminal, SQL, and harness summaries.
354360
- vector recall for deposited AssetPack evidence uses OpenAI
355361
`text-embedding-3-small` by default with `encoding_format='float'` and
356362
`dimensions=1536`, matching Supabase `deliverable_vectors.embedding
@@ -362,7 +368,7 @@ Acceptance criteria:
362368
dedupe/materialization roots where available, and finality/readiness status;
363369
- AssetPack synthesis must be protocol-specified and reproducibly evidenced;
364370
deterministic bring-up branches are regression scaffolds, while
365-
staging-testnet commercial QA must run model-backed PTRR inference. If source
371+
staging-testnet QA must run model-backed PTRR inference. If source
366372
materialization, settlement, BTC fee broadcast, ledger anchor, or BTD range
367373
issuance is not live, the result must state that blocker rather than imply
368374
delivery or minting;
@@ -372,6 +378,10 @@ Acceptance criteria:
372378
- SQL readback must show Deposit before Read, Read before Fit, no
373379
`frontier/*` or mock repository leakage, and no ledger/database drift for any
374380
finality that Terminal claims.
381+
- Ledger settlement evidence must carry neutral protocol fields:
382+
`settlementAdmissible`, `ownershipBoundary`, `btcFee`, and `readback`.
383+
Depositor ownership, reader fee/license posture, and server-custody state
384+
must be explicit even when settlement is blocked.
375385

376386
#### Pipeline host runtime environment for Read/Fit QA
377387

@@ -425,11 +435,11 @@ The harness has two admissible modes:
425435
installs workspace dependencies, builds the manifest Deposit into searchable
426436
depository supply, invokes the AssetPack pipeline entrypoint, exports
427437
evidence and telemetry artifacts, and relies on SQL readback before any
428-
commercial result is accepted.
438+
result is accepted.
429439

430440
If a local source overlay is used to debug the harness before deployment, the
431-
run must report `sourceOverlay.commercialAdmissibility` as
432-
`qa-only-not-source-revision-evidence` and fail closed for commercial
441+
run must report `sourceOverlay.admissibility` as
442+
`qa-only-not-source-revision-evidence` and fail closed for
433443
settlement review even when the pipeline output itself contains a worthy
434444
classification. The same implementation must exist at the deposited source
435445
revision before that result can become source-bound evidence.
@@ -443,7 +453,7 @@ Read/Fit result review remains fail-closed:
443453
- `blocked_readiness` is mandatory when source materialization, model/tool
444454
credentials, telemetry persistence, BTC fee, ledger anchor, settlement,
445455
AssetPack range projection, or finality readback is unavailable.
446-
- staging-testnet commercial Read/Fit QA must run model-backed inference.
456+
- staging-testnet Read/Fit QA must run model-backed inference.
447457
`BITCODE_ASSET_PACK_REAL_INFERENCE=1` is the deployment-level switch for the
448458
AssetPack pipeline; it forces every PTRR-capable setup, discovery, synthesis,
449459
validation, and Finish agent off deterministic bring-up branches. A run with
@@ -613,10 +623,10 @@ V28 keeps these layer boundaries:
613623
- `/terminal` plus `uapi/app/terminal`: Terminal route surface.
614624
- `uapi/app/terminal`: Terminal implementation module retained as an internal component boundary while the prior generic workspace route remains absent.
615625
- `uapi/app/btd/[assetPackId]`: AssetPack range disclosure surface.
616-
- MCP API and ChatGPT App: V28 MVP commercial interface surfaces over registry-derived policy and proof truth.
626+
- MCP API and ChatGPT App: V28 MVP interface surfaces over registry-derived policy and proof truth.
617627
- `protocol-demonstration`: minimal deterministic protocol witness. It may
618-
contain a local source-bound fit-finding loop for demonstration E2E proof, but
619-
it must not import commercial packages or be imported by commercial runtime
628+
contain a local source-bound fit-finding loop for E2E proof, but
629+
it must not import workspace packages or be imported by product runtime
620630
code.
621631

622632
## canonical domain model

BITCODE_V28_QA.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ Implemented after Pass 2, pending next manual QA confirmation:
321321
| Terminal transaction search keeps the typed value stable while URL-backed filter state updates. | Focused Terminal activity-search E2E passes; full commercial MVP E2E passes. |
322322
| Retired generic workspace route/import/runtime compatibility artifacts are absent from commercial source scans. | Source scans show no active retired route, generic workspace subtree, or retired-shell runtime names outside explicit historical spec notes and framework error patterns. |
323323
| Protocol-demonstration client-entry, public mount globals, UAPI demonstration witness mocks, and demonstration state title use demonstration vocabulary rather than retired shell vocabulary. | Runtime/API scans show no retired shell names across active demonstration entrypoints. |
324-
| Standalone demonstration is not a commercial runtime dependency. | `@bitcode/protocol` is the commercial dependency, UAPI source/tests no longer import `@bitcode/protocol-demonstration`, Terminal witness routes read `packages/protocol/public`, `protocol-demonstration` is outside `pnpm-workspace.yaml`, and bidirectional boundary tests are added. |
325-
| Embedded demonstration witness no longer overwrites the commercial `/terminal` document title. | Dual-lane Playwright smoke found `/terminal` rendering with the browser title `Bitcode Demonstration`; the protocol witness bundle now skips `document.title` updates when mounted under the commercial witness host attribute, while standalone demonstration can keep its own title. |
324+
| Standalone demonstration is not a product runtime dependency. | `@bitcode/protocol` is the product dependency, UAPI source/tests no longer import `@bitcode/protocol-demonstration`, Terminal witness routes read `packages/protocol/public`, `protocol-demonstration` is outside `pnpm-workspace.yaml`, and bidirectional boundary tests are added. |
325+
| Embedded demonstration witness no longer overwrites the `/terminal` document title. | Dual-lane Playwright smoke found `/terminal` rendering with the browser title `Bitcode Demonstration`; the protocol witness bundle now skips `document.title` updates when mounted under the product witness host attribute, while standalone demonstration can keep its own title. |
326326

327327
### 2026-05-08 Pass 3A Setup: Dual Environment Lanes
328328

@@ -890,10 +890,10 @@ V28 blockers:
890890
- GitHub access tokens or wallet signatures appear unredacted in browser-visible UI, query output intended for routine QA, or client telemetry.
891891
- A broad model selector can alter ledgerized Terminal/Fit/AssetPack synthesis.
892892
893-
### Pass 2B: Single-Deposit Commercial Read/Fit QA
893+
### Pass 2B: Single-Deposit Read/Fit QA
894894
895895
Purpose:
896-
Validate Bitcode's most commercially critical flow against the smallest real
896+
Validate Bitcode's most value-critical flow against the smallest real
897897
data-space now available in staging: a single deposited repository revision.
898898
This pass asks whether Reading can find a worthy Fit, synthesize the right
899899
AssetPack posture, and fail closed when evidence is not strong enough.
@@ -904,7 +904,7 @@ source type.
904904
905905
First-run execution boundary:
906906
907-
- A recorded Fit posture is not yet a commercial worthy Fit unless the deployed
907+
- A recorded Fit posture is not yet a worthy Fit unless the deployed
908908
pipeline has actually executed and written its evidence.
909909
- The AssetPack pipeline must now emit depository search evidence in execution
910910
storage: `depository/search.result`, `depository/search.candidateRanking`,
@@ -937,7 +937,7 @@ First-run execution boundary:
937937
`blocked_readiness`: Deposit, Read admission, source binding, and Fit posture
938938
are reviewable, but AssetPack range, ledger anchor, BTC fee, settlement, and
939939
finality readback must not be claimed.
940-
- `worthy_fit` and `no_worthy_fit` become commercially admissible only when the
940+
- `worthy_fit` and `no_worthy_fit` become admissible only when the
941941
result is derived from pipeline execution evidence rather than local posture
942942
rows alone.
943943
@@ -953,7 +953,7 @@ Starting condition:
953953
- Query `v28_qa_terminal_03_btd_ledger_after_terminal` still shows no claimed
954954
mint/anchor/finality without matching projection rows.
955955
956-
Commercial Read scenario:
956+
Read scenario:
957957
958958
Use this as the first manual Read frame, whether entered directly or selected
959959
from the closest Terminal scenario:
@@ -1029,11 +1029,15 @@ Manual steps:
10291029
`selectedCandidateAssetIds` are present in the pipeline output or execution
10301030
storage summary. Also verify `embeddingPolicy.model`,
10311031
`embeddingPolicy.dimensions`, and `embeddingPolicy.vectorStore.rpc`.
1032+
Inspect `fitResult.selectionTrace` for selected and blocked candidates,
1033+
source binding, use tier, score channels, selected unit hashes,
1034+
proof/measurement evidence, provider recall, blockers, warnings, and
1035+
rejection reasons.
10321036
11. Run saved query `v28_qa_terminal_07_pipeline_harness_after_fit`. It must
10331037
show at least one recent pipeline run or deliverable pipeline run, event
10341038
telemetry, phase trace rows, agent-step rows, and generation/tool rows
10351039
before a `worthy_fit` or `no_worthy_fit` classification can graduate from
1036-
posture into commercial result review.
1040+
posture into result review.
10371041
12. Rerun `v28_qa_terminal_02_activity_after_write` and
10381042
`v28_qa_terminal_03_btd_ledger_after_terminal`.
10391043
13. Paste screenshots, Network payload summaries, Vercel logs for the same
@@ -1053,6 +1057,9 @@ Pass criteria:
10531057
- No `frontier/*` repository or mock repository appears in staging-testnet
10541058
activity.
10551059
- Fit evidence is source-bound and quality-explained, not just a summary.
1060+
- Fit evidence includes a compact selection trace with candidate source
1061+
binding, use tier, score channels, selected unit hashes, proof/measurement
1062+
evidence, provider recall, blockers, warnings, and rejection reasons.
10561063
- Real `worthy_fit` or `no_worthy_fit` classification is backed by deployed
10571064
pipeline execution rows, events, logs, depository search evidence, candidate
10581065
ranking roots, embedding policy, and result evidence.
@@ -1066,7 +1073,7 @@ Pass criteria:
10661073
when query 03 shows matching projection rows; otherwise the Terminal result
10671074
labels the exact blocked-readiness state.
10681075
1069-
Commercial blockers:
1076+
Blockers:
10701077
10711078
- Read/Fit runs against a repository other than the deposited repository revision.
10721079
- Read/Fit produces a "fit" without source evidence, proof posture, rejection
@@ -1087,10 +1094,10 @@ Commercial blockers:
10871094
10881095
Purpose:
10891096
Prove that the Read/Fit path can run inside the first lightweight deployment
1090-
host before QA treats a Fit result as commercially meaningful. This pass checks
1097+
host before QA treats a Fit result as meaningful. This pass checks
10911098
the harness itself: sandbox creation, command execution, manifest binding,
10921099
artifact export, telemetry, database persistence, and cleanup.
1093-
It also checks the first commercial finding layer: manifest Deposit supply is
1100+
It also checks the first finding layer: manifest Deposit supply is
10941101
converted into depository search input, candidates are ranked, and the pipeline
10951102
stores query/ranking roots before any result state is reviewed.
10961103
@@ -1147,9 +1154,9 @@ Before promotion, operators may add `BITCODE_SANDBOX_APPLY_LOCAL_PATCH=1` to
11471154
overlay the current worktree on the cloned source revision. This is only for
11481155
debugging the harness and pipeline implementation before deployment. Overlay
11491156
evidence must remain QA-only, must report
1150-
`sourceOverlay.commercialAdmissibility='qa-only-not-source-revision-evidence'`,
1157+
`sourceOverlay.admissibility='qa-only-not-source-revision-evidence'`,
11511158
and must not be used for source-revision settlement, ledger finality, or a
1152-
commercial `worthy_fit` claim.
1159+
`worthy_fit` claim.
11531160
If the heavyweight pipeline exceeds the staging function window, set
11541161
`BITCODE_PIPELINE_HARNESS_MAX_RUNTIME_MS` below that window. The deployed
11551162
streaming route declares an 800 second ceiling, so staging should start with
@@ -1250,15 +1257,19 @@ Pass criteria:
12501257
blocked-readiness.
12511258
- Generation/tool rows appear before any model/tool-mediated Fit quality claim
12521259
can be accepted.
1253-
- For the staging-testnet commercial pass, generation rows must be non-zero
1260+
- For the staging-testnet pass, generation rows must be non-zero
12541261
because `BITCODE_ASSET_PACK_REAL_INFERENCE=1` is required. A completed run
12551262
with zero generation rows is only deterministic bring-up evidence.
12561263
- Parsed/cast generation output is stored when a ThriceifiedGeneration parser
12571264
runs, so operators can compare raw model text with typed Fit/search evidence.
12581265
- Query 03 still shows no AssetPack range, BTC fee, ledger anchor, settlement,
12591266
or finality claim without matching projection rows.
1267+
- If `ledgerSettlement` is present in evidence, it uses
1268+
`settlementAdmissible`, `ownershipBoundary`, `btcFee`, and `readback`.
1269+
Depositor ownership, reader fee/license posture, and server custody are
1270+
explicit even when settlement is blocked.
12601271
1261-
Commercial blockers:
1272+
Blockers:
12621273
12631274
- The harness cannot create a sandbox or authenticate with Vercel.
12641275
- The harness runs but cannot export evidence artifacts before sandbox stop.

packages/pipeline-hosts/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ manifest and runner, executes Node, writes `evidence.json` and
3030
dependencies, builds a manifest depository asset from the pinned Deposit and
3131
source revision, and runs the AssetPack pipeline runner in the sandbox. It still
3232
requires SQL readback before any `worthy_fit`, settlement, range, BTC fee, or
33-
ledger finality claim is commercially admissible. If the operator has already
33+
ledger finality claim is admissible. If the operator has already
3434
verified proof and measurement posture for the manifest Deposit, set
3535
`BITCODE_SANDBOX_DEPOSIT_HAS_PROOF=1` and
3636
`BITCODE_SANDBOX_DEPOSIT_HAS_MEASUREMENT=1`; otherwise the pipeline should
@@ -69,15 +69,15 @@ trusted command environment. For local Vercel Sandbox creation, either pull
6969
token tuple `VERCEL_TOKEN`, `VERCEL_TEAM_ID`, and `VERCEL_PROJECT_ID`. Deployed
7070
Vercel code should use automatic OIDC rather than storing a Vercel token when
7171
possible.
72-
Staging-testnet commercial Read/Fit QA must also set
72+
Staging-testnet Read/Fit QA must also set
7373
`BITCODE_ASSET_PACK_REAL_INFERENCE=1`. That single flag forces every
7474
PTRR-capable AssetPack setup, discovery, synthesis, validation, and finish
7575
agent off the deterministic bring-up path. The phase-specific
7676
`BITCODE_ASSET_PACK_*_USE_PTRR=1` flags remain available for local bisection,
7777
but they are not sufficient as a staging posture because a missed flag silently
7878
turns part of the run back into deterministic evidence.
7979
`BITCODE_LLM_PROVIDER` and `BITCODE_LLM_MODEL` may pin the generation model.
80-
When they are absent, the commercial runtime chooses OpenAI if `OPENAI_API_KEY`
80+
When they are absent, the runtime chooses OpenAI if `OPENAI_API_KEY`
8181
is the only model credential present. A provider pin is forwarded only when the
8282
matching provider credential is also forwarded; stale pins without credentials
8383
are stripped so staging does not silently require an unavailable model service.
@@ -132,7 +132,7 @@ When validating local harness changes before the pinned source revision has been
132132
promoted, add `BITCODE_SANDBOX_APPLY_LOCAL_PATCH=1`. The runner uploads
133133
`git diff --binary $BITCODE_SANDBOX_SOURCE_REVISION` as a source overlay and
134134
applies it before dependency installation. Overlay runs are QA-only: evidence records
135-
`sourceOverlay.commercialAdmissibility=qa-only-not-source-revision-evidence`,
135+
`sourceOverlay.admissibility=qa-only-not-source-revision-evidence`,
136136
and the harness must not be used as settlement or source-revision finality
137137
evidence until the same changes exist at the deposited revision.
138138

@@ -166,7 +166,7 @@ psql "$SUPABASE_DB_URL" -v ON_ERROR_STOP=1 \
166166
-f supabase/queries/v28_qa_terminal_07_pipeline_harness_after_fit.sql
167167
```
168168

169-
The harness is not commercially reviewable until this query reports pipeline
169+
The harness is not reviewable until this query reports pipeline
170170
run/event/phase/agent/generation/tool visibility rather than a blocker state.
171171

172172
Only pass secrets through `BITCODE_SANDBOX_ENV_KEYS` when the sandbox code path

packages/pipeline-hosts/src/__tests__/asset-pack-harness.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ describe('asset-pack sandbox harness plan', () => {
102102
expect(plan.sourceOverlay).toEqual({
103103
path: '.bitcode/pipeline-harness/source-overlay.patch',
104104
patchRoot: '/vercel/sandbox',
105-
commercialAdmissibility: 'qa-only-not-source-revision-evidence',
105+
admissibility: 'qa-only-not-source-revision-evidence',
106106
});
107107
expect(plan.files.map((file) => file.path)).toContain(
108108
'.bitcode/pipeline-harness/source-overlay.patch'
@@ -142,5 +142,8 @@ describe('asset-pack sandbox harness plan', () => {
142142
expect(source).toContain('artifact-streaming-enabled');
143143
expect(source).toContain('execution: execution ? summarizeExecution(execution) : null');
144144
expect(source).toContain('PipelineHarnessTimeoutError');
145+
expect(source).toContain('settlementOwnershipBoundary');
146+
expect(source).toContain('depositor owns minted BTD range');
147+
expect(source).toContain('reader pays BTC fee');
145148
});
146149
});

0 commit comments

Comments
 (0)