feat(app): R2 switch — the application runs its domain rules in the Rust core

Consumers now fed by the core (crates/core through @faunosteo/core-wasm):
- the sheet: the bundled payload is parsed and indexed by the core
  (SheetHandle, SheetIndexData); SheetIndex reads precomputed tables only;
- the store: new report, add / remove / move observation, draft restore
  (v2 migration + rebase) through the core, actions answering { ok };
- the editor click chain (zone.click), laterality and vertebra pickers
  (zone.add_sides, vertebra.initial / sync / select), the findings picker
  (finding.toggle by clicked leaf position), zone removal;
- the import: engine byte scan (TypeScript until R4), then the core's
  layered reading and rebase in one call; the export: the core builds the
  sheet snapshot, the frozen TypeScript engine writes the PDF (R4).
Lazy core: Home and the new-report form read the sheet availability from
the bundle and load the module on import / submit only; the auth shell
never references it. Degraded states (core_unavailable, invalid_sheet)
show the validated notice with a retry and never redirect or touch the
draft; an unreadable draft or archive is set aside under
osteo:quarantine:* (only content kinds; a failed write keeps it in place
and the editor stays), a rebase that flags items keeps the raw pre-rebase
draft. Four strings, wording validated by the owner.
Deleted: services/zoneInteraction.ts and its suite (13 cases ported to
cargo), the TypeScript Finding builder and vertebra selection rules of the
pickers, store rules, persistence parsing, hydrateReport. ESLint forbids
@faunosteo/domain in apps/app/src; the report:compare CLI keeps the frozen
domain until R4 (scripts/compare/sheet.ts). App suite 313/313 on the real
core (24 new tests: quarantine, degraded editor, core failures, N-1
reader); step6 goldens and the frozen envelopes unchanged.
This commit is contained in:
bchanot committed 2026-10-14 00:41:34 +02:00
1 parent 794dfd9d0b
commit 74fcb37564
65 files changed
+2227 -1678

No files matched your search

+9
View File
@@ -24,6 +24,8 @@ export const en: Dict = {
'Reopen a previous report generated by this app to follow up.',
'home.import.cta': 'Choose a PDF',
'home.import.loading': 'Reading…',
'home.import.error_core_unavailable':
'The reading engine could not be loaded. Try the import again.',
'home.import.error_generic': 'Failed to read the PDF.',
'home.import.error_invalid_pdf': 'This file is not a readable PDF.',
'home.import.error_no_attachment':
@@ -76,6 +78,8 @@ export const en: Dict = {
'PDF exported with missing elements: {items}. Check the browser console.',
'editor.draft_rebased':
'Draft restored on an anatomical sheet different from the one it was created on. Items not found: {count} (kept with their labels).',
'editor.draft_quarantined':
"This tab's draft could not be read by this version of Faunosteo. It was set aside, not deleted.",
'editor.edit_infos': 'Edit info',
'editor.edit_dialog_title': 'Edit information',
'editor.disclaimer_title': 'Legal scope of animal osteopathy',
@@ -152,6 +156,11 @@ export const en: Dict = {
'Anatomical sheet: reference draft, not medically validated',
'sheet.status.published': 'Official anatomical sheet',
'sheet.loading': 'Loading the anatomical sheet…',
'sheet.core_unavailable':
"Faunosteo's computation engine could not be loaded. Your session data is kept.",
'sheet.core_retry': 'Retry',
'core.action_failed':
'This action could not be applied. Try again; your report was not changed.',
// unresolved (migrated) data
'observation.unresolved_short': 'inherited',
+9
View File
@@ -26,6 +26,8 @@ export const fr: Dict = {
'Reprendre un bilan précédent généré par cette application pour effectuer un suivi.',
'home.import.cta': 'Choisir un PDF',
'home.import.loading': 'Lecture…',
'home.import.error_core_unavailable':
"Le moteur de lecture n'a pas pu être chargé. Réessayez l'import.",
'home.import.error_generic': 'Erreur de lecture du PDF.',
'home.import.error_invalid_pdf': "Ce fichier n'est pas un PDF lisible.",
'home.import.error_no_attachment':
@@ -82,6 +84,8 @@ export const fr: Dict = {
'PDF exporté avec des éléments manquants : {items}. Vérifiez la console du navigateur.',
'editor.draft_rebased':
'Brouillon restauré sur une fiche anatomique différente de celle où il a été créé. Éléments non retrouvés : {count} (conservés avec leurs libellés).',
'editor.draft_quarantined':
"Le brouillon de cet onglet n'a pas pu être relu par cette version de Faunosteo. Il a été mis de côté, pas supprimé.",
'editor.edit_infos': 'Modifier les infos',
'editor.edit_dialog_title': 'Modifier les informations',
'editor.disclaimer_title': "Périmètre légal de l'ostéopathie animale",
@@ -166,6 +170,11 @@ export const fr: Dict = {
'Fiche anatomique : brouillon de référence, non validé médicalement',
'sheet.status.published': 'Fiche anatomique officielle',
'sheet.loading': 'Chargement de la fiche anatomique…',
'sheet.core_unavailable':
"Le moteur de calcul de Faunosteo n'a pas pu être chargé. Vos données de session sont conservées.",
'sheet.core_retry': 'Réessayer',
'core.action_failed':
"Cette action n'a pas pu être appliquée. Réessayez ; votre bilan n'a pas été modifié.",
// unresolved (migrated) data
'observation.unresolved_short': 'hérité',
+8
View File
@@ -14,3 +14,11 @@ export function pickLocaleLabel(
if (locale === 'en') return en || fr || fallback
return fr || en || fallback
}
/** The same rule for a `{ fr, en }` label of the sheet or a snapshot ('' when absent). */
export function pickLabel(
text: { fr?: string; en?: string } | null | undefined,
locale: Locale,
): string {
return pickLocaleLabel(text?.fr, text?.en, locale)
}