Skip to content

Commit ab6ca95

Browse files
wip v28
1 parent 0aff6e5 commit ab6ca95

33 files changed

Lines changed: 1908 additions & 112 deletions

BITCODE_SPEC_V28.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,18 @@ Acceptance criteria:
346346
product-critical path, including Terminal Deposit/Read components, execution
347347
history persistence, repository source selection, wallet/GitHub readiness,
348348
QA SQL, and BTD/ledger proof readback;
349+
- depository search must be a reusable AssetPack primitive, not a UI-only
350+
posture: every pipeline run stores searched asset count, query root, ranking
351+
root, selected candidate ids, rejected/blocker reasons, proof/measurement
352+
posture, embedding policy, and result state under the execution evidence
353+
tree;
354+
- vector recall for deposited AssetPack evidence uses OpenAI
355+
`text-embedding-3-small` by default with `encoding_format='float'` and
356+
`dimensions=1536`, matching Supabase `deliverable_vectors.embedding
357+
vector(1536)`, `ivfflat`, `vector_cosine_ops`, and
358+
`match_deliverable_vectors` cosine readback. Any model or dimension override
359+
creates a distinct vector space and must not mix with existing rows unless the
360+
rows are re-embedded and the matching function/schema still agree;
349361
- the Fit result must expose ranking quality, rejection reasons, proof roots,
350362
dedupe/materialization roots where available, and finality/readiness status;
351363
- AssetPack synthesis must be protocol-specified and deterministic; if source
@@ -405,9 +417,10 @@ The harness has two admissible modes:
405417
export, and stop/cleanup. This mode always produces `blocked_readiness`
406418
because it does not invoke the AssetPack pipeline.
407419
- `asset_pack_pipeline`: clones or mounts the selected repository revision,
408-
installs workspace dependencies, invokes the AssetPack pipeline entrypoint,
409-
exports evidence and telemetry artifacts, and relies on SQL readback before
410-
any commercial result is accepted.
420+
installs workspace dependencies, builds the manifest Deposit into searchable
421+
depository supply, invokes the AssetPack pipeline entrypoint, exports
422+
evidence and telemetry artifacts, and relies on SQL readback before any
423+
commercial result is accepted.
411424

412425
Read/Fit result review remains fail-closed:
413426

@@ -418,6 +431,9 @@ Read/Fit result review remains fail-closed:
418431
- `blocked_readiness` is mandatory when source materialization, model/tool
419432
credentials, telemetry persistence, BTC fee, ledger anchor, settlement,
420433
AssetPack range projection, or finality readback is unavailable.
434+
- manifest-only Deposit supply can satisfy candidate recall but cannot produce
435+
`worthy_fit` unless proof and measurement posture are explicitly visible to
436+
the pipeline input and the downstream readback queries confirm them.
421437
- secrets for wallets, GitHub, model providers, Supabase service roles, or
422438
other systems may be passed into a sandbox only by explicit allowlist or
423439
brokered network policy; routine QA artifacts must show only redacted names.
@@ -605,12 +621,12 @@ Current accepted boundaries: V28 productizes Terminal reads without redefining i
605621

606622
### Fit, recall, ranking, and verification
607623

608-
Current canonical objects and emitted artifacts: Fit review rows, recall candidates, verification decisions.
609-
Current algorithms and derivation rules: deposit-to-read fit, recall and ranking, and verification decisions are explicit before settlement.
610-
Current invariants and fail-closed conditions: no-survivor asset pack blocks range commitment.
611-
Current proof obligations: prove candidate qualities and rejection reasons.
612-
Current source-bearing implementation basis: protocol-demonstration Read/Fit witnesses and UAPI execution components.
613-
Current validating commands and parity basis: demonstration tests and UAPI route tests.
624+
Current canonical objects and emitted artifacts: Fit review rows, depository search results, recall candidates, verification decisions, selected candidate ids, query roots, ranking roots, embedding policy.
625+
Current algorithms and derivation rules: deposit-to-read fit, recall, vector/lexical source-bound ranking, proof/measurement gating, and verification decisions are explicit before settlement.
626+
Current invariants and fail-closed conditions: no-survivor asset pack blocks range commitment; broad Reads block readiness; unrelated Reads return no-worthy-fit; mock/frontier repository leakage blocks readiness; embedding model/dimension drift blocks vector recall promotion.
627+
Current proof obligations: prove candidate qualities, rejection reasons, source revision binding, proof posture, measurement posture, embedding model/dimensions/vector store, and ranking determinism.
628+
Current source-bearing implementation basis: AssetPack depository-search primitive, protocol-demonstration Read/Fit witnesses, and UAPI execution components.
629+
Current validating commands and parity basis: AssetPack depository-search tests, demonstration tests, and UAPI route tests.
614630
Current accepted boundaries: V28 does not add broad market discovery.
615631

616632
### Selection and materialization

BITCODE_V28_QA.md

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,17 @@ First-run execution boundary:
900900
901901
- A recorded Fit posture is not yet a commercial worthy Fit unless the deployed
902902
pipeline has actually executed and written its evidence.
903+
- The AssetPack pipeline must now emit depository search evidence in execution
904+
storage: `depository/search.result`, `depository/search.candidateRanking`,
905+
`depository/search.selectedCandidates`, `depository/search.embeddingPolicy`,
906+
`fit.result`, `fit.resultState`, and `fit.resultReasons`.
907+
- Depository vector recall uses `text-embedding-3-small` by default with
908+
`encoding_format='float'`, `dimensions=1536`, Supabase
909+
`deliverable_vectors.embedding vector(1536)`, `ivfflat`,
910+
`vector_cosine_ops`, and `match_deliverable_vectors` cosine similarity.
911+
A different model or dimension is a new vector space and is a blocker unless
912+
all candidate vectors and query vectors are regenerated under that same
913+
policy.
903914
- Until real pipeline execution exists, the honest positive-control result is
904915
`blocked_readiness`: Deposit, Read admission, source binding, and Fit posture
905916
are reviewable, but AssetPack range, ledger anchor, BTC fee, settlement, and
@@ -941,6 +952,10 @@ Positive-control expectation:
941952
Terminal Deposit/Read components, repository/branch/commit source selection,
942953
execution-history persistence, wallet/GitHub readiness, saved QA SQL, BTD
943954
ledger readback, and proof/finality/admission primitives.
955+
- Candidate ranking should expose query root, ranking root, searched asset
956+
count, selected candidate ids, rejected candidates, blocked candidates,
957+
semantic score, source revision score, proof score, measurement score,
958+
embedding model, embedding dimensions, vector table/RPC, and distance metric.
944959
- The Fit result must name why the selected deposited source evidence is
945960
decisive or why it is insufficient. A decorative Fit summary with no
946961
source/proof linkage is a failure.
@@ -986,9 +1001,15 @@ Manual steps:
9861001
9. Run saved query `v28_qa_terminal_06_read_fit_quality_after_read`. Before the
9871002
first deployed pipeline execution, expect `latest_fit_result_state` to be
9881003
`blocked_readiness`, not `worthy_fit`.
989-
10. Rerun `v28_qa_terminal_02_activity_after_write` and
1004+
10. If the Vercel Sandbox pipeline harness is run, save the exported
1005+
`evidence.json` and `telemetry.jsonl` summaries and verify that
1006+
`depositorySearch`, `fitResult`, `queryRoot`, `rankingRoot`, and
1007+
`selectedCandidateAssetIds` are present in the pipeline output or execution
1008+
storage summary. Also verify `embeddingPolicy.model`,
1009+
`embeddingPolicy.dimensions`, and `embeddingPolicy.vectorStore.rpc`.
1010+
11. Rerun `v28_qa_terminal_02_activity_after_write` and
9901011
`v28_qa_terminal_03_btd_ledger_after_terminal`.
991-
11. Paste screenshots, Network payload summaries, Vercel logs for the same
1012+
12. Paste screenshots, Network payload summaries, Vercel logs for the same
9921013
timestamps, and all three query outputs.
9931014
9941015
Pass criteria:
@@ -1006,7 +1027,8 @@ Pass criteria:
10061027
activity.
10071028
- Fit evidence is source-bound and quality-explained, not just a summary.
10081029
- Real `worthy_fit` or `no_worthy_fit` classification is backed by deployed
1009-
pipeline execution rows, events, logs, and result evidence.
1030+
pipeline execution rows, events, logs, depository search evidence, candidate
1031+
ranking roots, embedding policy, and result evidence.
10101032
- Settlement, finality, BTC fee, BTD range, or ledger anchor claims appear only
10111033
when query 03 shows matching projection rows; otherwise the Terminal result
10121034
labels the exact blocked-readiness state.
@@ -1019,6 +1041,10 @@ Commercial blockers:
10191041
- Negative controls produce a confident AssetPack instead of no-worthy-fit or
10201042
clarification.
10211043
- Fit search proceeds before Read review/admission.
1044+
- Pipeline output lacks `fit.resultState`, `fit.resultReasons`, query root, or
1045+
ranking root after the AssetPack pipeline entrypoint reports completion.
1046+
- Pipeline output uses an embedding model or dimensions that do not match the
1047+
stored depository vectors, or it lacks embedding policy readback.
10221048
- Terminal claims delivery, settlement, mint, anchor, or finality that SQL
10231049
readback cannot verify.
10241050
- Any staging-testnet Read/Fit row contains `frontier/*`, mock provider, or
@@ -1031,6 +1057,9 @@ Prove that the Read/Fit path can run inside the first lightweight deployment
10311057
host before QA treats a Fit result as commercially meaningful. This pass checks
10321058
the harness itself: sandbox creation, command execution, manifest binding,
10331059
artifact export, telemetry, database persistence, and cleanup.
1060+
It also checks the first commercial finding layer: manifest Deposit supply is
1061+
converted into depository search input, candidates are ranked, and the pipeline
1062+
stores query/ranking roots before any result state is reviewed.
10341063
10351064
Prerequisites:
10361065
@@ -1071,9 +1100,16 @@ BITCODE_SANDBOX_SOURCE_GIT_URL=https://github.com/engineeredsoftware/ENGI.git \
10711100
BITCODE_SANDBOX_SOURCE_BRANCH=main \
10721101
BITCODE_SANDBOX_SOURCE_COMMIT=31bbc0c5227b6b3aed5d107fd8507d35ec22970a \
10731102
BITCODE_SANDBOX_SOURCE_REVISION=31bbc0c5227b6b3aed5d107fd8507d35ec22970a \
1103+
BITCODE_SANDBOX_DEPOSIT_HAS_PROOF=1 \
1104+
BITCODE_SANDBOX_DEPOSIT_HAS_MEASUREMENT=1 \
10741105
pnpm run qa:pipeline-harness:sandbox
10751106
```
10761107
1108+
Omit `BITCODE_SANDBOX_DEPOSIT_HAS_PROOF` and
1109+
`BITCODE_SANDBOX_DEPOSIT_HAS_MEASUREMENT` when the manifest Deposit proof or
1110+
measurement posture has not been independently verified; expected result then
1111+
remains `blocked_readiness`.
1112+
10771113
If database streaming is intentionally being tested, pass only the required
10781114
keys by name:
10791115
@@ -1087,18 +1123,31 @@ After either harness run:
10871123
10881124
1. Save the command JSON summary, sandbox id, command exit codes, and artifact
10891125
presence fields.
1090-
2. Run saved query
1126+
2. Inspect exported `evidence.json` for `fitResult.resultState`,
1127+
`fitResult.resultReasons`, `depositorySearch.queryRoot`,
1128+
`depositorySearch.rankingRoot`, `depositorySearch.searchedAssetCount`, and
1129+
`depositorySearch.selectedCandidateAssetIds`. Verify
1130+
`depositorySearch.embeddingPolicy.model='text-embedding-3-small'`,
1131+
`depositorySearch.embeddingPolicy.dimensions=1536`,
1132+
`depositorySearch.embeddingPolicy.vectorStore.rpc='match_deliverable_vectors'`,
1133+
and `depositorySearch.embeddingPolicy.vectorStore.distanceMetric='cosine'`
1134+
unless the entire vector store was intentionally rebuilt under a different
1135+
matching policy.
1136+
3. Run saved query
10911137
`supabase/queries/v28_qa_terminal_07_pipeline_harness_after_fit.sql`.
1092-
3. Rerun `v28_qa_terminal_06_read_fit_quality_after_read` and
1138+
4. Rerun `v28_qa_terminal_06_read_fit_quality_after_read` and
10931139
`v28_qa_terminal_03_btd_ledger_after_terminal`.
1094-
4. Capture Vercel Sandbox dashboard/log evidence for the same timestamps.
1140+
5. Capture Vercel Sandbox dashboard/log evidence for the same timestamps.
10951141
10961142
Pass criteria:
10971143
10981144
- Host smoke returns exported evidence and telemetry artifacts and stops the
10991145
sandbox cleanly.
11001146
- The repository pipeline run either produces source-bound AssetPack pipeline
11011147
evidence or an explicit `blocked_readiness` error artifact.
1148+
- Repository pipeline evidence contains depository search result state,
1149+
candidate ranking, selected candidate ids, query root, ranking root, and
1150+
embedding policy.
11021151
- Query 07 reports `pipeline_harness_ready_for_result_review`, or reports a
11031152
precise blocker/warning that Terminal also shows as blocked-readiness.
11041153
- Query 07 shows recent pipeline runtime evidence in at least the base runtime
@@ -1117,6 +1166,7 @@ Commercial blockers:
11171166
- The harness runs but cannot export evidence artifacts before sandbox stop.
11181167
- A `worthy_fit` or `no_worthy_fit` result is claimed without query 07 runtime
11191168
evidence.
1169+
- The pipeline completed without depository search/ranking evidence.
11201170
- Provider tokens, wallet signatures, GitHub credentials, model keys, or
11211171
Supabase service-role secrets appear unredacted in command output, artifacts,
11221172
browser telemetry, or routine QA query rows.

packages/pipeline-hosts/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,17 @@ manifest and runner, executes Node, writes `evidence.json` and
2727
`blocked_readiness` because the AssetPack pipeline was not invoked.
2828

2929
`asset_pack_pipeline` clones or mounts a repository source, installs workspace
30-
dependencies, and runs the AssetPack pipeline runner in the sandbox. It still
30+
dependencies, builds a manifest depository asset from the pinned Deposit and
31+
source revision, and runs the AssetPack pipeline runner in the sandbox. It still
3132
requires SQL readback before any `worthy_fit`, settlement, range, BTC fee, or
32-
ledger finality claim is commercially admissible.
33+
ledger finality claim is commercially admissible. If the operator has already
34+
verified proof and measurement posture for the manifest Deposit, set
35+
`BITCODE_SANDBOX_DEPOSIT_HAS_PROOF=1` and
36+
`BITCODE_SANDBOX_DEPOSIT_HAS_MEASUREMENT=1`; otherwise the pipeline should
37+
return `blocked_readiness` rather than a worthy fit.
38+
The exported evidence must include the AssetPack embedding policy
39+
(`text-embedding-3-small`, `1536` dimensions, cosine
40+
`match_deliverable_vectors`) so SQL readback can detect vector-space drift.
3341

3442
## Live QA
3543

@@ -60,6 +68,8 @@ BITCODE_SANDBOX_SOURCE_GIT_URL=https://github.com/engineeredsoftware/ENGI.git \
6068
BITCODE_SANDBOX_SOURCE_BRANCH=main \
6169
BITCODE_SANDBOX_SOURCE_COMMIT=31bbc0c5227b6b3aed5d107fd8507d35ec22970a \
6270
BITCODE_SANDBOX_SOURCE_REVISION=31bbc0c5227b6b3aed5d107fd8507d35ec22970a \
71+
BITCODE_SANDBOX_DEPOSIT_HAS_PROOF=1 \
72+
BITCODE_SANDBOX_DEPOSIT_HAS_MEASUREMENT=1 \
6373
pnpm -C packages/pipeline-hosts run qa:asset-pack:sandbox
6474
```
6575

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

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,46 @@ function record(event) {
252252
});
253253
}
254254
255+
function buildManifestDepositoryAsset(manifest) {
256+
const assetId = manifest.deposit?.assetId || manifest.deposit?.id || 'manifest-deposit-reference';
257+
const source = manifest.sourceRevision || {};
258+
const repositoryFullName = source.repositoryFullName || '';
259+
const text = [
260+
'Deposited repository revision',
261+
repositoryFullName,
262+
source.branch,
263+
source.commit,
264+
'repository-revision fit-quality-receipt asset-pack-evidence proof-root reconciliation-readback',
265+
manifest.read?.prompt,
266+
].filter(Boolean).join(' ');
267+
268+
return {
269+
assetId,
270+
title: \`Deposited repository revision \${repositoryFullName || assetId}\`,
271+
summary: text,
272+
artifactKind: 'repository-revision',
273+
artifactType: 'repository/revision',
274+
repositoryFullName,
275+
sourceBranch: source.branch || null,
276+
sourceCommit: source.commit || null,
277+
contentRoot: \`sha256:\${createHash('sha256').update(text).digest('hex')}\`,
278+
contentUnits: [
279+
{
280+
unitId: \`\${assetId}:repository-revision\`,
281+
unitKind: 'repository-revision',
282+
text,
283+
},
284+
],
285+
sourceMaterialBinding: {
286+
mode: 'source-bound-repository-revision',
287+
mutableInBranch: false,
288+
materializationRoot: \`.bitcode/source-material/\${assetId}\`,
289+
},
290+
hasWalletOrAttestationProof: manifest.deposit?.hasWalletOrAttestationProof === true,
291+
hasAssetMeasurementEvidence: manifest.deposit?.hasAssetMeasurementEvidence === true,
292+
};
293+
}
294+
255295
function summarizeExecution(execution) {
256296
const summary = {
257297
root: execution.summary(),
@@ -385,8 +425,9 @@ try {
385425
},
386426
sourceRevision: manifest.sourceRevision,
387427
deposit: manifest.deposit,
428+
depositoryAssets: [buildManifestDepositoryAsset(manifest)],
388429
writtenAssetType: 'asset_pack',
389-
deliveryMechanismTemplate: 'blocked-readiness-review',
430+
deliveryMechanismTemplate: 'pull-request',
390431
harness: manifest,
391432
};
392433

packages/pipeline-hosts/src/dev/run-asset-pack-sandbox-harness.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ async function main(): Promise<void> {
6767
deposit: {
6868
id: process.env.BITCODE_SANDBOX_DEPOSIT_ID || 'manual-deposit-qa',
6969
assetId: process.env.BITCODE_SANDBOX_DEPOSIT_ASSET_ID || null,
70+
hasWalletOrAttestationProof: process.env.BITCODE_SANDBOX_DEPOSIT_HAS_PROOF === '1',
71+
hasAssetMeasurementEvidence: process.env.BITCODE_SANDBOX_DEPOSIT_HAS_MEASUREMENT === '1',
7072
},
7173
sourceRevision: {
7274
repositoryFullName,

packages/pipeline-hosts/src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export interface PipelineReadRequest {
8080
export interface PipelineDepositReference {
8181
id: string;
8282
assetId?: string | null;
83+
hasWalletOrAttestationProof?: boolean;
84+
hasAssetMeasurementEvidence?: boolean;
8385
}
8486

8587
export interface PipelineHarnessManifest {

0 commit comments

Comments
 (0)