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:
1 parent
794dfd9d0b
commit
74fcb37564
65 files changed
+2227
-1678
No files matched your search
@@ -1,10 +1,7 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import {
|
||||
readReportDocument,
|
||||
ReportSchema,
|
||||
type Report,
|
||||
} from '@faunosteo/domain'
|
||||
import type { Report } from '@faunosteo/core-wasm/types'
|
||||
import { importAttachment } from '@/pdf/import'
|
||||
import type { SheetIndex } from '@/services/sheetIndex'
|
||||
import { FIXTURES_DIR } from './goldens'
|
||||
import {
|
||||
@@ -16,7 +13,9 @@ import {
|
||||
/**
|
||||
* The three reports the Step 6 goldens and the R2 envelope freeze are drawn
|
||||
* from: the Step 5 v2 archive fixture migrated, the v3 demo report, and a v2
|
||||
* report whose sphenoid and ssb findings the migration cannot place.
|
||||
* report whose sphenoid and ssb findings the migration cannot place. Since
|
||||
* R2 they are read the way the application reads an attachment: the core's
|
||||
* layered reading (v3 parsed, v2 migrated through the sheet's map).
|
||||
*/
|
||||
|
||||
export const GOLDEN_REPORTS = ['v2full', 'demo', 'v2unresolved'] as const
|
||||
@@ -38,21 +37,20 @@ function buildV2Unresolved(sheet: SheetIndex) {
|
||||
(l) => l.zoneId === 'sphenoid' || l.zoneId === 'ssb',
|
||||
)
|
||||
const resolved = leaves.find((l) => l.zoneId === 'frontal')!
|
||||
return readReportDocument(
|
||||
return importAttachment(
|
||||
leavesAsV2Report([...unresolvedFamilies, resolved]),
|
||||
sheet.sheet.migrationMap,
|
||||
)
|
||||
sheet,
|
||||
).read
|
||||
}
|
||||
|
||||
export function buildGoldenReports(sheet: SheetIndex): GoldenReports {
|
||||
const v2unresolved = buildV2Unresolved(sheet)
|
||||
return {
|
||||
reports: {
|
||||
v2full: readReportDocument(
|
||||
readJson('report-v2.full.json'),
|
||||
sheet.sheet.migrationMap,
|
||||
).report,
|
||||
demo: ReportSchema.parse(readJson('report-v3.demo.json')),
|
||||
v2full: importAttachment(readJson('report-v2.full.json'), sheet).read
|
||||
.report,
|
||||
demo: importAttachment(readJson('report-v3.demo.json'), sheet).read
|
||||
.report,
|
||||
v2unresolved: v2unresolved.report,
|
||||
},
|
||||
unresolvedOfV2Unresolved: v2unresolved.unresolvedFindings,
|
||||
|
||||
Reference in new issue
Block a user