feat(app): R4.3b/c import worker, client, controller; HomeRoute on the disposable worker

Protocol v1 (task → ready → result | failed with phase and kind), the worker entry with
the glue bundled statically and the page's compiled Module posted, the file streamed into
the module's memory; client with start and task timers (paused while hidden), settle-once,
terminate always, error events never masked; module-level controller (one import at a
time, cancel on leaving Home, worker chunk prefetched once the engine is loaded); the
settlement mapped to the B.1.8 messages (OD-5: a trap, a timeout or an unreadable file is
« Erreur de lecture du PDF. », never a corrupt PDF). HomeRoute keeps its routing and size
pre-checks, loads its own index after acceptance, drops a result when the session changed.
Tests: handler and client in-process, the corpus message test (O8 51, O7 stored inputs,
O2/O3/Step 5), the six existing suites migrated to the real worker logic.
This commit is contained in:
bchanot committed 2026-10-18 18:10:42 +02:00
1 parent 52471dbbc0
commit 6d1cce6e06
26 files changed
+2164 -247

No files matched your search

+1 -16
View File
@@ -1,11 +1,10 @@
import type { ArchiveImport, RebaseOutcome } from '@faunosteo/core-wasm/types'
import type { ArchiveImport } from '@faunosteo/core-wasm/types'
import {
ArchiveReadError,
readAttachedDocument,
type ArchiveReadErrorKind,
} from '@faunosteo/pdf'
import type { SheetIndex } from '@/services/sheetIndex'
import { UNREADABLE_DRAFT_KINDS } from '@/state/reportStore'
export { MAX_ATTACHMENT_BYTES, MAX_PDF_BYTES } from '@faunosteo/pdf'
@@ -87,17 +86,3 @@ export async function importReportFromPdf(
): Promise<ArchiveImport> {
return importAttachment(await readAttachment(pdfBytes), index)
}
/**
* A rescue copy (`JSON.stringify(report)`, the byte format of the tab's draft)
* read by the core's draft restore, no archive beside it. Content the core
* refuses is `invalid_copy`; any other failure is the engine's or the sheet's.
*/
export function readRescueCopy(text: string, index: SheetIndex): RebaseOutcome {
const outcome = index.ops.restoreDraft(text, null)
if (outcome.ok) return outcome.value.rebase
if (UNREADABLE_DRAFT_KINDS.has(outcome.kind)) {
throw new ImportError('invalid_copy')
}
throw new ImportError('core_unavailable')
}