Skip to content

Commit dd42a0d

Browse files
V48 Gate 3 (specification-only): local-testnet Supabase project setup matrix + AssetPack artifact storage contract
BITCODE_V48_QA.md's local-development auth environment section gains the concrete setup for project mwugicjpxmrtctvjghjg: dashboard checklist (schema migrations, exact redirect allow-list incl. the testnet host callback, the custom:bitcode-bitcoin provider field-by-field — JWKS intentionally empty since the app serves no jwks route, authorize URL localhost-first with the project-global flip caveat), the Vercel env matrix for the testnet.bitcode.exchange environment, the local .env.local flip block (prepared, commented, keys pending), and the finding that no code edits are needed (auth endpoints are env-driven and host-agnostic). New artifact-storage contract: raw AssetPack artifacts are ALWAYS .patch files stored in the PRIVATE asset-pack-artifacts Supabase file bucket at <user_id>/<run_id>/<option_id>.patch — owner-only RLS (foldername[1] = auth.uid, extension = 'patch'), buyers via post-settlement signed URLs only; implementation lands with the Gate 4-5 upload/delivery work. Later-gate note: depository search vectors move to Supabase Vector buckets. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 263f58b commit dd42a0d

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

BITCODE_V48_QA.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,83 @@ must reach server-to-server.
4545
never leaves the page; the panel's 8s watchdog + manual-continuation link
4646
surface exactly this).
4747

48+
### Concrete setup — project `mwugicjpxmrtctvjghjg` (created 2026-07-05)
49+
50+
Project URL `https://mwugicjpxmrtctvjghjg.supabase.co`; GoTrue callback
51+
`https://mwugicjpxmrtctvjghjg.supabase.co/auth/v1/callback`. Data API enabled.
52+
53+
**Dashboard checklist (new project):**
54+
1. Apply the repo schema: run `supabase/migrations/*` against the new project
55+
(9 files, `001_v26_production.sql` onward), then the `v48_qa_*` scripts
56+
work as on staging.
57+
2. Auth → URL Configuration: Site URL `http://localhost:3000`; Redirect URLs
58+
(exact, query-free): `http://localhost:3000/tps/supabase/callback`,
59+
`http://localhost:3001/tps/supabase/callback`,
60+
`https://testnet.bitcode.exchange/tps/supabase/callback`.
61+
3. Auth → Custom provider (`custom:bitcode-bitcoin`, manual configuration):
62+
- Display name: Bitcode Bitcoin Wallet
63+
- Authorization URL: `http://localhost:3000/tps/wallet/authorize`
64+
(browser hop — flip to `https://testnet.bitcode.exchange/tps/wallet/authorize`
65+
when QAing the hosted surface; the setting is project-global)
66+
- Token URL: `https://testnet.bitcode.exchange/api/wallet/oauth/token`
67+
- Userinfo URL: `https://testnet.bitcode.exchange/api/wallet/oauth/userinfo`
68+
- JWKS URI: leave empty — the app serves no `/.well-known/jwks.json`
69+
(oauth2 type; no id_token is issued, GoTrue uses the userinfo endpoint)
70+
- Client ID `bitcode-bitcoin-wallet`; Client Secret = the shared HMAC
71+
secret; Scopes `profile, wallet:bitcoin`; Allow users without email ON.
72+
4. Storage → Files: create bucket `asset-pack-artifacts` (PRIVATE) — the raw
73+
AssetPack artifact store; see the artifact-storage contract below.
74+
5. Database SSL enforcement: fine off for dev; enable before any production
75+
promotion of this project's pattern.
76+
77+
**Vercel env (testnet.bitcode.exchange environment):**
78+
- `NEXT_PUBLIC_SUPABASE_URL` + `SUPABASE_URL` = `https://mwugicjpxmrtctvjghjg.supabase.co`
79+
- `NEXT_PUBLIC_SUPABASE_ANON_KEY` + `SUPABASE_ANON_KEY` /
80+
`SUPABASE_PUBLISHABLE_KEY` = new project anon/publishable key
81+
- `SUPABASE_SERVICE_ROLE_KEY` (+ `SUPABASE_SECRET_KEY` where read) = new
82+
project service-role/secret key
83+
- `SUPABASE_JWT_SECRET` = new project JWT secret
84+
- `BITCODE_BITCOIN_OAUTH_CLIENT_SECRET` = the shared HMAC secret (same value
85+
as the dashboard provider Client Secret and local `.env.local`)
86+
- `BITCODE_BITCOIN_OAUTH_SUPABASE_CALLBACK_URL` =
87+
`https://mwugicjpxmrtctvjghjg.supabase.co/auth/v1/callback`
88+
- `NEXT_PUBLIC_BITCODE_BITCOIN_NETWORK` = `testnet4`
89+
- carry over the non-Supabase vars (GitHub app, provider keys) from staging.
90+
No `BITCODE_BITCOIN_OAUTH_ALLOWED_REDIRECT_ORIGINS` needed — the redirect
91+
allow-check derives from `SUPABASE_URL`/`NEXT_PUBLIC_SUPABASE_URL`.
92+
93+
**Local `.env.local`:** prepared commented block sits under the Supabase
94+
section (six values flip to the new project + callback URL); uncomment and
95+
paste keys, restart dev.
96+
97+
**Code edits:** none required for the auth flow — the wallet authorize page,
98+
authorization-code mint, token, and userinfo endpoints are host-agnostic
99+
(env-driven). JWKS is intentionally unset (no such route exists).
100+
101+
### Raw AssetPack artifact storage (decided 2026-07-05)
102+
103+
Raw AssetPack artifacts are ALWAYS `.patch` files (an AssetPack is a measured
104+
patch) and are stored in Supabase Storage FILE buckets, not in database rows:
105+
106+
- Bucket `asset-pack-artifacts`, PRIVATE. Object path law:
107+
`<user_id>/<run_id>/<option_id>.patch` — owner id first segment so RLS
108+
stays trivial.
109+
- RLS: owner-only insert/select via
110+
`(storage.foldername(name))[1] = auth.uid()::text` AND
111+
`storage.extension(name) = 'patch'`; buyers get time-limited signed URLs
112+
minted server-side (service role) only after settlement — the source-safety
113+
law (withheld until BTC finality + BTD rights transfer) is enforced by the
114+
bucket being private, never by obscurity.
115+
- Bucket-level upload restrictions: allowed content type `text/x-patch` /
116+
`text/plain`; conservative max object size.
117+
- Implementation lands with the upload/delivery work in Gates 4-5 (the read
118+
Finish→upload step and /packs deliveries write to and read from this
119+
bucket).
120+
121+
Subsequent-gate note: depository VECTORS (search embeddings) move to Supabase
122+
**Vector buckets** (S3-backed similarity indexes) in a later V48 gate — the
123+
current pgvector/document-root posture stays until that gate opens.
124+
48125
## Testnet BTC resources
49126

50127
- Faucet (testnet4): https://coinfaucet.eu/en/btc-testnet4/

0 commit comments

Comments
 (0)