Merge bugfix/avatar-e2e-sandbox-only into develop

This commit is contained in:
bchanot committed 2026-11-02 11:24:52 +01:00
commit 4eab981fe2
23 files changed
+743 -116

No files matched your search

@@ -0,0 +1,149 @@
# Audit log — `pnpm e2e:avatar` on develop reaches the sandbox only (2026-11-02)
Branch `bugfix/avatar-e2e-sandbox-only` (off develop 6287e5b). Contract
`.claude/tasks/contracts/2026-11-02-avatar-e2e-sandbox-only-0240.md`, plan
`.claude/tasks/plans/2026-11-02-avatar-e2e-sandbox-only-0215.md` (revision 3).
Every live command below was run by the orchestrator, from the bugfix worktree by
absolute path (`W=…/scratchpad/bugfix-avatar`), never through a bare `pnpm`, never
from the main checkout (which still holds the old DEV runner). Raw traces and outputs
stay in the session scratchpad (`…/scratchpad/proofs/`), not in the repository.
## Pre-flight (read-only)
- Docker: context `default`, endpoint `unix:///run/user/1000/docker.sock`, `DOCKER_HOST`
set to that same socket. No `docker context` pointing elsewhere.
- Proxy variables (`HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, `NO_PROXY`, their lower-case
forms, `NODE_USE_ENV_PROXY`, `npm_config_proxy`, `npm_config_https_proxy`,
`GLOBAL_AGENT_HTTP_PROXY`): none set in the shell; every proof below also unsets them
explicitly (`env -u …`).
- `scripts/avatar-e2e.sh` absent in `$W`; `package.json` alias = `bash scripts/db-sandbox.sh avatar-e2e`.
- Old DEV runner container `faunosteo_worker_e2e`: absent.
- DEV containers `supabase_*_faunosteo` (8), all `running`, `StartedAt` 2026-10-28T14:45:28/29Z
(recorded before; identical after every proof, see "After").
- Sandbox before: the V1-2 session's stack (db 57432, auth 57999, rest 57300, storage 57500,
mail 57025, all on 127.0.0.1, no gateway, no worker), network `faunosteo_dbsandbox_net`
(bridge, 5 containers), no Docker volume named `faunosteo_dbsandbox*`.
- Shared image `faunosteo_worker:dev` before: `sha256:b32319b9…` (V1-2 build of 2026-11-01 22:59).
- No concurrent `db-sandbox`, `vitest` or `playwright` process.
## Static criteria (contract 1-4, 8)
| # | Oracle | Result |
|---|---|---|
| 1 | runner deleted, no line invokes it (the two "removed" mentions excluded) | `DEV_RUNNER_GONE` |
| 2 | alias, `bash -n`, dispatcher line | `ALIAS_OK` |
| 3 | suite identical to V1-2 once the `noRedirectFetch` lines are dropped (owner-gated, see below); db-sandbox.sh blocks 47-52, 58-61, 255, 270-332, 342-359 verbatim; no `cmd_verify_e2e` / `cmd_sheet_assets_e2e` | `BLOCKS_IDENTICAL` |
| 4 | no `supabase status`, `54321`, `supabase_kong`, `supabase_db_faunosteo`, `supabase_network_faunosteo` in the runner or the suite | `NO_DEV_IDS` |
| 8 | `corepack pnpm -s typecheck && lint` in `$W` (after `pnpm wasm:build`, the git-ignored `packages/core-wasm/pkg` being absent in a fresh worktree) | `STATIC_GREEN` |
## Refusal proofs (strace `-f -e trace=connect,sendto,sendmsg`, child processes followed)
Positive control: the same filter on `curl http://127.0.0.1:9/` shows 1 `AF_INET` connect.
Keys in c, d, e, h, i are forged unsigned JWTs (`base64url(header).base64url(payload).x`),
never the sandbox secrets, never DEV keys. Criterion: no `AF_INET` / `AF_INET6` line unless stated.
| Case | Setup | Result | AF_INET lines |
|---|---|---|---|
| a | `bash $W/scripts/db-sandbox.sh avatar-e2e`, `FAUNOSTEO_SANDBOX_DIR` = empty dir | `db-sandbox: not running (pnpm db:sandbox up fresh)`, rc 1, no container, dir still empty | 0 |
| b | the suite (vitest binary, `vitest.e2e.config.ts`), no environment | throws `avatar e2e: run it through pnpm e2e:avatar, on the sandbox stack only`, rc 1 | 0 |
| c | `SUPABASE_URL=http://127.0.0.1:54321`, `AVATAR_E2E_DB_CONTAINER=supabase_db_faunosteo`, two keys `iss: supabase-demo` | throws (same message) | 0 |
| d | sandbox URL, keys `iss: db-sandbox`, container `supabase_db_faunosteo` | throws | 0 |
| e | sandbox URL and container, anon key whose payload is not JSON | throws | 0 |
| i | sandbox URL and container, anon `iss: db-sandbox` + service `iss: supabase-demo`, then the swap (i1, i2) | throws, both orders | 0, 0 |
| h | nothing listening on 57800 (`ss -ltn`: 0), sandbox URL and container, two forged `iss: db-sandbox` keys | the guard passes; `beforeAll` fails on `createUser: fetch failed` (the refused connect), 5 tests skipped, rc 1 | 1: `connect(127.0.0.1:57800)` |
| f | sandbox up, image present, 127.0.0.1:57800 held by `python3 -I -m http.server` | `db-sandbox: port 127.0.0.1:57800 is already in use: free it, nothing was started`, rc 1, no gateway, no worker, no `worker.*` env file | 1: the `/dev/tcp` probe `connect(127.0.0.1:57800) = 0` (the exception accepted by the owner) |
Reading of h (brief §3): the issuer check routes the run to the sandbox, it is not a signature
check and not an authentication: whoever holds 127.0.0.1:57800 receives the keys the
environment supplies. Nothing else is contacted.
## Setup and positive run
- `corepack pnpm --dir $W worker:image`: `faunosteo_worker:dev` now `sha256:d841660a…`
(develop's crates; cached build dated 2026-11-01 01:38). The V1-2 build `b32319b9…` is no
longer listed: the V1-2 session rebuilds it before its next worker run.
- `bash $W/scripts/db-sandbox.sh down` (identity checked first: 5 `faunosteo_dbsandbox_*`
containers on `faunosteo_dbsandbox_net`, no volume, no concurrent process), then
`up fresh` from the branch: develop migrations and seeds, no key in the output.
- Positive run, once, under strace, with hostile exports in the environment:
`SUPABASE_URL=http://127.0.0.1:54321`, forged `iss: supabase-demo` keys,
`AVATAR_E2E_DB_CONTAINER=supabase_db_faunosteo`, `SUPABASE_NETWORK=supabase_network_faunosteo`,
`SUPABASE_INTERNAL_URL=http://supabase_kong_faunosteo:8000`, `WORKER_IMAGE=faunosteo_worker:local`
(the old runner's knobs), proxies unset → `bash $W/scripts/db-sandbox.sh avatar-e2e`:
**5/5 passed** (15 s), rc 0, `== worker up (faunosteo_worker:dev, run, via faunosteo_dbsandbox_gateway)`.
- strace of the run: 4 `AF_INET` connects, all `127.0.0.1:57800` (1 probe `ECONNREFUSED`
before the gateway existed, 3 from the suite); 0 to `:54321` / `:54322` / a LAN address; 0 `AF_INET6`.
- Watcher during the run (filtered templates only, never a raw `docker inspect`):
`docker port faunosteo_dbsandbox_gateway 8000/tcp` = `127.0.0.1:57800`; gateway and worker
networks = `faunosteo_dbsandbox_net` only; worker `SUPABASE_URL=http://faunosteo_dbsandbox_gateway:8000`;
worker env names = `PATH SSL_CERT_FILE SUPABASE_SERVICE_ROLE_KEY SUPABASE_URL WORKER_ID
WORKER_POLL_SECONDS WORKER_QUARANTINE_GRACE_SECONDS WORKER_SWEEP_SECONDS`; image
`faunosteo_worker:dev` = `d841660a…`; user `nonroot`, read-only rootfs, `CapDrop=[ALL]`,
no published port.
- Worker log events: `worker_start` 1, `job_completed` 3, `job_rejected` 3, `child_rejected` 3,
`sweep_done` 4, `token_expires_soon` 1 (the sandbox key's lifetime); no DEV name, no key
(`eyJ` count 0 in every output).
## After
- Gateway and avatar worker removed by the EXIT trap; no `worker.*` env file left in the state dir.
- Final `bash $W/scripts/db-sandbox.sh down`: 0 `faunosteo_dbsandbox_*` container; the state
dir keeps only `rehearsal/` and `upgrade-base/` (pre-existing).
- DEV containers: same 8 `StartedAt` values as before. No HTTP request to DEV at any point
(no connect to 54321/54322 in any trace).
## What the isolation rests on (not the issuer check)
- The worker's target is fixed to `http://faunosteo_dbsandbox_gateway:8000` in a 600 env file
removed once the container started (`scripts/db-sandbox.sh` `start_worker`); the worker's
HTTP client sets `max_redirects(0)` and `proxy(None)` (`crates/worker/src/http.rs:31,33`).
- The gateway's upstreams are the sandbox containers by name; `location / { return 404; }`;
published on `127.0.0.1:57800` only, checked after start (`docker port`).
- The sandbox keys are signed with a secret DEV does not hold; the suite builds its clients on the
constant `http://127.0.0.1:57800`, never on the env URL; `psql` on the constant container.
- `scripts/dev-env.sh:23` exports `FAUNOSTEO_DEV_API_URL` into every child of db-sandbox.sh;
nothing in the runner or the suite reads it. `NET` is a plain bridge (it can route to the host):
the proofs above show nothing uses that route.
## Redirects refused (owner condition at the checkpoint, 2026-11-02)
The former residual LOW is closed on this branch: `tests/e2e/noRedirectFetch.ts` wraps the
global fetch with `redirect: 'error'` (set after the caller's init, so nothing restores
`follow`); the suite's `anonClient()` and `serviceClient()` pass it through `global.fetch`,
which supabase-js hands to its auth, REST and Storage calls (raw to auth-js, through
`fetchWithAuth` for REST and Storage; neither layer sets `redirect`, retries reuse the wrapper). No production client changes (`packages/supabase/src`, `apps/app/src`
untouched since 6287e5b). Security gate nuance that motivated it: on a cross-origin redirect
undici drops `Authorization` but keeps supabase-js's `apikey` header.
- Regression test `packages/supabase/tests/no-redirect-fetch.test.ts` (in `pnpm --filter
@faunosteo/supabase test:run`, 12 files / 131 tests green): two `node:http` servers, the
origin answers every request with 302 towards the target; REST, auth and Storage calls all
error, the target receives nothing, every origin request carries `apikey: test-key`; the
control (plain fetch, default `follow`) reaches the target at `/landed`. Negative control by
the executor: with `follow` in the wrapper, 3 of the 4 cases fail.
- Live proof j (strace, same harness as a-i): a Python 302 listener on 127.0.0.1:57800
(`Location: http://127.0.0.1:57801/landed`) and a recording target on 57801. Control:
`curl -L` lands on 57801 (1 hit). The suite with forged `iss: db-sandbox` keys: 1 connect to
127.0.0.1:57800, 0 to 57801, 0 hit on the target, `createUser: fetch failed`, 5 tests skipped,
rc 1 (fails closed).
- Positive run 2, fresh sandbox from the branch, under strace, proxies unset: **5/5**, 4
connects all to 127.0.0.1:57800, 0 key in the output, gateway and worker removed, final `down`.
DEV `StartedAt` digest identical to the pre-flight.
## Residual LOW (owner brief §3; kept as is, V1-2 first then port)
- A proxy would be honoured by Node's fetch only with `NODE_USE_ENV_PROXY=1` (unset here,
unset by every proof).
- `worker_env` is read by the EXIT trap before `start_worker` assigns it (an inherited value
would be `rm -f`'d on an early `die`).
- Every docker call follows `DOCKER_HOST` / the current context (both local here).
- `SB_SEED_PW` / rotated seed password not ported (develop's sandbox suite signs in with the
seed password); the avatar suite itself creates its two accounts with a random password.
## Hand-off
- V1-2 session: rebuild `faunosteo_worker:dev` (`pnpm worker:image` in its worktree) and run
`pnpm db:sandbox up fresh` before its next sandbox run (the develop secrets file carries no
`SB_SEED_PW`; V1-2's `load_secrets` refuses it: fails closed).
- Copies that still reach DEV through `pnpm e2e:avatar`: the main checkout
`/home/bchanot/Documents/faunosteo` (feature/v1-1-clients-animals, merged) and the worktree
`old-958228a`. Agents never run them; their fate is the owner's call.
+7
View File
@@ -102,3 +102,10 @@ Friction: JSON copy (6371523) had no in-app restore (Home picker PDF only; devto
Root cause: copy shipped without restore path (round trip never tested in app); `internal` from draft read treated as transient core failure, no memory of trapping input; guard scoped to one route; session replacement unguarded since MVP.
Solution: 9bd9aca (BDR-056). Evidence: round trip identical (3 golden reports, slot + import); fuzz 37k draft.restore 0 traps, OOM only ~50 MB drafts (5 MB worst = 0.4-0.8 GB wasm). Verifier CONFORME 10/10, security PASS 2 LOW, check:all green.
Status: resolved 2026-10-17. Residuals: GC finalizer throws "memory access out of bounds" after stack-overflow trap (console only, live instance unaffected 50/50), ≤ 3 dead instances retained (~13.5 MB typical, ~4.5 MB each) until reload; raw lone surrogate in archive text quarantines readable draft (unreachable, session.rs); copy lacks archive envelope; iOS Safari likely ignores beforeunload (dialog + copy are protection there); Retry clicked during ms-long recovery → reload screen; re-importing copy of trapping draft re-traps (spends recovery); copy near 16 MiB may OOM low-memory device; storage full + confirmed replace + reload restores replaced draft; `internal` may come from handle rebuild (Retry reopens).
## BLK-013 — e2e:avatar on develop reached DEV (keys via supabase status, worker on DEV net, purge queue drained) (2026-11-02)
- **Status**: resolved
Friction: develop `pnpm e2e:avatar` = scripts/avatar-e2e.sh could reach DEV: keys via `supabase status -o env`, worker on supabase_network_faunosteo against DEV Kong, suite wrote accounts + drained whole purge queue (`expeditePurges` unscoped), psql on supabase_db_faunosteo. Same family as sheet-assets incidents 2026-11-01.
Real cause: runner and suite knew no authorised target; URL, keys, container from env or DEV defaults.
Solution: 3a4614b ports V1-2 sandbox runner (`db-sandbox.sh avatar-e2e`: loopback gateway 127.0.0.1:57800, worker in 600 env file, constants unconditional) + guarded suite (fixed URL, container, key issuer `db-sandbox`, per-run accounts); DEV runner deleted. d3dfd03: clients refuse redirects (`noRedirectFetch`, `redirect: 'error'`). Proofs a-j strace, 2 × 5/5, log `.claude/audits/2026-11-02-avatar-e2e-sandbox-only.md`.
Status: resolved for develop path after merge. NOT fixed in old checkouts: main checkout /home/bchanot/Documents/faunosteo (feature/v1-1-clients-animals) and worktree old-958228a still hold scripts/avatar-e2e.sh + old alias; `pnpm e2e:avatar` there targets DEV. Agents never run them; owner decides their fate.
+3
View File
@@ -456,3 +456,6 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp
- Owner recette: 19 lines FR detailed, EN global + 4 at 375 px, isolation ok. RESP-01 global scroll = owner browser zoom (owner DEV measures). Real defect found on sandbox: long account e-mail widens dashboard cards (implicit grid track). Fix DashboardRoute + `e2e/shell/responsive.spec.ts` (fails on old code). LRN-094.
- AVATAR-01 = class A: DEV worker stopped, row `uploaded` waits, message by design (STORAGE §4.4). Sandbox repro with temp gateway + worker on sandbox net: clean in 1.1 s. Side finding (pre-V1-1): full reload doesn't resume the waiting row, new save supersedes it. DEV read-only only.
- Owner closure 2026-10-27: RESP-01 counter-check 6 PASS → closed; AVATAR-01 class A non-blocking, DEV worker stays off, Alice's waiting upload kept; AVATAR-02 ticket in TODO (no Gitea CLI). Pre-merge checkpoint, no merge.
## 2026-11-02
- bugfix/avatar-e2e-sandbox-only: develop e2e:avatar → sandbox only (3a4614b, e8da0d9, d3dfd03). Proofs a-j strace with forged JWTs, 2 × 5/5, DEV untouched. Verifier CONFORME 10/10, security PASS ×2. BLK-013, LRN-095, TODO RR-11. Owner authorised merge into develop; worktree kept.
+8
View File
@@ -651,3 +651,11 @@ Apply: SQL test touching a worker queue or shared bucket → neutralise or scope
Context: V1-1 DEV acceptance RESP-01. Owner saw whole-page sideways scroll everywhere at 375 px (DevTools responsive). Sandbox sweep (Chromium mobile + desktop with scrollbars shown via `ignoreDefaultArgs: ['--hide-scrollbars']`, WebKit iPhone, Firefox; 280-430 px) found none at 375; owner then measured DEV with a console snippet (cw/sw + topmost offending boxes, classes only): no overflow without zoom → browser zoom was the cause. Same sweep with long account e-mails found a real defect: dashboard `grid gap-4 md:grid-cols-2` has no explicit column below md → implicit `auto` track = cards' min-content → `truncate` e-mail never truncates, cards past screen from ~31 chars at 320 px.
Fix: `grid-cols-1` (minmax(0,1fr)) + e-mail wraps (`min-w-0 [overflow-wrap:anywhere]`). Test sweeps 320-430 + desktop with long values, proven failing on old code.
Apply: overflow report → ask how observed (zoom, preset, device type), give owner a read-only console probe for DEV, reproduce with realistic max-length values on sandbox; a grid used as a single column on phones needs `grid-cols-1`, else one unbreakable value widens every card.
## LRN-095 — Port a safe runner verbatim; prove refusals with forged JWTs + strace; one-line gates.sh oracles (2026-11-02)
Context: porting safe runner V1-2 → develop (bugfix/avatar-e2e-sandbox-only, 2026-11-02).
Pattern 1: port by verbatim block extraction (`sed -n 'a,bp'` from reference worktree, by function name), oracle = python "chunk in file" per block + forbidden names absent; keeps protections intact, later merge rule = take reference file whole, check diff empty.
Pattern 2: refusal proofs with FORGED unsigned JWTs (`base64url(header).base64url(payload).x`, iss varied), never DEV or sandbox secrets; strace `-f -e trace=connect,sendto,sendmsg` on bash/vitest binary (never via pnpm), curl positive control, one case per guard clause + mixed-issuer case; hostile DEV exports on positive run; watcher with filtered docker templates only (raw inspect leaks keys).
Pattern 3: `gates.sh` CHECK = one line; heredoc / multi-line python is NOT parsed (silent NOT-MET "wanted PY"); use `python3 -I -c '…'`. Oracle wording must match doc wording ("names it" vs "invokes it").
Pattern 4: `pkill -f <name>` kills own shell when the command line contains <name> (exit 144); use pid files or self-timed servers.
Apply: any runner port, any "no IP connection" proof, any contract oracle.
+5
View File
@@ -543,6 +543,11 @@ Inventory: `.claude/audits/2026-10-25-functional-inventory.md`. Each item: treat
- [ ] RR-7 accessibility: WCAG target to set; dialog focus trap/restore (done V1-1.3, native modal dialog), close button 24 px, canvas zones keyboard-unreachable, axe test (done V1-1.3: e2e:ui, e2e:shell), D2/D5 Context7 items (RUST.md §10.14). Pre-existing serious axe findings let through by exact node in `apps/app/e2e/support/browser.ts` KNOWN_VIOLATIONS: LanguageSwitcher label-in-name (« FR » shown, « Passer en français » announced), top bar account link label-in-name (display name shown, « Mon compte » announced), DashboardRoute `dl` with a status row lacking dt/dd. Seen outside the scanned states: ObservationCard header `nested-interactive` + label-in-name (editor with an observation); moderate: duplicate `main` landmarks (App + routes), no h1 on Home
- [ ] RR-8 mobile and end-to-end: real-browser e2e for sign-up, login, account, avatar, full editor flow, export, locale, mobile drawer (TEST_STRATEGY §1 `apps/app/e2e`); per-check device results (J1/J2 recorded as a whole)
- [ ] RR-9 release 0.2.0 fate (Steps 3–6 on TS engines, 341 commits behind develop): ship, supersede, or rebase; sheet bundle default `none`
- [ ] RR-11 sandbox-only e2e follow-ups (bugfix/avatar-e2e-sandbox-only 2026-11-02, BLK-013, LRN-095; audit `.claude/audits/2026-11-02-avatar-e2e-sandbox-only.md`):
- [ ] V1-2 → develop merge: `scripts/db-sandbox.sh` conflicts (header, function block, dispatcher, sed range) → take V1-2's file whole, `git diff <V1-2 tip> -- scripts/db-sandbox.sh` empty; keep every protection (constants unconditional, `/dev/tcp` probe, `docker port` check, 600 worker env file); V1-2 adopts `noRedirectFetch` in the avatar suite (d3dfd03); doc lines reworded on develop → keep V1-2's text; registry IDs BLK-013 / LRN-095 collide with V1-2's numbering → renumber at integration
- [ ] old checkouts still hold the DEV scripts (`scripts/avatar-e2e.sh`, old `sheet-assets-e2e.sh`): main checkout `/home/bchanot/Documents/faunosteo` (feature/v1-1-clients-animals, merged) and worktree `old-958228a`; `pnpm e2e:avatar` there targets DEV; agents never run them; owner decides (move main checkout to develop, `gitflow.sh delete`, worktree removal)
- [ ] V1-2 session: rebuild `faunosteo_worker:dev` (`pnpm worker:image`, the tag now holds develop's build d841660a) and `pnpm db:sandbox up fresh` before its next sandbox run
- [ ] residual LOW: every docker call follows `DOCKER_HOST` / context; `worker_env` read by the EXIT trap before assignment (`worker_env=` before `trap`); literal password of the two throwaway `up upgrade` accounts (db-sandbox.sh:182-184); gateway container less hardened than the worker (no `--cap-drop ALL` / `--read-only` / limits); shared container names across worktrees (a concurrent run is killed, fails closed); `NODE_USE_ENV_PROXY` proxy path (unset in every proof)
- [ ] RR-10 census tools maintenance (LOW `#[ignore]` positions) and controlled oracle evolution on a new anatomical changeset
## Phase A — DONE (kept for reference)
@@ -0,0 +1,84 @@
# CONTRACT — avatar-e2e-sandbox-only
- date: 2026-11-02 | flow: bugfix | branch: bugfix/avatar-e2e-sandbox-only (off develop 6287e5b)
- status: active
- worktree: /tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar
- reference worktree (V1-2 a15c35c): /tmp/claude-1000/-home-bchanot-Documents-faunosteo/e641af9a-743e-46d0-9804-99667836040e/scratchpad/v1-2
- plan: .claude/tasks/plans/2026-11-02-avatar-e2e-sandbox-only-0215.md (revision 3)
## REQUEST (verbatim — IMMUTABLE)
Owner brief « Suite incident DEV et préparation de la validation graphique V1-2.4 » (2026-11-02), §1 and §3:
> ## 1. Nouveau bugfix urgent sur develop : e2e:avatar
>
> Je t'autorise à créer une branche `bugfix/*` dédiée depuis `develop`, dans un worktree sûr, afin de neutraliser l'ancien `pnpm e2e:avatar` qui peut encore écrire dans DEV.
>
> Appliquer la même approche prudente que pour `sheet-assets` :
>
> - Préférer un portage minimal du runner sûr déjà développé dans V1-2 si toutes ses dépendances sont disponibles.
> - Sinon, remplacer le point d'entrée par un refus explicite sans effet de bord.
> - Aucun accès automatique à DEV, ni lecture ni écriture.
> - Aucune récupération implicite des clés par `supabase status`.
> - Aucun repli sur les URL, bases, comptes ou buckets DEV.
> - Refus avant toute connexion en cas de configuration absente ou invalide.
> - Tests des refus avec preuve d'absence de connexion IP.
> - Revue de sécurité indépendante ciblée.
>
> Après réussite de ces vérifications, je t'autorise à fusionner uniquement ce bugfix dans `develop`, selon Gitflow.
>
> Ne fusionne pas la branche V1-2.
>
> ## 3. Limites de sécurité du runner
>
> Conserver le suivi des LOW signalés.
>
> Le contrôle de l'émetteur d'un JWT n'équivaut pas à une vérification de signature. Ne le présenter ni comme une authentification cryptographique complète ni comme l'unique protection.
>
> La restriction stricte de destination et l'isolation du bac à sable restent obligatoires.
>
> Vérifier que les redirections, les variables héritées et les configurations ambiguës ne permettent pas de sortir du bac à sable.
Skill invocation: « develop: neutraliser `pnpm e2e:avatar` (scripts/avatar-e2e.sh lit les clés DEV via supabase status, démarre le worker sur le réseau DEV, écrit et accélère les purges). Porter le runner sûr de V1-2 (db-sandbox avatar-e2e + garde dans la suite) ou refus explicite. Branche bugfix/* depuis develop dans un worktree sûr, aucun accès DEV, refus prouvés sans connexion IP, revue sécurité indépendante, puis merge dans develop (autorisé par le propriétaire). »
## CLARIFICATIONS
Q: port `cmd_sheet_assets_e2e` too (same gateway), so `pnpm e2e:sheet-assets` works on develop? / A: no, avatar only [gated 2026-11-02]
Q (challengers): the port cannot make the later V1-2 → develop merge conflict-free in db-sandbox.sh / A: accepted, expectations and rule written in the plan ("take V1-2's file whole") [gated 2026-11-02]
Q (owner, checkpoint 2026-11-02): close the redirect LOW before the merge / A: the suite's two client factories pass `global: { fetch: noRedirectFetch }` (`redirect: 'error'`, tests/e2e/noRedirectFetch.ts), a regression test with a real 302 in `pnpm --filter @faunosteo/supabase test:run`, live proof j; the suite file therefore differs from V1-2 by those lines only (V1-2 gets the same change at integration) [gated 2026-11-02]
Q (executor): the plan's CLAUDE.md:490 and SUPABASE.md §6 wording names `scripts/avatar-e2e.sh` as removed, criterion 1 said "nothing names it" / A: criterion 1 narrowed to "nothing invokes it", lines containing `removed` or `the DEV script` (the SUPABASE.md note wraps before `removed`) excluded from the oracle (same wording as V1-2) [gated 2026-11-02, internal]
Q (challengers): proof f (port taken) contains one loopback connect by construction / A: criterion for f = the only AF_INET connect is 127.0.0.1:57800; flagged to the owner [gated 2026-11-02]
## ACCEPTANCE CRITERIA
1. The DEV runner is gone: `scripts/avatar-e2e.sh` no longer exists and nothing in the tree invokes or documents it as runnable; the only remaining mentions say it was removed (CLAUDE.md workflow line, SUPABASE.md §6 note, the V1-2 wording).
CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; test ! -e "$W/scripts/avatar-e2e.sh" && ! git -C "$W" grep -n "avatar-e2e\.sh" -- . ':!.claude' | grep -v -i -E 'removed|the DEV script' | grep -q . && echo DEV_RUNNER_GONE
EXPECT: DEV_RUNNER_GONE
EVIDENCE: MET exit=0 marker-found :: DEV_RUNNER_GONE
2. `pnpm e2e:avatar` is the sandbox alias and the runner dispatches it; the script parses.
CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; grep -qF '"e2e:avatar": "bash scripts/db-sandbox.sh avatar-e2e"' "$W/package.json" && bash -n "$W/scripts/db-sandbox.sh" && grep -qF 'avatar-e2e) shift; cmd_avatar_e2e "$@" ;;' "$W/scripts/db-sandbox.sh" && echo ALIAS_OK
EXPECT: ALIAS_OK
EVIDENCE: MET exit=0 marker-found :: ALIAS_OK
3. The ported blocks are the V1-2 bytes: the suite file is identical to V1-2's once the lines naming `noRedirectFetch` are dropped (the import and the two `global: { fetch: noRedirectFetch }` options, owner-gated); db-sandbox.sh contains V1-2 a15c35c lines 47-52 (variables), 58-61 (REPO check), 255 (down), 270-332 (gateway and worker helpers) and 342-359 (`cmd_avatar_e2e`) verbatim, and does NOT contain `cmd_verify_e2e` nor `cmd_sheet_assets_e2e`.
CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; V=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/e641af9a-743e-46d0-9804-99667836040e/scratchpad/v1-2; python3 -I -c 'import sys; a=[l for l in open(sys.argv[1],encoding="utf-8") if "noRedirectFetch" not in l]; b=open(sys.argv[2],encoding="utf-8").readlines(); sys.exit("suite differs beyond noRedirectFetch lines") if a!=b else None' "$W/packages/supabase/tests/e2e/avatar-flow.e2e.ts" "$V/packages/supabase/tests/e2e/avatar-flow.e2e.ts" && python3 -I -c 'import sys; dev=open(sys.argv[1],encoding="utf-8").read(); ref=open(sys.argv[2],encoding="utf-8").read().split("\n"); bad=[f"{a}-{b}" for a,b in [(47,52),(58,61),(255,255),(270,332),(342,359)] if "\n".join(ref[a-1:b]) not in dev]; bad+=[n for n in ("cmd_verify_e2e","cmd_sheet_assets_e2e") if n in dev]; sys.exit("not verbatim / forbidden: "+" ".join(bad)) if bad else print("BLOCKS_IDENTICAL")' "$W/scripts/db-sandbox.sh" "$V/scripts/db-sandbox.sh"
EXPECT: BLOCKS_IDENTICAL
EVIDENCE: MET exit=0 marker-found :: BLOCKS_IDENTICAL
4. No DEV identifier remains in the runner or the suite (no `supabase status`, no 54321, no DEV container or network name).
CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; ! grep -rn "supabase status\|54321\|supabase_kong\|supabase_db_faunosteo\|supabase_network_faunosteo" "$W/scripts/db-sandbox.sh" "$W/packages/supabase/tests/e2e" && echo NO_DEV_IDS
EXPECT: NO_DEV_IDS
EVIDENCE: MET exit=0 marker-found :: NO_DEV_IDS
5. Refusal before any connection, no environment (plan proof b): the suite throws at load and opens no AF_INET / AF_INET6 socket. Positive control: the same trace filter, run on `curl -s http://127.0.0.1:9/`, shows an AF_INET connect.
CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; T="$(mktemp -d)"; strace -f -e trace=connect,sendto,sendmsg -o "$T/ctl" curl -s --max-time 2 http://127.0.0.1:9/ >/dev/null 2>&1; grep -q 'AF_INET' "$T/ctl" || { echo "positive control failed"; exit 1; }; (cd "$W/packages/supabase" && env -u SUPABASE_URL -u SUPABASE_ANON_KEY -u SUPABASE_SERVICE_ROLE_KEY -u AVATAR_E2E_DB_CONTAINER strace -f -e trace=connect,sendto,sendmsg -o "$T/run" node_modules/.bin/vitest run --config vitest.e2e.config.ts >"$T/out" 2>&1); rc=$?; [ "$rc" -ne 0 ] && grep -q "run it through pnpm e2e:avatar, on the sandbox stack only" "$T/out" && ! grep -q 'AF_INET' "$T/run" && echo REFUSED_NO_IP
EXPECT: REFUSED_NO_IP
EVIDENCE: MET exit=0 marker-found :: REFUSED_NO_IP
6. The other refusals of the plan (a, c, d, e, f, h, i) and the straced positive sandbox run with hostile DEV exports are executed by the orchestrator (never a sub-agent), by absolute path, and recorded in `.claude/audits/2026-11-02-avatar-e2e-sandbox-only.md` with the strace criterion per case (f: the single loopback connect to 127.0.0.1:57800 named), the `docker ps` / `docker port` / `docker inspect` readings, the DEV containers' start times unchanged, and the hand-off to V1-2 (`down` at the end). Judged by the verifier against the log.
7. Documentation names the sandbox path only and is true on develop: no instruction to run the worker or the suite against `supabase_network_faunosteo` / `supabase status` for the e2e, the removal date is 2026-11-02, no `verify-e2e`, no "V1-2.3" introduced; STORAGE.md §6 no longer tells the reader to run `pnpm --filter @faunosteo/supabase test:e2e` against the local stack. RUST.md:178, BROWSER_TESTS.md:103, SUPABASE.md:38 and CHANGELOG.md untouched. Judged by the verifier.
8. The static gates pass in the worktree.
CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; cd "$W" && corepack pnpm -s typecheck >/dev/null 2>&1 && corepack pnpm -s lint >/dev/null 2>&1 && echo STATIC_GREEN
EXPECT: STATIC_GREEN
EVIDENCE: MET exit=0 marker-found :: STATIC_GREEN
9. The guard's limits are written where a reader meets them (brief §3), without touching the byte-copied code: the SUPABASE.md §5.1 row for `pnpm db:sandbox avatar-e2e` and the audit log state that the issuer check routes to the sandbox and is not a signature check, and name what the isolation rests on (fixed gateway URL in the worker's 600 env file, `max_redirects(0)` and `proxy(None)` in `crates/worker/src/http.rs`, sandbox-signed keys, upstreams by container name) and the redirect refusal of criterion 10 (the former residual LOW). Judged by the verifier.
10. The suite's supabase-js clients refuse HTTP redirects: `tests/e2e/noRedirectFetch.ts` exports `noRedirectFetch` (`fetch(input, { ...init, redirect: 'error' })`, `redirect` set last), both client factories of the suite pass `global: { fetch: noRedirectFetch }`, no production client (`packages/supabase/src`, `apps/app/src`) changes, and the regression test `tests/no-redirect-fetch.test.ts` proves with two local `node:http` servers that a 302 from the first towards the second is not followed by auth, REST and Storage calls (the second server receives no request, the `apikey` header reaches only the first) while a control fetch with the default `follow` does reach the second. Live proof j (orchestrator): the suite with forged `iss: db-sandbox` keys against a 302 listener on 127.0.0.1:57800 pointing at 127.0.0.1:57801 opens no connect to 57801 (strace), logged in the audit file.
CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; grep -qF "redirect: 'error'" "$W/packages/supabase/tests/e2e/noRedirectFetch.ts" && [ "$(grep -c 'global: { fetch: noRedirectFetch }' "$W/packages/supabase/tests/e2e/avatar-flow.e2e.ts")" = 2 ] && git -C "$W" diff --quiet 6287e5b -- packages/supabase/src apps/app/src && cd "$W/packages/supabase" && node_modules/.bin/vitest run tests/no-redirect-fetch.test.ts >/dev/null 2>&1 && echo NO_REDIRECT_OK
EXPECT: NO_REDIRECT_OK
EVIDENCE: MET exit=0 marker-found :: NO_REDIRECT_OK
## FILE SCOPE
packages/supabase/tests/e2e/noRedirectFetch.ts (new), packages/supabase/tests/no-redirect-fetch.test.ts (new), scripts/db-sandbox.sh, scripts/avatar-e2e.sh (deleted), package.json, packages/supabase/tests/e2e/avatar-flow.e2e.ts, packages/supabase/vitest.e2e.config.ts, scripts/dev-env.sh, CLAUDE.md, README.md, docs/development/{STORAGE,SUPABASE,WORKSPACE,TEST_STRATEGY,ENVIRONMENTS,IDENTITY}.md, .claude/audits/2026-11-02-avatar-e2e-sandbox-only.md (new), .claude/tasks/{plans,contracts}/2026-11-02-avatar-e2e-sandbox-only-*.md
@@ -0,0 +1,200 @@
# PLAN — bugfix: `pnpm e2e:avatar` on develop can no longer reach DEV
- date: 2026-11-02 | flow: bugfix | branch: bugfix/avatar-e2e-sandbox-only (off develop 6287e5b)
- revision 3: three challengers (correctness, robustness, simplicity: CONCERNS each, no BLOCKER), then one
confirmation challenger (robustness, CONCERNS(5)); every MAJOR folded in as a named change
- worktree: /tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar
- reference (safe runner already built): feature/v1-2-anatomical-sheets at a15c35c, worktree
/tmp/claude-1000/-home-bchanot-Documents-faunosteo/e641af9a-743e-46d0-9804-99667836040e/scratchpad/v1-2
(commits cdd43ac, 2a84e37, 3c141c9, f924ad0)
## Bug
On develop, `pnpm e2e:avatar` = `bash scripts/avatar-e2e.sh`:
- reads API_URL, ANON_KEY, SERVICE_ROLE_KEY from `supabase status -o env` (the DEV stack), lines 12-23;
- starts the worker container on `supabase_network_faunosteo` against `http://supabase_kong_faunosteo:8000`
(DEV Kong) with a 5 s sweep and a 0 s quarantine grace;
- runs `packages/supabase/tests/e2e/avatar-flow.e2e.ts` with those keys: creates a confirmed account on DEV,
signs in as the seeded `bob@faunosteo.local` with the DEV password written in the suite
(`LocalDev-only-password-1`), uploads, and `expeditePurges()` moves EVERY due date of DEV's
`private.object_purge_queue` to now; `psql` goes to `supabase_db_faunosteo` by default (suite :29-31, :175, :215).
Root cause: neither the runner nor the suite knows an authorised target; URL, keys and container come
from the environment or from DEV defaults. Same family as the sheet-assets incidents of 2026-11-01
(fixed on develop by 6287e5b).
## Decisions already taken (constraints)
- Owner brief 2026-11-02 §1: minimal port of the V1-2 runner if its dependencies exist on develop, else an
explicit refusal; no DEV access (read or write), no implicit key recovery through `supabase status`, no
fallback to DEV URL / database / accounts / buckets; refusal before any connection when the configuration
is absent or invalid; refusals proven without any IP connection; independent security review; merge into
develop only (never V1-2).
- Owner brief §3: a JWT issuer check is not a signature check; never present it as full cryptographic
authentication nor as the only protection; strict destination restriction + sandbox isolation stay
mandatory; check that redirects, inherited variables and ambiguous configurations cannot leave the sandbox.
- Scope answer (gated 2026-11-02): avatar only; `cmd_sheet_assets_e2e` is NOT ported (`pnpm e2e:sheet-assets`
keeps refusing on develop until the V1-2 merge).
- LRN-110: absolute verified cwd for every command, no `cd X && cmd &`, quoted heredocs, env validated inside
the script; agents never run the old scripts (develop's `scripts/avatar-e2e.sh`, the main checkout's or
old-958228a's copies).
- Each ported block is copied from the V1-2 text (same bytes) where develop has no conflicting need; this
does NOT make the later V1-2 → develop merge conflict-free (see "Merge expectations").
Dependencies checked on develop: `scripts/db-sandbox.sh` (network, db/auth/rest/storage/mail containers,
keys signed with issuer `db-sandbox` :80-81, `load_secrets` :50, `wait_for` :63, `with_sandbox_env` :229);
the worker's default `run` logs `"event":"worker_start"` (`crates/worker/src/run.rs:121`, `main.rs:21-29`:
`run` takes no argument on develop); the image is `static-debian13:nonroot` with `USER nonroot`
(`crates/worker/Dockerfile:37-39`); `apps/app/e2e/support/sandbox.ts:111` creates its accounts with random
passwords; `packages/supabase/src/assets.ts` identical on both branches.
NOT ported (V1-2 only, with the reason): `SB_SEED_PW` / `seed_passwords` / `SANDBOX_SEED_PASSWORD`
(develop's `packages/supabase/tests/sandbox/workspaces.sandbox.ts:197-199` signs in to
`owner@faunosteo.local` with the seed password: rotating it would break `pnpm db:sandbox test`),
`throwaway_password`, `verify-e2e` / `cmd_verify_e2e` (needs `run --jobs sheet-verify`, V1-2 worker only),
`test` args pass-through, `cmd_sheet_assets_e2e` (scope answer).
## Fix plan (files in the bugfix worktree)
1. `scripts/db-sandbox.sh` — port from V1-2 a15c35c, copied by function name, bytes identical:
- usage header: insert after develop line 16 the V1-2 `avatar-e2e [args]` three lines only (V1-2 :20-22);
the usage fallback becomes `sed -n '2,26p'` (header grows by 3 lines);
- variables: after `MAIL=…` insert V1-2 :47-51 verbatim (`GATEWAY=`, `WORKER=faunosteo_dbsandbox_worker_verify`,
`AVATAR_WORKER=`, `GATEWAY_IMAGE=nginx:1.31-alpine`, `WORKER_IMAGE=faunosteo_worker:dev`); the PORT line
becomes V1-2 :52 (`PORT_GATEWAY=57800` appended). `WORKER=` is inert on develop; it lets `down` remove a
verify worker left by an interrupted V1-2 run (shared Docker names) and keeps the line identical;
- the `REPO="$(realpath "$PWD")"` check: V1-2 :58-62 (comment, `REPO=`, `case`, pattern, `esac`) replace develop :45-47 (a STATE inside the repository
reached through a symlink no longer passes; the port adds `$STATE/worker.XXXXXX` files holding the
sandbox service key);
- `cmd_down`: V1-2 :255 verbatim (`"$AVATAR_WORKER" "$WORKER" "$GATEWAY" "$REST" …`);
- after `with_sandbox_env`: V1-2 :270-332 (`GATEWAY_CONF`, `start_gateway`, `start_worker`,
`print_worker_log`, `worker_cleanup`, `worker_preflight`) and :342-359 (`cmd_avatar_e2e`, the comment
above it through the closing brace, the suite invocation :356-358 included); NOT :333-341
(`cmd_verify_e2e`) nor :361-376 (`cmd_sheet_assets_e2e`);
- dispatcher: `avatar-e2e) shift; cmd_avatar_e2e "$@" ;;` between `e2e-shell` and `sql`.
- `bash -n $W/scripts/db-sandbox.sh` and `bash $W/scripts/db-sandbox.sh` (usage, exit 1; absolute path, never a
bare `pnpm db:sandbox`) prove the file parses and the header range is right.
2. `scripts/avatar-e2e.sh` — deleted (`git rm`).
3. `package.json` — `"e2e:avatar": "bash scripts/db-sandbox.sh avatar-e2e"`.
4. `packages/supabase/tests/e2e/avatar-flow.e2e.ts` — replaced by the V1-2 file (same bytes): guard at
module load: `SUPABASE_URL === 'http://127.0.0.1:57800'`, `AVATAR_E2E_DB_CONTAINER === 'faunosteo_dbsandbox_db'`,
both keys' payload `iss === 'db-sandbox'`, else `throw` before any client is created; clients built on
the constant, never on the env URL; `psql` on the constant container; a random password per run; two
accounts created per run and deleted after; `expeditePurges(userId)` scoped to the account's objects;
`describe.skipIf(!configured)` gone: a wrong environment is an error, not a skip. The guard checks the
issuer, not the role and not the signature (brief §3): a role mix-up fails at the first admin call
against the sandbox; a forged `iss: db-sandbox` key passes the guard and fails at the sandbox's GoTrue.
5. `packages/supabase/vitest.e2e.config.ts`, `scripts/dev-env.sh` — the comment lines (V1-2 text).
6. Docs: only the lines this fix makes false (dead `scripts/avatar-e2e.sh` references, DEV-target
instructions), worded so they are true on develop (removal date 2026-11-02, no "V1-2.3", no `verify-e2e`):
- `CLAUDE.md`: the `db:sandbox` line (add `avatar-e2e` only), the `e2e:avatar` line, the two folder-structure
lines (tests/e2e, scripts list), the "Storage or worker change" workflow line;
- `docs/development/STORAGE.md` §6: the DEV `docker run` keeps its place with the V1-2 comment ("the worker
beside the local stack, for the manual photo flow (IDENTITY.md); the e2e suite refuses this stack"), the
`pnpm --filter @faunosteo/supabase test:e2e` line is DELETED (it would always throw), the `e2e:avatar`
line becomes the sandbox alias;
- `docs/development/SUPABASE.md` §3.2 block and §6 DEV-acceptance note; §5.1 table: a develop-only row for
`pnpm db:sandbox avatar-e2e` that describes the gateway on its own (no reference to a verify-e2e row);
- `docs/development/WORKSPACE.md`, `docs/development/TEST_STRATEGY.md`, `README.md:114`,
`docs/development/ENVIRONMENTS.md:38`, `docs/development/IDENTITY.md:130` (the manual photo flow points at
the STORAGE §6 `docker run` line, not at the e2e container: it sits on the sandbox network and is removed
at exit).
- NOT touched (still true after the fix): `docs/development/RUST.md:178`, `BROWSER_TESTS.md:103`,
`SUPABASE.md:38`, `CHANGELOG.md` (neither 6287e5b nor the V1-2 commits added a line).
7. (owner, checkpoint 2026-11-02) `packages/supabase/tests/e2e/noRedirectFetch.ts`: `export const noRedirectFetch: typeof fetch = (input, init) => fetch(input, { ...init, redirect: 'error' })`; the suite's `anonClient()` and `serviceClient()` add `global: { fetch: noRedirectFetch }` (supabase-js hands `global.fetch` raw to auth-js and through `fetchWithAuth` to REST and Storage; no layer sets `redirect`, our wrapper sets it last); regression test `tests/no-redirect-fetch.test.ts` (two `node:http` servers, 302 from A to B, auth + REST + Storage calls fail, B sees nothing, `apikey` only at A, control plain fetch reaches B); live proof j under strace. The suite now differs from V1-2 by those lines: V1-2 takes the same change at integration (merge rule amended).
## Merge expectations (V1-2 → develop, later)
Develop's `db-sandbox.sh` is the merge-base text (9135d73); the port changes base regions V1-2 changes
differently. Expected conflicts: the usage header, the function block (V1-2 has `cmd_verify_e2e` and
`cmd_sheet_assets_e2e` around `cmd_avatar_e2e`), the dispatcher, the usage `sed` range. Rule: take V1-2's
file whole; check with an empty `git diff <V1-2 tip> -- scripts/db-sandbox.sh` after the merge. The suite,
`package.json`, `dev-env.sh`, the vitest comment and the ported variable / `down` / `REPO` lines merge
cleanly, except the suite: V1-2 adopts the `noRedirectFetch` lines (owner decision 2026-11-02). Doc lines reworded for develop conflict with V1-2's: keep V1-2's text (same rule as the
sheet-assets lines in TODO).
## Proof (log committed as `.claude/audits/2026-11-02-avatar-e2e-sandbox-only.md` on this branch)
Who runs what: the executor applies the code and the static checks (contract criteria 1-5, 8); the LIVE proofs
below (a, c-i, the positive run) and the audit log are run by the orchestrator in the main loop, never by a
sub-agent (incident 1 of 2026-11-01 was an executor's backgrounded `cd`).
`W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar`.
Every command names `$W` explicitly: `bash "$W/scripts/db-sandbox.sh" …`, `corepack pnpm --dir "$W" …`,
`"$W/packages/supabase/node_modules/.bin/vitest" …`; NEVER a bare `pnpm e2e:avatar` / `pnpm db:sandbox` /
`pnpm worker:image` (the shell's cwd resets to the main checkout, which still holds the DEV runner).
Pre-flight before any live command: `test ! -e "$W/scripts/avatar-e2e.sh"` and `grep -F '"e2e:avatar": "bash
scripts/db-sandbox.sh avatar-e2e"' "$W/package.json"`; `docker ps -a --filter name=^faunosteo_worker_e2e$`
(a leftover of the old DEV runner; read-only; the owner removes it if present); the DEV containers' start
times recorded (`docker inspect -f '{{.State.StartedAt}}'`, read-only) and compared at the end.
Keys used in c, d, e, h, i are FORGED unsigned JWTs built in the shell (`base64url(header).base64url(payload).x`),
never read from `~/.cache/faunosteo-db-sandbox/secrets.sh` and never the DEV keys.
Trace: `strace -f -e trace=connect,sendto,sendmsg -o <file>` on `bash "$W/scripts/db-sandbox.sh" …` or on the
vitest binary directly, never through `pnpm` (its own process would be inside the trace). Criterion for a-e
and i: no `AF_INET` / `AF_INET6` in the trace, except where stated.
a. `bash "$W/scripts/db-sandbox.sh" avatar-e2e` with `FAUNOSTEO_SANDBOX_DIR` pointing at an empty temp dir
(no secrets file) → `db-sandbox: not running`, exit 1, no connect, no container started;
b. the suite (`vitest run --config vitest.e2e.config.ts` in `$W/packages/supabase`) with no environment →
throws at load, no connect (contract oracle 5, positive control on `curl 127.0.0.1:9`);
c. the suite with `SUPABASE_URL=http://127.0.0.1:54321`, `AVATAR_E2E_DB_CONTAINER=supabase_db_faunosteo` and
two forged JWTs saying `iss: supabase-demo` → throws at load, no connect;
d. the suite with the sandbox URL and forged `iss: db-sandbox` keys but `AVATAR_E2E_DB_CONTAINER=supabase_db_faunosteo`
→ throws, no connect;
e. the suite with the sandbox URL and container and a key whose payload is not JSON → throws, no connect;
i. the suite with the sandbox URL and container, a forged anon key `iss: db-sandbox` and a forged service
key `iss: supabase-demo`, then the swap → throws, no connect. This is the only case that isolates the
issuer comparison itself (c stops at the URL, d at the container, e in the JSON.parse catch).
h. (sandbox NOT running, nothing listens on 57800) the suite with the sandbox URL and container and two
forged JWTs saying `iss: db-sandbox` → the guard passes, `beforeAll` fails with ECONNREFUSED; strace shows
connects to 127.0.0.1:57800 only. The brief §3 point made visible: the issuer check routes, it does not
authenticate; whoever holds 127.0.0.1:57800 would receive the keys the environment supplies.
f. (after the setup below, sandbox up from this branch, image present) `bash "$W/scripts/db-sandbox.sh"
avatar-e2e` with 127.0.0.1:57800 held by a foreign listener (`python3 -I -m http.server` bound to
127.0.0.1:57800) → `already in use`, exit 1, `docker ps` shows no gateway and no avatar worker.
EXCEPTION, by construction: the probe `(exec 3<>"/dev/tcp/127.0.0.1/$PORT_GATEWAY")` is one
`connect(AF_INET, 127.0.0.1:57800)`; the criterion for f is "the only AF_INET connect is 127.0.0.1:57800;
none to :54321 / :54322 or the LAN address". Flagged to the owner. Known limitation (not exercised): a port
held by another run's `faunosteo_dbsandbox_gateway` is torn down by `worker_preflight` before the probe
(shared container names and default STATE dir across worktrees); fails closed, sandbox only.
Setup (destroys the current sandbox and the V1-2 build of the worker image; the V1-2 worktree belongs to an
earlier session at its checkpoint, no run in progress; listed at the approval gate): `corepack pnpm --dir "$W"
worker:image` (develop's crates), `bash "$W/scripts/db-sandbox.sh" down`, `bash "$W/scripts/db-sandbox.sh" up fresh`.
Positive run, ONCE, under strace, WITH hostile exports in the shell: `SUPABASE_URL=http://127.0.0.1:54321`,
`SUPABASE_ANON_KEY` and `SUPABASE_SERVICE_ROLE_KEY` forged (`iss: supabase-demo`),
`AVATAR_E2E_DB_CONTAINER=supabase_db_faunosteo`, `SUPABASE_NETWORK=supabase_network_faunosteo`,
`SUPABASE_INTERNAL_URL=http://supabase_kong_faunosteo:8000`, `WORKER_IMAGE=faunosteo_worker:local` (the old
runner's knobs; the script's constant wins) → `bash "$W/scripts/db-sandbox.sh" avatar-e2e` 5/5; trace
criterion: no connect to :54321 / :54322 or the LAN address; every other AF_INET connect named in the log
(expected: 127.0.0.1:57800 from the suite, the `/dev/tcp` probe). A watcher started beforehand in the
background with absolute paths (`until docker inspect faunosteo_dbsandbox_worker_avatar; do sleep 1; done`)
records, DURING the run and with filtered templates only: `docker port faunosteo_dbsandbox_gateway 8000/tcp`
(= 127.0.0.1:57800), the worker's networks (`{{range $k,$v := .NetworkSettings.Networks}}{{println $k}}{{end}}`
= faunosteo_dbsandbox_net) and `{{range .Config.Env}}{{println .}}{{end}} | grep '^SUPABASE_URL='`
(= http://faunosteo_dbsandbox_gateway:8000). NEVER a raw `docker inspect` or `.Config.Env` in the log: the
service key sits there. After the run: both containers gone, DEV start times unchanged.
What the isolation rests on (stated in the log with file:line, not "only one network": `NET` is a plain
bridge that can route to the host and the LAN where DEV's Kong publishes): the worker's URL is fixed to the
gateway container in the 600 env file, `crates/worker/src/http.rs:31` `max_redirects(0)` and `:33 proxy(None)`,
the gateway's upstreams are the sandbox containers by name, the sandbox keys are signed with a secret DEV
does not hold; `scripts/dev-env.sh:23` exports `FAUNOSTEO_DEV_API_URL` into every child of db-sandbox.sh,
the suite included, and nothing reads it.
Residuals (LOW, for the owner, no code change here, fixed in V1-2 first then ported): the suite's supabase-js
clients use Node's global fetch (`redirect: follow`; `HTTP(S)_PROXY` honoured when `NODE_USE_ENV_PROXY=1`):
no endpoint the suite calls redirects today, a proxy would receive sandbox keys only; `worker_env` is read by
the EXIT trap before `start_worker` assigns it (an inherited value would be `rm -f`'d on an early `die`);
every docker call follows `DOCKER_HOST` / the current context.
Static: `grep -rn "supabase status\|54321\|supabase_kong\|supabase_db_faunosteo\|supabase_network_faunosteo" "$W/scripts/db-sandbox.sh" "$W/packages/supabase/tests/e2e"` → nothing;
`git -C "$W" grep -n avatar-e2e.sh -- ':!.claude'` → nothing (the historical contract of 2026-10-13 under
`.claude/` keeps its citation).
Hand-off (in the log and to the owner): end with `bash "$W/scripts/db-sandbox.sh" down`; the V1-2 session
rebuilds `faunosteo_worker:dev` (`pnpm worker:image` there) and runs `pnpm db:sandbox up fresh` before its next
sandbox run (the develop secrets file has no SB_SEED_PW, V1-2's `load_secrets` refuses it: fails closed).
Copies that STILL reach DEV after the merge: the main checkout `/home/bchanot/Documents/faunosteo` (branch
feature/v1-1-clients-animals, merged, holds `scripts/avatar-e2e.sh` and the old `e2e:avatar` line: `pnpm
e2e:avatar` there targets DEV until that checkout moves to develop and the branch is deleted with
`gitflow.sh delete`), and the worktree old-958228a (same two scripts). Agents never run them.
## Gates
- `bash -n`, `pnpm typecheck`, `pnpm lint`, `pnpm --filter @faunosteo/supabase test:run` (PGlite) green in
the worktree.
- fresh verifier on the contract; fresh security-auditor on the diff (MODE: gate), both before commit.
- merge into develop with `gitflow.sh finish` only after the owner's go (brief §1 authorises it after the
verifications succeed); never V1-2.
+5 -5
View File
@@ -127,7 +127,7 @@ pnpm db:reset # replay from zero
pnpm db:test # pgTAP on the real stack
pnpm db:types # regenerate packages/supabase/src/database.types.ts
pnpm db:types:check # CI diff
pnpm db:sandbox up fresh|up upgrade <version> [<then>]|test-db|types [--check]|test|e2e-shell|down # throwaway stack (SUPABASE.md §5.1): migrations tested without touching DEV
pnpm db:sandbox up fresh|up upgrade <version> [<then>]|test-db|types [--check]|test|e2e-shell|avatar-e2e|down # throwaway stack (SUPABASE.md §5.1): migrations tested without touching DEV
# Reference sheet in the app: the dev server bundles the curated draft; a build does not
pnpm build:preview # SHEET_BUNDLE=draft build (manual validation, preview deployments)
@@ -147,7 +147,7 @@ pnpm rust:check:docker # the same rust-check.sh inside the builder image
pnpm wasm:build:docker # the same wasm-build.sh inside the builder image
pnpm worker:test # Docker only: crates/worker/Dockerfile stage test, sandbox tests + seccomp derivation on the musl binary
pnpm worker:image # Docker only: runtime image faunosteo_worker:dev (distroless/static, `run --check`)
pnpm e2e:avatar # scripts/avatar-e2e.sh: worker container against the local stack + packages/supabase/tests/e2e (real-stack avatar flow)
pnpm e2e:avatar # = pnpm db:sandbox avatar-e2e: the worker container and packages/supabase/tests/e2e on the throwaway stack only (the suite refuses any other target; no DEV variant since 2026-11-02)
```
## Test commands
@@ -268,7 +268,7 @@ faunosteo/
├─ packages/supabase/ ← @faunosteo/supabase
│ ├─ src/{index,client,database.types,anatomical-sheets,assets}.ts ← typed client, generated types, publish gate, avatar flow (closed AssetFailure kinds)
│ ├─ src/{records,workspaces,clients,species,animals,relations,field-limits}.ts ← V1-1 record access (closed RecordFailure kinds, keyset pages), D-R7 bounds
│ ├─ tests/e2e/avatar-flow.e2e.ts + vitest.e2e.config.ts ← real-stack end-to-end (`pnpm e2e:avatar`), skipped without the stack env
│ ├─ tests/e2e/avatar-flow.e2e.ts + vitest.e2e.config.ts ← real-stack end-to-end (`pnpm e2e:avatar` = `pnpm db:sandbox avatar-e2e`), fails on any target but the sandbox gateway and database
│ └─ tests/{client,anatomical-sheets}.test.ts, tests/db/ ← PGlite harness, shim, pgTAP runner, schema↔types test
├─ supabase/
│ ├─ config.toml, seed.sql ← CLI config (public schema only), local dev accounts
@@ -285,7 +285,7 @@ faunosteo/
│ ├─ core/ ← faunosteo-core: domain/{js,sheet,report,archive,editor,session} (contracts and rules), anatomy/{svg/{prescan,tree,sanitize,refs,number,serialize},layer,compose} (R3: the one SVG reader, the layer, canvas + highlight composition), pdf/{read,json_js,import,write,compare} (R4: reader, writer and session, the archive check tool behind feature `cli`), ops.rs + facade.rs (`call`, `call_with_sheet`), json (JS number printing), curation/{text,ids,prettier_json,markdown,report_guard,legacy/*,draft/*} (R5, feature `curation`: Prettier layout, the legacy importer, the changeset applier, migration map, stats, seed SQL, CHANGELOG, REVIEW-REPORT, review drawings), curation/upload.rs (R5.5, feature `upload`: the upload rules, pure) + bin/report_compare.rs (`pnpm report:compare`) + bin/import_equine.rs (`pnpm r5:import-equine`) + bin/upload_sheet_assets/ (`pnpm assets:upload`, ureq; the three tools allowed std::fs); tests/{oracles,conformance,fixtures,pdf/LEDGER.tsv} frozen from the TypeScript (oracles/r3, oracles/r4, fixtures/svg/hostile); no I/O, no clock (lint-enforced)
│ ├─ wasm/ ← faunosteo-wasm: wasm-bindgen facade (core_version, call, SheetHandle; trap exports in the proofs build only)
│ └─ worker/ ← faunosteo-worker: plain main; `decode` sandboxed child (rlimits, seccomp allowlist, image → libwebp), parent Spawner + RIFF check; R1 `run` loop: config, log (JSON lines, allowlist), keys, backend trait + http (ureq, PostgREST rpc + Storage objects), job, sweep, watchdog; Dockerfile, scripts/derive-seccomp.sh
├─ scripts/{rust-env,rust-check,wasm-build,check-all,avatar-e2e,report-compare,import-equine,upload-sheet-assets,sheet-assets-e2e,floor-clarification-check}.sh, wasm-stamp.mjs ← native Rust gate, wasm build (pkg + pkg-proofs + stamp), the pre-merge gate (`pnpm check:all`), the real-stack avatar e2e, the archive check tool (`pnpm report:compare`), the Rust pipeline (`pnpm r5:import-equine`)
├─ scripts/{rust-env,rust-check,wasm-build,check-all,report-compare,import-equine,upload-sheet-assets,sheet-assets-e2e,floor-clarification-check}.sh, wasm-stamp.mjs ← native Rust gate, wasm build (pkg + pkg-proofs + stamp), the pre-merge gate (`pnpm check:all`), the archive check tool (`pnpm report:compare`), the Rust pipeline (`pnpm r5:import-equine`)
├─ scripts/{dev-env,supabase,dev}.sh ← the DEV origin (LAN address) in one place; CLI wrapper; `pnpm dev` on that origin
├─ docker-compose.yml ← `app` service; `worker` service under the `worker` profile (read-only, cap_drop ALL, external Supabase network, `.env.worker`)
├─ docker/rust-builder.Dockerfile, rust-run.sh, csp-proof/ ← reproducible Rust builder (alternative) + the CSP proofs (R0 module, R2 app image: app-image.sh)
@@ -487,7 +487,7 @@ release 0.2.0 unaffected.
- After PDF roundtrip tests fail: check the attachment bytes (the N-1 scanner reads them in the envelope suites), then the layered reader (report first, envelope metadata, snapshot/branding/labels), then the core's inflation (`pdf/read/inflate.rs`). Goldens under `apps/app/tests/fixtures/goldens/step6` and the R4 digests under `goldens/r4` are never regenerated without a user decision.
- Node 24 / pnpm 10.13.1: `corepack enable` or `corepack pnpm`; never a global install.
- Rust: native on the Ubuntu development machine (user-level rustup, never a global package, never on the VPS); `pnpm rust:check` and `pnpm wasm:build` run natively, the `:docker` variants reproduce them in the builder image. Before every Rust commit: `pnpm rust:check` green, `pnpm worker:test` green when `crates/worker` changed (Docker only: the sandbox tests and the seccomp derivation never run natively), the ts-rs types under `packages/core-wasm/types` committed, `Cargo.lock` committed. Before a merge: `pnpm check:all`. No CI runs on the forge: a workflow file is never cited as a passed check. The core takes ids, time and bytes as inputs (clippy `disallowed_methods`); the worker child is the only process that decodes untrusted bytes.
- Storage or worker change: `pnpm e2e:avatar` (worker container against the local stack, `packages/supabase/tests/e2e`) in addition to `pnpm worker:test`; `docker compose --profile worker` serves the worker from `.env.worker` (never the app `.env`).
- Storage or worker change: `pnpm db:sandbox avatar-e2e` (the avatar suite `packages/supabase/tests/e2e` and the real worker on the throwaway stack) in addition to `pnpm worker:test`; `pnpm e2e:avatar` is its alias (owner decision 2026-11-02: no avatar e2e against DEV, `scripts/avatar-e2e.sh` removed); `docker compose --profile worker` serves the worker from `.env.worker` (never the app `.env`).
- SQL change: `pnpm --filter @faunosteo/supabase test:run` (PGlite) before commit; `pnpm db:reset && pnpm db:test`
on the real stack when Docker is available; regenerate types (`pnpm db:types`).
+2 -2
View File
@@ -111,8 +111,8 @@ pinned toolchain from `rust-toolchain.toml` on first use; see
`docs/development/RUST.md` §1 for the three `cargo install` / `rustup
target add` lines and the Docker alternative. The files worker (profile
photos, Step 8) runs as a container beside the local Supabase stack:
`pnpm worker:image`, then `pnpm e2e:avatar` for the real-stack end-to-end
run, or `docker compose --profile worker up worker` with a `.env.worker`
`pnpm worker:image`, then `pnpm db:sandbox up fresh` and `pnpm e2e:avatar` (= `pnpm db:sandbox avatar-e2e`) for the
real-stack end-to-end run on the throwaway stack, or `docker compose --profile worker up worker` with a `.env.worker`
(`docs/development/STORAGE.md`).
Docker Compose (matches production topology):
+1 -1
View File
@@ -35,7 +35,7 @@ never hard-coded in the sources.
Consumers: `scripts/supabase.sh` (every CLI call: `pnpm supabase …`,
`pnpm db:start|stop|reset|test|types`), `scripts/dev.sh` (`pnpm dev`),
`scripts/avatar-e2e.sh`. The address changes with `FAUNOSTEO_DEV_HOST=…`
`scripts/db-sandbox.sh`. The address changes with `FAUNOSTEO_DEV_HOST=…`
in front of the command, without touching a source file. Calling the CLI
binary directly (`node_modules/.bin/supabase start`) leaves the literal
`env(...)` text in the services: always go through `pnpm`.
+2 -2
View File
@@ -126,8 +126,8 @@ VITE_AUTH_PROVIDERS=google pnpm dev # http://<host>:5173 from any device of th
9. REST: anon cannot read profiles (`42501`), alice reads one row only
(SUPABASE.md §8).
10. Profile photo (Step 8, worker container running: `pnpm worker:image`
then `docker compose --profile worker up worker` or the container of
`scripts/avatar-e2e.sh`): Mon compte → Modifier la photo with a phone
then `docker compose --profile worker up worker` or the `docker run` of
STORAGE.md §6; `pnpm e2e:avatar` runs on the sandbox): Mon compte → Modifier la photo with a phone
JPEG → preview → Enregistrer → "Traitement en cours…" → the photo in the
circle, the sidebar, the drawer (mobile) and the top bar (name beside it
on desktop, alone on mobile) linking to Mon compte; a renamed PNG is
+2 -3
View File
@@ -327,9 +327,8 @@ docker run --rm --read-only --cap-drop ALL --security-opt no-new-privileges:true
--network supabase_network_faunosteo \
-e SUPABASE_URL=http://supabase_kong_faunosteo:8000 \
-e SUPABASE_SERVICE_ROLE_KEY="$(pnpm -s supabase status -o env | sed -n 's/^SERVICE_ROLE_KEY="\(.*\)"/\1/p')" \
faunosteo_worker:dev run
pnpm --filter @faunosteo/supabase test:e2e # real-stack end-to-end (needs the worker above)
pnpm e2e:avatar # scripts/avatar-e2e.sh: the three lines above in one, worker started with a 5 s sweep and no quarantine grace
faunosteo_worker:dev run # the worker beside the local stack, for the manual photo flow (IDENTITY.md); the e2e suite refuses this stack
pnpm e2e:avatar # = pnpm db:sandbox avatar-e2e: the suite and the worker (5 s sweep, no quarantine grace) on the throwaway stack only (SUPABASE.md §5.1); the DEV script was removed on 2026-11-02
```
`docker compose --profile worker up worker` runs the same container from
+5 -3
View File
@@ -171,7 +171,7 @@ User files land in private buckets and are processed by the Rust worker
```bash
pnpm worker:image # faunosteo_worker:dev
pnpm e2e:avatar # starts the container on supabase_network_faunosteo, runs tests/e2e, stops it
pnpm e2e:avatar # = pnpm db:sandbox avatar-e2e: the suite and the worker on the throwaway stack (§5.1) only
docker compose --profile worker up worker # the same container from docker-compose.yml, reading .env.worker
```
@@ -518,8 +518,9 @@ the scripts:
on the sandbox, clean and with those conditions reproduced (scenarios and
mutations in the journal of 2026-10-27). DEV is not validated by `db:test`
until a run there passes.
- `pnpm e2e:avatar`: not part of this procedure; optional, the owner's call.
It writes on DEV beyond its own fixture: it creates a temporary confirmed
- `pnpm e2e:avatar`: not part of this procedure. Since 2026-11-02 it runs on
the sandbox only (owner decision; the DEV script `scripts/avatar-e2e.sh` is
removed). Its DEV run, as recorded on 2026-10-26, wrote on DEV beyond its own fixture: it creates a temporary confirmed
account `e2e-avatar-<time>@faunosteo.local` (and, after M1, its workspace),
deletes it at the end (a failed run leaves it), signs in as
`bob@faunosteo.local` (sessions and `last_sign_in_at` of an existing
@@ -804,6 +805,7 @@ Docker.
| `pnpm db:sandbox types [--check]` | `supabase gen types --db-url ... --schema public` through Prettier, written or diffed with the committed file |
| `pnpm db:sandbox test` | `packages/supabase/tests/sandbox/*.sandbox.ts`: real GoTrue and PostgREST sessions, concurrent SQL sessions |
| `pnpm db:sandbox e2e-shell` (= `pnpm e2e:shell`) | the authenticated `/app` shell in Chromium (`apps/app/e2e/shell`, `docs/development/BROWSER_TESTS.md`): a loopback dev server whose Supabase calls are replayed on the sandbox, fictitious accounts per test |
| `pnpm db:sandbox avatar-e2e` (= `pnpm e2e:avatar`) | the avatar flow on the sandbox alone: an nginx gateway (`nginx:1.31-alpine`; `/auth/v1/`, `/rest/v1/`, `/storage/v1/` to the sandbox containers, `return 404` elsewhere) published on `127.0.0.1:57800` only; the real worker `faunosteo_worker:dev run` (avatars and sweep, 5 s sweep, no quarantine grace, 512 MiB, read-only, no capability, `nonroot`) on the sandbox network, its service key in a 600 env file removed once started; then `packages/supabase/tests/e2e/avatar-flow.e2e.ts` through that port. The suite accepts only `http://127.0.0.1:57800`, the container `faunosteo_dbsandbox_db` and keys whose JWT payload carries `iss: db-sandbox`, else it throws before any request. The issuer check only routes the run to the sandbox: it is not a signature check and not an authentication. The isolation rests on the fixed gateway URL in the worker's env file, the worker's `max_redirects(0)` and `proxy(None)` (`crates/worker/src/http.rs`), sandbox-signed keys and upstreams reached by container name on the sandbox network. The suite's supabase-js clients refuse every HTTP redirect (`global.fetch` = `tests/e2e/noRedirectFetch.ts`, `redirect: 'error'`; regression test `tests/no-redirect-fetch.test.ts`) |
| `pnpm db:sandbox sql` / `down` | psql as postgres on stdin / remove the stack |
Every CLI call passes `--db-url` with `sslmode=disable` (the sandbox has no
+1 -1
View File
@@ -67,7 +67,7 @@ unit suites, 2 by the browser journeys.
| CSP on the image (R2) | the real app image behind the DEPLOY.md CSP in headless Chromium: with `'wasm-unsafe-eval'` the core runs the editor path, without it the degraded state and an untouched draft; no module request on `/login`, `/app/account`, `/` | `docker/csp-proof/app-image.sh` | before a merge touching the core loading or the image; manual (needs Chromium) |
| Worker sandbox | integration tests against the musl binary that ships: fixture corpus through the full sandbox, refusals, SIGSYS on a denied syscall, output cap, `RLIMIT_AS` abort, `RLIMIT_CPU`, deadline; seccomp allowlist derived by `strace` and compared | `crates/worker/tests/sandbox.rs`, Dockerfile stage `test` (`pnpm worker:test`, Docker only, never native) | every `crates/worker` commit, `pnpm check:all`; CI `docker` job prepared |
| Worker job loop | native unit tests on a fake backend and a fake decoder: call order claim → download → decode → upload → commit → purge, every child outcome mapped to a closed code, no deletion on a refused commit, lease left on transport failures, sweeper targets and acks, key validation, config and secret redaction | `crates/worker/tests/job_loop.rs`, `crates/worker/src/*` unit tests (`pnpm rust:check`) | every Rust commit |
| Files e2e (real stack) | the worker container against the local Supabase stack: clean upload and owner-only download (Bob, anon, quarantine, direct final-key write refused), replacement and purge after the grace (queue clock shifted through psql), late signed-upload bytes swept, hostile uploads rejected with closed codes, removal and drained queue | `packages/supabase/tests/e2e/avatar-flow.e2e.ts` (`pnpm e2e:avatar`, `scripts/avatar-e2e.sh`) | every Storage, worker or avatar change; not in `check:all` (needs the stack) |
| Files e2e (real stack) | the worker container against the throwaway sandbox stack (since 2026-11-02; DEV before): clean upload and owner-only download (Bob, anon, quarantine, direct final-key write refused), replacement and purge after the grace (queue clock shifted through psql), late signed-upload bytes swept, hostile uploads rejected with closed codes, removal and drained queue | `packages/supabase/tests/e2e/avatar-flow.e2e.ts` (`pnpm e2e:avatar` = `pnpm db:sandbox avatar-e2e`, `scripts/db-sandbox.sh`) | every Storage, worker or avatar change; not in `check:all` (needs the sandbox) |
Browser-only code (`svgToPng`, `DOMParser` in the importer) runs under
happy-dom where sufficient and under Playwright when real rendering matters
+1 -1
View File
@@ -101,7 +101,7 @@ works as `corepack pnpm <cmd>`.
| `pnpm build` | typecheck + Vite build in every package |
| `pnpm check` | typecheck, test:run, lint, build in sequence (the Node gate) |
| `pnpm check:all` | the whole pre-merge gate: native Rust check, types drift, wasm build, `pnpm check`, application and worker images (`docs/development/RUST.md` §4; no CI runs it yet) |
| `pnpm e2e:avatar` | real-stack end-to-end of the avatar flow: worker container against the local Supabase stack + `packages/supabase/tests/e2e` (`docs/development/STORAGE.md` §6; needs `pnpm db:start`) |
| `pnpm e2e:avatar` | = `pnpm db:sandbox avatar-e2e`: real-stack end-to-end of the avatar flow, worker container + `packages/supabase/tests/e2e` on the throwaway stack only (`docs/development/STORAGE.md` §6; needs `pnpm db:sandbox up fresh` and `pnpm worker:image`) |
| `pnpm format` | Prettier on the whole repository |
Package-scoped: `pnpm --filter @faunosteo/app <script>`.
+1 -1
View File
@@ -46,7 +46,7 @@
"wasm:build:docker": "bash docker/rust-run.sh bash scripts/wasm-build.sh",
"worker:test": "docker build -f crates/worker/Dockerfile --target test -t faunosteo_worker:test .",
"worker:image": "docker build -f crates/worker/Dockerfile -t faunosteo_worker:dev .",
"e2e:avatar": "bash scripts/avatar-e2e.sh",
"e2e:avatar": "bash scripts/db-sandbox.sh avatar-e2e",
"e2e:ui": "pnpm --filter @faunosteo/app e2e:ui",
"e2e:shell": "bash scripts/db-sandbox.sh e2e-shell"
},
+64 -32
View File
@@ -1,17 +1,21 @@
/**
* Avatar flow against the real local stack and the worker container
* Avatar flow against a real stack and the worker container
* (docs/development/STORAGE.md §4, §3; STEP8_FILES_ANALYSIS IV.2 "integration"
* and "real-stack e2e"). Run through `pnpm e2e:avatar` (scripts/avatar-e2e.sh),
* which starts the worker with a 5 s sweep and a 0 s quarantine grace.
* and "real-stack e2e"). Run through `pnpm e2e:avatar` (= `pnpm db:sandbox
* avatar-e2e`): the throwaway stack only, the worker started with a 5 s sweep and
* a 0 s quarantine grace.
*
* Environment: SUPABASE_URL, SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY
* (the service key is used for inspection only: listing objects and shifting
* the purge clock through psql in the database container).
* the purge clock through psql) and AVATAR_E2E_DB_CONTAINER. The URL and the
* container must be the sandbox's own: any other value, or a missing one, fails
* the run before any request. Both accounts are made per run.
*/
import { createHash } from 'node:crypto'
import { createHash, randomBytes } from 'node:crypto'
import { execFileSync } from 'node:child_process'
import { deflateSync } from 'node:zlib'
import { createClient, type SupabaseClient } from '@supabase/supabase-js'
import { noRedirectFetch } from './noRedirectFetch'
import {
beginAvatarUpload,
confirmAssetUpload,
@@ -26,16 +30,30 @@ import {
const URL_ = process.env.SUPABASE_URL
const ANON = process.env.SUPABASE_ANON_KEY
const SERVICE = process.env.SUPABASE_SERVICE_ROLE_KEY
const DB_CONTAINER = process.env.AVATAR_E2E_DB_CONTAINER ?? 'supabase_db_faunosteo'
const PASSWORD = 'LocalDev-only-password-1'
const BOB = 'bob@faunosteo.local'
const DB_CONTAINER = process.env.AVATAR_E2E_DB_CONTAINER
/** The only target accepted: the gateway and database of `pnpm db:sandbox avatar-e2e`. */
const SANDBOX_URL = 'http://127.0.0.1:57800'
const SANDBOX_DB = 'faunosteo_dbsandbox_db'
/** The sandbox signs its keys with issuer `db-sandbox` (scripts/db-sandbox.sh); no other stack's key does. */
const sandboxKey = (key: string | undefined): boolean => {
try {
return JSON.parse(Buffer.from(key?.split('.')[1] ?? '', 'base64url').toString()).iss === 'db-sandbox'
} catch {
return false
}
}
if (URL_ !== SANDBOX_URL || DB_CONTAINER !== SANDBOX_DB || !sandboxKey(ANON) || !sandboxKey(SERVICE))
throw new Error('avatar e2e: run it through pnpm e2e:avatar, on the sandbox stack only')
/** Per run, kept in memory only: both accounts are deleted after the suite. */
const PASSWORD = randomBytes(18).toString('base64url')
const WORKER_WAIT_MS = 60_000
type Client = SupabaseClient<Database>
function anonClient(): Client {
return createClient<Database>(URL_ ?? '', ANON ?? '', {
return createClient<Database>(SANDBOX_URL, ANON ?? '', {
auth: { persistSession: false, autoRefreshToken: false },
global: { fetch: noRedirectFetch },
})
}
@@ -47,8 +65,9 @@ async function signedIn(email: string): Promise<Client> {
}
function serviceClient(): Client {
return createClient<Database>(URL_ ?? '', SERVICE ?? '', {
return createClient<Database>(SANDBOX_URL, SERVICE ?? '', {
auth: { persistSession: false, autoRefreshToken: false },
global: { fetch: noRedirectFetch },
})
}
@@ -166,19 +185,24 @@ async function objectExists(service: Client, bucket: string, key: string): Promi
function psql(sql: string): string {
return execFileSync('docker', [
'exec', DB_CONTAINER, 'psql', '-U', 'postgres', '-d', 'postgres', '-Atc', sql,
'exec', SANDBOX_DB, 'psql', '-U', 'postgres', '-d', 'postgres', '-Atc', sql,
]).toString().trim()
}
/** Moves every due date of the purge queue to now (the grace is 48 h / 1 h in production). */
function expeditePurges(): void {
psql('update private.object_purge_queue set not_before = now() where not_before > now()')
function accountPattern(userId: string): string {
if (!/^[0-9a-f-]{36}$/.test(userId)) throw new Error('userId is not a uuid')
return `'%/${userId}/%'`
}
/** Moves an account's due dates of the purge queue to now (the grace is 48 h / 1 h in production). */
function expeditePurges(userId: string): void {
psql(`update private.object_purge_queue set not_before = now()
where not_before > now() and object_name like ${accountPattern(userId)}`)
}
/** Purge entries still queued for an account (served entries are acked, hence deleted). */
function queuedPurges(userId: string): number {
if (!/^[0-9a-f-]{36}$/.test(userId)) throw new Error('userId is not a uuid')
return Number(psql(`select count(*) from private.object_purge_queue where object_name like '%/${userId}/%'`))
return Number(psql(`select count(*) from private.object_purge_queue where object_name like ${accountPattern(userId)}`))
}
async function downloadFails(client: Client, key: string): Promise<boolean> {
@@ -192,31 +216,39 @@ function sha256(bytes: Uint8Array): string {
// --- suite ------------------------------------------------------------------
const configured = Boolean(URL_ && ANON && SERVICE)
/** A confirmed throwaway account; resolves with its id. */
async function newAccount(service: Client, tag: string, name: string): Promise<{ id: string; email: string }> {
const email = `e2e-${tag}-${Date.now()}@faunosteo.local`
const created = await service.auth.admin.createUser({
email,
password: PASSWORD,
email_confirm: true,
user_metadata: { display_name: name, locale: 'fr' },
})
if (created.error || !created.data.user) throw new Error(`createUser: ${created.error?.message}`)
return { id: created.data.user.id, email }
}
describe.skipIf(!configured)('avatar flow on the real stack', () => {
describe('avatar flow on the sandbox stack', () => {
const service = serviceClient()
let alice: Client
let aliceId: string
let bob: Client
let bobId: string
beforeAll(async () => {
// A fresh account per run keeps the seeded accounts clean and the per-hour rate out of reach.
const email = `e2e-avatar-${Date.now()}@faunosteo.local`
const created = await service.auth.admin.createUser({
email,
password: PASSWORD,
email_confirm: true,
user_metadata: { display_name: 'E2E Avatar', locale: 'fr' },
})
if (created.error || !created.data.user) throw new Error(`createUser: ${created.error?.message}`)
aliceId = created.data.user.id
alice = await signedIn(email)
bob = await signedIn(BOB)
// Fresh accounts per run keep the seeded accounts out of the suite and the per-hour rate out of reach.
const a = await newAccount(service, 'avatar', 'E2E Avatar')
aliceId = a.id
alice = await signedIn(a.email)
const b = await newAccount(service, 'other', 'E2E Other')
bobId = b.id
bob = await signedIn(b.email)
})
afterAll(async () => {
if (aliceId) await service.auth.admin.deleteUser(aliceId)
if (bobId) await service.auth.admin.deleteUser(bobId)
})
it('cleans a valid upload, and only the owner can download the result', async () => {
@@ -260,7 +292,7 @@ describe.skipIf(!configured)('avatar flow on the real stack', () => {
expect(state.clean?.id).toBe(row.id)
expect(await downloadFails(alice, previous!.object_key)).toBe(true)
expect(await objectExists(service, 'avatars', previous!.object_key)).toBe(true)
expeditePurges()
expeditePurges(aliceId)
await waitFor(
async () => ((await objectExists(service, 'avatars', previous!.object_key)) ? null : true),
30_000,
@@ -316,7 +348,7 @@ describe.skipIf(!configured)('avatar flow on the real stack', () => {
expect(await downloadFails(alice, row.object_key)).toBe(true)
const state = await fetchOwnAvatarState(alice, aliceId)
expect(state.clean).toBeNull()
expeditePurges()
expeditePurges(aliceId)
await waitFor(
async () => {
const listed = await service.storage.from('avatars').list(`profiles/${aliceId}`, { limit: 100 })
@@ -0,0 +1,8 @@
/**
* The suite's fetch: a 3xx answer is an error, never a request to another
* origin (owner decision 2026-11-02). supabase-js hands `global.fetch` to its
* auth, REST and Storage calls and spreads the caller's init before ours runs,
* so `redirect` set here is final: nothing restores `follow`.
*/
export const noRedirectFetch: typeof fetch = (input, init) =>
fetch(input, { ...init, redirect: 'error' })
@@ -0,0 +1,95 @@
import { createServer, type IncomingMessage, type Server } from 'node:http'
import type { AddressInfo } from 'node:net'
import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
import { createClient } from '@supabase/supabase-js'
import type { Database } from '../src'
import { noRedirectFetch } from './e2e/noRedirectFetch'
type Seen = { url?: string; apikey?: string | string[] }
const targetSeen: Seen[] = []
const originSeen: Seen[] = []
let target: Server
let origin: Server
let originUrl = ''
function listen(
seen: Seen[],
answer: (res: import('node:http').ServerResponse) => void,
): Promise<Server> {
const server = createServer((req: IncomingMessage, res) => {
seen.push({ url: req.url, apikey: req.headers.apikey })
answer(res)
})
return new Promise((resolve) => {
server.listen(0, '127.0.0.1', () => resolve(server))
})
}
const portOf = (server: Server) => (server.address() as AddressInfo).port
function client() {
return createClient<Database>(originUrl, 'test-key', {
auth: { persistSession: false, autoRefreshToken: false },
global: { fetch: noRedirectFetch },
})
}
function expectNotFollowed() {
expect(targetSeen).toHaveLength(0)
// supabase-js may retry a failed GET: count the origin hits, not their number
expect(originSeen.length).toBeGreaterThan(0)
expect(originSeen.every((r) => r.apikey === 'test-key')).toBe(true)
}
beforeAll(async () => {
target = await listen(targetSeen, (res) => {
res.writeHead(200, { 'content-type': 'application/json' }).end('{}')
})
origin = await listen(originSeen, (res) => {
const landing = `http://127.0.0.1:${portOf(target)}/landed`
res.writeHead(302, { location: landing }).end()
})
originUrl = `http://127.0.0.1:${portOf(origin)}`
})
afterAll(async () => {
await Promise.all(
[target, origin].map((s) => new Promise((done) => s.close(done))),
)
})
beforeEach(() => {
targetSeen.length = 0
originSeen.length = 0
})
describe('noRedirectFetch', () => {
it('does not follow a redirect on a REST call', async () => {
const { error } = await client().from('assets').select('id')
expect(error).not.toBeNull()
expectNotFollowed()
})
it('does not follow a redirect on an auth call', async () => {
const { error } = await client().auth.signInWithPassword({
email: 'a@b.c',
password: 'x',
})
expect(error).not.toBeNull()
expectNotFollowed()
})
it('does not follow a redirect on a storage call', async () => {
const { error } = await client().storage.from('avatars').download('k')
expect(error).not.toBeNull()
expectNotFollowed()
})
it('control: the default fetch follows the same redirect', async () => {
const res = await fetch(`${originUrl}/control`)
expect(res.status).toBe(200)
expect(targetSeen).toHaveLength(1)
expect(targetSeen[0].url).toBe('/landed')
})
})
+2 -2
View File
@@ -1,8 +1,8 @@
import { defineConfig } from 'vitest/config'
/**
* Real-stack end-to-end suite (tests/e2e/*.e2e.ts): needs the local Supabase
* stack and the worker container (scripts/avatar-e2e.sh starts both sides).
* Real-stack end-to-end suite (tests/e2e/*.e2e.ts): the throwaway stack and the
* worker container, both started by `pnpm e2e:avatar` (scripts/db-sandbox.sh).
* Kept out of the default `test:run` include on purpose.
*/
export default defineConfig({
-58
View File
@@ -1,58 +0,0 @@
#!/usr/bin/env bash
# Real-stack end-to-end run of the avatar flow (docs/development/STORAGE.md §6):
# starts the worker container against the local Supabase stack with a fast sweep
# and no quarantine grace, runs packages/supabase/tests/e2e, stops the container.
# Needs: `pnpm db:start` done, Docker, the worker image (`pnpm worker:image`,
# built here when absent). The keys come from `supabase status`; the service key
# reaches the container through a 600-mode temporary env file, never the command line.
set -euo pipefail
cd "$(dirname "$0")/.."
network="${SUPABASE_NETWORK:-supabase_network_faunosteo}"
kong="${SUPABASE_INTERNAL_URL:-http://supabase_kong_faunosteo:8000}"
image="${WORKER_IMAGE:-faunosteo_worker:dev}"
name="faunosteo_worker_e2e"
. scripts/dev-env.sh
status="$(node_modules/.bin/supabase status -o env 2>/dev/null)" \
|| { echo "avatar-e2e: the local stack is not running (pnpm db:start)" >&2; exit 1; }
value() { printf '%s\n' "$status" | sed -n "s/^$1=\"\(.*\)\"$/\1/p"; }
api_url="$(value API_URL)"
anon_key="$(value ANON_KEY)"
service_key="$(value SERVICE_ROLE_KEY)"
[ -n "$api_url" ] && [ -n "$anon_key" ] && [ -n "$service_key" ] \
|| { echo "avatar-e2e: could not read the keys from supabase status" >&2; exit 1; }
if ! docker image inspect "$image" >/dev/null 2>&1; then
echo "== building $image"
docker build -f crates/worker/Dockerfile -t "$image" .
fi
env_file="$(mktemp)"
chmod 600 "$env_file"
cleanup() {
echo "== worker log (last lines)"
docker logs --tail 40 "$name" 2>/dev/null || true
docker rm -f "$name" >/dev/null 2>&1 || true
rm -f "$env_file"
}
trap cleanup EXIT
{
echo "SUPABASE_URL=$kong"
echo "SUPABASE_SERVICE_ROLE_KEY=$service_key"
echo "WORKER_ID=e2e"
echo "WORKER_POLL_SECONDS=1"
echo "WORKER_SWEEP_SECONDS=5"
echo "WORKER_QUARANTINE_GRACE_SECONDS=0"
} > "$env_file"
docker rm -f "$name" >/dev/null 2>&1 || true
echo "== starting $name on $network"
docker run -d --name "$name" --read-only --cap-drop ALL \
--security-opt no-new-privileges:true --memory 512m --cpus 1 --pids-limit 64 \
--network "$network" --env-file "$env_file" "$image" run >/dev/null
echo "== e2e suite"
SUPABASE_URL="$api_url" SUPABASE_ANON_KEY="$anon_key" SUPABASE_SERVICE_ROLE_KEY="$service_key" \
pnpm --filter @faunosteo/supabase test:e2e
+97 -4
View File
@@ -14,6 +14,9 @@
# pnpm db:sandbox types [--check] generated types (write, or diff with the committed file)
# pnpm db:sandbox test packages/supabase/tests/sandbox (HTTP, concurrency)
# pnpm db:sandbox e2e-shell [args] = pnpm e2e:shell: the /app shell in Chromium (apps/app/e2e); args go to Playwright (a spec file, --grep)
# pnpm db:sandbox avatar-e2e [args] (= pnpm e2e:avatar) the avatar worker (default mode: avatars + sweep) against the
# sandbox: a gateway on 127.0.0.1:$PORT_GATEWAY, the worker
# container, then tests/e2e/avatar-flow.e2e.ts (args go to vitest)
# pnpm db:sandbox sql psql as postgres on stdin
# pnpm db:sandbox down
#
@@ -36,14 +39,21 @@ AUTH=faunosteo_dbsandbox_auth
REST=faunosteo_dbsandbox_rest
STORAGE=faunosteo_dbsandbox_storage
MAIL=faunosteo_dbsandbox_mail
PORT_DB=57432 PORT_AUTH=57999 PORT_REST=57300 PORT_STORAGE=57500 PORT_MAIL=57025
GATEWAY=faunosteo_dbsandbox_gateway
WORKER=faunosteo_dbsandbox_worker_verify
AVATAR_WORKER=faunosteo_dbsandbox_worker_avatar
GATEWAY_IMAGE=nginx:1.31-alpine
WORKER_IMAGE=faunosteo_worker:dev
PORT_DB=57432 PORT_AUTH=57999 PORT_REST=57300 PORT_STORAGE=57500 PORT_MAIL=57025 PORT_GATEWAY=57800
STATE="${FAUNOSTEO_SANDBOX_DIR:-$HOME/.cache/faunosteo-db-sandbox}"
SECRETS="$STATE/secrets.sh"
CLI=node_modules/.bin/supabase
die() { echo "db-sandbox: $*" >&2; exit 1; }
# Both sides resolved: a repository reached through a symlink is still the repository.
REPO="$(realpath "$PWD")"
case "$(realpath -m "$STATE")" in
"$PWD" | "$PWD"/*) die "FAUNOSTEO_SANDBOX_DIR must be outside the repository" ;;
"$REPO" | "$REPO"/*) die "FAUNOSTEO_SANDBOX_DIR must be outside the repository" ;;
esac
# Every value must be present: an empty password would turn --db-url into an
# argument the CLI might read as absent and fall back to the DEV database.
@@ -219,7 +229,7 @@ cmd_up() {
}
cmd_down() {
docker rm -f "$REST" "$STORAGE" "$AUTH" "$MAIL" "$DB" >/dev/null 2>&1 || true
docker rm -f "$AVATAR_WORKER" "$WORKER" "$GATEWAY" "$REST" "$STORAGE" "$AUTH" "$MAIL" "$DB" >/dev/null 2>&1 || true
docker network rm "$NET" >/dev/null 2>&1 || true
rm -f "$SECRETS" "$STATE/db.env" "$STATE/auth.env" "$STATE/storage.env" "$STATE/rest.env" "$STATE/service-header"
echo "== sandbox removed"
@@ -234,6 +244,88 @@ with_sandbox_env() (
"$@"
)
# The Kong routes of the CLI stack (/auth/v1/, /rest/v1/, /storage/v1/) on the
# sandbox network; host port only for avatar-e2e, on 127.0.0.1 like the services.
GATEWAY_CONF='server {
listen 8000;
client_max_body_size 8m;
proxy_http_version 1.1;
location /auth/v1/ { proxy_pass http://'"$AUTH"':9999/; }
location /rest/v1/ { proxy_pass http://'"$REST"':3000/; }
location /storage/v1/ { proxy_pass http://'"$STORAGE"':5000/; }
location / { return 404; }
}'
start_gateway() { # [docker run options]
docker run -d --name "$GATEWAY" --network "$NET" --security-opt no-new-privileges:true "$@" \
--entrypoint sh "$GATEWAY_IMAGE" -c 'printf "%s\n" "$0" > /etc/nginx/conf.d/default.conf && exec nginx -g "daemon off;"' \
"$GATEWAY_CONF" >/dev/null
wait_for "gateway" docker exec "$GATEWAY" wget -q -O /dev/null http://127.0.0.1:8000/rest/v1/
}
# The service key reaches the container through a 600 file removed once it started;
# memory as the compose service of the same mode (docker-compose.yml).
start_worker() { # name worker-id memory extra-env-lines args...
local name="$1" id="$2" memory="$3" extra="$4"; shift 4
worker_env="$(umask 077; mktemp "$STATE/worker.XXXXXX")"
printf 'SUPABASE_URL=http://%s:8000\nSUPABASE_SERVICE_ROLE_KEY=%s\nWORKER_ID=%s\nWORKER_POLL_SECONDS=1\n%s' \
"$GATEWAY" "$SB_SERVICE_KEY" "$id" "$extra" > "$worker_env"
docker run -d --name "$name" --network "$NET" --env-file "$worker_env" \
--read-only --cap-drop ALL --security-opt no-new-privileges:true \
--memory "$memory" --cpus 1 --pids-limit 64 --user nonroot \
"$WORKER_IMAGE" "$@" >/dev/null
rm -f "$worker_env"; worker_env=
for _ in $(seq 1 30); do
docker logs "$name" 2>&1 | grep -q '"event":"worker_start"' && break
[ "$(docker inspect -f '{{.State.Running}}' "$name")" = true ] || die "worker exited before worker_start"
sleep 1
done
docker logs "$name" 2>&1 | grep -q '"event":"worker_start"' || die "timeout waiting for worker_start"
echo "== worker up ($WORKER_IMAGE, $*, via $GATEWAY)"
}
# The worker's JSON lines hold no secret by design (crates/worker log allowlist);
# they are printed only after checking that neither key appears in them.
print_worker_log() { # name
local lines
lines="$(docker logs "$1" 2>&1)" || return 0
case "$lines" in
*"$SB_SERVICE_KEY"* | *"$SB_ANON_KEY"*) echo "== worker log withheld: it contains a key" ;;
*) echo "== worker log"; printf '%s\n' "$lines" ;;
esac
}
worker_cleanup() { # name
[ -n "${worker_env:-}" ] && rm -f "$worker_env"
print_worker_log "$1"
docker rm -f "$1" "$GATEWAY" >/dev/null 2>&1 || true
}
worker_preflight() { # name
load_secrets
docker image inspect "$WORKER_IMAGE" >/dev/null 2>&1 || die "$WORKER_IMAGE missing (pnpm worker:image)"
docker rm -f "$1" "$GATEWAY" >/dev/null 2>&1 || true
}
# The avatar suite drives supabase-js through the gateway's loopback port; its
# psql calls name the sandbox database container. The suite accepts no other
# target, and a port already taken stops the run before anything starts.
cmd_avatar_e2e() {
worker_preflight "$AVATAR_WORKER"
if (exec 3<>"/dev/tcp/127.0.0.1/$PORT_GATEWAY") 2>/dev/null; then
die "port 127.0.0.1:$PORT_GATEWAY is already in use: free it, nothing was started"
fi
trap 'worker_cleanup "$AVATAR_WORKER"' EXIT
start_gateway -p 127.0.0.1:$PORT_GATEWAY:8000
[ "$(docker port "$GATEWAY" 8000/tcp)" = "127.0.0.1:$PORT_GATEWAY" ] \
|| die "the gateway is not published on 127.0.0.1:$PORT_GATEWAY only"
start_worker "$AVATAR_WORKER" sandbox-avatar 512m \
$'WORKER_SWEEP_SECONDS=5\nWORKER_QUARANTINE_GRACE_SECONDS=0\n' run
SUPABASE_URL="http://127.0.0.1:$PORT_GATEWAY" SUPABASE_ANON_KEY="$SB_ANON_KEY" \
SUPABASE_SERVICE_ROLE_KEY="$SB_SERVICE_KEY" AVATAR_E2E_DB_CONTAINER="$DB" \
node_modules/.bin/pnpm --filter @faunosteo/supabase test:e2e "$@"
}
case "${1:-}" in
up) shift; cmd_up "$@" ;;
down) cmd_down ;;
@@ -248,6 +340,7 @@ case "${1:-}" in
fi ;;
test) load_secrets; with_sandbox_env node_modules/.bin/pnpm --filter @faunosteo/supabase test:sandbox ;;
e2e-shell) shift; load_secrets; with_sandbox_env node_modules/.bin/pnpm --filter @faunosteo/app e2e:shell "$@" ;;
avatar-e2e) shift; cmd_avatar_e2e "$@" ;;
sql) load_secrets; sb_psql ;;
*) sed -n '2,23p' "$0"; exit 1 ;;
*) sed -n '2,26p' "$0"; exit 1 ;;
esac
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# The one place the DEV origin is decided (docs/development/ENVIRONMENTS.md §2).
# Sourced by the wrappers (scripts/supabase.sh, scripts/dev.sh, scripts/avatar-e2e.sh):
# Sourced by the wrappers (scripts/supabase.sh, scripts/dev.sh, scripts/db-sandbox.sh):
# every service the browser of another device must reach is addressed by the
# host's LAN address, never by 127.0.0.1 or localhost.
#