Skip to content

Commit cad1f6f

Browse files
wip v28
1 parent 27b5d68 commit cad1f6f

13 files changed

Lines changed: 792 additions & 91 deletions

BITCODE_SPEC_V28.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,47 @@ 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
322+
323+
The first commercially meaningful V28 Read/Fit QA scenario runs against the
324+
smallest real Bitcode data-space: one deposited repository revision.
325+
The current staging fixture happens to use `engineeredsoftware/ENGI`, but
326+
Terminal implementation must remain repository-, owner-, branch-, and
327+
commit-generic.
328+
329+
The required Read is not "does anything exist?".
330+
It is:
331+
332+
> Read the deposited repository revision and determine whether it contains
333+
> a worthy, proof-bearing path for Bitcode Terminal's wallet/GitHub readiness,
334+
> Deposit, Read/Fit, AssetPack evidence, settlement/finality readback, and
335+
> Supabase/ledger reconciliation flow. If the evidence is worthy, synthesize
336+
> the minimal AssetPack; if not, return explicit no-worthy-fit or blocked
337+
> readiness evidence.
338+
339+
Acceptance criteria:
340+
341+
- the Read cannot run until a Deposit row exists for the selected repository
342+
with repository, branch, commit, signer, and wallet authorization posture;
343+
- the Read and Fit rows must carry the same repository, branch, and commit as
344+
the deposited source revision;
345+
- candidate recall must prefer source and proof surfaces that explain the
346+
product-critical path, including Terminal Deposit/Read components, execution
347+
history persistence, repository source selection, wallet/GitHub readiness,
348+
QA SQL, and BTD/ledger proof readback;
349+
- the Fit result must expose ranking quality, rejection reasons, proof roots,
350+
dedupe/materialization roots where available, and finality/readiness status;
351+
- AssetPack synthesis must be protocol-specified and deterministic; if source
352+
materialization, settlement, BTC fee broadcast, ledger anchor, or BTD range
353+
issuance is not live, the result must state that blocker rather than imply
354+
delivery or minting;
355+
- negative controls must return no-worthy-fit or clarification, not a decorative
356+
AssetPack, when the Read is unrelated to ENGI's deposited source or too broad
357+
to measure;
358+
- SQL readback must show Deposit before Read, Read before Fit, no
359+
`frontier/*` or mock repository leakage, and no ledger/database drift for any
360+
finality that Terminal claims.
361+
321362
### Gate 4: Terminal AssetPack Range Detail
322363

323364
Purpose:

BITCODE_SPEC_V28_NOTES.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,40 @@ Terminal Deposit/Read QA now starts from a real deployed staging-testnet prerequ
8282

8383
The first Terminal prerequisite pass also exposed a profile round-trip drift: later Profile writes could preserve wallet address/provider/status while dropping `network`, `authAddress`, `paymentAddress`, `proofKind`, and `addressType` from `settings.bitcodeProfile.walletBinding`. V28 treats `user_connections` as the active provider connection record, but the profile projection must retain the same non-secret wallet metadata for UI/readiness parity. The profile contract and profile write path now preserve those fields, and `v28_qa_01b_backfill_profile_wallet_projection_from_connection` repairs existing staging rows from the active wallet connection before Terminal write QA continues.
8484

85+
## May 15 Single-Deposit Reading/Fit QA Focus
86+
87+
The first successful staging Deposit placed a live repository revision into the
88+
Bitcode data-space. That makes the next QA step commercially sharper: Reading
89+
must prove whether Bitcode can discover, rank, synthesize, and explain a worthy
90+
Fit from the only available deposited source, not from protocol-demo fixtures or
91+
broad mock state.
92+
93+
The active QA fixture currently uses ENGI because that is the deposited source
94+
available in staging. That fixture must not become a commercial Terminal
95+
special case. Product logic must remain generic across user, provider,
96+
repository, branch, commit, and deposited source.
97+
98+
The active QA scenario is therefore single-deposit:
99+
100+
- data-space: the latest deposited repository revision row, currently exercised
101+
with the `engineeredsoftware/ENGI` fixture, with repository, branch, commit,
102+
signer, wallet authorization, and asset candidate evidence;
103+
- Read: determine whether the deposited repository contains a complete
104+
Terminal-backed path from wallet/GitHub readiness through Deposit, Read/Fit,
105+
AssetPack evidence, proof/finality readback, and Supabase/ledger
106+
reconciliation;
107+
- expected positive outcome: a minimal, proof-bearing AssetPack fit that cites
108+
exact deposited source revision evidence and names any settlement/finality
109+
blockers honestly;
110+
- expected negative outcome: no-worthy-fit or clarification when the Read is
111+
unrelated to ENGI's deposited source or too broad to measure.
112+
113+
Saved query `v28_qa_terminal_06_read_fit_quality_after_read` is the QA readback
114+
for this focus. It is intentionally stricter than the generic activity query:
115+
it checks Deposit before Read, Read before Fit, repository/branch/commit
116+
alignment, frontier/mock leakage, and visibility of proof or measurement
117+
posture in the execution rows.
118+
85119
## May 15 Terminal Terminology Closure
86120

87121
V28 now retires user-facing Deposit/Depositing and Read/Reading language in favor of Deposit/Depositing and Read/Reading.

BITCODE_SPEC_V28_PARITY_MATRIX.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ It links manual screenshots, console logs, server logs, Supabase SQL checks, and
116116
| Terminal terminology parity | `BITCODE_SPEC_V28.md` terminology contract, `uapi/app/terminal/terminal-workspace-copy.ts`, `uapi/app/terminal/TerminalDepositComposer.tsx`, `uapi/app/terminal/TerminalReadScenarioPanel.tsx`, `uapi/components/base/bitcode/layout/bitcode-public-copy.ts`, Terminal/public-shell/docs tests, `supabase/migrations/20260515143000_v28_deposit_read_data_contract.sql` | closed for UI, docs, tests, API, ORM, demonstration, and data-contract carriers | Active V28 UI, docs, QA prose, OpenAPI, test-visible assertions, BTD journal kinds, ORM types, Supabase queries, and live schema use Deposit/Depositing and Read/Reading. The migration applied to staging renames range linkage to `read_id` and journal writes to `read_submission`; source audit has no exact retired Terminal-domain vocabulary outside excluded legacy/build artifacts. |
117117
| PSQL/Supabase data reality | `supabase/migrations/001_v26_production.sql`, `002_v27_btd_crypto_registry.sql`, `003_user_connections_provider_scope.sql`, `20260514173000_enable_pipeline_runs_rls.sql`, `20260514175000_enable_pipeline_runtime_rls.sql`, `20260515143000_v28_deposit_read_data_contract.sql`, `packages/orm/src/data-health/*`, `packages/orm/scripts/run-data-health.ts`, `packages/orm/scripts/check-schema-types.ts`, `supabase/DATA_HEALTH.md`, `supabase/queries/*` | data-contract naming closed; Terminal Deposit/Read write evidence pending | Staging database has all required auth/profile/connection/repository/BTD registry/journal/telemetry tables, RLS posture does not hide required user-scoped reads, generated schema types cover canonical public tables, automated data-health checks pass, and QA SQL queries match Terminal/Wallet/Externals UI state. Current baseline: migration `20260515143000` is applied locally and remotely, `btd_asset_pack_ranges` exposes `read_id`, journal kind constraints accept `read_submission`, `pnpm db:data-health:daily` passes against staging, wallet/GitHub SQL evidence is green, and the Terminal-specific saved queries gate Deposit/Read/Fit write-read parity. |
118118
| Fit-finding | `uapi/app/terminal/TerminalDepositReadWorkbench.tsx`, `TerminalReadScenarioPanel.tsx`, `terminal-deposit-read-workbench.ts`, `terminal-read-scenarios.ts`, `packages/protocol/src/canonical/*`, `protocol-demonstration/src/*` reference witness | partial | Terminal simplest Read produces or reads Fit candidates, review decision, qualities, rejection/block reasons, source roots, proof/dedupe roots, and visible readiness state without relying on demonstration runtime imports. |
119+
| Single-deposit commercial Read/Fit QA | `BITCODE_SPEC_V28.md` single-deposit commercial Reading QA, `BITCODE_V28_QA.md` Pass 2B, `supabase/queries/v28_qa_terminal_06_read_fit_quality_after_read.sql`, `uapi/tests/terminalActivityHistory.test.ts` | opened as the next critical V28 QA gate | Against the current single deposited repository revision, Terminal must prove Deposit before Read, Read before Fit, repository/branch/commit alignment, no `frontier/*` or mock leakage, worthy-fit AssetPack synthesis or explicit no-worthy-fit/blocker result, and honest settlement/finality readback. The current fixture is ENGI, but implementation must remain source-generic. |
119120
| AssetPack synthesis and deterministic pipeline configuration | `internal-docs/ASSETPACK_EXECUTION.md`, `packages/protocol/src/canonical/run-artifacts.js`, `packages/btd/src/semantic-volume.ts`, `measuremint.ts`, `range.ts`, `receipts.ts`, `replay.ts`, `uapi/app/api/btd/mint-draft/route.ts`, Terminal AssetPack components | partial with blocker | Staging Read/Fit path creates or reads AssetPack evidence, semantic volume, measuremint/range or zero-cell receipt, and access-policy hash using protocol-specified model/pipeline configuration. Any broad user model-selection UI that can affect ledgerized synthesis must be removed or scoped to non-ledgerized conversation UX. |
120121
| Ledgerized journal and ledger anchors | `packages/btd/src/terminal-journal.ts`, `ledger-anchor.ts`, `reconciliation.ts`, `uapi/app/api/btd/terminal-journal/route.ts`, `asset-pack-ledger-anchor/route.ts`, `ledger-database-reconciliation/route.ts`, `supabase/migrations/002_v27_btd_crypto_registry.sql` | partial | Terminal shows journal rows for Read/Fit/AssetPack/BTC fee/anchor/reconciliation events, ledger anchor or blocked-readiness state is explicit, and SQL evidence in `btd_terminal_journal_entries`, `btd_asset_pack_ledger_anchors`, and reconciliation repair tables matches the UI. |
121122
| BTC fee and testnet ledger path | `packages/btd/src/bitcoin-fees.ts`, `bitcoin-provider.ts`, `uapi/app/api/btd/btc-fee-transaction/route.ts`, wallet client code | partial | Testnet path prepares fee state, uses wallet-controlled signing/PSBT or named blocked-readiness receipt, records no server custody, and writes/readbacks `btc_fee_transactions` where a fee receipt is produced. |

BITCODE_V28_QA.md

Lines changed: 119 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ Deposit path:
817817
1. Hard refresh `/terminal` and wait for top chrome wallet state and Terminal sync to settle.
818818
2. In the top Terminal activity area, confirm there is no visible red or amber `Failed to fetch execution history` error. Empty activity is acceptable; a 500/error banner is not.
819819
3. In `Repository supply`, confirm `Connection posture` says GitHub is connected, `Mode` is `live connection`, and `Inventory source` is `stored protocol inventory` or `live provider inventory`.
820-
4. In the repository selector, choose `engineeredsoftware/ENGI` for the first pass unless intentionally testing another `engineeredsoftware/*` repository.
820+
4. In the repository selector, choose the repository intended for this Deposit. The current walkthrough fixture uses `engineeredsoftware/ENGI`, but the Terminal flow must not special-case that repository.
821821
5. In `Deposit-side supply`, confirm the auth/session label and inventory cards use `engineeredsoftware/*`. If any `frontier/*`, `gh_inst_bitcode_001`, or other protocol-demo repository appears in the live staging lane, stop and classify as a V28 blocker.
822822
6. In `Deposit-side supply`, use the search box only to filter connected repositories. Search must not replace live inventory with protocol demo artifacts. Select/confirm one repository card; the selected card should match the `Repository supply` selector.
823823
7. Click `Record deposit selection`. Confirm the UI reports that selected deposit-side supply was recorded.
@@ -884,6 +884,124 @@ V28 blockers:
884884
- GitHub access tokens or wallet signatures appear unredacted in browser-visible UI, query output intended for routine QA, or client telemetry.
885885
- A broad model selector can alter ledgerized Terminal/Fit/AssetPack synthesis.
886886
887+
### Pass 2B: Single-Deposit Commercial Read/Fit QA
888+
889+
Purpose:
890+
Validate Bitcode's most commercially critical flow against the smallest real
891+
data-space now available in staging: a single deposited repository revision.
892+
This pass asks whether Reading can find a worthy Fit, synthesize the right
893+
AssetPack posture, and fail closed when evidence is not strong enough.
894+
The current walkthrough fixture is `engineeredsoftware/ENGI` because that is the
895+
repository already deposited, but Terminal code and operator flow must remain
896+
fully generic across repository owner, repository, branch, commit, signer, and
897+
source type.
898+
899+
Starting condition:
900+
901+
- Pass 2A Deposit submission has succeeded.
902+
- Query `v28_qa_terminal_02_activity_after_write` shows a completed
903+
`agentic-execution:asset-pack` from `terminal-deposit-composer`.
904+
- Query `v28_qa_terminal_04_deposit_repository_alignment` shows the recent
905+
deposit activity is for the selected deposited repository, with `source_branch` and
906+
`source_commit` present, `wallet_authorization_signed='true'`, and
907+
`frontier_reference_detected=false`.
908+
- Query `v28_qa_terminal_03_btd_ledger_after_terminal` still shows no claimed
909+
mint/anchor/finality without matching projection rows.
910+
911+
Commercial Read scenario:
912+
913+
Use this as the first manual Read frame, whether entered directly or selected
914+
from the closest Terminal scenario:
915+
916+
```text
917+
Read the deposited repository revision and determine whether it contains a
918+
complete, non-mock Terminal path from Bitcoin wallet identity and GitHub source
919+
scope through Deposit, Read/Fit, AssetPack evidence, proof/finality readback,
920+
and Supabase/ledger reconciliation. If there is a worthy fit, synthesize the
921+
minimal proof-bearing AssetPack. If there is not, return explicit no-worthy-fit
922+
or blocked-readiness evidence.
923+
```
924+
925+
Positive-control expectation:
926+
927+
- Candidate recall should point at deposited source surfaces that actually
928+
explain the path, not generic product copy. Expected evidence families include
929+
Terminal Deposit/Read components, repository/branch/commit source selection,
930+
execution-history persistence, wallet/GitHub readiness, saved QA SQL, BTD
931+
ledger readback, and proof/finality/admission primitives.
932+
- The Fit result must name why the selected ENGI evidence is decisive or why it
933+
is insufficient. A decorative Fit summary with no source/proof linkage is a
934+
failure.
935+
- The result must produce one of two honest outcomes:
936+
- `worthy_fit`: a minimal AssetPack candidate with source revision, evidence
937+
roots, proof/dedupe/materialization posture, and settlement/finality state;
938+
- `no_worthy_fit` or `blocked_readiness`: explicit reasons such as source
939+
materialization unavailable, no live branch materialization, missing ledger
940+
anchor, no accepted Read review, or no settlement proof.
941+
942+
Negative controls:
943+
944+
1. Run or simulate a Read unrelated to the deposited ENGI source, such as
945+
"Find a Solana wallet settlement AssetPack." Expected: no-worthy-fit or
946+
clarification, not an ENGI AssetPack.
947+
2. Run or simulate an overly broad Read, such as "Make Bitcode better."
948+
Expected: clarification or blocked measurement, not a confident Fit.
949+
3. Run or simulate a Read that would require unavailable source material outside
950+
the deposited ENGI revision. Expected: no-worthy-fit or source-scope blocker.
951+
952+
Manual steps:
953+
954+
1. Hard refresh `/terminal`.
955+
2. Confirm the Activity area shows the successful ENGI Deposit row and no
956+
execution-history error.
957+
3. Confirm the repository selector still shows the deposited repository, the
958+
selected branch, and the selected commit from the successful Deposit.
959+
4. In the Read area, select or express the commercial Read scenario above.
960+
5. Record the Read posture. Capture the `/api/executions/history` request and
961+
response; expected status is `201`.
962+
6. Accept the Read for fit search. Capture `/api/read-review`; expected response
963+
has `fitSearchAdmission.admitted=true`. If it remains blocked, the blocker
964+
must name the Read-review requirement or measurement deficiency.
965+
7. Record Fit posture. Capture the `/api/executions/history` request and
966+
response; expected status is `201`.
967+
8. If a branch, AssetPack, BTC fee, ledger anchor, or settlement control becomes
968+
enabled, inspect the preview first. Only click it if the preview names source
969+
revision, proof/finality posture, wallet authorization, and expected database
970+
readback.
971+
9. Run saved query `v28_qa_terminal_06_read_fit_quality_after_read`.
972+
10. Rerun `v28_qa_terminal_02_activity_after_write` and
973+
`v28_qa_terminal_03_btd_ledger_after_terminal`.
974+
11. Paste screenshots, Network payload summaries, Vercel logs for the same
975+
timestamps, and all three query outputs.
976+
977+
Pass criteria:
978+
979+
- `v28_qa_terminal_06_read_fit_quality_after_read` reports
980+
`critical_read_gate_state='critical_read_fit_sequence_ready_for_result_review'`
981+
for the positive-control run.
982+
- The observed repository matches the latest deposited repository.
983+
- Branch and commit are present on Deposit, Read, and Fit activity.
984+
- Deposit precedes Read, and Read precedes Fit.
985+
- No `frontier/*` repository or mock repository appears in staging-testnet
986+
activity.
987+
- Fit evidence is source-bound and quality-explained, not just a summary.
988+
- Settlement, finality, BTC fee, BTD range, or ledger anchor claims appear only
989+
when query 03 shows matching projection rows; otherwise the Terminal result
990+
labels the exact blocked-readiness state.
991+
992+
Commercial blockers:
993+
994+
- Read/Fit runs against a repository other than the deposited repository revision.
995+
- Read/Fit produces a "fit" without source evidence, proof posture, rejection
996+
reasons, or explicit blocker.
997+
- Negative controls produce a confident AssetPack instead of no-worthy-fit or
998+
clarification.
999+
- Fit search proceeds before Read review/admission.
1000+
- Terminal claims delivery, settlement, mint, anchor, or finality that SQL
1001+
readback cannot verify.
1002+
- Any staging-testnet Read/Fit row contains `frontier/*`, mock provider, or
1003+
protocol-demo source as if it were live deposited ENGI source.
1004+
8871005
## 2026-05-13 Staging Deployment Readiness Gate
8881006
8891007
Purpose:

supabase/queries/v28_qa_terminal_01_prerequisites_wallet_github_repo.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ repo_inventory AS (
8282
SELECT
8383
r.user_id,
8484
count(*)::bigint AS github_repository_count,
85-
count(*) FILTER (WHERE r.repo_full_name = 'engineeredsoftware/ENGI')::bigint AS engi_repository_rows,
8685
max(r.updated_at) AS repository_inventory_updated_at,
8786
coalesce(
8887
jsonb_agg(
@@ -134,14 +133,16 @@ SELECT
134133
ELSE 'github_installation_token_fresh'
135134
END AS github_token_freshness,
136135
coalesce(r.github_repository_count, 0) AS github_repository_count,
137-
coalesce(r.engi_repository_rows, 0) AS engi_repository_rows,
136+
CASE
137+
WHEN coalesce(r.github_repository_count, 0) > 0 THEN 'github_repository_inventory_available'
138+
ELSE 'github_repository_inventory_missing'
139+
END AS github_repository_inventory_state,
138140
CASE
139141
WHEN p.user_id IS NULL THEN 'blocker:missing_user_profile'
140142
WHEN nullif(trim(coalesce(p.wallet_address, '')), '') IS NULL THEN 'blocker:missing_profile_wallet_binding'
141143
WHEN w.user_id IS NULL THEN 'blocker:missing_wallet_connection'
142144
WHEN g.user_id IS NULL THEN 'blocker:missing_github_connection'
143145
WHEN coalesce(r.github_repository_count, 0) = 0 THEN 'blocker:missing_vcs_repository_inventory'
144-
WHEN coalesce(r.engi_repository_rows, 0) = 0 THEN 'warning:ENGI_repo_not_in_inventory'
145146
ELSE 'ready_for_terminal_deposit_read'
146147
END AS terminal_prerequisite_state,
147148
CASE

supabase/queries/v28_qa_terminal_04_deposit_repository_alignment.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ BEGIN
3131
'private', r.repo_private,
3232
'updated_at', r.updated_at
3333
)
34-
ORDER BY (r.repo_full_name = 'engineeredsoftware/ENGI') DESC, r.repo_full_name
34+
ORDER BY r.repo_full_name
3535
) FILTER (WHERE r.repo_full_name IS NOT NULL) AS repositories
3636
FROM public.vcs_repositories r
3737
JOIN latest_user u ON u.user_id = r.user_id

0 commit comments

Comments
 (0)