refactor(pdf): R4.8 the TypeScript PDF engine leaves: packages/pdf, pdf-lib, the TS CLI and import path, the oracle generators deleted; test read-back on an own reader of the writer's files (pdfFile.ts), view goldens from the session's SVGs, import helper on the module's reader, N-1 scanner exported by core-wasm/n-1; app no longer depends on @faunosteo/domain; r4.census suite

This commit is contained in:
bchanot committed 2026-10-19 12:17:01 +02:00
1 parent 77e11a53e4
commit 0dc1ba27c7
96 files changed
+743 -15769

No files matched your search

@@ -3,8 +3,10 @@
* (`CoreExportSession`): driven request by request on the O2 runs it writes the native
* bytes (`goldens/r4/pdf.*.sha256`), which the module's own reader imports back onto the
* bundled sheet as the report they carry (export Rust → import Rust, no loss); every view
* it asks for is the SVG the TypeScript engine composes (`composeHighlightedViewSvg`)
* and, on the real-raster run, the digests and sizes the R4.1 rasteriser recorded
* it asks for is composed on the view's own frame with the observation's markers
* highlighted (the text itself is pinned in cargo: `pdf_session` against `compose_highlight`,
* `anatomy_compose` against the frozen R3 trees of the TypeScript engine) and, on the
* real-raster run, the digests and sizes the R4.1 rasteriser recorded
* (`pdf/r3/real/manifest.json`); the refusals are closed kinds; a trap mid-session
* poisons the instance and the session answers `core_unavailable` from then on, `free()`
* included; the memory held by a fresh instance after an export is printed against the
@@ -14,7 +16,6 @@ import { createHash } from 'node:crypto'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { composeHighlightedViewSvg } from '@faunosteo/pdf'
import {
CoreRuntime,
@@ -221,22 +222,24 @@ describe('R4.6 export session through the shipped module', () => {
expect(outcome.value!.read.origin, run.name).toBe('envelope_v1')
expect(outcome.value!.read.snapshotRejected, run.name).toBeUndefined()
expect(outcome.value!.rebase.report, run.name).toEqual(report)
// Every view request is the TypeScript composition of that view for that observation.
// Every view request is a composition on that view's frame with the observation's
// markers highlighted and nothing of the editor's attributes (the exact text is the
// cargo suites' business).
let views = 0
const snapshotViews = (
envelope.sheetSnapshot as { document: { views: Array<{ id: string }> } }
).document.views
for (const request of driven.requests) {
if (!request.key.startsWith('view:')) continue
const [, observationId, viewId] = request.key.split(':')
const observation = report.observations.find((o) => o.id === observationId)!
expect(
request.svg,
`${run.name} ${request.key}`,
).toBe(
composeHighlightedViewSvg(
envelope.sheetSnapshot as never,
viewId!,
observation as never,
),
)
const where = `${run.name} ${request.key}`
expect(snapshotViews.some((v) => v.id === viewId), where).toBe(true)
expect(request.svg, where).toMatch(/^<svg /)
expect(request.svg, where).not.toContain('data-anno-id')
expect(request.svg, where).not.toContain('display="none"')
const highlighted = observation.zones.some((z) => z.viewId === viewId)
expect(request.svg.includes('fill="#b85a3f"'), where).toBe(highlighted)
views += 1
}
// Every (observation, view) the snapshot holds was asked for, once.