chore(chore): R3 owner decisions verify contract

This commit is contained in:
bchanot committed 2026-10-15 01:06:41 +02:00
1 parent 4553bf9b06
commit 2aa27b8e64
1 file changed
+37
@@ -0,0 +1,37 @@
# CONTRACT — R3 owner decisions: trigger names per language, two canvas failure messages
- date: 2026-10-15 | flow: ad-hoc on the R3 branch, verifier gate | branch: feature/rust-r3-anatomy-core
- spec: owner brief 2026-10-15 "R3 : décisions UX" (decision 1, decision 2, final checks)
- diff range: 23895b9..HEAD (run every CHECK from the repository root; `. scripts/rust-env.sh` first for cargo)
## REQUEST (IMMUTABLE)
Decision 1: fix the inconsistency of view triggers without an explicit name: the fallback labels must follow the selected language, FR or EN. Do not change stable identifiers, internal references, historical data or archive content. Check the exact role of the two name attributes before changing them: any field used as an identifier or a persistent contract stays stable. Add tests of the translations and of the fallback when a translation is missing. No graphic redesign. Decision 2: distinguish the Rust/WASM engine that could not load from an SVG view that is invalid, refused or cannot be composed; distinct, understandable FR/EN messages; detailed technical errors kept in internal checks, no sensitive detail in the interface; no Retry button for a deterministic error no retry can fix; preserve user data, never erase or replace the refused drawing; targeted, no major design change. Final checks: Rust and WASM tests, anatomical integration tests, DOM parity and reference captures, FR/EN labels, report and PDF non-regression, `pnpm check:all`, relevant audits. Never modify existing goldens to hide a difference. Do not merge R3, do not start R4, no production or release change.
## CLARIFICATIONS
- The frozen R3 oracles keep the French name twice for the unnamed trigger; the tests apply the owner's declared change to them before comparing (`with_trigger_names_per_language` in crates/core/tests/common/svg_tree.rs, `withTriggerNamesPerLanguage` in apps/app/tests/helpers/svgTree.ts, `declared` in scripts/visual-canvas.mjs); the files are unchanged.
- The two name attributes are display data: read by the canvas tooltip (which skips triggers) and the native title; never an identifier (`data-anno-id` is), never persisted.
## ACCEPTANCE CRITERIA
1. No golden or oracle file changed in the range.
CHECK: git diff --stat 23895b9..HEAD -- apps/app/tests/fixtures crates/core/tests/oracles crates/core/tests/fixtures supabase/seed | wc -l
EXPECT: 0
2. An unnamed trigger takes the opened view's name per language, with a fallback; a named one keeps its names (Rust tests).
CHECK: . scripts/rust-env.sh && cargo test -p faunosteo-core --lib anatomy::layer 2>&1 | grep "test result"; cargo test -p faunosteo-core --test anatomy_layer 2>&1 | grep -E "an_unnamed_trigger_names_the_opened_view|test result"
EXPECT: 2 passed / the named test ok and 3 passed
3. The stable identifier and the persisted contracts are untouched: only the name attribute values of triggers changed in the layer code.
CHECK: git diff 23895b9..HEAD -- crates/core/src/anatomy/layer.rs | grep -E '^[+-] ' | grep -c 'data-anno-id'; git diff --stat 23895b9..HEAD -- crates/core/src/domain | wc -l
EXPECT: 0 / 0
4. The canvas distinguishes the two failures, with a retry only for the engine, and distinct FR/EN messages.
CHECK: grep -c "canvas.view_unavailable" apps/app/src/i18n/fr.ts apps/app/src/i18n/en.ts apps/app/src/components/canvas/AnatomyCanvas.tsx; grep -n "failure === 'engine' &&" apps/app/src/components/canvas/AnatomyCanvas.tsx | wc -l
EXPECT: fr.ts:1 en.ts:1 AnatomyCanvas.tsx:1 / 1
5. The interface shows no technical detail: the kind/detail go to the DEV console only.
CHECK: grep -n "console.warn" apps/app/src/anatomy/drawing.ts; grep -c "import.meta.env.DEV" apps/app/src/anatomy/drawing.ts
EXPECT: one console.warn line / 1
6. The canvas suites cover: the view failure (no retry, drawing and draft untouched), the engine failure (retry draws the view), both in English, and the O1 trees with the declared change.
CHECK: cd apps/app && npx vitest run tests/unit/components.AnatomyCanvas.test.tsx tests/unit/canvas.trees.test.tsx 2>&1 | grep -E "Tests "
EXPECT: Tests 13 passed (13)
7. The whole gate is green.
CHECK: ./node_modules/.bin/pnpm check:all > /tmp/r3d-verify.log 2>&1; echo "exit $?"; grep "apps/app test:run: Tests" /tmp/r3d-verify.log
EXPECT: exit 0 / Tests 354 passed (354)
8. The rendering contract changed before the rendering code.
CHECK: git log --format=%h 23895b9..HEAD -- docs/ANNOTATION-RENDERING.md crates/core/src/anatomy/layer.rs | tail -2
EXPECT: the docs commit d8e9bd3 is older than (listed after) the layer commit 6882c6d