docs(docs): realign active docs on develop for P0

Roadmap section and step statuses in the plan, D-R9 Rust services in
place of Edge Functions and a Node worker, platform roles per BDR-026,
equine sheet draft-only, curation-only authoring until Step 17,
OPEN_QUESTIONS statuses and conflict resolutions, dated snapshot
notices on the Step 0 documents.
This commit is contained in:
bchanot committed 2026-10-25 17:12:37 +01:00
1 parent c71fafa3c5
commit ac60b24267
12 files changed
+260 -92

No files matched your search

+90 -37
View File
@@ -12,6 +12,39 @@ Reference product/architecture: `faunosteo-business-architecture.md`
does today; the architecture document is the source of truth for what it
must become. Where the two disagree, `OPEN_QUESTIONS.md` records it.
## 0. Where the plan stands (2026-10-25)
Done on `develop`: Steps 0 to 8 (Step 4 in three parts 4, 4b, 4c) and the Rust
migration R0 to R5 (`RUST_ARCHITECTURE_REVIEW.md`, `RUST.md`): every domain
rule, the SVG reader, the PDF reader and writer, the curation pipeline and the
files worker are Rust (`crates/`). Merging into `develop` authorises nothing in
production; release 0.2.0 (Steps 3 to 6) is still waiting (TODO RR-9).
The product roadmap validated by the owner on 2026-10-25 regroups the
remaining steps toward a first usable version: a signed-in practitioner keeps
clients, animals and bilans in the cloud, with history and PDF, on phone and
computer. Inventory: `.claude/audits/2026-10-25-functional-inventory.md`.
| Order | Content | Plan steps |
|---|---|---|
| P0 | Documents realigned on the code, decisions recorded (`OPEN_QUESTIONS.md` statuses) | none |
| V1-1 | Clients and animals of a practitioner's workspace, with the permission frame of future cabinets (`V1-1_OWNERS_ANIMALS.md`) | 12 reduced, frame of 10 |
| V1-2 | Anatomical sheets loaded from Supabase under control (no publication of the equine draft without the owner) | 13 reduced |
| V1-3 | Bilans persisted, linked to an animal, history | 14 (+ 11 skeleton if a quota applies) |
| V1-4 | Stored PDF artifacts and authorised sharing | 15 reduced, sharing part of 12 |
| V1-5 | Cross-cutting mobile and accessibility validation | design README, `TEST_STRATEGY.md` |
| Next | Verification 9, cabinets 10, entitlements 11, then 16 to 27 | per step |
Accessibility and security apply at every step, not only at V1-5. The release
readiness track (TODO RR-1 to RR-10) stays separate: no V1 step authorises a
release or a public exposure, and passing development tests is not a
production authorisation. The step texts below keep their numbering; each V1
item reuses the step it reduces. For a done step, the block is the original
specification: its "as built" note, the code and `CLAUDE.md` are
authoritative where they differ (the TypeScript packages `domain`, `anatomy`
and `pdf` named in Steps 4 to 6 were replaced by `crates/core` and deleted at
R4.8 and R5.7).
## 1. How to read the plan
- Steps follow the real dependency order, not the commercial sprint order of
@@ -32,12 +65,14 @@ must become. Where the two disagree, `OPEN_QUESTIONS.md` records it.
## 2. Guiding principles for every step
1. `pnpm typecheck && pnpm test:run && pnpm lint` green before any commit; for
DB steps also `supabase db reset && supabase test db` (architecture §36).
DB steps also `pnpm db:reset && pnpm db:test` (the CLI runs only through
`scripts/supabase.sh`); after a Rust change `pnpm rust:check`; before a
merge `pnpm check:all`.
2. A step that adds a table adds its RLS policies, indexes, pgTAP tests and
regenerated types in the same branch.
3. The UI is never the security boundary; every rule listed in
`BACKEND_ARCHITECTURE.md` §10 is implemented in PostgreSQL or a server
function.
`BACKEND_ARCHITECTURE.md` §10 is implemented in PostgreSQL or in a Rust
server process (`crates/worker` or a Rust HTTP service, D-R9).
4. No deletion of user data. Soft delete, revisions, archive.
5. Legacy modules are deleted at the step named in
`REPOSITORY_MIGRATION_MAP.md`, in the same branch that makes them dead.
@@ -200,7 +235,8 @@ Risks: snapshot size growth with future sheets (mitigate: snapshot subset = only
Milestone A (after Step 6): release 0.2.0 "canonical sheet + PDF v3", still a
local tool. Everything above has no backend and can ship to faunosteo.com
as-is.
as-is. Status 2026-10-25: `release/0.2.0` cut on 2026-10-11, not finished; its
fate (ship, supersede, rebase) is TODO RR-9.
```text
Step 7
@@ -220,7 +256,7 @@ Step 7 implementation note (2026-10-11): shipped as `docs/development/IDENTITY.m
Deviations: no TanStack Query (a zustand store covers the profile read/update of this
step; the query layer comes with the first list screens); `platform_invitations` and the
MFA helper not written (no admin screen to protect yet, gap documented in IDENTITY.md §4);
professional fields added to `profiles` as declared free text (verification = Step 11);
professional fields added to `profiles` as declared free text (verification = Step 9);
Google/Apple wired in config.toml behind env ids, buttons behind `APP_AUTH_PROVIDERS`.
```text
@@ -244,7 +280,8 @@ Step 8 as built (2026-10-13, `STEP8_FILES_ANALYSIS.md` D1–D9 + Rust R1,
family); there is no `issue_signed_url` RPC (the Storage API signs after the
SELECT policy; the owner-only avatar is downloaded under RLS, no signed URL);
the SVG sanitiser and the user SVG upload path move to Step 13 with their
producer (the allowlist sanitiser already exists in `packages/pdf`); the
producer (the allowlist sanitiser then lived in `packages/pdf`; since R3 it
is the Rust core's one SVG reader, `anatomy::svg::read_svg`); the
avatar pointer is derived from the single clean `assets` row (no
`profiles.avatar_asset_id`); the sheet bucket keeps its name
`anatomical-sheet-assets`.
@@ -288,7 +325,7 @@ Changes expected:
Tests: pgTAP matrix: free user, verified free user, invited grant with expiry, admin role; expired grant yields nothing.
Manual validation: grant an invited entitlement to a user via admin RPC and watch capabilities change.
Definition of Done: no is_paid boolean anywhere; every later feature reads capabilities.
Risks: capability list drift (keep it as one SQL enum + one TS const checked by a test).
Risks: capability list drift (keep it as one SQL enum + one Rust const in the core, exported to TypeScript through ts-rs, checked by a test).
```
```text
@@ -305,20 +342,37 @@ Definition of Done: architecture Sprint 3; rule 1 (animal ≠ sheet) visible in
Risks: the global-client design (C4) if confirmed as plain shared rows; GDPR consent texts not final (version column from day one).
```
Step 12 note (2026-10-25): roadmap item V1-1 proposes a reduced Step 12 under
the owner's orientation C4 (records attached to a workspace, one personal
workspace per practitioner, cabinets later, no global client record shared
between practitioners), without consents, grants, sharing, files or candidate
matching: `V1-1_OWNERS_ANIMALS.md`. The text above stands until the owner
ratifies the contract's orientations (§9.1) and answers its sub-choices
(§9.2).
```text
Step 13 (∥ Steps 9–12)
Name: Anatomical sheets in the database and official equine seed
Objective: Sheet and version tables with immutability, SVG assets in Storage, seed of the official equine sheet v1, SheetProvider over Supabase, read-only sheet library in the app.
Objective: Sheet and version tables with immutability, SVG assets in Storage, seed of the official equine sheet as a draft, SheetProvider over Supabase, read-only sheet library in the app.
Dependencies: Step 3, Step 4, Step 8
Changes expected:
- supabase: anatomical_sheets, anatomical_sheet_versions (content_jsonb + schema CHECK), immutability trigger on published rows, version numbering RPC, deprecate RPC, GC function with the four preconditions (no report, no fork, no grant, no pending process) returning candidates only (deletion job at Step 18), helpers can_use_sheet/can_fork_sheet (creator-only for now), seed script uploading the two SVG assets and inserting v1 published.
- supabase: anatomical_sheets, anatomical_sheet_versions (content_jsonb + schema CHECK), immutability trigger on published rows, version numbering RPC, deprecate RPC, GC function with the four preconditions (no report, no fork, no grant, no pending process) returning candidates only (deletion job at Step 18), helpers can_use_sheet/can_fork_sheet (creator-only for now), operator upload of the drawings (`pnpm assets:upload`) and the generated draft seed. Publication of the official equine sheet is an explicit act of a platform admin after the business review of REVIEW-REPORT.md (BDR-034, BDR-037); no step publishes it automatically.
- packages/supabase: typed accessors; apps/app: SheetProvider.supabase replaces the bundled seed in production builds (bundled kept for tests), /app/anatomy read-only list and preview.
Tests: pgTAP: UPDATE on published content raises; v2 numbering; GC preconditions each individually; non-creator cannot read a private sheet; integration: seed is idempotent and byte-faithful (checksums).
Manual validation: open /app/anatomy, see "Faunosteo / Cheval / officielle v1", preview both views, click zones (no report yet).
Definition of Done: rules 4–7 enforced in SQL; public/species/* no longer fetched by apps/app (nginx /species/ rule removed); SvgEditorRoute loads assets through signed URLs.
Risks: seed drift vs the committed document.json (CI compares); storage policy for public sheets to be widened at Step 18 only.
Manual validation: open /app/anatomy, see "Faunosteo / Cheval / officielle" with its draft or published status, preview both views, click zones (no report yet).
Definition of Done: rules 4–7 enforced in SQL; the app loads the sheet document and its drawings from Supabase, every drawing through the core's SVG reader; the bundled sheet stays for tests and the local tool.
Risks: seed drift vs the generated folders (`pnpm import:equine --check` and the curation tests compare; no CI runs, BDR-047); storage policy for public sheets to be widened at Step 18 only.
```
Step 13 status (2026-10-25): the tables, immutability triggers, RPCs, the
`anatomical-sheet-assets` bucket and the generated equine DRAFT seed exist
since Steps 4, 4b and 4c (migrations `20261008110000`, `20261009100000`,
`20261010100000`); `public/species/` and the SVG editor were deleted at
Step 5. Remaining: the provider over Supabase, the library screen, the GC
candidates. Roadmap item V1-2 reduces the step to a controlled loading of the
sheets; whether a signed-in practitioner may load the unpublished draft is an
owner decision taken at V1-2.
```text
Step 14
Name: Cloud reports
@@ -339,12 +393,12 @@ Name: PDF artifacts and cloud import
Objective: Store generated PDFs as report artifacts; import PDFs into the account through a server-validated path; render historical reports even if the sheet is gone.
Dependencies: Step 6, Step 14. Gate: confirmation before touching import/attachment code again.
Changes expected:
- supabase: report_pdf_artifacts (asset, locale, revision no, sha256), RPC import_report(attachment json, target animal) doing: version check, Zod validation server-side (plpgsql cannot run Zod → validate in an Edge Function or accept the attachment into a staging row and validate in the app with a server re-check of the invariants that matter: sheet version exists or snapshot-only version created, quota, ownership), snapshot-only version creation (read-only, status deprecated, flagged snapshot_only) when the referenced version no longer exists.
- supabase: report_pdf_artifacts (asset, locale, revision no, sha256), RPC import_report(attachment json, target animal) doing: version check, server-side validation of the archive (plpgsql cannot run the core's readers → run the Rust core's archive reader in a Rust service, D-R9, or accept the attachment into a staging row, read it with the core in the browser and re-check on the server the invariants that matter: sheet version exists or snapshot-only version created, quota, ownership), snapshot-only version creation (read-only, status deprecated, flagged snapshot_only) when the referenced version no longer exists. Opening import to external users stays gated by PDF_IMPORT_HARDENING.md §5 (BDR-040).
- apps/app: download/open artifact list on a report; import flow from the dashboard with quota preflight message and pricing redirect.
Tests: pgTAP: import beyond quota denied before any insert; snapshot-only version is never selectable for new reports; integration: export → delete sheet version (as admin) → import → PDF re-renders.
Manual validation: export, import into a second account (denied: wrong animal/owner), import into own account, check artifact list.
Definition of Done: rule 8 (historical restorable) demonstrated by test; PDF v2 import decision (Q1) applied.
Risks: Zod validation location (server vs client) must be decided per Q2; duplicate imports (idempotency by report id + sha256).
Risks: validation location (Rust service vs browser core with server re-check) decided at the step; duplicate imports (idempotency by report id + sha256).
```
```text
@@ -367,15 +421,15 @@ with the practitioner client. Steps 17–18 can start before B.
```text
Step 17 (∥ Steps 14–16)
Name: Anatomical sheet editor (merge of SVG editor and findings editor)
Objective: One structured editor on the canonical document: views, points/zones, categories, laterality, vertebral config, detail view creation, finding tree, annotation ↔ zone mapping, draft/publish/deprecate; personal sheets and official sheet maintenance; old tools deleted.
Dependencies: Step 13 (tables), Step 5 (document), decisions Q4/Q5/C8
Objective: One structured editor on the canonical document: views, points/zones, categories, laterality, vertebral config, detail view creation, finding tree, annotation ↔ zone mapping, draft/publish/deprecate; personal sheets and official sheet maintenance.
Dependencies: Step 13 (tables), Step 5 (document). Q4, Q5 and C8 are settled (OPEN_QUESTIONS statuses).
Changes expected:
- apps/app: /app/anatomy (library: official, own), /app/anatomy/new, /app/anatomy/:sheetId/editor with SheetEditorStore (document + selection + mode + undo), canvas tools (select/point/polygon, drag, vertex edit), properties panel, categories panel, views panel (create detail view from zone: bbox + margin → view_box, child view), vertebral config panel, findings panel (tree edit from pathology-editor behaviour + validation), mapping panel (annotation → finding zone, suggestions from zoneMatch allowed here as a helper), publish flow (new immutable version), deprecate.
- Deleted in the same branch: SvgEditorRoute.tsx, svg-editor.css, svg_editor.* keys, EditorsRoute, public/pathology-editor.html, public/species/equine/pathologies.json, scripts/scaffold-species.mjs.
- supabase: draft uniqueness (one draft per sheet), publish RPC validating the document (mapping targets exist, no dangling views) and uploading assets, personal-sheet creation RPC.
- apps/app: /app/anatomy (library: official, own), /app/anatomy/new, /app/anatomy/:sheetId/editor with SheetEditorStore (document + selection + mode + undo), canvas tools (select/point/polygon, drag, vertex edit), properties panel, categories panel, views panel (create detail view from zone: bbox + margin → view_box, child view), vertebral config panel, findings panel (tree edit + validation by the core), mapping panel (annotation → finding zone), publish flow (new immutable version), deprecate. Document rules, validation and drawing go through `crates/core` (BDR-043).
- The legacy tools (SvgEditorRoute, EditorsRoute, public/pathology-editor.html, public/species, scripts/scaffold-species.mjs) were already deleted at Step 5 (BDR-038); until this step, sheet content changes only through `curation/changes.json` and the Rust pipeline, reviewed, tested and versioned, and no graphic editor changes or publishes it (owner confirmed 2026-10-25). Annotating a bilan never changes the anatomical reference.
- supabase: draft uniqueness (one draft per sheet, exists since Step 4), publish RPC validating the document (mapping targets exist, no dangling views) and uploading assets, personal-sheet creation RPC.
Tests: one test per legacy operation (audit 03 §2, 05 §3.5) on the new model; detail-view geometry; publish creates v+1 and v1 reports still render (regression from Step 15 fixtures); pgTAP for draft uniqueness and publish validation.
Manual validation: fork-free scenario: create a personal sheet from scratch for a second species (dog, 3 points, 1 spine zone, 1 detail), publish, create a report on it, PDF; then edit the official sheet as admin, publish v2, open an old report (still v1).
Definition of Done: architecture Sprint 6 (except "promote manual point", added once Q6 is answered); REPOSITORY_MIGRATION_MAP REPLACE items for the editors closed.
Definition of Done: architecture Sprint 6 (except "promote manual point", added once Q6 is answered); every legacy editor operation of audit 03 §2 and 05 §3.5 covered on the new model.
Risks: largest UI step; split into sub-branches (canvas tools / panels / publish) each merged green behind a "beta" flag; feature parity gaps with the vanilla tool found late (mitigate with the reference tests first).
```
@@ -396,16 +450,15 @@ Risks: discovery performance (indexes §32); GC race with an in-flight report cr
```text
Step 19
Name: Notifications foundation and worker
Objective: Email provider abstraction, PostgreSQL job queue, apps/worker, transactional templates FR/EN, secure links.
Objective: Email provider abstraction, PostgreSQL job queue, notification jobs in the Rust worker, transactional templates FR/EN, secure links.
Dependencies: Step 7, Step 12 (document delivery to clients), decision Q7 (provider)
Changes expected:
- apps/worker: Node service, service-role client, job loop on private.jobs (SKIP LOCKED), EmailProvider interface + one implementation, retry/backoff, no clinical data in logs.
- supabase: private.jobs, email delivery log, secure_links (token hash, purpose, expiry).
- packages/i18n split (dictionaries without React) for templates.
- Docker: worker service in compose.
Tests: unit: queue semantics, template rendering; integration: enqueue → worker sends to Inbucket; secure link single-use and expiry.
- crates/worker (Rust, exists since Step 8 / R1 with the avatar job family and its compose service): a notification job family on the PostgreSQL queue (SKIP LOCKED or the lease-token pattern of BDR-048), EmailProvider trait + one implementation, retry/backoff, no clinical data in logs; least privilege per process (D-R9).
- supabase: job table, email delivery log, secure_links (token hash, purpose, expiry).
- Template dictionaries readable by the worker (FR/EN), kept in step with the app dictionaries.
Tests: unit: queue semantics, template rendering; integration: enqueue → worker sends to Mailpit; secure link single-use and expiry.
Manual validation: trigger "send report to owner" and receive the secure link locally.
Definition of Done: first job that is not SQL runs in the worker; architecture §22.3–22.4.
Definition of Done: notification jobs run in the worker; architecture §22.3–22.4 with D-R9 applied.
Risks: provider deliverability (SPF/DKIM at DNS); worker single instance (acceptable at launch).
```
@@ -417,7 +470,7 @@ Dependencies: Step 12, Step 19, Step 11 (booking.manage)
Changes expected:
- supabase: service_types, locations, availability_rules, availability_exceptions, appointments, intake_forms/questions/answers, RPCs request_booking (row lock on practitioner-day, one pending per client), confirm/reject/cancel/reschedule, expiry function (48h / 24h if <72h / 1h if <25h) run by pg_cron, availability RPC (server-side evaluation; travel buffers as fixed minutes until Step 21).
- apps/app: /app/calendar (week view), services/locations settings, manual appointment, intake form builder (default templates per species).
Tests: pgTAP: double request on the same slot (one wins), second pending request by the same client denied, expiry rules at each boundary, status transitions; unit: expiry rule mirror in TS; integration: full booking lifecycle.
Tests: pgTAP: double request on the same slot (one wins), second pending request by the same client denied, expiry rules at each boundary, status transitions; unit: expiry rule mirror in the Rust core (BDR-043); integration: full booking lifecycle.
Manual validation: book as a client via a test page (public UI comes at Step 22), confirm as practitioner, reminder enqueued (Step 19).
Definition of Done: architecture Sprint 8; principle 13 (race-safe) tested.
Risks: timezone handling (store timestamptz, practitioner tz on profile); calendar UI effort (consider a maintained library, declared at the step).
@@ -430,8 +483,8 @@ Objective: RoutingProvider abstraction with cache, travel before/after, return-t
Dependencies: Step 20, Step 19 (worker, alerts)
Changes expected:
- supabase: travel_profiles, travel_pricing_rules, route_cache, external_calendar_connections (encrypted credentials, server only), external_calendar_events, availability RPC extended with travel.
- apps/worker: routing provider adapter (one provider chosen after evaluation; interface first), calendar sync jobs, conflict detection.
- Edge Function or worker endpoint for Google OAuth callback.
- crates/worker: routing provider adapter (one provider chosen after evaluation; interface first), calendar sync jobs, conflict detection.
- Google OAuth callback served by a Rust HTTP service behind the reverse proxy (same image, `serve` subcommand, its own secrets; D-R9). Edge Functions are not used.
Tests: unit: engine with a mocked provider (previous location → travel → appointment → travel → next); pgTAP: external events block slots, titles never exposed; integration: ICS feed import.
Manual validation: two appointments 30 km apart; the availability RPC refuses the gap; connect a Google test calendar and see the block.
Definition of Done: architecture Sprint 9; no provider name in business logic.
@@ -442,7 +495,7 @@ Risks: provider cost/quota; refresh token storage (pgsodium or app-level encrypt
Step 22
Name: Public web and booking widget
Objective: apps/public-web with landing, practitioner public profile, search, SEO; booking widget (iframe + token).
Dependencies: Step 7, Step 9, Step 20, decision Q8 (framework)
Dependencies: Step 7, Step 9, Step 20. Framework: Astro (D-R8, validated with BDR-045; re-checked at the step's brainstorm per the global rule)
Changes expected:
- supabase: public_practitioner_profiles, public views/RPCs (approved columns only), booking_widget_tokens, public booking RPCs rate-limited.
- apps/public-web: SSR pages /, /osteopathe/<slug>, /osteopathes-animaliers/<region|city|species>, sitemap, metadata; booking UI used both on the profile and inside the widget iframe (postMessage height/theme).
@@ -450,7 +503,7 @@ Changes expected:
Tests: pgTAP: anon sees only published profiles and approved columns, never clients/animals/reports; e2e: book from the public page; widget on a static test site.
Manual validation: publish a profile, open it logged out, book; embed the widget script in a local HTML page; revoke the token.
Definition of Done: architecture Sprint 10; SEO checks (/seo, /web-validate) pass on the public pages.
Risks: SEO data leak via views (allow-list columns, tested); framework choice (Q8).
Risks: SEO data leak via views (allow-list columns, tested).
```
```text
@@ -460,7 +513,7 @@ Objective: Stripe customers/subscriptions for individual monthly/yearly, entitle
Dependencies: Step 11, Step 10, Step 7 (verified email + phone for referral), Step 19 (emails)
Changes expected:
- supabase: subscriptions filled by webhook, subscription_seats, referrals, webhook idempotency table, invoice links; get_effective_entitlements covers active subscriptions and referral months.
- Edge Function stripe-webhook (signature check, idempotent); checkout session creation RPC/Edge.
- Stripe webhook endpoint in a Rust HTTP service behind the reverse proxy (signature check, idempotent, its own secret; D-R9); checkout session creation by the same service.
- apps/app: /app/billing (plan, invoices, cancel at period end), pricing page redirect from quota blocks, referral code and status.
Tests: pgTAP: entitlement with active/cancelled/past-due subscription; referral cap 5/year; reward only after referred becomes paying; unit: webhook handler idempotency; integration with Stripe test clocks.
Manual validation: subscribe in test mode, see capability change, cancel, hit period end with a test clock.
@@ -475,7 +528,7 @@ Objective: Staging model, adapters (generic CSV/XLSX/JSON/ZIP, Faunosteo PDF v2/
Dependencies: Step 15 (PDF import), Step 12, Step 11, Step 19 (long imports in worker)
Changes expected:
- supabase: import_jobs, import_files, import_raw_records, import_mappings, import_errors, import_unmapped_data; commit RPC in one transaction; quota preflight.
- apps/worker: ImportAdapter interface (detect/inspect/map/validate/transform/commit), generic adapters; vendor adapters behind feature flags until samples are obtained.
- crates/worker: ImportAdapter trait (detect/inspect/map/validate/transform/commit), generic adapters; vendor adapters behind feature flags until samples are obtained.
- apps/app: /app/settings/import wizard (upload → preview → duplicates → confirm), "Données importées" panel on client/animal.
Tests: adapters on fixture files; pgTAP: commit is atomic (20 reports on a free account roll back entirely); duplicates never auto-merged; traceability of every transformed field.
Manual validation: import a CSV with a duplicate client; confirm the review; check unmapped data is visible.
@@ -503,7 +556,7 @@ Name: Data lifecycle: export, deletion, archive
Objective: Account data export, deletion workflow with hot retention, archive package to S3-compatible storage, sheet-version GC in production mode, restoration from archive.
Dependencies: Step 19 (worker), Step 23 (subscription states), Step 15 (artifacts)
Changes expected:
- apps/worker: export job (JSON + files manifest + checksums), archive job (lifecycle rules, no Object Lock), restore job; supabase: account_lifecycle states (active, restricted, archived, deleted), minimal archive pointer.
- crates/worker: export job (JSON + files manifest + checksums), archive job (lifecycle rules, no Object Lock), restore job; supabase: account_lifecycle states (active, restricted, archived, deleted), minimal archive pointer.
- apps/app: data export request, account deletion request.
Tests: unit: manifest/checksum; integration: export → delete → restore on staging; GC and archive never delete a version referenced by an archived report before its legal retention.
Manual validation: run the full cycle on a test account with artifacts.
@@ -659,7 +712,7 @@ only on explicit human signal.
| PDF: attachment format change, import of user data, browser-only rasteriser | CRITICAL | Steps 6, 15 | v3 format documented, v2 adapter, confirmation gate, Rasterizer interface |
| RLS mistakes | CRITICAL | every DB step | helper + pgTAP per table, full matrix at Step 27, no `USING (true)` for authenticated on core tables |
| Multi-tenant leakage via organization context | CRITICAL | Steps 10, 14 | context passed explicitly to services; org-scoped tests |
| Storage: direct uploads bypass metadata; signed URL leakage | IMPORTANT | Step 8 | insert policy requires assets row; short-lived signed URLs |
| Storage: direct uploads bypass metadata; signed URL leakage | IMPORTANT | Step 8 | insert policy requires assets row; owner-only files downloaded under RLS with no signed URL (BDR-048); short-lived signed URLs only for shared kinds |
| Offline conflicts overwriting server data | IMPORTANT | Step 16 | stale base rejection, conflict revisions, user choice |
| Agenda race conditions and expiry errors | IMPORTANT | Step 20 | row locks, single SQL expiry function, boundary tests |
| Route/travel provider lock-in or cost | IMPORTANT | Step 21 | `RoutingProvider` interface, cache, provider chosen after evaluation |
@@ -670,7 +723,7 @@ only on explicit human signal.
| Phone/email providers undecided | IMPORTANT | Steps 7, 19 | interfaces first; email-only verification until Q7 |
| Vocabulary collision (Observation) in new UI strings | LOW | all UI steps | fixed in C7 |
| Workspace move regressions | LOW | Step 2 | manual script + CI |
| Public site framework choice | LOW | Step 22 | Q8, isolated app |
| Public site framework choice | LOW | Step 22 | Astro (D-R8), isolated app |
## 9. Deliverable checklist per step (applies to every step)