Commit Graph
151 Commits
Author SHA1 Message Date
bchanot b682f78209 test(supabase): sandbox suites refuse every target but the sandbox
The sandbox suites (stack.ts and its importers, the shell Playwright
config) stop before their first request unless the container, the
four loopback URLs and the key issuer are exactly the db:sandbox
ones; the LAN config accepts the 5193 trial app only. Drift and
wiring tests tie the constants to scripts/db-sandbox.sh.
2026-11-10 13:36:08 +01:00
bchanot 2b10471b0a test(supabase): TOTP step guard in the sandbox verify helper 2026-11-04 18:55:47 +01:00
bchanot f7e7bf4ee1 feat(supabase): sheet drawing register, upload, confirm accessors and save answer 2026-11-04 11:57:22 +01:00
bchanot 2f824a947c feat(supabase): add draft_last_save to the sheet admin read (M8, sandbox only) 2026-11-04 11:40:22 +01:00
bchanot f5456f330d test(supabase): concurrency seeding accepts Storage's duplicate answer
After e2e:shell seeds the same content-addressed drawing, Storage answers HTTP 400 with statusCode 409 (KeyAlreadyExists); any other 400 still fails. Docs: M7 adds no new write path; a TOTP code replays more than once within its span.
2026-11-02 23:31:49 +01:00
bchanot dcb1a94ee4 docs(supabase): V1-2.5 checkpoint decisions, TOTP reuse measured, lost-factor review
IDENTITY 4.1 asserted reuse span (step N and N+1), 4.2 lost authenticator paths and gaps, production prerequisite; V1-2 contract 12.3, 13, 17.10, 17.11; design README accepted deviations; REVUE L15 and object_conflict EN; M7 header.
2026-11-02 22:57:22 +01:00
bchanot 0499a39389 test(supabase): working-copy sandbox case holds on a fresh stack
The first call creates the copy on a fresh sandbox; the second must answer working_copy.exists. Was green only from the second run.
2026-11-02 22:57:21 +01:00
bchanot 4744e28986 feat(app): admin and catalogue entries, step-up guard, MFA in Mon compte (V1-2.5 E, F)
Nav hint from own grants and roles (never a control); RequireCatalog, RequireAdmin (no admin read before aal2), Accès non autorisé page, placeholder routes; TOTP factor list, enrolment with QR and one-time secret, removal, inline step-up for aal2 actions, step-up in password reset; auth kind aal2_required. App 601, e2e:ui 227.
2026-11-02 16:49:37 +01:00
bchanot c9ace9aff2 feat(supabase): MFA, species, rights, admin and catalogue access layer (V1-2.5 D)
mfa.ts (closed kinds, TOTP list incl. unverified, enrol, verify, unenrol, assurance); sheets.ts wrappers for species, working copy, account lookup, M7 reads, versions list, drawing download, own grants, with shape parsers. Unit 148, sandbox sheets-admin 5/5 x2.
2026-11-02 16:31:50 +01:00
bchanot bbab0e61cb feat(domain): sheet.empty free op for a new sheet's document (V1-2.5 C)
Wraps create_empty_sheet_document; refusals invalid_shape / invalid_json; ts-rs SheetEmptyInput, core-wasm proof, app wrapper emptySheetDocument.
2026-11-02 16:19:49 +01:00
bchanot b0a4cbe588 feat(supabase): M7 admin read RPCs for official sheets (V1-2.5 B)
list_official_sheets_admin and get_official_sheet_admin: badges, version and round states, named actors; capability holders at aal2, one answer for unknown or forbidden ids, no write path. pgTAP 022 (40); sandbox fresh and upgrade from M6: 1938 pass, types match.
2026-11-02 16:19:48 +01:00
bchanot 78791bfb6b test(supabase): GoTrue MFA behaviour proven on the sandbox (V1-2.5 A)
Ten cases on the pinned GoTrue: aal1 cannot enrol a second factor or remove a verified one (no STOP); removal downgrades only the sessions verified with that factor; password change and reset need aal2 once a factor is verified. Findings in IDENTITY.md §4.1.
2026-11-02 16:19:47 +01:00
bchanot 3c141c942b fix(supabase): targeted review LOWs on retry and sandbox isolation
fail_sheet_verification refuses lease_expired (the claim's record, never a
worker report); the sandbox state dir guard resolves the repository path; the
avatar suite also refuses keys not issued by the sandbox. pgTAP 021: 90.
2026-11-01 23:13:42 +01:00
bchanot a5844b9d56 feat(supabase): verification retry by effective cause
resource_limit (intrinsic to the frozen input: frame, input or output cap,
SIGXCPU, SIGABRT, SIGSYS) and verdict_refused close the round at the first
occurrence; timeout, unavailable (now also an external SIGKILL) and
lease_expired keep the 2/5/10/20 s retries up to five attempts. pgTAP 021: 89;
sandbox case k closes at attempt 1.
2026-11-01 23:01:30 +01:00
bchanot cdd43ac431 test(supabase): avatar e2e on the sandbox only, per-session seed secret
pnpm e2e:avatar is now an alias of pnpm db:sandbox avatar-e2e and the DEV
script scripts/avatar-e2e.sh is removed; the suite fails on any target but
the sandbox gateway and database; an occupied port 57800 stops the run before
anything starts. The sandbox replaces the seed accounts' DEV password by a
per-session secret.
2026-11-01 22:55:23 +01:00
bchanot 5adad3709f feat(supabase): retry delay of 2, 5, 10, 20 s for technical verification failures
M6 amended in place (applied only to the throwaway sandbox): a hidden
not_before on the round, set by fail_sheet_verification and honoured by the
claim; RPC signatures unchanged. pgTAP 021 (68), sandbox cases i (delay with
the real worker), j (inputs at the caps, 2 MiB base), k (just beyond).
2026-11-01 21:09:00 +01:00
bchanot 2a84e3702e test(supabase): avatar suite on the sandbox, per-run sandbox passwords
pnpm db:sandbox avatar-e2e runs tests/e2e/avatar-flow.e2e.ts with the real
worker (default mode) on the throwaway stack; the suite now requires its
database container by name, makes both accounts per run and expedites only
its own purges. Throwaway sandbox accounts get random passwords per run.
2026-11-01 21:02:59 +01:00
bchanot 5afb34ed0f test(supabase): V1-2.3 verification worker end to end on the sandbox 2026-11-01 17:34:33 +01:00
bchanot 1cd4344363 feat(supabase): V1-2.3 M6 worker verification RPCs, service role only 2026-11-01 16:51:31 +01:00
bchanot d8562f60f5 fix(anatomy): V1-2.2 refuse a root visibility that hides the markers
Both composers append the marker layer as the root's last child, so a
root visibility="hidden" whose children set visible back drew the
drawing without a marker (0 marker pixels in Chromium and Firefox, PDF
and canvas). The reader refuses any root visibility but visible
(root_visibility); cleaning, verdict, preview, PDF gate and both
composers answer it.
2026-10-30 18:56:48 +01:00
bchanot 08efd9a792 fix(anatomy): V1-2.2 reserve the PDF halo id in the reader and composers
A drawing defining filter#osteo-halo replaced the PDF halo (a transparent
filter erased the marker); an element holding the id before the first
defs won its resolution. The reader refuses the id in any letter case
(reserved_id), both composers refuse such a tree, the halo is always the
engine's. Exact name only: osteo-overlays stays.
2026-10-30 17:30:48 +01:00
bchanot e823655f09 fix(anatomy): V1-2.2 owner arbitrations on SVG references and bytes
Refuse local references to ids a drawing does not define, scope canvas
ids per view, upload every drawing in one stored form checked by the
verdict and the preview, keep strict numeric rgb() colours, and commit
real Inkscape 1.4.3 exports with their generator.
2026-10-29 16:24:07 +01:00
bchanot ca31b787b6 fix(domain): V1-2.2 second review round, linear walks, bounds, CSS loaders
Verifier ECARTS(3) and security PASS on 8294d54: one indexed walk per
view chain in sheet.edit, a set for referenced drawings, released
preview parses, xml:base and CSS loaders refused, fail-closed PI scan,
PI drawings rejected by the preview, the builder naming its cap.
2026-10-29 13:58:32 +01:00
bchanot 8294d5471c fix(anatomy): V1-2.2 review findings, PIs and HTML refused, bounds
Security audit (PASS, 2 MEDIUM, 2 LOW) and verifier (ECARTS 6) on
741c25c: processing instructions and HTML fetchers refused, active
content under a long title classified, linear review groups, full
fixpoint check, bounded preview drawings, missing cap fixtures and
property checks, record wordings.
2026-10-29 13:38:33 +01:00
bchanot 8ae756534c feat(domain): V1-2.2 wasm facade, contract types, module proofs
PreviewBuilder, PreviewSheet and clean_svg on the browser module, the
31 ts-rs types and their index, the glue interface, and the proofs on
the shipped module; the module stays under its 600 KB budget.
2026-10-29 13:14:22 +01:00
bchanot 2379d28d9b test(supabase): V1-2.1 number-walk timing on a small base document 2026-10-28 20:42:52 +01:00
bchanot 538d10369f fix(supabase): V1-2.1 walk the document's numbers in linear time
jsonb_path_query row by row is quadratic on PostgreSQL 17: a document of
200k numbers under the cap ran into the statement timeout. One
jsonb_path_query_array call, then its elements. pgTAP 017 saves 600 000
numbers; the perf suite times 600k (saved) and 1M (closed code) over HTTP.
2026-10-28 20:34:35 +01:00
bchanot b1de87b5d0 fix(supabase): V1-2.1 owner self-review grant and the text size measure
M6 option A: grant_catalog_right no longer refuses an owner granting
itself sheet_reviewer; authors stay refused at acknowledgment, approval
and publication. The document cap is the UTF-8 bytes of the JSON text:
check_document_structure drops pg_column_size and M5 replaces the base
table CHECK by octet_length(content::text). pgTAP 015 and 017 cover the
owner-reviewer journey and cap - 1, cap, cap + 1, multi-byte, dense.
2026-10-28 19:32:57 +01:00
bchanot ef1f4b593f test(supabase): V1-2.1 re-runnable sandbox suite, two-session cases, caps timing
F18 and workspaces no longer leave the seed owner changed. Ten two-session
scenarios with a blocking session, seed-owner AR-1 acceptance, shim columns
against the image, save/submit/approve/publish timed at the caps.
2026-10-28 18:14:10 +01:00
bchanot d05f75da84 fix(supabase): V1-2.1 audit M1 M2 M3 and LOW fixes in M5
Approval needs an active sheet (lock sheet, version, round); a base only
from a still-published round version; rights.mfa before rights.capability;
withdrawal of a published round refused; approver separation at publish;
deprecate and working copy serialised; closed codes; append-only acks;
upload policy bound to the registering editor. pgTAP 017-019 added.
2026-10-28 18:14:09 +01:00
bchanot 3914eaa866 fix(supabase): V1-2.1 harden M5 after the security and verifier gates
Fresh security audit PASS; verifier ECARTS(10) addressed:
- publish re-checks the approver's sheet_reviewer grant (publish.approval.invalid)
- scope disclaimer enforced at approve and publish (publish.disclaimer.missing, O6)
- to_confirm split from inherited (publish.to_confirm.open distinct from publish.inherited.present)
- save_sheet_draft requires an active sheet; working copy adds the 2 MiB octet_length check
- delete_sheet_asset EXECUTE revoked from service_role (§5.4 surface)
- species table comment updated (§7.2); lease columns dropped from the reviews grant
- lock order sheet->version->round in decide/publish; conflict_retry kind (40001/40P01) in sheets.ts
Tests: pgTAP 016 (omitted status, separation, revoked-reviewer + renewal, ack carry,
inactive-species publish refusal, deprecated-delete, schema_version 1, content-write
without actor, working-copy positive), 001 census (no other writer of profile_roles).
871 real-stack pgTAP / 122 PGlite / 4 sandbox green; typecheck, lint, types drift clean.
2026-10-28 16:20:51 +01:00
bchanot 77e5fa4cf5 feat(supabase): V1-2.1 M4/M5 secure sheet access and review workflow
M4 20261028100000_sheet_access_hardening + M5 20261028110000_sheet_review_workflow
(applied together; no unprotected window). Implements contract §5-§14.

- Catalogue rights table + owner RPCs; has_mfa / has_aal2_session (live
  auth.sessions check); grant_active vs caller_has split; catalogue reader
  predicate; can_edit_sheet on the sheet_editor capability (F14).
- AR-1 B: aal2 required on every platform role change, target verified factor,
  race-free last-owner guard (F18/F19); service_role loses table privileges on
  the catalogue + profiles/profile_roles and EXECUTE on the role RPCs (F12/F17).
- Reviewed lifecycle: version provenance + review columns, content/freeze/
  author triggers, rounds/comments/acknowledgments, save/submit/withdraw/
  comment/acknowledge/decide, atomic publish_sheet_version(review_id) on the
  stored verdict, deprecate/archive/restore, species RPCs, equine working copy,
  uploads with the storage check (F7) + editor INSERT policy + 2 MiB bucket.
  F1-F3,F5,F6,F8,F9,F13,F15,F16 closed. Verdict is a fixture until M6 (V1-2.3).
- O22: SQL business mirror removed, declared status check kept; pgTAP 011 and
  the Rust generator's SQL parts deleted, ledger retargeted.
- Access layer sheets.ts (closed SheetFailure kinds); old client publish gate
  deleted; types regenerated; upload tool reads via get_sheet_asset_state.

Tested on the throwaway sandbox only; DEV untouched. pgTAP 850 (real stack) /
122 (PGlite) green; real-GoTrue AR-1 B + F18 race green; fresh install and
M3->M5 upgrade green; V1-1 regression green; rust:check, typecheck, lint,
build, types drift clean. BDR-084, LRN-095.
2026-10-28 15:52:49 +01:00
bchanot e22357630f feat(supabase): animals and relations access layer
animals.ts: POST search with species filter and a probe row, read by id with
explicit columns, create with the optional first client in one call, update,
archive. relations.ts: an animal's relations in one select (voided left out),
create, end, dates, void. Kinds duplicate_relation and already_ended added.
2026-10-26 17:11:23 +01:00
bchanot a0e069959b feat(supabase): workspaces and clients access layer with closed failures
fetchPersonalWorkspaceId, client search (keyset, one probe row), read by id
with explicit columns, create (request id), update (every field), archive,
client animals and archive preview, species labels; RecordFailure kinds of
contract §9.4 plus session_expired and network; RPC answers checked by Zod.
Unit tests and the same functions against real PostgREST on the sandbox.
2026-10-26 01:34:45 +01:00
bchanot 533a1c497d test(supabase): close the gaps two M3 mutations went through
A client whose only link was voided while current must not count the animal;
B linking its own animal to a client of A must not wait on A's lock. Also a
relation create racing the archive of its animal, and a replay changing the
initial relation's role.
2026-10-26 00:57:38 +01:00
bchanot b54c8e5bd8 feat(supabase): animals and relations M3 with RPCs, history and caps
Species rows (8 + other), animals with the D6b birth model, relations with
composite workspace keys, current/ended/voided states and a partial unique
index; definer RPCs for animals and relations (one lock order, shared write
budget, caps), invoker reads (search_animals, list_client_animals,
client_archive_preview) and search_clients with current_animal_count.
pgTAP 014 (254), parity test, sandbox suite, types from the isolated stack.
2026-10-26 00:52:22 +01:00
bchanot 4adbfcb608 feat(supabase): clients M2 with RPCs, search and per-workspace budget
V1-1.2 (contract V1-1_OWNERS_ANIMALS.md §5, §9, §10). public.clients (person or organization, display name only, optional contact, folded search keys), create/update/set_archived as definer RPCs (identical not_found, idempotent create with divergent-replay refusal, revisions, archive read-only), search_clients invoker with keyset pages and phone search, write budget per workspace in UTC hour/day windows under a row lock, 20 000-client cap, ids-only audit hidden from platform staff (N9), nothing for anon or service_role. pgTAP 013 (130), field-limits parity test, sandbox suite (concurrency, budget races, 20 000-client search), types regenerated.
2026-10-25 21:09:45 +01:00
bchanot 08abe42c48 test(supabase): isolated Supabase stack and real-stack suite for M1
scripts/db-sandbox.sh (pnpm db:sandbox): DEV images on an own network, loopback ports distinct from DEV, no volume, secrets generated outside Git; fresh and upgrade modes through the CLI's migration up, test db and gen types with --db-url. packages/supabase/tests/sandbox: M1 sign-up and confirmation, reads and refusals per role, residual GoTrue admin path, correlation cap, concurrent sessions.
2026-10-25 20:57:09 +01:00
bchanot 7bf4fb6079 feat(supabase): workspaces M1, one personal workspace per account
V1-1.1 (contract V1-1_OWNERS_ANIMALS.md §4, §8, §9). Tables workspaces and workspace_members, created with the profile by trigger through one atomic, idempotent write path; deferred invariant (a personal workspace has exactly its account as holder); backfill of existing profiles; access helpers caller_workspace_ids (active profile, confirmed email) and writable_workspace_ids; RLS select for members only; no privilege for anon or service_role. log_event keeps x-correlation-id only as a short token. pgTAP 012 (85 checks), census and types updated, config test.
2026-10-25 19:53:16 +01:00
bchanot 4e0a6c04d6 docs(docs): R5.7 census, ledger, reproducibility, RUST.md 11.23
CLAUDE.md, WORKSPACE, packages/README, README, sheet model, SUPABASE, TEST_STRATEGY,
PDF-FORMAT and ANNOTATION-RENDERING follow the deletion; RUST.md 11.23 records the census,
counts, the historical TS replay procedure and hashes; CHANGELOG, TODO, R5.7 plan and
contract.
2026-10-25 04:00:15 +01:00
bchanot 1b359598ab chore(workspace): R5.7 delete packages/anatomy and packages/domain
The TS pipeline, domain, upload script and legacy scripts leave; xmldom out of the
lockfile, Dockerfile copies trimmed. LEDGER.tsv (407 cases) and FILES.tsv (112 files)
record each disposition; r4 and r5 census tests guard the tree, lockfile and
production imports.
2026-10-25 04:00:07 +01:00
bchanot 0da7d3ab9f test(domain): R5.7 port the contracts only the TS suites checked
612 leaves and 26 legacy ids (curation_leaves), region inference, R5.1 ledger rows,
generated folder lists, migration-map oracle entry by entry, overlay removal, halo
filter, CHG-000 and dollar-tag refusals; report-v2 fixtures moved to crates/core/tests
(sha256 unchanged).
2026-10-25 03:59:49 +01:00
bchanot 9e87016399 feat(domain): R5.6 fingerprint switch to sha256-rfc8785-validated-v1
The Rust pipeline is the official seed writer (pnpm import:equine); sheet-ref.json
and report-migration-map.json carry 12d78872...74e2 and the v1 block, the only two
seed files changed. 27c7383c...2660 stays a registered alias, honoured only through
LoadedSheet::recognises_historical_stamp (verified v1, recomputed document). M1: the
snapshot of an old report keeps its stamp; export, archive reader strict. Historical
oracles run in their pre-switch context; equivalence is crate-private.
2026-10-25 02:02:42 +01:00
bchanot 2c445063a4 feat(supabase): R5.5 upload-sheet-assets in Rust, R5.4 caps and FLOOR clarification
Core rules curation::upload (manifest, local destination, bytes through the SVG reader,
plan from observed state); binary upload-sheet-assets over ureq (handshake, no overwrite,
confirm after verify, bounded retries, key never printed); pnpm assets:upload repointed,
e2e:sheet-assets for the local stack. 4 MiB cap on changes.json and references.json.
FLOOR clarification for audit prose with its negative proof.
2026-10-23 21:15:22 +02:00
bchanot 88e42749ec docs(docs): R5.4 emoji refusal named at the guard, round 12 residuals declared 2026-10-23 17:13:30 +02:00
bchanot aeb5050502 fix(anatomy): R5.4 field segments and code spans on the generator alphabet, wiki and liquid brackets refused in list items, linear guard 2026-10-23 13:58:14 +02:00
bchanot bc5d0ad038 fix(anatomy): R5.4 authored backticks refused, underscores paired across code spans refused; sweep cites probe_ref and probe_ref_ 2026-10-23 13:21:28 +02:00
bchanot dcef2eb79c fix(anatomy): R5.4 guard rules & (legacy references), image references, nested padded wiki links; linear URL checks 2026-10-23 13:02:21 +02:00
bchanot 124d954a0d fix(anatomy): R5.4 report guard as an allowlist (report_guard.rs), sweep of 762 probes incl. seeded random strings, NUL refused in field segments 2026-10-23 12:39:17 +02:00
bchanot df82424107 fix(anatomy): R5.4 guard covers links, autolinks, references, CJK underscores; ids validated at the op; prescan before the drawing comparison 2026-10-23 12:10:35 +02:00