@embedpdf/engine-core 3.0.0-next.2 → 3.0.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/{AbortError-ByBflvEl.cjs → AbortError-BFwCIKC6.cjs} +2 -2
  2. package/dist/{AbortError-ByBflvEl.cjs.map → AbortError-BFwCIKC6.cjs.map} +1 -1
  3. package/dist/{AbortError-CjSasIlL.js → AbortError-D0w0N4pJ.js} +2 -2
  4. package/dist/{AbortError-CjSasIlL.js.map → AbortError-D0w0N4pJ.js.map} +1 -1
  5. package/dist/{AnnotationListSnapshot-W0RCsyDE.d.cts → AnnotationListSnapshot-_Z600IzD.d.cts} +216 -20
  6. package/dist/{AnnotationListSnapshot-W0RCsyDE.d.ts → AnnotationListSnapshot-_Z600IzD.d.ts} +216 -20
  7. package/dist/{DocumentSecurityService-B-tULKNY.d.ts → DocumentSecurityService-BR4tesJK.d.ts} +2 -2
  8. package/dist/{DocumentSecurityService-Df79fgpe.d.cts → DocumentSecurityService-CoHQf0Ju.d.cts} +2 -2
  9. package/dist/{Engine-D9loFZc1.d.cts → Engine-LHgbW5z-.d.cts} +4 -4
  10. package/dist/{Engine-B7Oe7f5i.d.ts → Engine-h_6P4pjM.d.ts} +4 -4
  11. package/dist/{builders-C548U47M.js → builders-BWgXkLKd.js} +382 -167
  12. package/dist/builders-BWgXkLKd.js.map +1 -0
  13. package/dist/{builders-BvikWRuO.cjs → builders-CBK8k_cn.cjs} +423 -220
  14. package/dist/builders-CBK8k_cn.cjs.map +1 -0
  15. package/dist/conformance.cjs +303 -135
  16. package/dist/conformance.cjs.map +1 -1
  17. package/dist/conformance.d.cts +37 -3
  18. package/dist/conformance.d.ts +37 -3
  19. package/dist/conformance.js +303 -136
  20. package/dist/conformance.js.map +1 -1
  21. package/dist/{fold-CB4fAOOy.js → fold-D3_ZiKOg.js} +162 -3
  22. package/dist/fold-D3_ZiKOg.js.map +1 -0
  23. package/dist/{fold-IaMph3CO.cjs → fold-M6iEyY8X.cjs} +233 -2
  24. package/dist/fold-M6iEyY8X.cjs.map +1 -0
  25. package/dist/index.cjs +22 -12
  26. package/dist/index.d.cts +2 -2
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.js +4 -4
  29. package/dist/runtime.cjs +23 -13
  30. package/dist/runtime.d.cts +4 -4
  31. package/dist/runtime.d.ts +4 -4
  32. package/dist/runtime.js +5 -5
  33. package/dist/{schemas-9OpSSeM6.js → schemas-C32v81cE.js} +29 -4
  34. package/dist/schemas-C32v81cE.js.map +1 -0
  35. package/dist/{schemas-B_1VyFsm.cjs → schemas-CLByd6ze.cjs} +29 -4
  36. package/dist/schemas-CLByd6ze.cjs.map +1 -0
  37. package/dist/{subtype-qejjVr6h.cjs → subtype-C4XA7C16.cjs} +9 -1
  38. package/dist/subtype-C4XA7C16.cjs.map +1 -0
  39. package/dist/{subtype-BvAzLCGC.js → subtype-DsxZbJtP.js} +9 -1
  40. package/dist/subtype-DsxZbJtP.js.map +1 -0
  41. package/dist/wire.cjs +14 -1
  42. package/dist/wire.cjs.map +1 -1
  43. package/dist/wire.d.cts +13 -4
  44. package/dist/wire.d.ts +13 -4
  45. package/dist/wire.js +14 -2
  46. package/dist/wire.js.map +1 -1
  47. package/package.json +1 -1
  48. package/dist/builders-BvikWRuO.cjs.map +0 -1
  49. package/dist/builders-C548U47M.js.map +0 -1
  50. package/dist/fold-CB4fAOOy.js.map +0 -1
  51. package/dist/fold-IaMph3CO.cjs.map +0 -1
  52. package/dist/schemas-9OpSSeM6.js.map +0 -1
  53. package/dist/schemas-B_1VyFsm.cjs.map +0 -1
  54. package/dist/subtype-BvAzLCGC.js.map +0 -1
  55. package/dist/subtype-qejjVr6h.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"conformance.cjs","names":["openFixture","AbortError","EngineError","EngineErrorCode","openFixture","AnnotationListSnapshotAllPagesSchema","AnnotationListPageSnapshotSchema","AnnotationDTOSchema","AbortError","EngineError","EngineErrorCode","DocumentActionsSnapshotSchema","DEFAULT_QUAD","openFixture","AnnotationCreateResultSchema","AnnotationUpdateResultSchema","AnnotationDeleteResultSchema","AbortError","EngineError","EngineErrorCode","AnnotationMoveResultSchema","EngineErrorCode","openFixture","AbortError","openFixture","PageListSnapshotSchema","PageMoveResultSchema","EngineError","EngineErrorCode","AbortError","QUAD","openFixture","PageRotateResultSchema","EngineError","EngineErrorCode","AbortError","QUAD","openFixture","PageDeleteResultSchema","EngineError","EngineErrorCode","AbortError","openFixture","PageFlattenResultSchema","EngineErrorCode","openFixture","RedactionApplyResultSchema","EngineErrorCode","openFixture","EngineError","EngineErrorCode","AbortError","EngineError","openFixture","EngineError","EngineErrorCode","openFixture","openFixture","openFixture","PageTextSnapshotSchema","EngineError","EngineErrorCode","AbortError","SearchSliceSchema","foldText","EngineError","EngineErrorCode","AbortError"],"sources":["../src/conformance/runMetadataConformance.ts","../src/conformance/runAnnotationReadConformance.ts","../src/conformance/runActionsConformance.ts","../src/conformance/runAnnotationMutationConformance.ts","../src/conformance/runFormConformance.ts","../src/conformance/runAnnotationAppearanceConformance.ts","../src/conformance/runPageReorderConformance.ts","../src/conformance/runPageRotateConformance.ts","../src/conformance/runPageDeleteConformance.ts","../src/conformance/runPageFlattenConformance.ts","../src/conformance/runRedactionApplyConformance.ts","../src/conformance/runPageExtractConformance.ts","../src/conformance/runAttachmentConformance.ts","../src/conformance/runPageInsertConformance.ts","../src/conformance/runPieceInfoConformance.ts","../src/conformance/runDocumentEventsConformance.ts","../src/conformance/runPageTextConformance.ts","../src/conformance/runSearchConformance.ts","../src/conformance/diffAnnotationListSnapshot.ts"],"sourcesContent":["import type { DocumentMetadata } from '../dto/DocumentMetadata';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\n\nexport interface ConformanceTestRunner {\n describe(name: string, fn: () => void): void;\n test(name: string, fn: () => void | Promise<void>): void;\n beforeAll(fn: () => void | Promise<void>): void;\n afterAll(fn: () => void | Promise<void>): void;\n expect: ConformanceExpect;\n}\n\nexport interface ConformanceExpect {\n (actual: unknown): {\n toBe(expected: unknown): void;\n toBeNull(): void;\n toEqual(expected: unknown): void;\n toHaveLength(expected: number): void;\n toMatch(re: RegExp): void;\n toMatchObject(shape: Record<string, unknown>): void;\n toBeInstanceOf(ctor: Function): void;\n toBeTruthy(): void;\n rejects: {\n toBeInstanceOf(ctor: Function): Promise<void>;\n toMatchObject(shape: Record<string, unknown>): Promise<void>;\n };\n resolves: {\n toMatchObject(shape: Record<string, unknown>): Promise<void>;\n toEqual(expected: unknown): Promise<void>;\n };\n };\n}\n\nexport interface ConformanceFixture {\n /** Stable id used for the local engine; cloud uses its own id. */\n id: string;\n /** Bytes for the local engine. */\n bytes: () => Uint8Array | Promise<Uint8Array>;\n /** Override the cloud-side id. Defaults to `id`. */\n cloudId?: string;\n /** The expected document metadata. Used for parity assertions. */\n expected: Partial<DocumentMetadata>;\n}\n\nexport interface ConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. Suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /** Sample fixture for the happy-path metadata read. */\n fixture: ConformanceFixture;\n /** Engine 'kind' for opening: 'bytes' for local, 'id' for cloud. */\n openKind: 'bytes' | 'id';\n}\n\n/**\n * The conformance harness is transport-agnostic. It takes the test runner as\n * a parameter so engine-core has no dependency on vitest/jest/node:test.\n */\nexport function runMetadataConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`metadata conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('reads metadata from sample fixture', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const meta = await doc.metadata.read();\n expect(meta).toMatchObject(opts.fixture.expected);\n expect(meta.trapped).toMatch(/^(true|false|unknown)$/);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() before completion rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.metadata.read();\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('aborting one read does not affect a concurrent one', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const a = doc.metadata.read();\n const b = doc.metadata.read();\n a.abort('test');\n await expect(a).rejects.toBeInstanceOf(AbortError);\n await expect(b).resolves.toMatchObject(opts.fixture.expected);\n } finally {\n await doc.close();\n }\n });\n\n test('metadata after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.metadata.read();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n\n test('update() sets standard + custom fields and a subsequent read observes them', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const result = await doc.metadata.update({\n title: 'Conformance Title',\n subject: 'Conformance Subject',\n custom: { ConformanceKey: 'conformance-value' },\n });\n // The result carries the re-read metadata; cloud also carries cache\n // pins (local is null) — both expose the post-write values here.\n expect(result.metadata.title).toBe('Conformance Title');\n expect(result.metadata.subject).toBe('Conformance Subject');\n expect(result.metadata.custom.ConformanceKey).toBe('conformance-value');\n\n // A fresh read goes through the versioned leaf (cloud) / re-read\n // (local) and must observe the same write.\n const after = await doc.metadata.read();\n expect(after.title).toBe('Conformance Title');\n expect(after.subject).toBe('Conformance Subject');\n expect(after.custom.ConformanceKey).toBe('conformance-value');\n } finally {\n await doc.close();\n }\n });\n\n test('update() clears a field with null', async () => {\n const doc = await openFixture(engine, opts);\n try {\n await doc.metadata.update({ title: 'To Be Cleared' });\n const set = await doc.metadata.read();\n expect(set.title).toBe('To Be Cleared');\n\n await doc.metadata.update({ title: null });\n const cleared = await doc.metadata.read();\n expect(cleared.title).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('update() after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.metadata.update({ title: 'nope' });\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { AnnotationListPageSnapshot } from '../annotation/AnnotationListSnapshot';\nimport { AnnotationDTOSchema } from '../annotation/kinds';\nimport type { AnnotationDTO } from '../annotation/kinds';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport {\n AnnotationListPageSnapshotSchema,\n AnnotationListSnapshotAllPagesSchema,\n} from '../wire/schemas';\n\n/**\n * Expected per-fixture annotation knowledge. The harness asserts against\n * these without locking the exact wire content, so different fixtures can\n * be added by suites without rewriting the harness.\n */\nexport interface AnnotationReadConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page used by the annotation tests. */\n pageObjectNumber: number;\n /** The total annotation count expected on that page (across all subtypes). */\n expectedAnnotationCount: number;\n /** At least this many `'highlight'` annotations on the page. */\n minHighlightCount: number;\n /** At least this many `'unsupported'` annotations on the page. */\n minUnsupportedCount: number;\n /** At least this many `'circle'` annotations on the page. Defaults to 0. */\n minCircleCount?: number;\n /** At least this many `'square'` annotations on the page. Defaults to 0. */\n minSquareCount?: number;\n /** At least this many `'polygon'` annotations on the page. Defaults to 0. */\n minPolygonCount?: number;\n /** At least this many `'polyline'` annotations on the page. Defaults to 0. */\n minPolylineCount?: number;\n /** At least this many `'line'` annotations on the page. Defaults to 0. */\n minLineCount?: number;\n /** At least this many `'ink'` annotations on the page. Defaults to 0. */\n minInkCount?: number;\n /** At least this many `'free-text'` annotations on the page. Defaults to 0. */\n minFreeTextCount?: number;\n /** At least this many `'caret'` annotations on the page. Defaults to 0. */\n minCaretCount?: number;\n /**\n * `true` if the fixture has at least one weak annotation (no /NM, direct\n * object). Drives the weak-ref + revision tests.\n */\n expectsWeakAnnotation: boolean;\n}\n\nexport interface AnnotationConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: AnnotationReadConformanceFixture;\n}\n\nexport function runAnnotationReadConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation read conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('listRawAll returns one entry per page with valid PageState', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRawAll();\n expect(AnnotationListSnapshotAllPagesSchema.safeParse(snap).success).toBe(true);\n expect(snap.pages.length >= 1).toBe(true);\n const target = snap.pages.find(\n (p) => p.pageState.pageObjectNumber === opts.fixture.pageObjectNumber,\n );\n expect(target !== undefined).toBe(true);\n expect(target!.annotations.length).toBe(opts.fixture.expectedAnnotationCount);\n } finally {\n await doc.close();\n }\n });\n\n test('listRaw on the test page returns the expected counts and DTO shape', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n expect(AnnotationListPageSnapshotSchema.safeParse(snap).success).toBe(true);\n expect(snap.annotations.length).toBe(opts.fixture.expectedAnnotationCount);\n const highlights = snap.annotations.filter((a) => a.subtype === 'highlight');\n expect(highlights.length >= opts.fixture.minHighlightCount).toBe(true);\n const unsupported = snap.annotations.filter((a) => a.subtype === 'unsupported');\n expect(unsupported.length >= opts.fixture.minUnsupportedCount).toBe(true);\n const circles = snap.annotations.filter((a) => a.subtype === 'circle');\n expect(circles.length >= (opts.fixture.minCircleCount ?? 0)).toBe(true);\n const squares = snap.annotations.filter((a) => a.subtype === 'square');\n expect(squares.length >= (opts.fixture.minSquareCount ?? 0)).toBe(true);\n const polygons = snap.annotations.filter((a) => a.subtype === 'polygon');\n expect(polygons.length >= (opts.fixture.minPolygonCount ?? 0)).toBe(true);\n const polylines = snap.annotations.filter((a) => a.subtype === 'polyline');\n expect(polylines.length >= (opts.fixture.minPolylineCount ?? 0)).toBe(true);\n const lines = snap.annotations.filter((a) => a.subtype === 'line');\n expect(lines.length >= (opts.fixture.minLineCount ?? 0)).toBe(true);\n const inks = snap.annotations.filter((a) => a.subtype === 'ink');\n expect(inks.length >= (opts.fixture.minInkCount ?? 0)).toBe(true);\n const freeTexts = snap.annotations.filter((a) => a.subtype === 'free-text');\n expect(freeTexts.length >= (opts.fixture.minFreeTextCount ?? 0)).toBe(true);\n const carets = snap.annotations.filter((a) => a.subtype === 'caret');\n expect(carets.length >= (opts.fixture.minCaretCount ?? 0)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('shape/vertex/line annotations expose their family fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n for (const a of snap.annotations) {\n // Ink carries the geometry styling (/C, /CA, /BS) but NOT /IC, plus\n // its /InkList (a non-empty array of point paths).\n if (a.subtype === 'ink') {\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.strokeWidth).toBe('number');\n expect(typeof a.borderStyle).toBe('string');\n expect(typeof a.opacity).toBe('number');\n expect('interiorColor' in a).toBe(false);\n expect(Array.isArray(a.inkList)).toBe(true);\n expect(a.inkList.length >= 1).toBe(true);\n expect(Array.isArray(a.inkList[0])).toBe(true);\n expect(a.inkList[0]!.length >= 1).toBe(true);\n continue;\n }\n // Free text: text fields (/DA) + nullable /C background + intent.\n if (a.subtype === 'free-text') {\n expect(typeof a.fontFamily).toBe('string');\n expect(typeof a.fontSize).toBe('number');\n expect(typeof a.textAlign).toBe('string');\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect('interiorColor' in a).toBe(true);\n expect(a.intent === 'free-text' || a.intent === 'free-text-callout').toBe(true);\n if (a.intent === 'free-text-callout' && a.calloutLine) {\n expect(a.calloutLine.length === 2 || a.calloutLine.length === 3).toBe(true);\n }\n continue;\n }\n // Caret: color-only style (/C, /CA) + optional /RD, no border/quads.\n if (a.subtype === 'caret') {\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.opacity).toBe('number');\n expect('strokeWidth' in a).toBe(false);\n expect('quadPoints' in a).toBe(false);\n continue;\n }\n // Every stroke/fill family member shares this styling surface.\n const isFilledStyle =\n a.subtype === 'circle' ||\n a.subtype === 'square' ||\n a.subtype === 'polygon' ||\n a.subtype === 'polyline' ||\n a.subtype === 'line';\n if (!isFilledStyle) continue;\n // interiorColor is Color | null; color (/C) is always present.\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.strokeWidth).toBe('number');\n expect(typeof a.borderStyle).toBe('string');\n expect(typeof a.opacity).toBe('number');\n expect('interiorColor' in a).toBe(true);\n\n if (a.subtype === 'polygon' || a.subtype === 'polyline') {\n expect(Array.isArray(a.vertices)).toBe(true);\n expect(a.vertices.length >= 2).toBe(true);\n }\n if (a.subtype === 'polyline') {\n expect(typeof a.lineEndings.start).toBe('string');\n expect(typeof a.lineEndings.end).toBe('string');\n }\n if (a.subtype === 'line') {\n expect(typeof a.linePoints.start.x).toBe('number');\n expect(typeof a.linePoints.end.y).toBe('number');\n expect(typeof a.lineEndings.start).toBe('string');\n expect(typeof a.lineEndings.end).toBe('string');\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('full page list dispatches per-subtype and matches raw counts', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const full = await page.annotations.list();\n expect(AnnotationListPageSnapshotSchema.safeParse(full).success).toBe(true);\n expect(full.annotations.length).toBe(opts.fixture.expectedAnnotationCount);\n } finally {\n await doc.close();\n }\n });\n\n test('every annotation DTO satisfies AnnotationDTOSchema (discriminated union)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n for (const a of snap.annotations) {\n const result = AnnotationDTOSchema.safeParse(a);\n expect(result.success).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('AnnotationDTOSchema rejects an annotation with a foreign subtype', () => {\n const bogus: unknown = {\n subtype: 'pretend-not-real',\n ref: { kind: 'objectNumber', pageObjectNumber: 1, annotObjectNumber: 1 },\n pageObjectNumber: 1,\n index: 0,\n identityQuality: 'durable',\n nm: null,\n flags: emptyFlags(),\n rect: { left: 0, top: 0, right: 0, bottom: 0 },\n contents: null,\n author: null,\n created: null,\n modified: null,\n };\n const result = AnnotationDTOSchema.safeParse(bogus);\n expect(result.success).toBe(false);\n });\n\n if (opts.fixture.expectsWeakAnnotation) {\n test('weak annotations carry identityQuality: weak and ref.kind: index', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n const weak = snap.annotations.find((a) => a.identityQuality === 'weak');\n expect(weak !== undefined).toBe(true);\n expect(weak!.ref.kind).toBe('index');\n } finally {\n await doc.close();\n }\n });\n\n test('a stale revision token throws InvalidReference', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const snap = await page.annotations.list();\n const weak = snap.annotations.find((a) => a.identityQuality === 'weak');\n expect(weak !== undefined).toBe(true);\n const staleRevision = {\n ...snap.pageState.revision,\n generation: snap.pageState.revision.generation + 999,\n };\n // create() will fail in this slice with NotImplemented; the\n // path we exercise here is reading-back via a fabricated\n // index-ref. We can't hit it via a public read API today, so\n // this test is a placeholder until mutations land. It still\n // proves the schema accepts a stale revision shape.\n expect(staleRevision.generation > snap.pageState.revision.generation).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('abort() on listRaw rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('listRaw on an unknown pageObjectNumber throws NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.annotations.listRaw(999_999_999);\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: AnnotationConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\nfunction emptyFlags() {\n return {\n invisible: false,\n hidden: false,\n print: false,\n noZoom: false,\n noRotate: false,\n noView: false,\n readOnly: false,\n locked: false,\n toggleNoView: false,\n lockedContents: false,\n };\n}\n\n// Re-export for convenience: tests can hand a literal snapshot.\nexport type { AnnotationListPageSnapshot, AnnotationDTO };\n","import type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { DocumentActionsSnapshotSchema } from '../dto/PdfAction.schema';\nimport type { ConformanceFixture, ConformanceTestRunner } from './runMetadataConformance';\n\nexport interface ActionsConformanceFixtures {\n document: ConformanceFixture;\n page: ConformanceFixture;\n annotation: ConformanceFixture;\n field: ConformanceFixture;\n /** A page whose only annotation is a Link with a `/S /JavaScript` action.\n * Optional: the javascript-link classification test skips without it. */\n javascriptLink?: ConformanceFixture;\n}\n\nexport interface ActionsConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n fixtures: ActionsConformanceFixtures;\n openKind: 'bytes' | 'id';\n}\n\n/** Action extraction parity. These tests assert data only; no script executes. */\nexport function runActionsConformance(\n runner: ConformanceTestRunner,\n opts: ActionsConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n let engine: Engine;\n\n describe(`actions conformance: ${opts.label}`, () => {\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('reads catalog additional actions and preserves /CO identity', async () => {\n const doc = await open(engine, opts, opts.fixtures.document);\n try {\n expect(Boolean(doc.actions)).toBe(true);\n const snapshot = await doc.actions!.read();\n expect(DocumentActionsSnapshotSchema.safeParse(snapshot).success).toBe(true);\n expect(snapshot.openAction).toBeNull();\n expect(snapshot.willSave?.root?.type).toBe('javascript');\n expect(snapshot.willSave?.root?.script ?? '').toMatch(/Will Save/);\n expect(snapshot.didSave?.root?.script ?? '').toMatch(/Did Save/);\n expect(snapshot.willPrint?.root?.script ?? '').toMatch(/Will Print/);\n expect(snapshot.didPrint?.root?.script ?? '').toMatch(/Did Print/);\n\n const form = await doc.forms.list();\n expect(form.calculationOrder).toEqual([{ kind: 'objectNumber', fieldObjectNumber: 9 }]);\n } finally {\n await doc.close();\n }\n });\n\n test('attaches page /AA to PageLayout', async () => {\n const doc = await open(engine, opts, opts.fixtures.page);\n try {\n const pages = await doc.pages.list();\n expect(pages.pages[0].actions?.open?.root?.type).toBe('goto-embedded');\n expect(pages.pages[0].actions?.close).toBe(undefined);\n expect(pages.pages[1].actions?.open?.root?.type).toBe('goto-embedded');\n expect(pages.pages[1].actions?.close?.root?.type).toBe('goto-embedded');\n } finally {\n await doc.close();\n }\n });\n\n test('attaches activation actions to AnnotationBase, including links', async () => {\n const doc = await open(engine, opts, opts.fixtures.annotation);\n try {\n const firstPage = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(firstPage.pageObjectNumber).annotations.list();\n const button = snapshot.annotations.find(\n (annotation) =>\n annotation.ref.kind === 'objectNumber' && annotation.ref.annotObjectNumber === 7,\n );\n const link = snapshot.annotations.find(\n (annotation) =>\n annotation.ref.kind === 'objectNumber' && annotation.ref.annotObjectNumber === 8,\n );\n expect(button?.actions?.activate?.root?.type).toBe('uri');\n // A link carries BOTH planes: the base-level scripting action model\n // (chain shape, for the orchestrator) and its own normalized target\n // (payload, for navigation). They must agree on the action type.\n expect(link?.subtype).toBe('link');\n expect(link?.actions?.activate?.root?.type).toBe('uri');\n if (link?.subtype === 'link') {\n expect(link.target?.kind).toBe('uri');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('classifies a /S /JavaScript link target, script staying on base.actions', async () => {\n const fixture = opts.fixtures.javascriptLink;\n if (!fixture) return; // fixture not provided for this engine flavour\n const doc = await open(engine, opts, fixture);\n try {\n const firstPage = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(firstPage.pageObjectNumber).annotations.list();\n const link = snapshot.annotations.find((annotation) => annotation.subtype === 'link');\n expect(link?.subtype).toBe('link');\n if (link?.subtype === 'link') {\n // The navigation vocabulary classifies (FPDFAction_GetType alone\n // cannot — it has no JavaScript code)…\n expect(link.target).toEqual({ kind: 'javascript' });\n }\n // …while the script text lives ONLY on the scripting plane's model.\n expect(link?.actions?.activate?.root?.type).toBe('javascript');\n expect(link?.actions?.activate?.root?.script ?? '').toMatch(/app\\.alert/);\n } finally {\n await doc.close();\n }\n });\n\n test('keeps field actions separate from merged widget events', async () => {\n const doc = await open(engine, opts, opts.fixtures.field);\n try {\n const form = await doc.forms.list();\n expect(form.fields).toHaveLength(1);\n expect(form.fields[0].actions?.format?.root?.type).toBe('javascript');\n expect(form.fields[0].actions?.format?.root?.script ?? '').toMatch(/AFDate_FormatEx/);\n const page = (await doc.pages.list()).pages[0];\n const widget = (await doc.page(page.pageObjectNumber).annotations.list()).annotations[0];\n expect(widget.actions).toBe(undefined);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function open(\n engine: Engine,\n opts: ActionsConformanceOptions,\n fixture: ConformanceFixture,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: fixture.id, bytes: await fixture.bytes() });\n }\n return engine.open({ kind: 'id', id: fixture.cloudId ?? fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type {\n AnnotationDraft,\n AnnotationPatch,\n CaretDraft,\n CircleDraft,\n FreeTextDraft,\n HighlightDraft,\n InkDraft,\n LineDraft,\n LinkDraft,\n PolygonDraft,\n PolylineDraft,\n RedactDraft,\n SquareDraft,\n StrikeoutDraft,\n} from '../annotation/kinds';\nimport type { WeakAnnotationEditSession } from '../engine/DocumentAnnotationsService';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { InkList, LinePoints, PdfPoint, PdfRect } from '../geometry/primitives';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport {\n AnnotationCreateResultSchema,\n AnnotationDeleteResultSchema,\n AnnotationMoveResultSchema,\n AnnotationUpdateResultSchema,\n} from '../wire/schemas';\n\n/**\n * Per-fixture knowledge the mutation harness needs. The shared fixture\n * fields (id, bytes, etc.) come from `ConformanceFixture`; the bits below\n * pin the test page. The harness asserts behaviour, not exact wire\n * content, so the same fixture can run against both local (WASM) and\n * cloud (native via @cloudpdf/server) engines.\n */\nexport interface AnnotationMutationConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page used by the mutation tests. */\n pageObjectNumber: number;\n /** Page already has at least one weak annotation (no /NM, direct object). */\n expectsWeakAnnotation: boolean;\n /**\n * QuadPoints to use for the create() smoke test. Coordinates are in\n * PDF user space; pick a small rectangle that fits anywhere on the\n * fixture page so we don't flake on different page sizes.\n */\n createQuad?: HighlightDraft['quadPoints'];\n /**\n * `/Rect` to use for the shape (circle/square) create tests. PDF user\n * space; pick a small box that fits anywhere on the fixture page.\n */\n createShapeRect?: PdfRect;\n /**\n * `/Vertices` to use for the polygon/polyline create tests. PDF user\n * space; must fit inside `createShapeRect` (the rect the engine bakes\n * the appearance into). Defaults to a small triangle.\n */\n createVertices?: PdfPoint[];\n /**\n * `/L` endpoints to use for the line create test. PDF user space; must\n * fit inside `createShapeRect`. Defaults to the rect's diagonal.\n */\n createLinePoints?: LinePoints;\n /**\n * `/InkList` strokes to use for the ink create test. PDF user space; must\n * fit inside `createShapeRect`. Defaults to a single short stroke.\n */\n createInkList?: InkList;\n}\n\nexport interface AnnotationMutationConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: AnnotationMutationConformanceFixture;\n /**\n * `true` for engines that expose the raw RGBA appearance rasters\n * (`renderAppearances`). When set, the shape-create test additionally\n * asserts that creating a shape produces a baked `/AP` the appearance\n * reader can rasterize. The cloud engine ships encoded images instead\n * and leaves this `false`.\n */\n supportsAppearanceRasters?: boolean;\n}\n\nconst DEFAULT_QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\nconst DEFAULT_SHAPE_RECT: PdfRect = { left: 60, bottom: 60, right: 160, top: 140 };\n\n/** A small triangle inside DEFAULT_SHAPE_RECT (valid for polygon: >=3). */\nconst DEFAULT_VERTICES: PdfPoint[] = [\n { x: 70, y: 70 },\n { x: 150, y: 70 },\n { x: 110, y: 130 },\n];\n\n/** A line along the diagonal of DEFAULT_SHAPE_RECT. */\nconst DEFAULT_LINE_POINTS: LinePoints = {\n start: { x: 70, y: 70 },\n end: { x: 150, y: 130 },\n};\n\n/**\n * A knee-jointed callout leader inside DEFAULT_SHAPE_RECT: the called-out\n * point, a knee, then the point touching the text box.\n */\nconst DEFAULT_CALLOUT_LINE: [PdfPoint, PdfPoint, PdfPoint] = [\n { x: 65, y: 65 },\n { x: 90, y: 90 },\n { x: 110, y: 100 },\n];\n\n/** A single freehand stroke inside DEFAULT_SHAPE_RECT (valid for ink). */\nconst DEFAULT_INK_STROKES: InkList = [\n [\n { x: 70, y: 70 },\n { x: 100, y: 120 },\n { x: 130, y: 80 },\n { x: 150, y: 130 },\n ],\n];\n\n/**\n * Mutation conformance suite. Mirrors the read suite: tests are written\n * once and run against any engine that satisfies the public API\n * surface. Both local (worker host + WASM) and cloud (HTTP +\n * @cloudpdf/server) implementations must pass identically.\n *\n * The locked rules being verified here:\n * - `create` is append-only: PDFium drops the new annotation at\n * `index = previousCount`, so no existing index shifts. Treated\n * as non-invalidating — revisions do NOT bump and weak refs\n * captured before the create remain valid.\n * - `update` is non-structural; revisions do NOT bump.\n * - Opportunistic /NM stamp upgrades a weak annotation's ref to\n * `kind: 'nm'` on update; an already-durable annotation's /NM is\n * NEVER touched.\n * - `delete` and `move` are the only index-shifting ops. They bump\n * the per-page revision and, on a page that had weak refs before\n * the mutation, surface `shouldRefetch: 'weakRefsInvalidated'`.\n * - Abort propagates as `AbortError` even before the worker\n * responds.\n */\nexport function runAnnotationMutationConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationMutationConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fix = opts.fixture;\n const quad = fix.createQuad ?? DEFAULT_QUAD;\n const shapeRect = fix.createShapeRect ?? DEFAULT_SHAPE_RECT;\n const vertices = fix.createVertices ?? DEFAULT_VERTICES;\n const linePoints = fix.createLinePoints ?? DEFAULT_LINE_POINTS;\n const inkStrokes = fix.createInkList ?? DEFAULT_INK_STROKES;\n\n describe(`annotation mutation conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('create appends without shifting indices and leaves weak refs valid', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const beforeCount = before.annotations.length;\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: created',\n color: { r: 200, g: 100, b: 50 },\n opacity: 0.5,\n quadPoints: quad,\n };\n const result = await page.annotations.create(draft);\n expect(AnnotationCreateResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // Always durable (engine uses the EPDFPage_CreateAnnot fork helper).\n expect(result.created.identityQuality).toBe('durable');\n expect(result.created.subtype).toBe('highlight');\n expect(result.created.ref.kind).toBe('objectNumber');\n\n // Locked rule: create is append-only, so the page revision does\n // NOT bump and no weak refs become stale — regardless of whether\n // the page had pre-existing weak annotations.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.shouldRefetch).toBe(null);\n expect(result.meta.weakRefsInvalidated).toBe(false);\n expect(result.meta.changed.length).toBe(1);\n\n // The annotation is actually on the page now, at the END of the\n // /Annots array. This is the invariant that justifies the\n // non-invalidating impact: every prior index is preserved.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(beforeCount + 1);\n expect(result.created.index).toBe(beforeCount);\n } finally {\n await doc.close();\n }\n });\n\n test('create + update honor annotation flags (set on create, merge on patch)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Create with a single flag set; the others must default to false.\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: flags',\n color: { r: 10, g: 20, b: 30 },\n opacity: 1,\n quadPoints: quad,\n flags: { print: true },\n };\n const created = await page.annotations.create(draft);\n expect(created.created.flags.print).toBe(true);\n expect(created.created.flags.hidden).toBe(false);\n\n // Patch a different flag: it must merge, leaving `print` intact.\n const hidden = await page.annotations.update(created.created.ref, {\n subtype: 'highlight',\n flags: { hidden: true },\n });\n expect(hidden.updated.flags.hidden).toBe(true);\n expect(hidden.updated.flags.print).toBe(true);\n\n // Clearing one flag leaves the rest untouched.\n const cleared = await page.annotations.update(created.created.ref, {\n subtype: 'highlight',\n flags: { print: false },\n });\n expect(cleared.updated.flags.print).toBe(false);\n expect(cleared.updated.flags.hidden).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('create shape annotations (circle + square) round-trip shape fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const circleDraft: CircleDraft = {\n subtype: 'circle',\n contents: 'mutation conformance: circle',\n rect: shapeRect,\n interiorColor: { r: 255, g: 0, b: 0 },\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 3,\n borderStyle: 'solid',\n opacity: 0.6,\n };\n const circle = await page.annotations.create(circleDraft);\n expect(AnnotationCreateResultSchema.safeParse(circle).success).toBe(true);\n expect(circle.created.subtype).toBe('circle');\n expect(circle.created.identityQuality).toBe('durable');\n expect(circle.created.ref.kind).toBe('objectNumber');\n if (circle.created.subtype === 'circle') {\n expect(circle.created.interiorColor).toMatchObject({ r: 255, g: 0, b: 0 });\n expect(circle.created.color).toMatchObject({ r: 0, g: 0, b: 255 });\n expect(circle.created.strokeWidth).toBe(3);\n expect(circle.created.borderStyle).toBe('solid');\n // /CA stored as f32 — compare at 2dp to absorb float drift.\n expect(Math.round(circle.created.opacity * 100) / 100).toBe(0.6);\n // /Rect round-trips. The chosen bounds are small integers that\n // are exactly representable in f32, so an exact compare is safe.\n expect(circle.created.rect.left).toBe(shapeRect.left);\n expect(circle.created.rect.right).toBe(shapeRect.right);\n expect(circle.created.rect.bottom).toBe(shapeRect.bottom);\n expect(circle.created.rect.top).toBe(shapeRect.top);\n }\n\n const squareDraft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: square',\n rect: shapeRect,\n interiorColor: null,\n color: { r: 0, g: 128, b: 0 },\n strokeWidth: 2,\n borderStyle: 'dashed',\n dashArray: [3, 2],\n opacity: 1,\n };\n const square = await page.annotations.create(squareDraft);\n expect(AnnotationCreateResultSchema.safeParse(square).success).toBe(true);\n expect(square.created.subtype).toBe('square');\n if (square.created.subtype === 'square') {\n // interiorColor omitted/null => no fill.\n expect(square.created.interiorColor).toBe(null);\n expect(square.created.color).toMatchObject({ r: 0, g: 128, b: 0 });\n expect(square.created.borderStyle).toBe('dashed');\n expect(square.created.dashArray).toEqual([3, 2]);\n }\n\n const after = await page.annotations.list();\n const subtypes = after.annotations.map((a) => a.subtype);\n expect(subtypes.includes('circle')).toBe(true);\n expect(subtypes.includes('square')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('cloudy border (/BE) + rect differences (/RD) are tri-state', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // A plain shape reads BOTH optional entries as explicit null — absence\n // is stated, so a read DTO compares structurally against a clearing\n // patch. The draft ALSO states them as null (exactly what the plugin's\n // total projection emits for a fresh solid shape): a draft writer must\n // skip null, never dereference it — the stale-worker regression where\n // solid creates vanished while cloudy ones survived.\n const plainDraft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: cloudy tri-state',\n rect: shapeRect,\n color: { r: 0, g: 128, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n cloudyIntensity: null,\n rectDifferences: null,\n };\n const plain = await page.annotations.create(plainDraft);\n expect(plain.created.subtype).toBe('square');\n if (plain.created.subtype === 'square') {\n expect(plain.created.cloudyIntensity).toBe(null);\n expect(plain.created.rectDifferences).toBe(null);\n }\n\n // A value sets /BE + /RD…\n const rd = { left: 5, top: 5, right: 5, bottom: 5 };\n const cloudy = await page.annotations.update(plain.created.ref, {\n subtype: 'square',\n cloudyIntensity: 2,\n rectDifferences: rd,\n });\n expect(cloudy.updated.subtype).toBe('square');\n if (cloudy.updated.subtype === 'square') {\n expect(cloudy.updated.cloudyIntensity).toBe(2);\n expect(cloudy.updated.rectDifferences).toMatchObject(rd);\n }\n\n // …and null removes them: the cloudy -> solid transition leaves no\n // stale /RD behind (the Adobe \"phantom padding\" regression).\n const solid = await page.annotations.update(plain.created.ref, {\n subtype: 'square',\n cloudyIntensity: null,\n rectDifferences: null,\n });\n expect(solid.updated.subtype).toBe('square');\n if (solid.updated.subtype === 'square') {\n expect(solid.updated.cloudyIntensity).toBe(null);\n expect(solid.updated.rectDifferences).toBe(null);\n }\n\n // Polygon carries /BE too (but never /RD, per ISO 32000) — same tri-state,\n // including the draft path.\n const polyDraft: PolygonDraft = {\n subtype: 'polygon',\n contents: 'mutation conformance: polygon cloudy tri-state',\n rect: shapeRect,\n vertices,\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n cloudyIntensity: 1,\n };\n const poly = await page.annotations.create(polyDraft);\n expect(poly.created.subtype).toBe('polygon');\n if (poly.created.subtype === 'polygon') {\n expect(poly.created.cloudyIntensity).toBe(1);\n }\n const polySolid = await page.annotations.update(poly.created.ref, {\n subtype: 'polygon',\n cloudyIntensity: null,\n });\n expect(polySolid.updated.subtype).toBe('polygon');\n if (polySolid.updated.subtype === 'polygon') {\n expect(polySolid.updated.cloudyIntensity).toBe(null);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('update echoes the appearance verdict: moves preserve /AP, restyles re-bake', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: appearance echo',\n rect: shapeRect,\n color: { r: 200, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n };\n const created = await page.annotations.create(draft);\n\n // A full-projection patch whose only real change is a same-size /Rect\n // move: the engine value-diffs away the unchanged style keys, verifies\n // the rigid translation, and preserves the baked /AP — the raster\n // invalidation signal stays off.\n const moved = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: {\n left: shapeRect.left + 12,\n bottom: shapeRect.bottom - 8,\n right: shapeRect.right + 12,\n top: shapeRect.top - 8,\n },\n color: { r: 200, g: 0, b: 0 },\n strokeWidth: 2,\n opacity: 1,\n });\n expect(moved.appearance).toEqual({ action: 'preserved', changed: false });\n\n // Metadata-only patches never touch /AP.\n const flagged = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n flags: { print: true },\n });\n expect(flagged.appearance).toEqual({ action: 'preserved', changed: false });\n\n // A real style edit re-bakes and says so.\n const restyled = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n interiorColor: { r: 255, g: 214, b: 0 },\n });\n expect(restyled.appearance).toEqual({ action: 'regenerated', changed: true });\n\n // A resize is not a translation — it re-bakes too.\n const resized = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: {\n left: shapeRect.left,\n bottom: shapeRect.bottom,\n right: shapeRect.right + 40,\n top: shapeRect.top,\n },\n });\n expect(resized.appearance).toEqual({ action: 'regenerated', changed: true });\n } finally {\n await doc.close();\n }\n });\n\n test('a partial /DA patch preserves the unpatched font members', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'DA read-modify-write',\n rect: shapeRect,\n fontFamily: 'times-roman',\n fontSize: 14,\n textAlign: 'left',\n color: { r: 200, g: 0, b: 0 },\n };\n const created = await page.annotations.create(draft);\n // `/DA` packs font+size+colour into one string; the writer must\n // read-modify-write, so a partial patch cannot reset the others (the\n // old constant fallbacks turned a size-only patch into 12pt black).\n expect(created.created.subtype).toBe('free-text');\n if (created.created.subtype === 'free-text') {\n expect(created.created.fontFamily).toBe('times-roman');\n }\n const sized = await page.annotations.update(created.created.ref, {\n subtype: 'free-text',\n fontSize: 18,\n });\n expect(sized.updated.subtype).toBe('free-text');\n if (sized.updated.subtype === 'free-text') {\n expect(sized.updated.fontFamily).toBe('times-roman');\n expect(sized.updated.fontSize).toBe(18);\n expect(sized.updated.color).toMatchObject({ r: 200, g: 0, b: 0 });\n }\n const recolored = await page.annotations.update(created.created.ref, {\n subtype: 'free-text',\n color: { r: 0, g: 0, b: 200 },\n });\n if (recolored.updated.subtype === 'free-text') {\n expect(recolored.updated.fontFamily).toBe('times-roman');\n expect(recolored.updated.fontSize).toBe(18);\n expect(recolored.updated.color).toMatchObject({ r: 0, g: 0, b: 200 });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('box transform is tri-state: rect-only moves keep rotation, null flattens', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: SquareDraft = {\n subtype: 'square',\n contents: 'transform tri-state',\n rect: shapeRect,\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n // A 90° rotation whose AABB equals the box (square) — valid pair.\n rotation: 90,\n unrotatedRect: shapeRect,\n };\n const created = await page.annotations.create(draft);\n expect(created.created.subtype).toBe('square');\n if (created.created.subtype === 'square') {\n expect(created.created.rotation).toBe(90);\n }\n\n // The whole group riding one delta is a verified translation: the\n // rotation survives AND the baked /AP is preserved.\n const d = { x: 15, y: -10 };\n const shift = (r: typeof shapeRect) => ({\n left: r.left + d.x,\n bottom: r.bottom + d.y,\n right: r.right + d.x,\n top: r.top + d.y,\n });\n const trioMoved = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: shift(shapeRect),\n rotation: 90,\n unrotatedRect: shift(shapeRect),\n });\n expect(trioMoved.appearance).toEqual({ action: 'preserved', changed: false });\n if (trioMoved.updated.subtype === 'square') {\n expect(trioMoved.updated.rotation).toBe(90);\n }\n\n // A rect-only move PRESERVES the omitted rotation (tri-state law: a\n // patch touches what it states) — the old writer cleared it.\n const rectOnly = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: shapeRect,\n });\n if (rectOnly.updated.subtype === 'square') {\n expect(rectOnly.updated.rotation).toBe(90);\n }\n\n // Explicit null flattens — the ONLY way to remove the rotation.\n const flattened = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rotation: null,\n unrotatedRect: null,\n });\n if (flattened.updated.subtype === 'square') {\n expect(flattened.updated.rotation).toBe(undefined);\n expect(flattened.updated.unrotatedRect).toBe(undefined);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('create vertex + line annotations (polygon/polyline/line) round-trip geometry', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const polygonDraft: PolygonDraft = {\n subtype: 'polygon',\n contents: 'mutation conformance: polygon',\n rect: shapeRect,\n vertices,\n interiorColor: { r: 255, g: 200, b: 0 },\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 0.8,\n };\n const polygon = await page.annotations.create(polygonDraft);\n expect(AnnotationCreateResultSchema.safeParse(polygon).success).toBe(true);\n expect(polygon.created.subtype).toBe('polygon');\n if (polygon.created.subtype === 'polygon') {\n expect(polygon.created.vertices.length).toBe(vertices.length);\n expect(polygon.created.color).toMatchObject({ r: 0, g: 0, b: 255 });\n expect(polygon.created.interiorColor).toMatchObject({ r: 255, g: 200, b: 0 });\n }\n\n const polylineDraft: PolylineDraft = {\n subtype: 'polyline',\n contents: 'mutation conformance: polyline',\n rect: shapeRect,\n vertices,\n interiorColor: null,\n color: { r: 200, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'open-arrow', end: 'closed-arrow' },\n };\n const polyline = await page.annotations.create(polylineDraft);\n expect(AnnotationCreateResultSchema.safeParse(polyline).success).toBe(true);\n expect(polyline.created.subtype).toBe('polyline');\n if (polyline.created.subtype === 'polyline') {\n expect(polyline.created.vertices.length).toBe(vertices.length);\n expect(polyline.created.lineEndings.start).toBe('open-arrow');\n expect(polyline.created.lineEndings.end).toBe('closed-arrow');\n }\n\n const lineDraft: LineDraft = {\n subtype: 'line',\n contents: 'mutation conformance: line',\n rect: shapeRect,\n linePoints,\n interiorColor: null,\n color: { r: 0, g: 128, b: 128 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'none', end: 'open-arrow' },\n };\n const line = await page.annotations.create(lineDraft);\n expect(AnnotationCreateResultSchema.safeParse(line).success).toBe(true);\n expect(line.created.subtype).toBe('line');\n if (line.created.subtype === 'line') {\n // /L stored as f32 — compare rounded to absorb float drift.\n expect(Math.round(line.created.linePoints.start.x)).toBe(Math.round(linePoints.start.x));\n expect(Math.round(line.created.linePoints.end.y)).toBe(Math.round(linePoints.end.y));\n expect(line.created.lineEndings.end).toBe('open-arrow');\n }\n\n const inkDraft: InkDraft = {\n subtype: 'ink',\n contents: 'mutation conformance: ink',\n rect: shapeRect,\n inkList: inkStrokes,\n color: { r: 29, g: 78, b: 216 },\n strokeWidth: 3,\n borderStyle: 'solid',\n opacity: 1,\n };\n const ink = await page.annotations.create(inkDraft);\n expect(AnnotationCreateResultSchema.safeParse(ink).success).toBe(true);\n expect(ink.created.subtype).toBe('ink');\n if (ink.created.subtype === 'ink') {\n expect(ink.created.inkList.length).toBe(inkStrokes.length);\n expect(ink.created.inkList[0]!.length).toBe(inkStrokes[0]!.length);\n expect(ink.created.color).toMatchObject({ r: 29, g: 78, b: 216 });\n expect(ink.created.intent).toBe(null);\n expect(ink.created.blendMode).toBe('normal');\n // Ink has a stroke but no /IC.\n expect('interiorColor' in ink.created).toBe(false);\n }\n\n const after = await page.annotations.list();\n const subtypes = after.annotations.map((a) => a.subtype);\n expect(subtypes.includes('polygon')).toBe(true);\n expect(subtypes.includes('polyline')).toBe(true);\n expect(subtypes.includes('line')).toBe(true);\n expect(subtypes.includes('ink')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('create free-text + callout round-trip text/colour/intent fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Plain free text, no fontColor override => text follows `color`.\n const freeTextDraft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'mutation conformance: free text',\n rect: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 14,\n textAlign: 'center',\n color: { r: 20, g: 40, b: 60 },\n interiorColor: { r: 250, g: 250, b: 210 },\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n };\n const freeText = await page.annotations.create(freeTextDraft);\n expect(AnnotationCreateResultSchema.safeParse(freeText).success).toBe(true);\n expect(freeText.created.subtype).toBe('free-text');\n if (freeText.created.subtype === 'free-text') {\n expect(freeText.created.intent).toBe('free-text');\n expect(freeText.created.fontFamily).toBe('helvetica');\n expect(freeText.created.fontSize).toBe(14);\n expect(freeText.created.textAlign).toBe('center');\n expect(freeText.created.color).toMatchObject({ r: 20, g: 40, b: 60 });\n expect(freeText.created.interiorColor).toMatchObject({ r: 250, g: 250, b: 210 });\n // No override sent => text follows `color`, so fontColor is omitted.\n expect(freeText.created.fontColor === undefined).toBe(true);\n }\n\n // Callout: intent + /CL leader + /LE ending, explicit fontColor\n // override, transparent (null) background.\n const calloutDraft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text-callout',\n contents: 'mutation conformance: callout',\n rect: shapeRect,\n fontFamily: 'times-roman',\n fontSize: 12,\n textAlign: 'left',\n color: { r: 0, g: 0, b: 0 },\n fontColor: { r: 200, g: 0, b: 0 },\n interiorColor: null,\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n calloutLine: DEFAULT_CALLOUT_LINE,\n lineEnding: 'open-arrow',\n };\n const callout = await page.annotations.create(calloutDraft);\n expect(AnnotationCreateResultSchema.safeParse(callout).success).toBe(true);\n expect(callout.created.subtype).toBe('free-text');\n if (callout.created.subtype === 'free-text') {\n expect(callout.created.intent).toBe('free-text-callout');\n expect(callout.created.interiorColor).toBe(null);\n // fontColor differs from color => surfaced as an override.\n expect(callout.created.fontColor).toMatchObject({ r: 200, g: 0, b: 0 });\n expect(callout.created.color).toMatchObject({ r: 0, g: 0, b: 0 });\n expect(callout.created.calloutLine?.length).toBe(DEFAULT_CALLOUT_LINE.length);\n expect(callout.created.lineEnding).toBe('open-arrow');\n }\n\n const after = await page.annotations.list();\n const freeTexts = after.annotations.filter((a) => a.subtype === 'free-text');\n expect(freeTexts.length >= 2).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('update a free-text patches alignment + colours and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'free-text-update-base',\n rect: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 12,\n textAlign: 'left',\n color: { r: 0, g: 0, b: 0 },\n interiorColor: null,\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n } satisfies FreeTextDraft);\n const before = await page.annotations.list();\n\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'free-text',\n textAlign: 'right',\n fontFamily: 'helvetica',\n fontSize: 18,\n color: { r: 0, g: 80, b: 160 },\n interiorColor: { r: 240, g: 240, b: 240 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('free-text');\n if (result.updated.subtype === 'free-text') {\n expect(result.updated.textAlign).toBe('right');\n expect(result.updated.fontSize).toBe(18);\n expect(result.updated.color).toMatchObject({ r: 0, g: 80, b: 160 });\n expect(result.updated.interiorColor).toMatchObject({ r: 240, g: 240, b: 240 });\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('create redact (area + text) round-trips label + colour fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Area redaction (no quads: /Rect is the removal region) with a\n // fully-styled label.\n const areaDraft: RedactDraft = {\n subtype: 'redact',\n contents: 'mutation conformance: area redact',\n rect: shapeRect,\n color: { r: 228, g: 66, b: 52 },\n opacity: 1,\n interiorColor: { r: 0, g: 0, b: 0 },\n overlayText: 'CONFIDENTIAL',\n repeat: true,\n fontFamily: 'helvetica',\n fontSize: 10,\n fontColor: { r: 255, g: 255, b: 255 },\n textAlign: 'center',\n };\n const area = await page.annotations.create(areaDraft);\n expect(AnnotationCreateResultSchema.safeParse(area).success).toBe(true);\n expect(area.created.subtype).toBe('redact');\n if (area.created.subtype === 'redact') {\n expect(area.created.quadPoints.length).toBe(0);\n expect(area.created.color).toMatchObject({ r: 228, g: 66, b: 52 });\n expect(area.created.interiorColor).toMatchObject({ r: 0, g: 0, b: 0 });\n expect(area.created.overlayText).toBe('CONFIDENTIAL');\n expect(area.created.repeat).toBe(true);\n expect(area.created.fontFamily).toBe('helvetica');\n expect(area.created.fontSize).toBe(10);\n expect(area.created.fontColor).toMatchObject({ r: 255, g: 255, b: 255 });\n expect(area.created.textAlign).toBe('center');\n }\n\n // Text redaction (quads) without a label: everything falls back to\n // the ISO defaults — transparent fill, no overlay text, no repeat.\n const textDraft: RedactDraft = {\n subtype: 'redact',\n contents: 'mutation conformance: text redact',\n rect: shapeRect,\n quadPoints: quad,\n };\n const text = await page.annotations.create(textDraft);\n expect(AnnotationCreateResultSchema.safeParse(text).success).toBe(true);\n expect(text.created.subtype).toBe('redact');\n if (text.created.subtype === 'redact') {\n expect(text.created.quadPoints.length).toBe(quad.length);\n expect(text.created.interiorColor).toBe(null);\n expect(text.created.overlayText).toBe(null);\n expect(text.created.repeat).toBe(false);\n // Default marking outline is the red redaction convention.\n expect(text.created.color).toMatchObject({ r: 255, g: 0, b: 0 });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('update a redact patches the label and clears it, non-structurally', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'redact',\n contents: 'redact-update-base',\n rect: shapeRect,\n interiorColor: { r: 0, g: 0, b: 0 },\n overlayText: 'DRAFT',\n fontFamily: 'helvetica',\n fontSize: 8,\n fontColor: { r: 255, g: 255, b: 255 },\n } satisfies RedactDraft);\n const before = await page.annotations.list();\n\n // Restyle the label. fontSize 0 is meaningful for a redaction label\n // (auto-fit) and must round-trip verbatim, unlike free text.\n const restyled = await page.annotations.update(created.created.ref, {\n subtype: 'redact',\n overlayText: 'REDACTED',\n repeat: true,\n fontFamily: 'helvetica',\n fontSize: 0,\n fontColor: { r: 255, g: 240, b: 240 },\n textAlign: 'right',\n interiorColor: { r: 10, g: 10, b: 10 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(restyled).success).toBe(true);\n expect(restyled.updated.subtype).toBe('redact');\n if (restyled.updated.subtype === 'redact') {\n expect(restyled.updated.overlayText).toBe('REDACTED');\n expect(restyled.updated.repeat).toBe(true);\n expect(restyled.updated.fontSize).toBe(0);\n expect(restyled.updated.fontColor).toMatchObject({ r: 255, g: 240, b: 240 });\n expect(restyled.updated.textAlign).toBe('right');\n expect(restyled.updated.interiorColor).toMatchObject({ r: 10, g: 10, b: 10 });\n }\n\n // Clear the label and the fill: null wipes /OverlayText and /IC.\n const cleared = await page.annotations.update(created.created.ref, {\n subtype: 'redact',\n overlayText: null,\n repeat: false,\n interiorColor: null,\n });\n expect(cleared.updated.subtype).toBe('redact');\n if (cleared.updated.subtype === 'redact') {\n expect(cleared.updated.overlayText).toBe(null);\n expect(cleared.updated.repeat).toBe(false);\n expect(cleared.updated.interiorColor).toBe(null);\n }\n\n // Updates never bump the revision.\n expect(cleared.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(cleared.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('create + update a caret round-trips color/opacity/rect differences', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const caretDraft: CaretDraft = {\n subtype: 'caret',\n intent: 'replace',\n contents: 'mutation conformance: caret',\n rect: shapeRect,\n color: { r: 0, g: 128, b: 255 },\n opacity: 0.7,\n rectDifferences: { left: 2, top: 2, right: 2, bottom: 2 },\n };\n const caret = await page.annotations.create(caretDraft);\n expect(AnnotationCreateResultSchema.safeParse(caret).success).toBe(true);\n expect(caret.created.subtype).toBe('caret');\n expect(caret.created.identityQuality).toBe('durable');\n expect(caret.created.ref.kind).toBe('objectNumber');\n if (caret.created.subtype === 'caret') {\n expect(caret.created.intent).toBe('replace');\n expect(caret.created.color).toMatchObject({ r: 0, g: 128, b: 255 });\n expect(Math.round(caret.created.opacity * 100) / 100).toBe(0.7);\n // Caret carries no border or quads.\n expect('strokeWidth' in caret.created).toBe(false);\n expect('quadPoints' in caret.created).toBe(false);\n expect(caret.created.rectDifferences).toMatchObject({\n left: 2,\n top: 2,\n right: 2,\n bottom: 2,\n });\n }\n\n const before = await page.annotations.list();\n const result = await page.annotations.update(caret.created.ref, {\n subtype: 'caret',\n color: { r: 255, g: 0, b: 0 },\n rectDifferences: { left: 4, top: 4, right: 4, bottom: 4 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('caret');\n if (result.updated.subtype === 'caret') {\n expect(result.updated.color).toMatchObject({ r: 255, g: 0, b: 0 });\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n\n // Tri-state: `null` removes /RD entirely (a read then states the absence).\n const rdCleared = await page.annotations.update(caret.created.ref, {\n subtype: 'caret',\n rectDifferences: null,\n });\n expect(rdCleared.updated.subtype).toBe('caret');\n if (rdCleared.updated.subtype === 'caret') {\n expect(rdCleared.updated.rectDifferences).toBe(null);\n }\n\n const after = await page.annotations.list();\n expect(after.annotations.some((a) => a.subtype === 'caret')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('update an ink annotation patches strokes + color and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'ink',\n contents: 'ink-update-base',\n rect: shapeRect,\n inkList: inkStrokes,\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies InkDraft);\n const before = await page.annotations.list();\n\n const newStrokes: InkList = [\n ...inkStrokes,\n [\n { x: 80, y: 90 },\n { x: 120, y: 110 },\n ],\n ];\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'ink',\n inkList: newStrokes,\n color: { r: 220, g: 20, b: 60 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('ink');\n if (result.updated.subtype === 'ink') {\n expect(result.updated.inkList.length).toBe(newStrokes.length);\n expect(result.updated.color).toMatchObject({ r: 220, g: 20, b: 60 });\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('ink highlight intent + blend round-trip and unrelated patches preserve blend', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'ink',\n intent: 'ink-highlight',\n blendMode: 'multiply',\n rect: shapeRect,\n inkList: inkStrokes,\n color: { r: 255, g: 205, b: 69 },\n strokeWidth: 14,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies InkDraft);\n expect(created.created.subtype).toBe('ink');\n if (created.created.subtype !== 'ink') return;\n expect(created.created.intent).toBe('ink-highlight');\n expect(created.created.blendMode).toBe('multiply');\n\n const recolored = await page.annotations.update(created.created.ref, {\n subtype: 'ink',\n color: { r: 250, g: 190, b: 40 },\n });\n expect(recolored.updated.subtype).toBe('ink');\n expect(recolored.updated.blendMode).toBe('multiply');\n\n const screened = await page.annotations.update(created.created.ref, {\n subtype: 'ink',\n blendMode: 'screen',\n });\n expect(screened.updated.subtype).toBe('ink');\n expect(screened.updated.blendMode).toBe('screen');\n } finally {\n await doc.close();\n }\n });\n\n test('update a polyline patches vertices + line endings and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'polyline',\n contents: 'polyline-update-base',\n rect: shapeRect,\n vertices,\n interiorColor: null,\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 1,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'none', end: 'none' },\n } satisfies PolylineDraft);\n const before = await page.annotations.list();\n\n const newVertices: PdfPoint[] = [\n ...vertices,\n { x: vertices[0]!.x + 5, y: vertices[0]!.y + 5 },\n ];\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'polyline',\n vertices: newVertices,\n lineEndings: { start: 'circle', end: 'diamond' },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('polyline');\n if (result.updated.subtype === 'polyline') {\n expect(result.updated.vertices.length).toBe(newVertices.length);\n expect(result.updated.lineEndings.start).toBe('circle');\n expect(result.updated.lineEndings.end).toBe('diamond');\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('update a shape annotation patches color and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'circle',\n contents: 'shape-update-base',\n rect: shapeRect,\n interiorColor: { r: 10, g: 20, b: 30 },\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 1,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies CircleDraft);\n const before = await page.annotations.list();\n\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'circle',\n interiorColor: { r: 200, g: 100, b: 50 },\n strokeWidth: 4,\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('circle');\n if (result.updated.subtype === 'circle') {\n expect(result.updated.interiorColor).toMatchObject({ r: 200, g: 100, b: 50 });\n expect(result.updated.strokeWidth).toBe(4);\n // Unpatched fields are preserved.\n expect(result.updated.borderStyle).toBe('solid');\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n if (opts.supportsAppearanceRasters) {\n test('creating a shape bakes an /AP appearance the reader can rasterize', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'circle',\n contents: 'appearance-gen',\n rect: shapeRect,\n interiorColor: { r: 255, g: 0, b: 0 },\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies CircleDraft);\n\n const appearances = await page.annotations.renderAppearances({ scale: 1 });\n const match = appearances.appearances.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n // The freshly created shape must carry a baked /AP (generated by\n // the mutator), so the appearance reader emits a non-empty raster.\n expect(match !== undefined).toBe(true);\n expect((match?.raster.width ?? 0) > 0).toBeTruthy();\n expect((match?.raster.height ?? 0) > 0).toBeTruthy();\n } finally {\n await doc.close();\n }\n });\n }\n\n test('update on a durable annotation is non-structural and never touches /NM', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n\n const target = before.annotations.find((a) => a.identityQuality === 'durable');\n // Skip the assertion gracefully if the fixture has no durable annot\n // up front; the test fixture used in our suites does (the existing\n // highlights have /NM).\n if (!target) return;\n\n const ref: AnnotationRef = target.ref;\n const newContents = `mutation conformance: updated@${Date.now()}`;\n const patch = subtypeAwarePatch(target.subtype, newContents);\n if (!patch) return;\n\n const result = await page.annotations.update(ref, patch);\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // Same identity, /NM untouched.\n expect(result.updated.ref.kind).toBe(target.ref.kind);\n expect(result.updated.nm).toBe(target.nm);\n\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.shouldRefetch).toBe(null);\n expect(result.meta.weakRefsInvalidated).toBe(false);\n\n // Round-trip the new contents.\n expect(result.updated.contents).toBe(newContents);\n } finally {\n await doc.close();\n }\n });\n\n if (fix.expectsWeakAnnotation) {\n test('update on a weak annotation stamps a UUID v4 /NM and upgrades the ref', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n expect(weak !== undefined).toBe(true);\n if (!weak) return;\n expect(weak.ref.kind).toBe('index');\n\n const newContents = `weak-upgrade@${Date.now()}`;\n const patch = subtypeAwarePatch(weak.subtype, newContents);\n if (!patch) return;\n\n const result = await page.annotations.update(weak.ref, patch);\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // The ref is upgraded to durable. Either nm (engine-stamped) or\n // objectNumber (if the annotation surprisingly had one) is fine.\n expect(\n result.updated.ref.kind === 'nm' || result.updated.ref.kind === 'objectNumber',\n ).toBe(true);\n expect(result.updated.identityQuality).toBe('durable');\n if (result.updated.ref.kind === 'nm') {\n expect(result.updated.nm !== null).toBe(true);\n expect(typeof result.updated.nm).toBe('string');\n // Engine stamps RFC 4122 v4 UUIDs: 8-4-4-4-12 hex with\n // version 4 and variant 10xx. Match loosely.\n expect(\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(\n result.updated.nm!,\n ),\n ).toBe(true);\n }\n\n // Still non-structural.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.shouldRefetch).toBe(null);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('delete by objectNumber removes the annotation and reports a stable id', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n // Create one we own so we don't disturb the fixture's other tests.\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: to-delete',\n quadPoints: quad,\n };\n const created = await page.annotations.create(draft);\n const before = await page.annotations.list();\n\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.delete(created.created.ref);\n try {\n expect(AnnotationDeleteResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // Stable id is reported (we created it; it's durable).\n expect(result.deleted !== null).toBe(true);\n expect(result.deleted?.kind).toBe('objectNumber');\n\n // Structural: revision bumped.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation + 1,\n );\n\n // The annotation is gone.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 1);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n if (fix.expectsWeakAnnotation) {\n test('delete by index of a weak annotation reports deleted: null and refetch reason', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n if (!weak) return;\n expect(weak.ref.kind).toBe('index');\n\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.delete(weak.ref);\n try {\n // The weak annotation MAY have had /NM in some shapes (very\n // legacy PDFs), but the locked semantics say a true weak\n // delete returns null. We assert \"either null or a stable id\"\n // since the fixture controls which side this lands on.\n expect(\n result.deleted === null ||\n result.deleted.kind === 'objectNumber' ||\n result.deleted.kind === 'nm',\n ).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // The page had weak refs before, structural mutation,\n // therefore: shouldRefetch is set.\n expect(result.meta.shouldRefetch?.reason).toBe('weakRefsInvalidated');\n expect(result.meta.weakRefsInvalidated).toBe(true);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n }\n\n test('abort on create rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'will be aborted',\n quadPoints: quad,\n };\n const p = page.annotations.create(draft);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('update with a stale index revision throws InvalidReference', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n if (!weak || weak.ref.kind !== 'index') return;\n\n // Force the revision out of date by minting an *index-shifting*\n // mutation, then trying to update against the stale ref. We\n // deliberately use a throwaway create+delete pair (delete is\n // the rev-bumping op now — create is append-only and does NOT\n // bump revisions, so it can't be used here).\n const throwaway = await page.annotations.create({\n subtype: 'highlight',\n contents: 'rev-bump-throwaway',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n await page.annotations.delete(throwaway.created.ref);\n await weakSession?.release();\n\n const patch = subtypeAwarePatch(weak.subtype, 'should-fail');\n if (!patch) return;\n let caught: unknown;\n try {\n await page.annotations.update(weak.ref, patch);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidReference)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // move() — batch contiguous-block reorder. Locked invariants:\n // - `move([ref], toIndex)` is the single-annotation case; same\n // primitive as multi-move.\n // - One revision bump per batch, regardless of `refs.length`.\n // - Caller-supplied order is preserved at the destination.\n // - Weak refs in the batch are upgraded to durable /NM BEFORE the\n // move; the moved DTOs come out durable and `meta.changed` lists\n // stable ids.\n // - Stale revision, out-of-range, duplicate, and abort all reject.\n // ─────────────────────────────────────────────────────────────────\n\n test('move single durable annotation reorders within the page (single-as-batch)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Seed two durable annotations we can predict ordering for.\n const aDraft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'move-a',\n quadPoints: quad,\n };\n const bDraft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'move-b',\n quadPoints: quad,\n };\n const a = await page.annotations.create(aDraft);\n const b = await page.annotations.create(bDraft);\n const list = await page.annotations.list();\n const beforeRev = list.pageState.revision.generation;\n\n // Find current indices of a and b.\n const aIdx = list.annotations.findIndex(\n (x) =>\n x.ref.kind === 'objectNumber' &&\n a.created.ref.kind === 'objectNumber' &&\n x.ref.annotObjectNumber === a.created.ref.annotObjectNumber,\n );\n const bIdx = list.annotations.findIndex(\n (x) =>\n x.ref.kind === 'objectNumber' &&\n b.created.ref.kind === 'objectNumber' &&\n x.ref.annotObjectNumber === b.created.ref.annotObjectNumber,\n );\n expect(aIdx >= 0 && bIdx >= 0).toBe(true);\n expect(aIdx < bIdx).toBe(true);\n\n // Move A to B's slot. Post-removal index space: A was removed,\n // so B's position becomes bIdx - 1. Targeting bIdx puts A AFTER\n // B's original position. Use `bIdx` as toIndex => A lands right\n // after B in the new order.\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.move([a.created.ref], bIdx);\n try {\n expect(AnnotationMoveResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n expect(result.moved.length).toBe(1);\n\n // Single revision bump per batch.\n expect(result.meta.affectedPages[0].revision.generation).toBe(beforeRev + 1);\n\n // The moved DTO sits at toIndex.\n if (result.moved[0].ref.kind === 'objectNumber') {\n const movedObjNum = result.moved[0].ref.annotObjectNumber;\n if (a.created.ref.kind === 'objectNumber') {\n expect(movedObjNum).toBe(a.created.ref.annotObjectNumber);\n }\n }\n\n // Verify the page now has A at its new position.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(list.annotations.length);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n test('move multi-block preserves caller-supplied order at the destination', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Seed three durable annotations.\n const ids = await Promise.all(\n ['multi-1', 'multi-2', 'multi-3'].map((label) =>\n page.annotations.create({\n subtype: 'highlight',\n contents: label,\n quadPoints: quad,\n }),\n ),\n );\n\n const list = await page.annotations.list();\n const beforeRev = list.pageState.revision.generation;\n\n // Move the three to position 0 in caller order [3, 1, 2].\n const callerOrder = [ids[2].created.ref, ids[0].created.ref, ids[1].created.ref];\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.move(callerOrder, 0);\n try {\n // One revision bump even though three annotations moved.\n expect(result.meta.affectedPages[0].revision.generation).toBe(beforeRev + 1);\n expect(result.moved.length).toBe(3);\n expect(result.meta.changed.length).toBe(3);\n\n // Caller-supplied order preserved at the destination. Indices\n // 0, 1, 2 of the page now hold the moved DTOs in that order.\n const expectedOrder = [ids[2].created.ref, ids[0].created.ref, ids[1].created.ref].map(\n (r) => (r.kind === 'objectNumber' ? r.annotObjectNumber : null),\n );\n\n const movedObjNums = result.moved.map((d) =>\n d.ref.kind === 'objectNumber' ? d.ref.annotObjectNumber : null,\n );\n for (let i = 0; i < expectedOrder.length; i++) {\n expect(movedObjNums[i]).toBe(expectedOrder[i]);\n }\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n if (fix.expectsWeakAnnotation) {\n test('move on a weak annotation upgrades it to durable /NM (one rev bump for batch)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n if (!weak || weak.ref.kind !== 'index') return;\n const beforeRev = before.pageState.revision.generation;\n\n // Move the weak annotation to position 0 (or somewhere\n // non-trivial). The engine must stamp a fresh /NM BEFORE the\n // move so the result is durable.\n const target = weak.ref.index === 0 ? 1 : 0;\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.move([weak.ref], target);\n try {\n expect(result.meta.affectedPages[0].revision.generation).toBe(beforeRev + 1);\n expect(result.moved.length).toBe(1);\n expect(result.moved[0].identityQuality).toBe('durable');\n expect(\n result.moved[0].ref.kind === 'nm' || result.moved[0].ref.kind === 'objectNumber',\n ).toBe(true);\n\n // meta.changed is a stable id, never a weak ref.\n expect(result.meta.changed.length).toBe(1);\n expect(\n result.meta.changed[0].kind === 'nm' ||\n result.meta.changed[0].kind === 'objectNumber',\n ).toBe(true);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n }\n\n test('move with a stale index revision rejects (locked rev-token guard)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'stale-a',\n quadPoints: quad,\n });\n const list = await page.annotations.list();\n const aIdx = list.annotations.findIndex(\n (x) =>\n x.ref.kind === 'objectNumber' &&\n a.created.ref.kind === 'objectNumber' &&\n x.ref.annotObjectNumber === a.created.ref.annotObjectNumber,\n );\n if (aIdx < 0) return;\n\n const staleIndexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: fix.pageObjectNumber,\n index: aIdx,\n revision: list.pageState.revision,\n };\n\n // Bump the revision by an unrelated index-shifting mutation.\n // create is append-only and no longer bumps revisions, so we\n // use a throwaway create+delete pair (the delete does the bump).\n const throwaway = await page.annotations.create({\n subtype: 'highlight',\n contents: 'bump-throwaway',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n await page.annotations.delete(throwaway.created.ref);\n\n let caught: unknown;\n try {\n await page.annotations.move([staleIndexRef], 0);\n } catch (err) {\n caught = err;\n } finally {\n await weakSession?.release();\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidReference)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('move with out-of-range toIndex rejects with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'oor-a',\n quadPoints: quad,\n });\n const list = await page.annotations.list();\n const farTooBig = list.annotations.length + 100;\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n let caught: unknown;\n try {\n await page.annotations.move([a.created.ref], farTooBig);\n } catch (err) {\n caught = err;\n } finally {\n await weakSession?.release();\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('move with duplicate refs rejects with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'dup-a',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n let caught: unknown;\n try {\n await page.annotations.move([a.created.ref, a.created.ref], 0);\n } catch (err) {\n caught = err;\n } finally {\n await weakSession?.release();\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on move rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'abort-a',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const p = page.annotations.move([a.created.ref], 0);\n p.abort('test');\n try {\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a page move does NOT bump per-page RevisionTokens (weak refs survive reorder)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n\n // Revision is annotation liveness, keyed by `pageObjectNumber`. A\n // page move is structural-geometry-only: no page's /Annots array is\n // touched, so no `RevisionToken` bumps and index-kind refs captured\n // before the reorder stay valid. We observe the host page's\n // revision via `annotations.list().pageState` (the move result no\n // longer carries liveness — it returns geometry).\n const page = doc.page(fix.pageObjectNumber);\n const beforeGen = (await page.annotations.list()).pageState.revision.generation;\n\n // Pull some page to the front (prefer one that is NOT the host so\n // we exercise the cross-page case; fall back to the host itself for\n // single-page fixtures).\n const mover =\n list.pages.find((pg) => pg.pageObjectNumber !== fix.pageObjectNumber)?.pageObjectNumber ??\n fix.pageObjectNumber;\n await doc.pages.move([mover], 0);\n\n const afterGen = (await page.annotations.list()).pageState.revision.generation;\n expect(afterGen).toBe(beforeGen);\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // /IRT + /RT relationships (reply vs group). Locked rules:\n // - A draft `inReplyTo` writes /IRT; /RT defaults to 'reply' when\n // `replyType` is omitted (ISO 32000 §12.5.6.2 default).\n // - The DTO surfaces `inReplyTo` (parent ref) + `replyType`; a\n // top-level annotation reports both as null.\n // - Linking reports the (possibly strengthened) parent id in\n // `meta.changed` and is non-structural (no rev bump / refetch).\n // - A cross-page parent is rejected with InvalidArg.\n // ─────────────────────────────────────────────────────────────────\n\n test('create a reply links /IRT and defaults /RT to \"reply\", reporting the parent', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'reply parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n // A freshly created top-level annotation has no relationship.\n expect(parent.created.inReplyTo).toBe(null);\n expect(parent.created.replyType).toBe(null);\n\n const reply = await page.annotations.create({\n subtype: 'highlight',\n contents: 'a reply',\n quadPoints: quad,\n inReplyTo: parent.created.ref,\n } satisfies HighlightDraft);\n expect(AnnotationCreateResultSchema.safeParse(reply).success).toBe(true);\n // /RT absent in the draft normalizes to 'reply'.\n expect(reply.created.replyType).toBe('reply');\n expect(reply.created.inReplyTo === null).toBe(false);\n if (\n reply.created.inReplyTo?.kind === 'objectNumber' &&\n parent.created.ref.kind === 'objectNumber'\n ) {\n expect(reply.created.inReplyTo.annotObjectNumber).toBe(\n parent.created.ref.annotObjectNumber,\n );\n expect(reply.created.inReplyTo.pageObjectNumber).toBe(fix.pageObjectNumber);\n }\n // The parent (already durable) is reported alongside the new reply.\n expect(reply.meta.changed.length).toBe(2);\n // Linking is non-structural: no rev bump, no refetch.\n expect(reply.meta.shouldRefetch).toBe(null);\n expect(reply.meta.weakRefsInvalidated).toBe(false);\n\n // The relationship survives a fresh read.\n const after = await page.annotations.list();\n const readReply = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n reply.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === reply.created.ref.annotObjectNumber,\n );\n expect(readReply?.replyType).toBe('reply');\n expect(readReply?.inReplyTo == null).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('create a grouped subordinate writes /RT /Group', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const primary = await page.annotations.create({\n subtype: 'highlight',\n contents: 'group primary',\n quadPoints: quad,\n } satisfies HighlightDraft);\n\n const caret = await page.annotations.create({\n subtype: 'caret',\n contents: '',\n rect: shapeRect,\n color: { r: 0, g: 0, b: 0 },\n opacity: 1,\n inReplyTo: primary.created.ref,\n replyType: 'group',\n } satisfies CaretDraft);\n expect(AnnotationCreateResultSchema.safeParse(caret).success).toBe(true);\n expect(caret.created.replyType).toBe('group');\n expect(caret.created.inReplyTo === null).toBe(false);\n\n const after = await page.annotations.list();\n const readCaret = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n caret.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === caret.created.ref.annotObjectNumber,\n );\n expect(readCaret?.replyType).toBe('group');\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // Link annotations. Locked rules:\n // - `/Dest` and `/A GoTo` both read as the normalized `goto` arm;\n // destinations carry page OBJECT NUMBERS on the wire (never\n // indices) and raw PDF user-space coordinates.\n // - `target: null` creates a dead link (create-then-edit flow).\n // - A patch RETARGETS by replacing `/A`; the reader gives `/A`\n // precedence so a retarget wins over any stray direct `/Dest`.\n // - Grouped links (v2 \"attached links\") are plain /IRT + /RT\n // /Group — nothing link-specific in the relationship plane.\n // ─────────────────────────────────────────────────────────────────\n\n test('create link annotations round-trip uri, goto/xyz, goto/fitH, and dead targets', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const uri = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://www.embedpdf.com/' },\n } satisfies LinkDraft);\n expect(AnnotationCreateResultSchema.safeParse(uri).success).toBe(true);\n expect(uri.created.subtype).toBe('link');\n if (uri.created.subtype === 'link') {\n expect(uri.created.target).toEqual({ kind: 'uri', uri: 'https://www.embedpdf.com/' });\n }\n\n // /XYZ with a null zoom axis: null means \"retain current\".\n const xyz = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: {\n kind: 'xyz',\n pageObjectNumber: fix.pageObjectNumber,\n left: 30,\n top: 500,\n zoom: null,\n },\n },\n } satisfies LinkDraft);\n expect(xyz.created.subtype).toBe('link');\n if (xyz.created.subtype === 'link') {\n expect(xyz.created.target?.kind).toBe('goto');\n if (xyz.created.target?.kind === 'goto') {\n const dest = xyz.created.target.destination;\n expect(dest.kind).toBe('xyz');\n if (dest.kind === 'xyz') {\n expect(dest.pageObjectNumber).toBe(fix.pageObjectNumber);\n expect(dest.left).toBe(30);\n expect(dest.top).toBe(500);\n expect(dest.zoom).toBe(null);\n }\n }\n }\n\n const fitH = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: { kind: 'fitH', pageObjectNumber: fix.pageObjectNumber, top: 420 },\n },\n } satisfies LinkDraft);\n expect(fitH.created.subtype).toBe('link');\n if (fitH.created.subtype === 'link' && fitH.created.target?.kind === 'goto') {\n expect(fitH.created.target.destination).toEqual({\n kind: 'fitH',\n pageObjectNumber: fix.pageObjectNumber,\n top: 420,\n });\n }\n\n // Dead link: legal to author, reported as-is.\n const dead = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: null,\n } satisfies LinkDraft);\n expect(dead.created.subtype).toBe('link');\n if (dead.created.subtype === 'link') expect(dead.created.target).toBe(null);\n\n // All four survive a fresh page read as link DTOs.\n const after = await page.annotations.list();\n const links = after.annotations.filter((a) => a.subtype === 'link');\n expect(links.length >= 4).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a link patch retargets in both directions (uri→goto, goto→uri) and moves the rect', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://old.example/' },\n } satisfies LinkDraft);\n\n const toGoto = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n target: {\n kind: 'goto',\n destination: { kind: 'fit', pageObjectNumber: fix.pageObjectNumber },\n },\n });\n expect(AnnotationUpdateResultSchema.safeParse(toGoto).success).toBe(true);\n if (toGoto.updated.subtype === 'link') {\n expect(toGoto.updated.target).toEqual({\n kind: 'goto',\n destination: { kind: 'fit', pageObjectNumber: fix.pageObjectNumber },\n });\n }\n\n const movedRect = {\n left: shapeRect.left + 5,\n bottom: shapeRect.bottom + 5,\n right: shapeRect.right + 5,\n top: shapeRect.top + 5,\n };\n const toUri = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n rect: movedRect,\n target: { kind: 'uri', uri: 'https://new.example/' },\n });\n if (toUri.updated.subtype === 'link') {\n expect(toUri.updated.target).toEqual({ kind: 'uri', uri: 'https://new.example/' });\n expect(Math.round(toUri.updated.rect.left)).toBe(Math.round(movedRect.left));\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a link patch clears the target with null — a dead link on re-read', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: { kind: 'fit', pageObjectNumber: fix.pageObjectNumber },\n },\n } satisfies LinkDraft);\n\n const cleared = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n target: null,\n });\n expect(AnnotationUpdateResultSchema.safeParse(cleared).success).toBe(true);\n if (cleared.updated.subtype === 'link') expect(cleared.updated.target).toBe(null);\n\n // Truly dead — a fresh page read agrees (both /A and /Dest gone).\n const after = await page.annotations.list();\n const readBack = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(readBack?.subtype).toBe('link');\n if (readBack?.subtype === 'link') expect(readBack.target).toBe(null);\n\n // And a cleared link can be re-targeted afterwards.\n const revived = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n target: { kind: 'uri', uri: 'https://revived.example/' },\n });\n if (revived.updated.subtype === 'link') {\n expect(revived.updated.target).toEqual({\n kind: 'uri',\n uri: 'https://revived.example/',\n });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a link grouped to a highlight round-trips /IRT + /RT /Group with its target', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'linked text',\n quadPoints: quad,\n } satisfies HighlightDraft);\n\n const link = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://www.embedpdf.com/docs' },\n inReplyTo: parent.created.ref,\n replyType: 'group',\n } satisfies LinkDraft);\n expect(AnnotationCreateResultSchema.safeParse(link).success).toBe(true);\n expect(link.created.replyType).toBe('group');\n expect(link.created.inReplyTo === null).toBe(false);\n if (\n link.created.inReplyTo?.kind === 'objectNumber' &&\n parent.created.ref.kind === 'objectNumber'\n ) {\n expect(link.created.inReplyTo.annotObjectNumber).toBe(\n parent.created.ref.annotObjectNumber,\n );\n }\n\n // Both the relationship AND the target survive a fresh read.\n const after = await page.annotations.list();\n const readLink = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n link.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === link.created.ref.annotObjectNumber,\n );\n expect(readLink?.subtype).toBe('link');\n expect(readLink?.replyType).toBe('group');\n if (readLink?.subtype === 'link') {\n expect(readLink.target).toEqual({ kind: 'uri', uri: 'https://www.embedpdf.com/docs' });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('replace-text round-trips /IT and groups StrikeOut under its Caret', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const caret = await page.annotations.create({\n subtype: 'caret',\n intent: 'replace',\n contents: 'replacement text',\n rect: shapeRect,\n color: { r: 228, g: 66, b: 52 },\n opacity: 1,\n rectDifferences: { left: 0.5, top: 0.5, right: 0.5, bottom: 0.5 },\n } satisfies CaretDraft);\n const strikeout = await page.annotations.create({\n subtype: 'strikeout',\n intent: 'strikeout-text-edit',\n quadPoints: quad,\n color: { r: 228, g: 66, b: 52 },\n opacity: 1,\n inReplyTo: caret.created.ref,\n replyType: 'group',\n } satisfies StrikeoutDraft);\n\n expect(caret.created.subtype).toBe('caret');\n if (caret.created.subtype === 'caret') expect(caret.created.intent).toBe('replace');\n expect(strikeout.created.subtype).toBe('strikeout');\n if (strikeout.created.subtype === 'strikeout') {\n expect(strikeout.created.intent).toBe('strikeout-text-edit');\n }\n expect(strikeout.created.replyType).toBe('group');\n expect(strikeout.created.inReplyTo).toEqual(caret.created.ref);\n\n const after = await page.annotations.list();\n const readCaret = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n caret.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === caret.created.ref.annotObjectNumber,\n );\n const readStrikeout = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n strikeout.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === strikeout.created.ref.annotObjectNumber,\n );\n expect(readCaret?.subtype === 'caret' && readCaret.intent).toBe('replace');\n expect(readStrikeout?.subtype === 'strikeout' && readStrikeout.intent).toBe(\n 'strikeout-text-edit',\n );\n expect(readStrikeout?.replyType).toBe('group');\n expect(readStrikeout?.inReplyTo).toEqual(caret.created.ref);\n } finally {\n await doc.close();\n }\n });\n\n test('patch inReplyTo: null clears /IRT and /RT (back to top-level)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'clear parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n const reply = await page.annotations.create({\n subtype: 'highlight',\n contents: 'clearable reply',\n quadPoints: quad,\n inReplyTo: parent.created.ref,\n } satisfies HighlightDraft);\n expect(reply.created.replyType).toBe('reply');\n\n const cleared = await page.annotations.update(reply.created.ref, {\n subtype: 'highlight',\n inReplyTo: null,\n });\n expect(AnnotationUpdateResultSchema.safeParse(cleared).success).toBe(true);\n expect(cleared.updated.inReplyTo).toBe(null);\n expect(cleared.updated.replyType).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('create with a cross-page /IRT parent throws InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'cross-page parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n if (parent.created.ref.kind !== 'objectNumber') return;\n\n // Same annotation object number, but a deliberately different page:\n // the engine must reject before resolving anything (ISO requires\n // reply and parent on the same page).\n const crossPageRef: AnnotationRef = {\n kind: 'objectNumber',\n pageObjectNumber: fix.pageObjectNumber + 2,\n annotObjectNumber: parent.created.ref.annotObjectNumber,\n };\n let caught: unknown;\n try {\n await page.annotations.create({\n subtype: 'highlight',\n contents: 'bad cross-page reply',\n quadPoints: quad,\n inReplyTo: crossPageRef,\n } satisfies HighlightDraft);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function beginWeakEditIfRequired(\n doc: DocumentHandle,\n pageObjectNumber: number,\n fix: AnnotationMutationConformanceFixture,\n): Promise<WeakAnnotationEditSession | null> {\n if (doc.capabilities.weakAnnotationEditSessions !== 'required' || !fix.expectsWeakAnnotation) {\n return null;\n }\n return doc.annotations.beginWeakEdit([pageObjectNumber]);\n}\n\nasync function openFixture(\n engine: Engine,\n opts: AnnotationMutationConformanceOptions,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\n/**\n * Build a valid `AnnotationPatch` for the supplied subtype that mutates\n * a single field we can read back. Returns `null` for subtypes the\n * harness can't synthesise a patch for (e.g. unsupported); caller\n * gracefully skips.\n */\nfunction subtypeAwarePatch(subtype: string, newContents: string): AnnotationPatch | null {\n switch (subtype) {\n case 'highlight':\n case 'underline':\n case 'squiggly':\n case 'strikeout':\n case 'circle':\n case 'square':\n case 'polygon':\n case 'polyline':\n case 'line':\n case 'ink':\n case 'free-text':\n case 'caret':\n return {\n subtype: subtype as AnnotationPatch['subtype'],\n contents: newContents,\n } as AnnotationPatch;\n default:\n return null;\n }\n}\n","import type {\n ConformanceFixture,\n ConformanceOptions,\n ConformanceTestRunner,\n} from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { FormFieldDTO } from '../forms/field';\nimport {\n FormImportResultSchema,\n FormRepairResultSchema,\n FormSetValueResultSchema,\n} from '../wire/schemas';\nimport { FormSnapshotSchema } from '../forms/schema';\n\n/**\n * The three fixtures the forms suite needs. Shapes (names, object numbers,\n * values) match the pdf-runtime fork's test resources:\n *\n * - `toggleFields` — toggle_fields.pdf: text field `maxlen_text`\n * (/MaxLen 5, value \"abc\"), radio `ntto_radio` (NoToggleToOff, /DV x,\n * widgets x/y), radio `unison_radio` (RadiosInUnison), checkbox\n * `opt_check` (/Opt \"Alpha\", on-state \"On\"), hierarchical text field\n * `billing.name`.\n * - `orphanWidgets` — orphan_widgets.pdf: `linked_text` in /AcroForm\n * /Fields plus RECOVERED `orphan_check` and `orphan_radio`.\n * - `choiceFields` — listbox_form.pdf: `Listbox_MultiSelect` (options\n * Apple..), `Listbox_SingleSelect`.\n */\nexport interface FormConformanceFixtures {\n /** toggle_fields.pdf; `pageObjectNumber` = its single page (object 3). */\n toggleFields: ConformanceFixture & { pageObjectNumber: number };\n orphanWidgets: ConformanceFixture;\n choiceFields: ConformanceFixture;\n /**\n * A second, independent copy of `toggleFields` used as the XFDF import\n * target. Required for `openKind: 'id'` (cloud) — id-opened documents are\n * server-side state, so the suite cannot mint a copy by re-opening the\n * same bytes under a suffixed id the way the bytes transport does.\n */\n importTarget?: ConformanceFixture;\n}\n\nexport interface FormConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixtures: FormConformanceFixtures;\n}\n\nexport function runFormConformance(\n runner: ConformanceTestRunner,\n opts: FormConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`forms conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n await engine.destroy();\n });\n\n async function open(fixture: ConformanceFixture, idSuffix = ''): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await fixture.bytes();\n return engine.open({ kind: 'bytes', id: fixture.id + idSuffix, bytes });\n }\n return engine.open({ kind: 'id', id: fixture.cloudId ?? fixture.id });\n }\n\n function fieldByName(fields: FormFieldDTO[], name: string): FormFieldDTO {\n const field = fields.find((f) => f.name === name);\n expect(Boolean(field)).toBe(true);\n return field!;\n }\n\n test('lists the reconciled field tree with per-family DTOs', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const snapshot = await doc.forms.list();\n // Wire parity: the snapshot must survive its own schema.\n FormSnapshotSchema.parse(snapshot);\n expect(snapshot.formKind).toBe('acroform');\n\n const text = fieldByName(snapshot.fields, 'maxlen_text');\n if (text.family !== 'text') throw new Error('expected text family');\n expect(text.value).toBe('abc');\n expect(text.valueEntry).toEqual({ kind: 'scalar', value: 'abc' });\n expect(text.defaultValueEntry).toEqual({ kind: 'none' });\n expect(text.maxLength).toBe(5);\n expect(text.widgets.length).toBe(1);\n\n const radio = fieldByName(snapshot.fields, 'ntto_radio');\n if (radio.family !== 'radio') throw new Error('expected radio family');\n expect(radio.noToggleToOff).toBe(true);\n expect(radio.value).toBe('x');\n expect(radio.valueEntry).toEqual({ kind: 'scalar', value: 'x' });\n expect(radio.defaultValueEntry).toEqual({ kind: 'scalar', value: 'x' });\n expect(radio.widgets.map((w) => w.onState)).toEqual(['x', 'y']);\n expect(radio.widgets.map((w) => w.checked)).toEqual([true, false]);\n\n const unison = fieldByName(snapshot.fields, 'unison_radio');\n if (unison.family !== 'radio') throw new Error('expected radio family');\n expect(unison.radiosInUnison).toBe(true);\n\n const check = fieldByName(snapshot.fields, 'opt_check');\n if (check.family !== 'checkbox') throw new Error('expected checkbox family');\n expect(check.checked).toBe(false);\n expect(check.exportValue).toBe('Alpha');\n\n // Hierarchical fields surface under their fully qualified name.\n const nested = fieldByName(snapshot.fields, 'billing.name');\n expect(nested.family).toBe('text');\n expect(snapshot.calculationOrder).toEqual([]);\n } finally {\n await doc.close();\n }\n });\n\n test('writes text values and truncates to /MaxLen', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const result = await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'abcde' },\n );\n FormSetValueResultSchema.parse(result);\n expect(result.field.family).toBe('text');\n if (result.field.family === 'text') expect(result.field.value).toBe('abcde');\n expect(result.changedWidgets.length).toBe(1);\n\n const truncated = await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'abcdef' },\n );\n if (truncated.field.family !== 'text') throw new Error('expected text family');\n expect(truncated.field.value).toBe('abcde');\n expect(truncated.changedWidgets).toHaveLength(0);\n\n // Re-read through the (invalidated) snapshot: the write is visible.\n const after = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (after.family === 'text') expect(after.value).toBe('abcde');\n } finally {\n await doc.close();\n }\n });\n\n test('toggles radio groups and honors NoToggleToOff', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const radioRef = { kind: 'fqn', name: 'ntto_radio' } as const;\n const result = await doc.forms.setValue(radioRef, { type: 'toggle', state: 'y' });\n if (result.field.family !== 'radio') throw new Error('expected radio family');\n expect(result.field.value).toBe('y');\n expect(result.field.widgets.map((w) => w.checked)).toEqual([false, true]);\n expect(result.changedWidgets.length).toBe(2); // x -> Off, y -> on\n\n // Clearing a NoToggleToOff group is a validation error.\n await expect(\n doc.forms.setValue(radioRef, { type: 'toggle', state: null }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // Checkbox with /Opt: checking reads back the export value.\n const check = await doc.forms.setValue(\n { kind: 'fqn', name: 'opt_check' },\n { type: 'toggle', state: 'On' },\n );\n if (check.field.family !== 'checkbox') throw new Error('expected checkbox family');\n expect(check.field.checked).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('rejects family/value mismatches without touching the field', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n // Compare against the CURRENT value, not the fixture seed: on\n // transports with durable server state (cloud), earlier tests'\n // legitimate writes persist. The invariant under test is that a\n // rejected write changes NOTHING.\n const before = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (before.family !== 'text') throw new Error('expected text family');\n await expect(\n doc.forms.setValue({ kind: 'fqn', name: 'maxlen_text' }, { type: 'toggle', state: 'On' }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n const field = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (field.family === 'text') expect(field.value).toBe(before.value);\n } finally {\n await doc.close();\n }\n });\n\n test('applies ordered script effects once and produces zero churn for a no-op batch', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n if (!doc.forms.applyEffects) {\n await doc.close();\n return;\n }\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'form.effectsApplied') events.push(event);\n });\n const result = await doc.forms.applyEffects([\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'maxlen_text' },\n value: { type: 'text', value: 'abcdef' },\n },\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'missing.effect.field' },\n value: { type: 'text', value: 'ignored' },\n },\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'maxlen_text' },\n value: { type: 'text', value: 'abcde' },\n },\n ]);\n expect(result.results.map((entry) => entry.status)).toEqual([\n 'applied',\n 'rejected',\n 'unchanged',\n ]);\n expect(result.meta === null).toBe(false);\n expect(events).toHaveLength(1);\n const appliedText = result.results[0]?.fields[0];\n if (appliedText?.family !== 'text') throw new Error('expected text family');\n expect(appliedText.value).toBe('abcde');\n\n const noOp = await doc.forms.applyEffects([\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'maxlen_text' },\n value: { type: 'text', value: 'abcde' },\n },\n ]);\n expect(noOp.results.map((entry) => entry.status)).toEqual(['unchanged']);\n expect(noOp.meta).toBeNull();\n expect(events).toHaveLength(1);\n unsubscribe();\n } finally {\n await doc.close();\n }\n });\n\n test('selects multi-select list box options by export value', async () => {\n const doc = await open(opts.fixtures.choiceFields);\n try {\n const multiRef = { kind: 'fqn', name: 'Listbox_MultiSelect' } as const;\n const result = await doc.forms.setValue(multiRef, {\n type: 'choice',\n values: ['Cherry', 'Apple'],\n });\n if (result.field.family !== 'listbox') throw new Error('expected listbox family');\n // Option order, not input order.\n expect(result.field.selectedValues).toEqual(['Apple', 'Cherry']);\n expect(result.field.valueEntry.kind).toBe('array');\n\n // Multiple values on a single-select list box is a validation error.\n await expect(\n doc.forms.setValue(\n { kind: 'fqn', name: 'Listbox_SingleSelect' },\n { type: 'choice', values: ['foo', 'bar'] },\n ),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n\n test('reset restores /DV or clears the value', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n // ntto_radio carries /DV x.\n await doc.forms.setValue(\n { kind: 'fqn', name: 'ntto_radio' },\n { type: 'toggle', state: 'y' },\n );\n const radio = await doc.forms.reset({ kind: 'fqn', name: 'ntto_radio' });\n if (radio.field.family === 'radio') expect(radio.field.value).toBe('x');\n\n // maxlen_text has no /DV: reset clears.\n await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'zzz' },\n );\n const text = await doc.forms.reset({ kind: 'fqn', name: 'maxlen_text' });\n if (text.field.family === 'text') expect(text.field.value).toBe('');\n } finally {\n await doc.close();\n }\n });\n\n test('round-trips form data across documents via XFDF and FDF', async () => {\n const first = await open(opts.fixtures.toggleFields);\n let second: DocumentHandle | null = null;\n try {\n // A second, independent copy of the same fixture (a dedicated\n // fixture when the transport needs server-side state, else the same\n // bytes under a suffixed id so the two sessions coexist).\n second = opts.fixtures.importTarget\n ? await open(opts.fixtures.importTarget)\n : await open(opts.fixtures.toggleFields, '-import-target');\n const tricky = 'a<b>&\"c\" \\'d\\'';\n await first.forms.setValue(\n { kind: 'fqn', name: 'billing.name' },\n { type: 'text', value: tricky },\n );\n\n const xfdf = await first.forms.exportData('xfdf');\n expect(xfdf.format).toBe('xfdf');\n expect(xfdf.bytes.length > 0).toBe(true);\n\n const imported = await second!.forms.importData(xfdf.bytes);\n FormImportResultSchema.parse(imported);\n expect(imported.fieldsSkipped).toBe(0);\n expect(imported.fieldsApplied > 0).toBe(true);\n const nested = imported.snapshot.fields.find((f) => f.name === 'billing.name');\n if (nested?.family === 'text') expect(nested.value).toBe(tricky);\n\n const fdf = await first.forms.exportData('fdf');\n expect(fdf.format).toBe('fdf');\n const head = String.fromCharCode(...fdf.bytes.slice(0, 5));\n expect(head).toBe('%FDF-');\n } finally {\n await first.close();\n if (second) await second.close();\n }\n });\n\n test('rejects garbage import payloads', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n await expect(\n doc.forms.importData(new TextEncoder().encode('not a form payload')),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n\n test('emits form events on mutations', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type.startsWith('form.')) events.push(event);\n });\n await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'ok' },\n );\n unsubscribe();\n expect(events.length).toBe(1);\n expect(events[0]!.type).toBe('form.valueChanged');\n } finally {\n await doc.close();\n }\n });\n\n test('repair makes recovered fields durable and is idempotent', async () => {\n const doc = await open(opts.fixtures.orphanWidgets);\n try {\n const before = await doc.forms.list();\n expect(before.fields.length).toBe(3);\n expect(before.fields.filter((f) => f.origin === 'recovered').length).toBe(2);\n\n const repair = await doc.forms.repair();\n FormRepairResultSchema.parse(repair);\n expect(repair.fieldsLinked).toBe(2);\n expect(repair.acroformCreated).toBe(false);\n expect(repair.fieldsUnrepairable).toBe(0);\n\n const after = await doc.forms.list();\n expect(after.fields.every((f) => f.origin === 'acroform')).toBe(true);\n\n const again = await doc.forms.repair();\n expect(again.fieldsLinked).toBe(0);\n expect(again.widgetsLinked).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('widgets live the full annotation-plane loop', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const pon = opts.fixtures.toggleFields.pageObjectNumber;\n try {\n // 1. Born as an annotation: inert, styled with the house vocabulary.\n const page = doc.page(pon);\n const created = await page.annotations.create({\n subtype: 'widget',\n rect: { left: 20, bottom: 20, right: 200, top: 44 },\n interiorColor: { r: 246, g: 248, b: 250 },\n color: { r: 31, g: 111, b: 235 },\n strokeWidth: 1,\n fontSize: 10,\n });\n if (created.created.subtype !== 'widget') throw new Error('expected widget DTO');\n expect(created.created.fieldObjectNumber).toBe(0); // inert\n expect(created.created.interiorColor).toEqual({ r: 246, g: 248, b: 250 });\n const widgetRef = created.created.ref;\n if (widgetRef.kind !== 'objectNumber') throw new Error('expected durable ref');\n\n // 2. Adopted by a field -> the DTO joins to the field plane.\n const field = await doc.forms.createField({ family: 'text', name: 'loop_field' });\n await doc.forms.attachWidget(field.field.ref, {\n annotObjectNumber: widgetRef.annotObjectNumber,\n pageObjectNumber: pon,\n });\n const { annotations } = await page.annotations.list();\n const widgetDto = annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === widgetRef.annotObjectNumber,\n );\n if (widgetDto?.subtype !== 'widget') throw new Error('expected widget DTO');\n expect(widgetDto.fieldObjectNumber).toBe(field.field.fieldObjectNumber);\n\n // 3. Restyled/moved through the SAME annotation path as every kind.\n const patched = await page.annotations.update(widgetRef, {\n subtype: 'widget',\n interiorColor: { r: 255, g: 247, b: 219 },\n });\n if (patched.updated.subtype !== 'widget') throw new Error('expected widget DTO');\n expect(patched.updated.interiorColor).toEqual({ r: 255, g: 247, b: 219 });\n\n // 4. Deleting an ATTACHED widget is refused - the field-tree owns it.\n await expect(page.annotations.delete(widgetRef)).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n\n // 5. Detach -> inert again -> ordinary annotation delete succeeds.\n await doc.forms.detachWidget(field.field.ref, {\n annotObjectNumber: widgetRef.annotObjectNumber,\n pageObjectNumber: pon,\n });\n await page.annotations.delete(widgetRef);\n\n // The field survives, unplaced.\n const after = await doc.forms.get(field.field.ref);\n expect(after.widgets.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('createField composes styled widgets atomically', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const pon = opts.fixtures.toggleFields.pageObjectNumber;\n try {\n const created = await doc.forms.createField({\n family: 'radio',\n name: 'authored_radio',\n noToggleToOff: true,\n widgets: [\n {\n pageObjectNumber: pon,\n rect: { left: 20, bottom: 60, right: 40, top: 80 },\n onState: 'yes',\n appearance: { color: { r: 0, g: 0, b: 0 }, strokeWidth: 1 },\n },\n {\n pageObjectNumber: pon,\n rect: { left: 60, bottom: 60, right: 80, top: 80 },\n onState: 'no',\n },\n ],\n });\n if (created.field.family !== 'radio') throw new Error('expected radio');\n expect(created.field.noToggleToOff).toBe(true);\n expect(created.field.widgets.map((w) => w.onState)).toEqual(['yes', 'no']);\n\n // The newborn group fills through the normal value path.\n const filled = await doc.forms.setValue(created.field.ref, {\n type: 'toggle',\n state: 'yes',\n });\n if (filled.field.family !== 'radio') throw new Error('expected radio');\n expect(filled.field.value).toBe('yes');\n\n // updateField: rename + conflict validation.\n await doc.forms.updateField(created.field.ref, {\n family: 'radio',\n name: 'renamed_radio',\n });\n await expect(\n doc.forms.updateField(created.field.ref, { family: 'radio', name: 'unison_radio' }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // deleteField cascades: field gone AND its widgets gone.\n const before = await doc.page(pon).annotations.list();\n const removed = await doc.forms.deleteField(created.field.ref);\n expect(removed.removedWidgets.length).toBe(2);\n const after = await doc.page(pon).annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 2);\n await expect(doc.forms.get({ kind: 'fqn', name: 'renamed_radio' })).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n } finally {\n await doc.close();\n }\n });\n\n test('unknown refs fail with NotFound', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n await expect(doc.forms.get({ kind: 'fqn', name: 'no.such.field' })).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n } finally {\n await doc.close();\n }\n });\n });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { AnnotationAppearanceMode } from '../dto/AnnotationRender';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport type { PageState } from '../revision/PageState';\n\n/**\n * Per-fixture knowledge for the annotation appearance conformance suite. The\n * harness asserts thresholds (not exact wire content) so the same suite runs\n * unchanged against the local and cloud engines and proves they emit the same\n * set of appearances — including weak (index-only) annotations.\n */\nexport interface AnnotationAppearanceConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page whose appearances are rendered. */\n pageObjectNumber: number;\n /** At least this many `/AP` appearances are expected on that page. */\n minAppearanceCount: number;\n /**\n * `true` when the page has at least one weak (index-only) annotation that\n * carries an appearance stream. The whole point of this suite: that weak\n * appearance must still be emitted (it used to be dropped on the wire).\n */\n expectsWeakAppearance: boolean;\n}\n\nexport interface AnnotationAppearanceConformanceOptions extends Omit<\n ConformanceOptions,\n 'fixture'\n> {\n fixture: AnnotationAppearanceConformanceFixture;\n /**\n * `true` for engines that expose the raw RGBA rasters (`renderAppearances`).\n * The local engine's encoder needs a browser Canvas, so under node it can\n * only be exercised via the raw rasters; the cloud engine ships encoded\n * images (`renderAppearanceImages`) and leaves this `false`.\n */\n supportsRawRasters?: boolean;\n}\n\nconst PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];\n\ninterface NormalizedAppearance {\n ref: AnnotationRef;\n mode: AnnotationAppearanceMode;\n width: number;\n height: number;\n /** Raw RGBA bytes (raw-raster engines) or `null`. */\n raster: { data: ArrayBuffer; width: number; height: number; stride: number } | null;\n /** Encoded image bytes (image engines) or `null`. */\n encoded: Uint8Array | null;\n}\n\nexport function runAnnotationAppearanceConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationAppearanceConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const useRaw = opts.supportsRawRasters === true;\n\n describe(`annotation appearance conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('renders the expected set of appearances with valid output', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { pageState, appearances } = await collect(doc, opts, useRaw);\n\n expect(pageState.pageObjectNumber).toBe(opts.fixture.pageObjectNumber);\n expect(appearances.length >= opts.fixture.minAppearanceCount).toBe(true);\n\n for (const appearance of appearances) {\n // Identity is the ref (durable or weak) — never a stableId.\n expect(['objectNumber', 'nm', 'index'].includes(appearance.ref.kind)).toBe(true);\n expect(['normal', 'rollover', 'down'].includes(appearance.mode)).toBe(true);\n expect(appearance.width > 0 && appearance.height > 0).toBe(true);\n\n if (appearance.encoded) {\n // Encoded engines must ship real PNG bytes, not an empty part.\n expect(appearance.encoded.length > PNG_SIGNATURE.length).toBe(true);\n expect(PNG_SIGNATURE.every((b, i) => appearance.encoded![i] === b)).toBe(true);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n if (opts.fixture.expectsWeakAppearance) {\n test('weak (index-only) annotations are emitted, not dropped', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { appearances } = await collect(doc, opts, useRaw);\n const weak = appearances.find((a) => a.ref.kind === 'index');\n expect(weak !== undefined).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n if (useRaw) {\n test('rendered appearances are not blank (non-zero alpha)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { appearances } = await collect(doc, opts, useRaw);\n // Guards the blank-render regression: at least one appearance must\n // have a visible (non-transparent) pixel. Scanning the RGBA alpha\n // byte is decoder-free and unambiguous.\n const anyVisible = appearances.some((a) => a.raster !== null && hasOpaquePixel(a.raster));\n expect(anyVisible).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('abort() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const p = useRaw\n ? page.annotations.renderAppearances({ scale: 1 })\n : page.annotations.renderAppearanceImages({ format: 'png', scale: 1 });\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function collect(\n doc: DocumentHandle,\n opts: AnnotationAppearanceConformanceOptions,\n useRaw: boolean,\n): Promise<{ pageState: PageState; appearances: NormalizedAppearance[] }> {\n const page = doc.page(opts.fixture.pageObjectNumber);\n if (useRaw) {\n const result = await page.annotations.renderAppearances({ scale: 1 });\n return {\n pageState: result.pageState,\n appearances: result.appearances.map((a) => ({\n ref: a.ref,\n mode: a.mode,\n width: a.raster.width,\n height: a.raster.height,\n raster: a.raster,\n encoded: null,\n })),\n };\n }\n const result = await page.annotations.renderAppearanceImages({ format: 'png', scale: 1 });\n return {\n pageState: result.pageState,\n appearances: result.appearances.map((a) => ({\n ref: a.ref,\n mode: a.mode,\n width: a.image.width ?? 0,\n height: a.image.height ?? 0,\n raster: null,\n encoded: a.image.source.kind === 'bytes' ? a.image.source.bytes : new Uint8Array(),\n })),\n };\n}\n\nfunction hasOpaquePixel(raster: {\n data: ArrayBuffer;\n width: number;\n height: number;\n stride: number;\n}): boolean {\n const bytes = new Uint8Array(raster.data);\n for (let y = 0; y < raster.height; y++) {\n const row = y * raster.stride;\n for (let x = 0; x < raster.width; x++) {\n if (bytes[row + x * 4 + 3] !== 0) return true;\n }\n }\n return false;\n}\n\nasync function openFixture(engine: Engine, opts: AnnotationAppearanceConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { AnnotationPatch, HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageListSnapshotSchema, PageMoveResultSchema } from '../wire/schemas';\n\n/**\n * Per-fixture knowledge for the page-reorder suite. The test pages must\n * be addressable by indirect `pageObjectNumber` (every page in our\n * fixtures is). The fixture is expected to have at least 3 pages so the\n * harness can exercise reorder permutations meaningfully.\n */\nexport interface PageReorderConformanceFixture extends ConformanceFixture {\n /** Stable, durable PONs of (at least) three distinct pages. Order\n * here is the *intended caller-visible* order, not the on-disk\n * order; the suite reads `pages.list()` first and works in document\n * order. */\n ponsForReorderTest?: number[];\n /**\n * Page used for the weak-ref-survival assertion. Defaults to the\n * first PON in `ponsForReorderTest`. The fixture page must already\n * have at least one weak annotation (no /NM, direct object) so the\n * harness can capture an `index`-kind ref before the page move and\n * re-use it after.\n */\n weakRefHostPon?: number;\n /** Quad to use for the `create()` step that produces a stable ref\n * the suite uses. */\n createQuad?: HighlightDraft['quadPoints'];\n}\n\nexport interface PageReorderConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: PageReorderConformanceFixture;\n}\n\nconst DEFAULT_QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Page reorder conformance suite. Verifies the architectural invariants\n * locked with the user, do NOT loosen these without re-reading\n * `PageMoveResult` and `DocumentPagesMutator`:\n *\n * 1. `pages.list()` returns every page in display order, addressed\n * by indirect `pageObjectNumber`.\n * 2. `pages.move()` returns the full new order + geometry via\n * `result.layout` (the same shape `pages.list()` returns). There is\n * no document-level revision; the wire never asks the caller for one.\n * 3. Index-based annotation refs survive a page reorder. This is the\n * whole reason per-page revisions stay put across a move: a user\n * shuffling pages mid-edit must not lose a pending highlight. (The\n * \"move never bumps a RevisionToken\" invariant is asserted directly\n * in the annotation mutation suite, where revision liveness lives.)\n * 4. Invalid inputs (duplicate PONs, unknown PONs, out-of-range\n * `destIndex`) reject with `InvalidArg`.\n * 5. Abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageReorderConformance(\n runner: ConformanceTestRunner,\n opts: PageReorderConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fix = opts.fixture;\n const quad = fix.createQuad ?? DEFAULT_QUAD;\n\n describe(`page reorder conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.list() returns every page in display order, durable PONs only', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n expect(PageListSnapshotSchema.safeParse(list).success).toBe(true);\n expect(list.pages.length >= 1).toBe(true);\n\n for (let i = 0; i < list.pages.length; i++) {\n // Strictly contiguous, 0..N-1.\n expect(list.pages[i].index).toBe(i);\n // Pages are durable by construction; PON > 0.\n expect(list.pages[i].pageObjectNumber > 0).toBe(true);\n }\n\n // PONs are unique across the document.\n const seen = new Set<number>();\n for (const p of list.pages) {\n expect(seen.has(p.pageObjectNumber)).toBe(false);\n seen.add(p.pageObjectNumber);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() reorders pages and returns the full post-move order', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 3) return;\n const pons = pickReorderPons(\n before.pages.map((p) => p.pageObjectNumber),\n fix,\n );\n if (!pons) return;\n\n // Move the LAST of the three to the FRONT.\n const target = pons[pons.length - 1];\n const result = await doc.pages.move([target], 0);\n expect(PageMoveResultSchema.safeParse(result).success).toBe(true);\n\n // The result carries the new geometry: same count, contiguous\n // indices, moved page leads.\n const after = result.layout;\n expect(after.pages.length).toBe(before.pages.length);\n expect(after.pages[0].pageObjectNumber).toBe(target);\n for (let i = 0; i < after.pages.length; i++) {\n expect(after.pages[i].index).toBe(i);\n }\n\n // Set of PONs is preserved (no page lost or fabricated).\n const beforePons = new Set(before.pages.map((p) => p.pageObjectNumber));\n const afterPons = new Set(after.pages.map((p) => p.pageObjectNumber));\n expect(beforePons.size).toBe(afterPons.size);\n for (const pon of beforePons) expect(afterPons.has(pon)).toBe(true);\n\n // A subsequent `pages.list()` agrees with the returned layout\n // (the move result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(relisted.pages.map((p) => p.pageObjectNumber)).toEqual(\n after.pages.map((p) => p.pageObjectNumber),\n );\n } finally {\n await doc.close();\n }\n });\n\n test('weak index-based annotation refs survive a page reorder', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n\n // Pick a host page and create a fresh annotation we can address\n // by index after the move. The created annotation is durable\n // (so we use its index ref via FPDFPage_GetAnnot, which yields\n // a working index-style ref bound to the current revision).\n const hostPon = fix.weakRefHostPon ?? list.pages[0].pageObjectNumber;\n const hostPage = doc.page(hostPon);\n const beforePageList = await hostPage.annotations.list();\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'page-reorder survives this',\n quadPoints: quad,\n };\n const created = await hostPage.annotations.create(draft);\n\n // Capture the *post-create* page state. Neither create\n // (append-only, non-invalidating) nor pages.move bumps the\n // host page's revision, so the revision we capture here is\n // the same one a fresh `list()` would return after the move.\n // We bind the index ref to that revision and use it as a\n // weak ref across the page reorder.\n const afterCreate = await hostPage.annotations.list();\n const targetIndex = afterCreate.annotations.findIndex(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(targetIndex >= 0).toBe(true);\n\n const indexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: hostPon,\n index: targetIndex,\n revision: afterCreate.pageState.revision,\n };\n\n // Move some OTHER page (not the host page) to the front. The\n // host page's revision must stay put.\n const otherPon = list.pages.find((p) => p.pageObjectNumber !== hostPon)?.pageObjectNumber;\n if (otherPon === undefined) return;\n await doc.pages.move([otherPon], 0);\n\n // Use the captured weak-style ref to update the annotation.\n // This is the locked invariant: per-page RevisionToken survives\n // a page reorder, so an index ref captured before the move\n // remains valid after.\n const patch: AnnotationPatch = {\n subtype: 'highlight',\n contents: 'still alive',\n };\n const update = await hostPage.annotations.update(indexRef, patch);\n expect(update.updated.contents).toBe('still alive');\n\n // Also: the annotation index inside the host page is unchanged\n // (the host page's /Annots array was never touched).\n const afterMove = await hostPage.annotations.list();\n expect(afterMove.annotations.length).toBe(beforePageList.annotations.length + 1);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n const target = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.move([target, target], 0);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() rejects out-of-range destIndex with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n const target = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n // Post-removal count is `pages.length - 1`; destIndex one past that\n // is out of range.\n await doc.pages.move([target], list.pages.length);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n // Pick a PON that is guaranteed to not exist.\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.move([bogus], 0);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.move() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n const target = list.pages[0].pageObjectNumber;\n const p = doc.pages.move([target], 0);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(\n engine: Engine,\n opts: PageReorderConformanceOptions,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\n/**\n * Choose three PONs to exercise reorder operations against. Prefers\n * the fixture-supplied ones, falls back to \"first three in document\n * order\" otherwise.\n */\nfunction pickReorderPons(\n documentPons: number[],\n fix: PageReorderConformanceFixture,\n): number[] | null {\n if (fix.ponsForReorderTest && fix.ponsForReorderTest.length >= 3) {\n return fix.ponsForReorderTest.slice(0, 3);\n }\n if (documentPons.length < 3) return null;\n return documentPons.slice(0, 3);\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { AnnotationPatch, HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageRotateResultSchema } from '../wire/schemas';\n\nconst QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Page rotate conformance suite. Verifies the architectural invariants —\n * do NOT loosen these without re-reading `PageRotateResult`:\n *\n * 1. Rotation is ABSOLUTE and idempotent: `rotate(pons, 90)` twice is\n * `rotate(pons, 90)` once. The wire never speaks \"turn by\".\n * 2. Rotation is presentation metadata over NORMALIZED content: the\n * layout's `width`/`height` stay un-rotated, order and identity are\n * untouched, and per-page `RevisionToken`s survive (an index-based\n * annotation ref captured before the rotate works after it).\n * 3. The result returns the full new `layout`; a subsequent `list()`\n * agrees with it.\n * 4. Invalid inputs (bad rotation value, duplicate PONs, unknown PONs)\n * reject with `InvalidArg` / `NotFound`.\n * 5. Abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageRotateConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page rotate conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.rotate() sets the absolute rotation and returns the full layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const target = before.pages[0];\n\n const result = await doc.pages.rotate([target.pageObjectNumber], 90);\n expect(PageRotateResultSchema.safeParse(result).success).toBe(true);\n\n const after = result.layout;\n const rotated = after.pages.find((p) => p.pageObjectNumber === target.pageObjectNumber);\n expect(rotated?.rotation).toBe(90);\n\n // Presentation metadata only: un-rotated dims, order, and the PON\n // set are all untouched.\n expect(rotated?.size.width).toBe(target.size.width);\n expect(rotated?.size.height).toBe(target.size.height);\n expect(after.pages.map((p) => p.pageObjectNumber)).toEqual(\n before.pages.map((p) => p.pageObjectNumber),\n );\n\n // A subsequent list() agrees (the result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(\n relisted.pages.find((p) => p.pageObjectNumber === target.pageObjectNumber)?.rotation,\n ).toBe(90);\n } finally {\n await doc.close();\n }\n });\n\n test('absolute rotation is idempotent: setting the same value twice is a no-op', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n const first = await doc.pages.rotate([pon], 180);\n const second = await doc.pages.rotate([pon], 180);\n expect(second.layout.pages.map((p) => [p.pageObjectNumber, p.rotation])).toEqual(\n first.layout.pages.map((p) => [p.pageObjectNumber, p.rotation]),\n );\n } finally {\n await doc.close();\n }\n });\n\n test('one rotation applies to EVERY listed page (the multi-select gesture)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n const pons = list.pages.slice(0, 2).map((p) => p.pageObjectNumber);\n const result = await doc.pages.rotate(pons, 270);\n for (const pon of pons) {\n expect(result.layout.pages.find((p) => p.pageObjectNumber === pon)?.rotation).toBe(270);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('weak index-based annotation refs survive a rotate (no revision bump)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const hostPon = list.pages[0].pageObjectNumber;\n const hostPage = doc.page(hostPon);\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'rotate survives this',\n quadPoints: QUAD,\n };\n const created = await hostPage.annotations.create(draft);\n const afterCreate = await hostPage.annotations.list();\n const targetIndex = afterCreate.annotations.findIndex(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(targetIndex >= 0).toBe(true);\n\n const indexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: hostPon,\n index: targetIndex,\n revision: afterCreate.pageState.revision,\n };\n\n // Rotate the HOST page itself — the strongest version of the\n // invariant: even the rotated page's revision stays put.\n await doc.pages.rotate([hostPon], 90);\n\n const patch: AnnotationPatch = { subtype: 'highlight', contents: 'still alive' };\n const update = await hostPage.annotations.update(indexRef, patch);\n expect(update.updated.contents).toBe('still alive');\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects an invalid rotation value with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n // 45 is not a legal /Rotate value; the type forbids it, the wire\n // must too.\n await doc.pages.rotate([pon], 45 as never);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.rotate([pon, pon], 90);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.rotate([bogus], 90);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.rotate() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n const p = doc.pages.rotate([pon], 90);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { AnnotationPatch, HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageDeleteResultSchema } from '../wire/schemas';\n\nconst QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Page delete conformance suite. Verifies the architectural invariants —\n * do NOT loosen these without re-reading `PageDeleteResult`:\n *\n * 1. `pages.delete()` removes exactly the listed pages and returns the\n * full surviving layout; a subsequent `list()` agrees.\n * 2. Deleted PONs are RETIRED: addressing a deleted page afterwards is a\n * clean `NotFound` (an API-level error, never native-memory danger).\n * 3. SURVIVING pages keep identity and `RevisionToken`s — an index-based\n * annotation ref on an unrelated page survives a neighbour's deletion.\n * 4. Deleting every page is rejected (`InvalidArg`) — a document keeps at\n * least one page.\n * 5. Duplicate / unknown PONs reject with `InvalidArg` / `NotFound`;\n * abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageDeleteConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page delete conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.delete() removes the page and returns the surviving layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const victim = before.pages[1].pageObjectNumber;\n\n const result = await doc.pages.delete([victim]);\n expect(PageDeleteResultSchema.safeParse(result).success).toBe(true);\n\n const after = result.layout;\n expect(after.pages.length).toBe(before.pages.length - 1);\n expect(after.pageCount).toBe(before.pageCount - 1);\n expect(after.pages.some((p) => p.pageObjectNumber === victim)).toBe(false);\n\n // Survivors keep their relative order, contiguous 0..N-1 indices.\n const expectedOrder = before.pages\n .map((p) => p.pageObjectNumber)\n .filter((pon) => pon !== victim);\n expect(after.pages.map((p) => p.pageObjectNumber)).toEqual(expectedOrder);\n for (let i = 0; i < after.pages.length; i++) {\n expect(after.pages[i].index).toBe(i);\n }\n\n // A subsequent list() agrees (the result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(relisted.pages.map((p) => p.pageObjectNumber)).toEqual(expectedOrder);\n } finally {\n await doc.close();\n }\n });\n\n test('addressing a deleted page afterwards is a clean NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const victim = before.pages[1].pageObjectNumber;\n await doc.pages.delete([victim]);\n\n let caught: unknown;\n try {\n await doc.page(victim).annotations.list();\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('surviving pages keep their weak index-based annotation refs', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n\n const hostPon = list.pages[0].pageObjectNumber;\n const victimPon = list.pages[1].pageObjectNumber;\n const hostPage = doc.page(hostPon);\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'neighbour deletion survives this',\n quadPoints: QUAD,\n };\n const created = await hostPage.annotations.create(draft);\n const afterCreate = await hostPage.annotations.list();\n const targetIndex = afterCreate.annotations.findIndex(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(targetIndex >= 0).toBe(true);\n\n const indexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: hostPon,\n index: targetIndex,\n revision: afterCreate.pageState.revision,\n };\n\n await doc.pages.delete([victimPon]);\n\n const patch: AnnotationPatch = { subtype: 'highlight', contents: 'still alive' };\n const update = await hostPage.annotations.update(indexRef, patch);\n expect(update.updated.contents).toBe('still alive');\n } finally {\n await doc.close();\n }\n });\n\n test('deleting EVERY page is rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let caught: unknown;\n try {\n await doc.pages.delete(list.pages.map((p) => p.pageObjectNumber));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.delete() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.delete([pon, pon]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.delete() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.delete([bogus]);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.delete() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n const pon = list.pages[1].pageObjectNumber;\n const p = doc.pages.delete([pon]);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { DocumentEvent } from '../events/DocumentEvent';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { PageFlattenResultSchema } from '../wire/schemas';\nimport type { ConformanceOptions, ConformanceTestRunner } from './runMetadataConformance';\n\n/** Transport-neutral coverage for the content + annotation flatten rail. */\nexport function runPageFlattenConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page flatten conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('flattens eligible appearances once without changing layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.flatten) return;\n const layoutBefore = await doc.pages.list();\n const pageObjectNumber = layoutBefore.pages[0].pageObjectNumber;\n const annotationsBefore = await doc.page(pageObjectNumber).annotations.list();\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'pages.flattened') events.push(event);\n });\n\n const result = await doc.pages.flatten([pageObjectNumber], 'display');\n expect(PageFlattenResultSchema.safeParse(result).success).toBe(true);\n expect(result.pageObjectNumbers).toEqual([pageObjectNumber]);\n expect(result.usage).toBe('display');\n expect(result.results.map((item) => item.status)).toEqual(['applied']);\n expect(result.meta === null).toBe(false);\n expect(events).toHaveLength(1);\n\n const layoutAfter = await doc.pages.list();\n expect(layoutAfter).toEqual(layoutBefore);\n const annotationsAfter = await doc.page(pageObjectNumber).annotations.list();\n expect(annotationsAfter.annotations.length < annotationsBefore.annotations.length).toBe(\n true,\n );\n expect(\n annotationsAfter.pageState.revision.generation >\n annotationsBefore.pageState.revision.generation,\n ).toBe(true);\n\n const noOp = await doc.pages.flatten([pageObjectNumber], 'display');\n expect(noOp.results.map((item) => item.status)).toEqual(['unchanged']);\n expect(noOp.meta).toBeNull();\n expect(events).toHaveLength(1);\n unsubscribe();\n\n await expect(doc.pages.flatten([pageObjectNumber, pageObjectNumber])).rejects.toMatchObject(\n {\n code: EngineErrorCode.InvalidArg,\n },\n );\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { HighlightDraft, RedactDraft } from '../annotation/kinds';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { RedactionApplyResultSchema } from '../wire/schemas';\nimport type { ConformanceOptions, ConformanceTestRunner } from './runMetadataConformance';\n\n/**\n * Transport-neutral coverage for the destructive redaction-apply rail.\n * Runs against a fixture page with NO pre-existing annotations so the\n * collateral counts are exact. Content-removal fidelity itself is pinned by\n * the native embeddertests; this suite pins the transport contract: scopes,\n * statuses, counts, revision bumps, events, and preflight rejection.\n */\nexport function runRedactionApplyConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n // Geometry: the highlight sits fully inside the redact rect, so applying\n // the redaction removes it as collateral (positive-area intersection).\n const REDACT_RECT = { left: 50, bottom: 50, right: 170, top: 150 };\n const COLLATERAL_QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 70, y: 120 },\n p2: { x: 150, y: 120 },\n p3: { x: 70, y: 80 },\n p4: { x: 150, y: 80 },\n },\n ];\n\n describe(`redaction apply conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('annotations scope applies the marked redaction and counts collateral', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.redaction) return;\n const layoutBefore = await doc.pages.list();\n const pageObjectNumber = layoutBefore.pages[0].pageObjectNumber;\n const page = doc.page(pageObjectNumber);\n\n const collateral = await page.annotations.create({\n subtype: 'highlight',\n quadPoints: COLLATERAL_QUAD,\n } satisfies HighlightDraft);\n expect(collateral.created.subtype).toBe('highlight');\n\n const marked = await page.annotations.create({\n subtype: 'redact',\n rect: REDACT_RECT,\n interiorColor: { r: 0, g: 0, b: 0 },\n overlayText: 'REDACTED',\n fontColor: { r: 255, g: 255, b: 255 },\n } satisfies RedactDraft);\n expect(marked.created.subtype).toBe('redact');\n\n const before = await page.annotations.list();\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'redaction.applied') events.push(event);\n });\n\n const result = await doc.redaction.apply({\n kind: 'annotations',\n refs: [marked.created.ref],\n });\n expect(RedactionApplyResultSchema.safeParse(result).success).toBe(true);\n expect(result.results).toHaveLength(1);\n expect(result.results[0].pageObjectNumber).toBe(pageObjectNumber);\n expect(result.results[0].status).toBe('applied');\n // Exactly the highlight counts: the consumed REDACT never does.\n expect(result.results[0].removedAnnotationCount).toBe(1);\n expect(result.removedAnnotationCount).toBe(1);\n expect(result.meta === null).toBe(false);\n expect(events).toHaveLength(1);\n unsubscribe();\n\n // Both the redaction and its collateral are gone; layout is not a\n // casualty; the page revision advanced (weak refs invalidated).\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 2);\n expect(after.pageState.revision.generation > before.pageState.revision.generation).toBe(\n true,\n );\n expect(await doc.pages.list()).toEqual(layoutBefore);\n } finally {\n await doc.close();\n }\n });\n\n test('pages scope applies everything once and validates its input', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.redaction) return;\n const layout = await doc.pages.list();\n const pageObjectNumber = layout.pages[0].pageObjectNumber;\n const page = doc.page(pageObjectNumber);\n\n await page.annotations.create({\n subtype: 'redact',\n rect: REDACT_RECT,\n interiorColor: { r: 0, g: 0, b: 0 },\n } satisfies RedactDraft);\n\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'redaction.applied') events.push(event);\n });\n\n const applied = await doc.redaction.apply({\n kind: 'pages',\n pageObjectNumbers: [pageObjectNumber],\n });\n expect(applied.results.map((item) => item.status)).toEqual(['applied']);\n expect(applied.removedAnnotationCount).toBe(0);\n expect(events).toHaveLength(1);\n\n // A page with no redactions left is unchanged: no artifact, no event.\n const noOp = await doc.redaction.apply({\n kind: 'pages',\n pageObjectNumbers: [pageObjectNumber],\n });\n expect(noOp.results.map((item) => item.status)).toEqual(['unchanged']);\n expect(noOp.meta).toBeNull();\n expect(events).toHaveLength(1);\n unsubscribe();\n\n await expect(\n doc.redaction.apply({\n kind: 'pages',\n pageObjectNumbers: [pageObjectNumber, pageObjectNumber],\n }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // Preflight rejects a ref that is not a REDACT annotation before\n // anything is written.\n const notRedact = await page.annotations.create({\n subtype: 'highlight',\n quadPoints: COLLATERAL_QUAD,\n } satisfies HighlightDraft);\n await expect(\n doc.redaction.apply({ kind: 'annotations', refs: [notRedact.created.ref] }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\n\n/** `%PDF` — every extracted document must lead with the PDF header. */\nconst PDF_MAGIC = [0x25, 0x50, 0x44, 0x46];\n\n/**\n * Page extract conformance suite. `pages.extract?` is OPTIONAL on the\n * contract (the `downloadLayer?` pattern) — the suite runs only when the\n * implementation provides it, so a cloud engine that has not shipped the\n * server endpoint yet skips cleanly instead of failing.\n *\n * Invariants:\n * 1. `pages.extract([pon])` returns standalone PDF bytes (magic header).\n * 2. The SOURCE document is untouched: identical layout before/after,\n * and page revisions do not bump (extract is a read).\n * 3. Caller order is preserved and page geometry survives the copy\n * (asserted by re-opening the extracted bytes — bytes-open engines\n * only, since a cloud engine cannot re-open loose bytes).\n * 4. Empty / duplicate PONs reject `InvalidArg`; unknown PONs reject\n * `NotFound` (or `InvalidArg`); abort propagates as `AbortError`.\n */\nexport function runPageExtractConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page extract conformance: ${opts.label}`, () => {\n let engine: Engine;\n let supported = false;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await openFixture(engine, opts);\n supported = probe.pages.extract !== undefined;\n await probe.close();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.extract() returns standalone PDF bytes and leaves the source untouched', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const target = before.pages[before.pages.length - 1];\n\n const bytes = await doc.pages.extract!([target.pageObjectNumber]);\n expect(bytes.length > PDF_MAGIC.length).toBe(true);\n expect(Array.from(bytes.slice(0, PDF_MAGIC.length))).toEqual(PDF_MAGIC);\n\n // Extract is a READ: the source layout is exactly what it was.\n const after = await doc.pages.list();\n expect(after.pages.map((p) => p.pageObjectNumber)).toEqual(\n before.pages.map((p) => p.pageObjectNumber),\n );\n expect(after.pageCount).toBe(before.pageCount);\n } finally {\n await doc.close();\n }\n });\n\n test('extracted bytes re-open as a document with the requested pages, in caller order', async () => {\n if (!supported || opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let extracted: DocumentHandle | null = null;\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n // Reversed order on purpose: output order is CALLER order.\n const p0 = list.pages[0];\n const p1 = list.pages[1];\n const bytes = await doc.pages.extract!([p1.pageObjectNumber, p0.pageObjectNumber]);\n\n extracted = await engine.open({ kind: 'bytes', id: `${opts.fixture.id}-extracted`, bytes });\n const out = await extracted.pages.list();\n expect(out.pageCount).toBe(2);\n expect(out.pages[0].size).toEqual(p1.size);\n expect(out.pages[1].size).toEqual(p0.size);\n } finally {\n if (extracted) await extracted.close();\n await doc.close();\n }\n });\n\n test('pages.extract() rejects empty input with InvalidArg', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.pages.extract!([]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.extract() rejects duplicate PONs with InvalidArg', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.extract!([pon, pon]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.extract() rejects unknown PON with NotFound or InvalidArg', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.extract!([bogus]);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.extract() rejects with AbortError', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const p = doc.pages.extract!([list.pages[0].pageObjectNumber]);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { FileAttachmentAnnotationDTO, TextAnnotationDTO } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport type { PageObjectNumber } from '../identity/PageObjectNumber';\n\n/**\n * Attachment conformance suite. Fixture requirement: a document whose\n * `/EmbeddedFiles` name tree contains AT LEAST ONE embedded file.\n *\n * Both attachment surfaces are OPTIONAL on the contract (the\n * `downloadLayer?` pattern), probed independently and skipped cleanly:\n * - `doc.attachments?` — document-level EmbeddedFiles (list/download)\n * - `page.annotations.downloadFile?` — annotation-level file bytes\n *\n * Invariants:\n * 1. `list()` reflects the name tree: positional indices, non-empty\n * names, and repeated calls agree (a read).\n * 2. `download(index)` round-trips the listed metadata and returns\n * exactly `size` decoded bytes when the fixture declares one.\n * 3. Unknown indices reject with an `EngineError`.\n * 4. A created file-attachment annotation round-trips its file:\n * metadata inline on the DTO (never bytes), bytes byte-identical\n * through `downloadFile(ref)`.\n * 5. A created text (sticky-note) annotation round-trips icon + color.\n */\nexport function runAttachmentConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`attachment conformance: ${opts.label}`, () => {\n let engine: Engine;\n let docSupported = false;\n let annotSupported = false;\n let firstPon: PageObjectNumber;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await openFixture(engine, opts);\n docSupported = probe.attachments !== undefined;\n const pages = await probe.pages.list();\n firstPon = pages.pages[0].pageObjectNumber;\n annotSupported = probe.page(firstPon).annotations.downloadFile !== undefined;\n await probe.close();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('attachments.list() reflects the /EmbeddedFiles name tree and is a stable read', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const items = await doc.attachments!.list();\n expect(items.length > 0).toBe(true);\n items.forEach((item, position) => {\n expect(item.index).toBe(position);\n expect(item.key.length > 0).toBe(true);\n expect(item.name.length > 0).toBe(true);\n });\n // Keys are unique by construction — they are the durable refs.\n expect(new Set(items.map((i) => i.key)).size).toBe(items.length);\n // A read: calling again observes the identical snapshot.\n expect(await doc.attachments!.list()).toEqual(items);\n } finally {\n await doc.close();\n }\n });\n\n test('attachments.download() round-trips the listed metadata and decoded size', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const items = await doc.attachments!.list();\n for (const item of items) {\n const content = await doc.attachments!.download({ kind: 'key', key: item.key });\n expect(content.name).toBe(item.name);\n if (item.mimeType !== undefined) {\n expect(content.mimeType).toBe(item.mimeType);\n }\n if (item.size !== undefined) {\n expect(content.bytes.length).toBe(item.size);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('attachments.download() rejects an unknown key', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n await expect(\n doc.attachments!.download({ kind: 'key', key: 'conformance-no-such-key.bin' }),\n ).rejects.toBeInstanceOf(EngineError);\n } finally {\n await doc.close();\n }\n });\n\n test('create() and delete() round-trip the name tree; keys survive index shifts', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n if (doc.attachments!.create === undefined || doc.attachments!.delete === undefined) {\n await doc.close();\n return;\n }\n try {\n const before = await doc.attachments!.list();\n const data = new Uint8Array(512);\n for (let i = 0; i < data.length; i++) data[i] = (i * 7 + 3) & 0xff;\n\n // \"0-…\" sorts before the fixture's entries, shifting their indices —\n // the sharpest difference from append-only annotation creates.\n const { created } = await doc.attachments!.create!({\n data,\n name: '0-conformance.bin',\n mimeType: 'application/octet-stream',\n description: 'added by conformance',\n });\n expect(created.key).toBe('0-conformance.bin');\n expect(created.name).toBe('0-conformance.bin');\n expect(created.mimeType).toBe('application/octet-stream');\n expect(created.description).toBe('added by conformance');\n expect(created.size).toBe(data.length);\n\n const after = await doc.attachments!.list();\n expect(after.length).toBe(before.length + 1);\n // Pre-existing keys still resolve even though their indices shifted.\n for (const item of before) {\n const match = after.find((i) => i.key === item.key);\n expect(match !== undefined).toBe(true);\n }\n\n // Duplicate keys reject — keys are the identity.\n await expect(\n doc.attachments!.create!({ data, name: '0-conformance.bin' }),\n ).rejects.toBeInstanceOf(EngineError);\n\n // The created file round-trips byte-identically.\n const content = await doc.attachments!.download({ kind: 'key', key: created.key });\n expect(content.bytes.length).toBe(data.length);\n expect(content.bytes.every((byte, i) => byte === data[i])).toBe(true);\n\n // Delete by key; the key stops resolving and the rest are intact.\n const { deleted } = await doc.attachments!.delete!({ kind: 'key', key: created.key });\n expect(deleted).toEqual({ kind: 'key', key: created.key });\n const final = await doc.attachments!.list();\n expect(final.map((i) => i.key)).toEqual(before.map((i) => i.key));\n await expect(\n doc.attachments!.delete!({ kind: 'key', key: created.key }),\n ).rejects.toBeInstanceOf(EngineError);\n } finally {\n await doc.close();\n }\n });\n\n test('a created file-attachment annotation round-trips its file through downloadFile()', async () => {\n if (!annotSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const annotations = doc.page(firstPon).annotations;\n const data = new Uint8Array(2048);\n for (let i = 0; i < data.length; i++) data[i] = (i * 31 + 7) & 0xff;\n\n const { created } = await annotations.create({\n subtype: 'file-attachment',\n rect: { left: 40, bottom: 40, right: 60, top: 60 },\n file: {\n data,\n name: 'conformance.bin',\n mimeType: 'application/octet-stream',\n description: 'attachment conformance payload',\n },\n icon: 'paperclip',\n color: { r: 220, g: 38, b: 38 },\n contents: 'conformance attachment',\n });\n\n // Metadata rides the DTO; bytes never do.\n const dto = created as FileAttachmentAnnotationDTO;\n expect(dto.subtype).toBe('file-attachment');\n expect(dto.icon).toBe('paperclip');\n expect(dto.color).toEqual({ r: 220, g: 38, b: 38 });\n expect(dto.file.name).toBe('conformance.bin');\n expect(dto.file.mimeType).toBe('application/octet-stream');\n expect(dto.file.description).toBe('attachment conformance payload');\n expect(dto.file.size).toBe(data.length);\n\n // Bytes come back byte-identical through the explicit download.\n const content = await annotations.downloadFile!(dto.ref);\n expect(content.name).toBe('conformance.bin');\n expect(content.bytes.length).toBe(data.length);\n expect(Array.from(content.bytes.slice(0, 16))).toEqual(Array.from(data.slice(0, 16)));\n expect(content.bytes.every((byte, i) => byte === data[i])).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a created text annotation round-trips icon, color, and contents', async () => {\n if (!annotSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const annotations = doc.page(firstPon).annotations;\n const { created } = await annotations.create({\n subtype: 'text',\n rect: { left: 100, bottom: 100, right: 120, top: 120 },\n icon: 'comment',\n color: { r: 250, g: 204, b: 21 },\n contents: 'conformance note',\n });\n const dto = created as TextAnnotationDTO;\n expect(dto.subtype).toBe('text');\n expect(dto.icon).toBe('comment');\n expect(dto.color).toEqual({ r: 250, g: 204, b: 21 });\n expect(dto.contents).toBe('conformance note');\n\n // Icon is patchable; the file half of an attachment is not, and\n // the same presentation-only patch path applies to notes.\n const { updated } = await annotations.update(dto.ref, {\n subtype: 'text',\n icon: 'help',\n });\n expect((updated as TextAnnotationDTO).icon).toBe('help');\n } finally {\n await doc.close();\n }\n });\n });\n\n async function openFixture(engine: Engine, options: ConformanceOptions): Promise<DocumentHandle> {\n if (options.openKind === 'bytes') {\n return engine.open({\n kind: 'bytes',\n id: options.fixture.id,\n bytes: await options.fixture.bytes(),\n });\n }\n return engine.open({ kind: 'id', id: options.fixture.cloudId ?? options.fixture.id });\n }\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\n\n/**\n * Page insert conformance. `pages.insert?` is optional only until the cloud\n * endpoint ships (it is slated REQUIRED-parity — a cloud viewer must be able\n * to add pages); the suite runs wherever the implementation exists.\n *\n * Invariants:\n * 1. Every page of the source bytes is COPIED in at `destIndex` (omitted →\n * append), in source order; the result lists the fresh PONs in\n * insertion order and they agree with the returned layout.\n * 2. Pre-existing pages keep their identity: same PONs before and after,\n * in the expected positions (an insert never invalidates neighbours).\n * 3. The mutation persists through save → re-open (bytes engines only).\n * 4. Empty bytes / malformed bytes / out-of-range destIndex reject with\n * InvalidArg / MalformedPdf, leaving the document untouched.\n */\nexport function runPageInsertConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page insert conformance: ${opts.label}`, () => {\n let engine: Engine;\n let supported = false;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await openFixture(engine, opts);\n supported = probe.pages.insert !== undefined && probe.pages.extract !== undefined;\n await probe.close();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('appends every source page with fresh PONs; existing pages keep identity', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const beforePons = before.pages.map((p) => p.pageObjectNumber);\n // Self-source: extract the first page, insert it back (append).\n const single = await doc.pages.extract!([beforePons[0]]);\n\n const result = await doc.pages.insert!(single);\n expect(result.insertedPageObjectNumbers.length).toBe(1);\n expect(result.layout.pageCount).toBe(before.pageCount + 1);\n // Existing pages: same identity, same leading positions.\n expect(\n result.layout.pages.slice(0, before.pageCount).map((p) => p.pageObjectNumber),\n ).toEqual(beforePons);\n // The appended copy is a FRESH object number at the tail.\n const newPon = result.insertedPageObjectNumbers[0];\n expect(beforePons.includes(newPon)).toBe(false);\n expect(result.layout.pages[before.pageCount].pageObjectNumber).toBe(newPon);\n // The copy inherits the source page's geometry.\n expect(result.layout.pages[before.pageCount].size).toEqual(before.pages[0].size);\n } finally {\n await doc.close();\n }\n });\n\n test('destIndex places the block mid-document, in source order', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const beforePons = before.pages.map((p) => p.pageObjectNumber);\n const two = await doc.pages.extract!([beforePons[0], beforePons[1]]);\n\n const result = await doc.pages.insert!(two, 1);\n expect(result.insertedPageObjectNumbers.length).toBe(2);\n const pons = result.layout.pages.map((p) => p.pageObjectNumber);\n expect(pons[0]).toBe(beforePons[0]);\n expect(pons.slice(1, 3)).toEqual(result.insertedPageObjectNumbers);\n expect(pons.slice(3)).toEqual(beforePons.slice(1));\n } finally {\n await doc.close();\n }\n });\n\n test('the inserted pages persist through save → re-open', async () => {\n if (!supported || opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let reopened: DocumentHandle | null = null;\n try {\n const before = await doc.pages.list();\n const single = await doc.pages.extract!([before.pages[0].pageObjectNumber]);\n await doc.pages.insert!(single);\n const bytes = await doc.download();\n\n reopened = await engine.open({\n kind: 'bytes',\n id: `${opts.fixture.id}-insert-reopen`,\n bytes,\n });\n const after = await reopened.pages.list();\n expect(after.pageCount).toBe(before.pageCount + 1);\n } finally {\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test('empty bytes reject with InvalidArg; garbage rejects with MalformedPdf', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.pages.insert!(new Uint8Array(0));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n\n caught = undefined;\n try {\n await doc.pages.insert!(new TextEncoder().encode('not a pdf at all'));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.MalformedPdf)).toBe(true);\n\n // Untouched after both rejections.\n const list = await doc.pages.list();\n expect(list.pageCount > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('out-of-range destIndex rejects with InvalidArg', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const single = await doc.pages.extract!([before.pages[0].pageObjectNumber]);\n let caught: unknown;\n try {\n await doc.pages.insert!(single, before.pageCount + 1);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\n\nconst APP = 'EMBD_ConformanceTest';\nconst SIBLING_APP = 'EMBD_ConformanceSibling';\n\n/**\n * `/PieceInfo` conformance (doc + page level). The service is OPTIONAL on\n * the contract (`downloadLayer?` pattern) — the suite runs only where the\n * implementation provides it, so an engine that has not shipped it yet\n * skips cleanly.\n *\n * Invariants:\n * 1. The full value vocabulary round-trips at both levels: string,\n * number, boolean, name, string-array — read back with the same tags.\n * 2. Writes PERSIST: download() → re-open → identical read (bytes-open\n * engines only, since cloud cannot re-open loose bytes).\n * 3. `null` deletes a key; sibling keys and sibling applications\n * survive both key deletes and whole-entry clears.\n * 4. An absent application reads as `null`; `applications()` enumerates\n * what is present; every write refreshes `lastModified`.\n */\nexport function runPieceInfoConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`pieceInfo conformance: ${opts.label}`, () => {\n let engine: Engine;\n let supported = false;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await openFixture(engine, opts);\n supported = probe.pieceInfo !== undefined;\n await probe.close();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('doc-level: the full value vocabulary round-trips with tags intact', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n await doc.pieceInfo!.update(APP, {\n name: 'Standard Stamps',\n schema: 1,\n shared: true,\n kind: { name: 'StampLibrary' },\n tags: ['legal', 'finance'],\n });\n const snap = await doc.pieceInfo!.read(APP);\n expect(snap).toBeTruthy();\n expect(snap!.entries).toEqual({\n name: { type: 'string', value: 'Standard Stamps' },\n schema: { type: 'number', value: 1 },\n shared: { type: 'boolean', value: true },\n kind: { type: 'name', value: 'StampLibrary' },\n tags: { type: 'string-array', value: ['legal', 'finance'] },\n });\n expect(typeof snap!.lastModified).toBe('string');\n } finally {\n await doc.close();\n }\n });\n\n test('page-level: the stamp schema round-trips on a page', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const page = doc.page(list.pages[0].pageObjectNumber);\n await page.pieceInfo!.update(APP, { name: 'Witness', subject: 'Getuige' });\n const snap = await page.pieceInfo!.read(APP);\n expect(snap!.entries).toEqual({\n name: { type: 'string', value: 'Witness' },\n subject: { type: 'string', value: 'Getuige' },\n });\n // The doc-level holder is a DIFFERENT dictionary: untouched.\n expect(await doc.pieceInfo!.read(APP)).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('writes persist through save → re-open', async () => {\n if (!supported || opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let reopened: DocumentHandle | null = null;\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n await doc.pieceInfo!.update(APP, { name: 'Standard Stamps' });\n await doc.page(pon).pieceInfo!.update(APP, { name: 'Witness', subject: 'Getuige' });\n const bytes = await doc.download();\n\n reopened = await engine.open({ kind: 'bytes', id: `${opts.fixture.id}-pi-reopen`, bytes });\n const relist = await reopened.pages.list();\n const docSnap = await reopened.pieceInfo!.read(APP);\n expect(docSnap!.entries.name).toEqual({ type: 'string', value: 'Standard Stamps' });\n const pageSnap = await reopened.page(relist.pages[0].pageObjectNumber).pieceInfo!.read(APP);\n expect(pageSnap!.entries.subject).toEqual({ type: 'string', value: 'Getuige' });\n } finally {\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test('null deletes a key; clear removes an entry; siblings survive', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n await doc.pieceInfo!.update(APP, { name: 'A', keep: 'B' });\n await doc.pieceInfo!.update(SIBLING_APP, { other: 'C' });\n\n await doc.pieceInfo!.update(APP, { name: null });\n const afterDelete = await doc.pieceInfo!.read(APP);\n expect(Object.keys(afterDelete!.entries)).toEqual(['keep']);\n\n const apps = await doc.pieceInfo!.applications();\n expect(apps.includes(APP)).toBe(true);\n expect(apps.includes(SIBLING_APP)).toBe(true);\n\n await doc.pieceInfo!.clear(APP);\n expect(await doc.pieceInfo!.read(APP)).toBe(null);\n // The sibling application is untouched by the clear.\n const sibling = await doc.pieceInfo!.read(SIBLING_APP);\n expect(sibling!.entries.other).toEqual({ type: 'string', value: 'C' });\n } finally {\n await doc.close();\n }\n });\n\n test('an application that was never written reads as null', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n expect(await doc.pieceInfo!.read('EMBD_NeverWritten')).toBe(null);\n const list = await doc.pages.list();\n expect(\n await doc.page(list.pages[0].pageObjectNumber).pieceInfo!.read('EMBD_NeverWritten'),\n ).toBe(null);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { DocumentEvent } from '../events/DocumentEvent';\n\nconst QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Document event stream conformance suite. Verifies the invariants the\n * collaboration design rests on — do NOT loosen these without re-reading\n * `DocumentEvent`:\n *\n * 1. EXACTLY ONCE: every confirmed mutation produces exactly one event,\n * in mutation order, regardless of engine (local worker or cloud HTTP).\n * 2. GROUND TRUTH: a failed mutation publishes nothing; events fire only\n * after confirmation.\n * 3. RESULTS RIDE VERBATIM: each event embeds the result the caller\n * received, deep-equal field for field.\n * 4. PROVENANCE: own mutations are `origin.kind: 'local'` with a stable\n * per-engine-instance `sessionId`.\n * 5. Unsubscribe stops delivery.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runDocumentEventsConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`document events conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('every confirmed mutation publishes exactly one event, results verbatim', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n\n const list = await doc.pages.list();\n if (list.pages.length < 3) return;\n const pon = list.pages[0].pageObjectNumber;\n const page = doc.page(pon);\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'events conformance',\n quadPoints: QUAD,\n };\n const created = await page.annotations.create(draft);\n const updated = await page.annotations.update(created.created.ref, {\n subtype: 'highlight',\n contents: 'updated',\n });\n const rotated = await doc.pages.rotate([pon], 90);\n const victim = list.pages[2].pageObjectNumber;\n const deleted = await doc.pages.delete([victim]);\n const meta = await doc.metadata.update({ title: 'events conformance' });\n\n expect(events.map((event) => event.type)).toEqual([\n 'annotation.created',\n 'annotation.updated',\n 'pages.rotated',\n 'pages.deleted',\n 'metadata.updated',\n ]);\n\n // The embedded results are the returned results, field for field.\n const [evCreated, evUpdated, evRotated, evDeleted, evMeta] = events;\n if (evCreated.type === 'annotation.created') {\n expect(evCreated.pageObjectNumber).toBe(pon);\n expect(evCreated.created).toEqual(created.created);\n expect(evCreated.meta).toEqual(created.meta);\n }\n if (evUpdated.type === 'annotation.updated') {\n expect(evUpdated.updated).toEqual(updated.updated);\n }\n if (evRotated.type === 'pages.rotated') {\n expect(evRotated.pageObjectNumbers).toEqual([pon]);\n expect(evRotated.rotation).toBe(90);\n expect(evRotated.layout).toEqual(rotated.layout);\n expect(evRotated.cache).toEqual(rotated.cache);\n }\n if (evDeleted.type === 'pages.deleted') {\n expect(evDeleted.pageObjectNumbers).toEqual([victim]);\n expect(evDeleted.layout).toEqual(deleted.layout);\n }\n if (evMeta.type === 'metadata.updated') {\n expect(evMeta.metadata).toEqual(meta.metadata);\n }\n\n // Provenance: own mutations, one engine instance.\n for (const event of events) {\n expect(event.origin.kind).toBe('local');\n expect(typeof event.origin.sessionId).toBe('string');\n expect(event.origin.sessionId.length > 0).toBe(true);\n expect(event.origin.sessionId).toBe(events[0].origin.sessionId);\n expect(typeof event.origin.ts).toBe('number');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a FAILED mutation publishes nothing (events are ground truth)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n const list = await doc.pages.list();\n let caught: unknown;\n try {\n // Deleting every page is rejected — see PageDeleteInput.\n await doc.pages.delete(list.pages.map((p) => p.pageObjectNumber));\n } catch (err) {\n caught = err;\n }\n expect(caught !== undefined).toBe(true);\n expect(events.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('unsubscribe stops delivery', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => events.push(event));\n unsubscribe();\n const list = await doc.pages.list();\n await doc.pages.rotate([list.pages[0].pageObjectNumber], 180);\n expect(events.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { PageTextSnapshot } from '../dto/PageTextSnapshot';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport { PageTextSnapshotSchema } from '../wire/schemas';\n\n/**\n * Per-fixture expectations for the text-extraction harness. Concrete\n * suites supply the page identity + a substring the harness asserts\n * exists in the extracted text. The harness deliberately avoids\n * locking the exact string so different fixtures (or PDFium upgrades\n * that change whitespace handling) don't require harness edits.\n */\nexport interface PageTextConformanceFixture extends ConformanceFixture {\n /** PDF indirect object number of the page used by the text tests. */\n pageObjectNumber: number;\n /**\n * Substring guaranteed to appear in the extracted text. The harness\n * uses `.includes(needle)`; suites should pick something distinctive\n * but not whitespace-sensitive.\n */\n expectedSubstring: string;\n /** Minimum char count the harness expects (sanity floor). */\n minCharCount: number;\n}\n\nexport interface PageTextConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: PageTextConformanceFixture;\n}\n\nexport function runPageTextConformance(\n runner: ConformanceTestRunner,\n opts: PageTextConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page text conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('read() returns a PageTextSnapshot with non-empty text', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const snap = await page.text.read();\n expect(PageTextSnapshotSchema.safeParse(snap).success).toBe(true);\n expect(snap.charCount >= opts.fixture.minCharCount).toBe(true);\n expect(snap.text.length > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('extracted text contains the expected substring', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const snap = await page.text.read();\n expect(snap.text.includes(opts.fixture.expectedSubstring)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('read() on an unknown pageObjectNumber throws NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n const ghost = doc.page(999_999_999);\n await ghost.text.read();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() on read rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const p = page.text.read();\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('read after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n const page = doc.page(opts.fixture.pageObjectNumber);\n await doc.close();\n let caught: unknown;\n try {\n await page.text.read();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: PageTextConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\nexport type { PageTextSnapshot };\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport { foldText } from '../search/fold';\nimport type { SearchMatch, SearchSlice } from '../search/types';\nimport { SearchSliceSchema } from '../wire/schemas';\n\n/**\n * Per-fixture expectations for the search harness. Suites supply a\n * literal known to be on a specific page, one known to be nowhere, and a\n * regex with a predictable hit — the harness asserts behavior (offsets,\n * rects, snippets, cursor mechanics, dialect rejection), never exact\n * match counts, so PDFium text-extraction tweaks don't require edits.\n */\nexport interface SearchConformanceFixture extends ConformanceFixture {\n /** Literal present in the document at least once. */\n presentLiteral: string;\n /** A page (pon) guaranteed to carry a `presentLiteral` match. */\n presentPageObjectNumber: number;\n /** Literal guaranteed to match nowhere. */\n absentLiteral: string;\n /** Dialect-valid regex with at least one match in the document. */\n presentRegex: string;\n}\n\nexport interface SearchConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: SearchConformanceFixture;\n}\n\nexport function runSearchConformance(\n runner: ConformanceTestRunner,\n opts: SearchConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fixture = opts.fixture;\n\n /** Drive the cursor loop to exhaustion; assert each slice parses. */\n async function collectAll(\n doc: Awaited<ReturnType<Engine['open']>>,\n request: Parameters<typeof doc.search.query>[0],\n ): Promise<{ matches: SearchMatch[]; slices: SearchSlice[] }> {\n const matches: SearchMatch[] = [];\n const slices: SearchSlice[] = [];\n let cursor: string | undefined;\n for (;;) {\n const slice = await doc.search.query({ ...request, cursor });\n expect(SearchSliceSchema.safeParse(slice).success).toBe(true);\n matches.push(...slice.matches);\n slices.push(slice);\n if (slice.nextCursor === null) return { matches, slices };\n cursor = slice.nextCursor;\n }\n }\n\n describe(`search conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('finds the present literal with sane matches', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches } = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n });\n expect(matches.length > 0).toBe(true);\n expect(matches.some((m) => m.pageObjectNumber === fixture.presentPageObjectNumber)).toBe(\n true,\n );\n for (const m of matches) {\n expect(m.charCount > 0).toBe(true);\n expect(m.rects.length > 0).toBe(true);\n for (const r of m.rects) {\n expect(r.right > r.left).toBe(true);\n expect(r.top > r.bottom).toBe(true);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('matching is case-insensitive by default', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const lower = await collectAll(doc, {\n query: { text: fixture.presentLiteral.toLowerCase() },\n });\n const upper = await collectAll(doc, {\n query: { text: fixture.presentLiteral.toUpperCase() },\n });\n expect(lower.matches.length).toBe(upper.matches.length);\n expect(lower.matches.length > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test(\"'full' snippets reproduce the matched text; 'rects' carries none\", async () => {\n const doc = await openFixture(engine, opts);\n try {\n const full = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n mode: 'full',\n });\n for (const m of full.matches) {\n expect(!!m.snippet).toBe(true);\n const s = m.snippet!;\n const hit = s.text.slice(s.matchStart, s.matchStart + s.matchLength);\n // Fold both sides: the snippet keeps the page's original case\n // and (1:1-flattened) whitespace.\n expect(foldText(hit).folded).toBe(foldText(fixture.presentLiteral).folded);\n }\n const rects = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n mode: 'rects',\n });\n expect(rects.matches.length).toBe(full.matches.length);\n for (const m of rects.matches) expect(m.snippet === undefined).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('the absent literal exhausts with zero matches', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches, slices } = await collectAll(doc, {\n query: { text: fixture.absentLiteral },\n });\n expect(matches.length).toBe(0);\n const last = slices[slices.length - 1];\n expect(last.nextCursor).toBe(null);\n expect(last.totalPages > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a one-page budget walks the whole document via the cursor', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const whole = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n });\n const sliced = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n budget: { maxPages: 1 },\n });\n expect(sliced.matches.length).toBe(whole.matches.length);\n const last = sliced.slices[sliced.slices.length - 1];\n expect(last.scannedPages).toBe(last.totalPages);\n expect(sliced.slices.length).toBe(last.totalPages);\n } finally {\n await doc.close();\n }\n });\n\n test('startPage rotates the scan order (viewport-first)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const slice = await doc.search.query({\n query: { text: fixture.presentLiteral },\n startPage: fixture.presentPageObjectNumber,\n budget: { maxPages: 1 },\n });\n expect(slice.matches.length > 0).toBe(true);\n expect(slice.matches[0].pageObjectNumber).toBe(fixture.presentPageObjectNumber);\n } finally {\n await doc.close();\n }\n });\n\n test('a cursor replayed against a different query is rejected', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const first = await doc.search.query({\n query: { text: fixture.presentLiteral },\n budget: { maxPages: 1 },\n });\n expect(first.nextCursor !== null).toBe(true);\n let caught: unknown;\n try {\n await doc.search.query({\n query: { text: fixture.absentLiteral },\n cursor: first.nextCursor!,\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a malformed cursor is rejected', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.search.query({\n query: { text: fixture.presentLiteral },\n cursor: 'not a cursor',\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('regex queries match with offsets and rects', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches } = await collectAll(doc, {\n query: { text: fixture.presentRegex, regex: true },\n });\n expect(matches.length > 0).toBe(true);\n for (const m of matches) {\n expect(m.charCount > 0).toBe(true);\n expect(m.rects.length > 0).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('regex flags are restrictions: matchCase and wholeWord return subsets', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const all = await collectAll(doc, {\n query: { text: fixture.presentRegex, regex: true },\n });\n const key = (m: SearchMatch) => `${m.pageObjectNumber}:${m.charStart}:${m.charCount}`;\n const allKeys = new Set(all.matches.map(key));\n // Each flag can only REMOVE matches, never invent them — true for\n // any fixture pattern, so the suite needs no per-fixture counts.\n for (const flags of [{ matchCase: true }, { wholeWord: true }]) {\n const restricted = await collectAll(doc, {\n query: { text: fixture.presentRegex, regex: true, ...flags },\n });\n expect(restricted.matches.length <= all.matches.length).toBe(true);\n for (const m of restricted.matches) expect(allKeys.has(key(m))).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('regex + matchDiacritics is rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.search.query({\n query: { text: fixture.presentRegex, regex: true, matchDiacritics: true },\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('dialect violations are rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n for (const pattern of ['(a)\\\\1', '(?=x)y', '(']) {\n let caught: unknown;\n try {\n await doc.search.query({ query: { text: pattern, regex: true } });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('an empty needle returns an exhausted, empty slice', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const slice = await doc.search.query({ query: { text: ' ' } });\n expect(slice.matches.length).toBe(0);\n expect(slice.nextCursor).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() on query rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.search.query({ query: { text: fixture.presentLiteral } });\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('query after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.search.query({ query: { text: fixture.presentLiteral } });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: SearchConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n AnnotationListPageSnapshot,\n AnnotationListSnapshotAllPages,\n} from '../annotation/AnnotationListSnapshot';\nimport type { AnnotationDTO } from '../annotation/kinds';\n\n/**\n * Returns a list of human-readable difference strings between two\n * snapshots. Empty array means parity. Used by `engine-node.ts` to assert\n * that local and cloud emit identical annotations for the same fixture.\n *\n * `RevisionToken.docSessionId` is intentionally NOT compared — sessions\n * are disjoint. We do compare `pageObjectNumber` and `generation` (which\n * should be 0 for fresh reads on both sides). Page order is no longer part\n * of `PageState`; it lives in `PageLayout.index` (see `pages.list()`).\n */\nexport function diffAnnotationListSnapshot(\n a: AnnotationListPageSnapshot,\n b: AnnotationListPageSnapshot,\n): string[] {\n const errs: string[] = [];\n\n if (a.pageState.pageObjectNumber !== b.pageState.pageObjectNumber) {\n errs.push(\n `pageState.pageObjectNumber mismatch: ${a.pageState.pageObjectNumber} vs ${b.pageState.pageObjectNumber}`,\n );\n }\n if (\n JSON.stringify(a.pageState.weakAnnotationState) !==\n JSON.stringify(b.pageState.weakAnnotationState)\n ) {\n errs.push(\n `pageState.weakAnnotationState mismatch: ${JSON.stringify(\n a.pageState.weakAnnotationState,\n )} vs ${JSON.stringify(b.pageState.weakAnnotationState)}`,\n );\n }\n if (a.pageState.revision.generation !== b.pageState.revision.generation) {\n errs.push(\n `pageState.revision.generation mismatch: ${a.pageState.revision.generation} vs ${b.pageState.revision.generation}`,\n );\n }\n if (a.annotations.length !== b.annotations.length) {\n errs.push(`annotations.length mismatch: ${a.annotations.length} vs ${b.annotations.length}`);\n }\n\n const n = Math.min(a.annotations.length, b.annotations.length);\n for (let i = 0; i < n; i++) {\n const aa = a.annotations[i]!;\n const bb = b.annotations[i]!;\n diffAnnotation(i, aa, bb, errs);\n }\n\n return errs;\n}\n\nexport function diffAnnotationListSnapshotAll(\n a: AnnotationListSnapshotAllPages,\n b: AnnotationListSnapshotAllPages,\n): string[] {\n const errs: string[] = [];\n if (a.pages.length !== b.pages.length) {\n errs.push(`pages.length mismatch: ${a.pages.length} vs ${b.pages.length}`);\n }\n const n = Math.min(a.pages.length, b.pages.length);\n for (let i = 0; i < n; i++) {\n const pageErrs = diffAnnotationListSnapshot(a.pages[i]!, b.pages[i]!);\n for (const e of pageErrs) {\n errs.push(`page[${i}]: ${e}`);\n }\n }\n return errs;\n}\n\nfunction diffAnnotation(i: number, a: AnnotationDTO, b: AnnotationDTO, errs: string[]): void {\n if (a.subtype !== b.subtype) {\n errs.push(`annotations[${i}].subtype mismatch: ${a.subtype} vs ${b.subtype}`);\n return;\n }\n if (a.identityQuality !== b.identityQuality) {\n errs.push(\n `annotations[${i}].identityQuality mismatch: ${a.identityQuality} vs ${b.identityQuality}`,\n );\n }\n if (a.ref.kind !== b.ref.kind) {\n errs.push(`annotations[${i}].ref.kind mismatch: ${a.ref.kind} vs ${b.ref.kind}`);\n }\n if (a.ref.kind === 'objectNumber' && b.ref.kind === 'objectNumber') {\n if (a.ref.annotObjectNumber !== b.ref.annotObjectNumber) {\n errs.push(\n `annotations[${i}].ref.annotObjectNumber mismatch: ${a.ref.annotObjectNumber} vs ${b.ref.annotObjectNumber}`,\n );\n }\n }\n if (a.nm !== b.nm) {\n errs.push(`annotations[${i}].nm mismatch: ${a.nm} vs ${b.nm}`);\n }\n}\n"],"mappings":";;;;;;;;;;AA4DA,SAAgB,uBACd,QACA,MACM;CACN,MAAM,EAAE,UAAU,MAAM,WAAW,UAAU,WAAW;CAExD,SAAS,yBAAyB,KAAK,eAAe;EACpD,IAAI;EAEJ,UAAU,YAAY;GACpB,SAAS,MAAM,KAAK,WAAW;EACjC,CAAC;EAED,SAAS,YAAY;GACnB,IAAI,QAAQ,MAAM,OAAO,QAAQ;EACnC,CAAC;EAED,KAAK,sCAAsC,YAAY;GACrD,MAAM,MAAM,MAAMA,eAAY,QAAQ,IAAI;GAC1C,IAAI;IACF,MAAM,OAAO,MAAM,IAAI,SAAS,KAAK;IACrC,OAAO,IAAI,CAAC,CAAC,cAAc,KAAK,QAAQ,QAAQ;IAChD,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,wBAAwB;GACvD,UAAU;IACR,MAAM,IAAI,MAAM;GAClB;EACF,CAAC;EAED,KAAK,qDAAqD,YAAY;GACpE,MAAM,MAAM,MAAMA,eAAY,QAAQ,IAAI;GAC1C,IAAI;IACF,MAAM,IAAI,IAAI,SAAS,KAAK;IAC5B,EAAE,MAAM,MAAM;IACd,MAAM,OAAO,CAAC,CAAC,CAAC,QAAQ,eAAeC,mBAAAA,UAAU;GACnD,UAAU;IACR,MAAM,IAAI,MAAM;GAClB;EACF,CAAC;EAED,KAAK,sDAAsD,YAAY;GACrE,MAAM,MAAM,MAAMD,eAAY,QAAQ,IAAI;GAC1C,IAAI;IACF,MAAM,IAAI,IAAI,SAAS,KAAK;IAC5B,MAAM,IAAI,IAAI,SAAS,KAAK;IAC5B,EAAE,MAAM,MAAM;IACd,MAAM,O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;EACpE,KAAK,MAAM,KAAK,UACd,KAAK,KAAK,QAAQ,EAAE,KAAK,GAAG;CAEhC;CACA,OAAO;AACT;AAEA,SAAS,eAAe,GAAW,GAAkB,GAAkB,MAAsB;CAC3F,IAAI,EAAE,YAAY,EAAE,SAAS;EAC3B,KAAK,KAAK,eAAe,EAAE,sBAAsB,EAAE,QAAQ,MAAM,EAAE,SAAS;EAC5E;CACF;CACA,IAAI,EAAE,oBAAoB,EAAE,iBAC1B,KAAK,KACH,eAAe,EAAE,8BAA8B,EAAE,gBAAgB,MAAM,EAAE,iBAC3E;CAEF,IAAI,EAAE,IAAI,SAAS,EAAE,IAAI,MACvB,KAAK,KAAK,eAAe,EAAE,uBAAuB,EAAE,IAAI,KAAK,MAAM,EAAE,IAAI,MAAM;CAEjF,IAAI,EAAE,IAAI,SAAS,kBAAkB,EAAE,IAAI,SAAS,gBAC9C;MAAA,EAAE,IAAI,sBAAsB,EAAE,IAAI,mBACpC,KAAK,KACH,eAAe,EAAE,oCAAoC,EAAE,IAAI,kBAAkB,MAAM,EAAE,IAAI,mBAC3F;CAAA;CAGJ,IAAI,EAAE,OAAO,EAAE,IACb,KAAK,KAAK,eAAe,EAAE,iBAAiB,EAAE,GAAG,MAAM,EAAE,IAAI;AAEjE"}
1
+ {"version":3,"file":"conformance.cjs","names":["openFixture","AbortError","EngineError","EngineErrorCode","openFixture","AnnotationListSnapshotAllPagesSchema","AnnotationListPageSnapshotSchema","AnnotationDTOSchema","AbortError","EngineError","EngineErrorCode","DocumentActionsSnapshotSchema","DEFAULT_QUAD","openFixture","AnnotationCreateResultSchema","AnnotationUpdateResultSchema","AnnotationDeleteResultSchema","AbortError","EngineError","EngineErrorCode","AnnotationMoveResultSchema","EngineErrorCode","openFixture","AbortError","openFixture","PageListSnapshotSchema","PageMoveResultSchema","EngineError","EngineErrorCode","AbortError","QUAD","openFixture","PageRotateResultSchema","EngineError","EngineErrorCode","AbortError","QUAD","openFixture","PageDeleteResultSchema","EngineError","EngineErrorCode","AbortError","openFixture","PageFlattenResultSchema","EngineErrorCode","openFixture","RedactionApplyResultSchema","EngineErrorCode","openFixture","EngineError","EngineErrorCode","AbortError","EngineError","openFixture","EngineError","EngineErrorCode","openFixture","openFixture","openFixture","PageTextSnapshotSchema","EngineError","EngineErrorCode","AbortError","openFixture","PageGeometrySnapshotSchema","isRotatedGeometryRun","pdfQuadBounds","SearchSliceSchema","foldText","EngineError","EngineErrorCode","AbortError"],"sources":["../src/conformance/runMetadataConformance.ts","../src/conformance/runAnnotationReadConformance.ts","../src/conformance/runActionsConformance.ts","../src/conformance/runAnnotationMutationConformance.ts","../src/conformance/runFormConformance.ts","../src/conformance/runAnnotationAppearanceConformance.ts","../src/conformance/runPageReorderConformance.ts","../src/conformance/runPageRotateConformance.ts","../src/conformance/runPageDeleteConformance.ts","../src/conformance/runPageFlattenConformance.ts","../src/conformance/runRedactionApplyConformance.ts","../src/conformance/runPageExtractConformance.ts","../src/conformance/runAttachmentConformance.ts","../src/conformance/runPageInsertConformance.ts","../src/conformance/runPieceInfoConformance.ts","../src/conformance/runDocumentEventsConformance.ts","../src/conformance/runPageTextConformance.ts","../src/conformance/runPageGeometryOrientationConformance.ts","../src/conformance/runSearchConformance.ts","../src/conformance/diffAnnotationListSnapshot.ts"],"sourcesContent":["import type { DocumentMetadata } from '../dto/DocumentMetadata';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\n\nexport interface ConformanceTestRunner {\n describe(name: string, fn: () => void): void;\n test(name: string, fn: () => void | Promise<void>): void;\n beforeAll(fn: () => void | Promise<void>): void;\n afterAll(fn: () => void | Promise<void>): void;\n expect: ConformanceExpect;\n}\n\nexport interface ConformanceExpect {\n (actual: unknown): {\n toBe(expected: unknown): void;\n toBeNull(): void;\n toEqual(expected: unknown): void;\n toHaveLength(expected: number): void;\n toMatch(re: RegExp): void;\n toMatchObject(shape: Record<string, unknown>): void;\n toBeInstanceOf(ctor: Function): void;\n toBeTruthy(): void;\n rejects: {\n toBeInstanceOf(ctor: Function): Promise<void>;\n toMatchObject(shape: Record<string, unknown>): Promise<void>;\n };\n resolves: {\n toMatchObject(shape: Record<string, unknown>): Promise<void>;\n toEqual(expected: unknown): Promise<void>;\n };\n };\n}\n\nexport interface ConformanceFixture {\n /** Stable id used for the local engine; cloud uses its own id. */\n id: string;\n /** Bytes for the local engine. */\n bytes: () => Uint8Array | Promise<Uint8Array>;\n /** Override the cloud-side id. Defaults to `id`. */\n cloudId?: string;\n /** The expected document metadata. Used for parity assertions. */\n expected: Partial<DocumentMetadata>;\n}\n\nexport interface ConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. Suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /** Sample fixture for the happy-path metadata read. */\n fixture: ConformanceFixture;\n /** Engine 'kind' for opening: 'bytes' for local, 'id' for cloud. */\n openKind: 'bytes' | 'id';\n}\n\n/**\n * The conformance harness is transport-agnostic. It takes the test runner as\n * a parameter so engine-core has no dependency on vitest/jest/node:test.\n */\nexport function runMetadataConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`metadata conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('reads metadata from sample fixture', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const meta = await doc.metadata.read();\n expect(meta).toMatchObject(opts.fixture.expected);\n expect(meta.trapped).toMatch(/^(true|false|unknown)$/);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() before completion rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.metadata.read();\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('aborting one read does not affect a concurrent one', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const a = doc.metadata.read();\n const b = doc.metadata.read();\n a.abort('test');\n await expect(a).rejects.toBeInstanceOf(AbortError);\n await expect(b).resolves.toMatchObject(opts.fixture.expected);\n } finally {\n await doc.close();\n }\n });\n\n test('metadata after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.metadata.read();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n\n test('update() sets standard + custom fields and a subsequent read observes them', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const result = await doc.metadata.update({\n title: 'Conformance Title',\n subject: 'Conformance Subject',\n custom: { ConformanceKey: 'conformance-value' },\n });\n // The result carries the re-read metadata; cloud also carries cache\n // pins (local is null) — both expose the post-write values here.\n expect(result.metadata.title).toBe('Conformance Title');\n expect(result.metadata.subject).toBe('Conformance Subject');\n expect(result.metadata.custom.ConformanceKey).toBe('conformance-value');\n\n // A fresh read goes through the versioned leaf (cloud) / re-read\n // (local) and must observe the same write.\n const after = await doc.metadata.read();\n expect(after.title).toBe('Conformance Title');\n expect(after.subject).toBe('Conformance Subject');\n expect(after.custom.ConformanceKey).toBe('conformance-value');\n } finally {\n await doc.close();\n }\n });\n\n test('update() clears a field with null', async () => {\n const doc = await openFixture(engine, opts);\n try {\n await doc.metadata.update({ title: 'To Be Cleared' });\n const set = await doc.metadata.read();\n expect(set.title).toBe('To Be Cleared');\n\n await doc.metadata.update({ title: null });\n const cleared = await doc.metadata.read();\n expect(cleared.title).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('update() after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.metadata.update({ title: 'nope' });\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { AnnotationListPageSnapshot } from '../annotation/AnnotationListSnapshot';\nimport { AnnotationDTOSchema } from '../annotation/kinds';\nimport type { AnnotationDTO } from '../annotation/kinds';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport {\n AnnotationListPageSnapshotSchema,\n AnnotationListSnapshotAllPagesSchema,\n} from '../wire/schemas';\n\n/**\n * Expected per-fixture annotation knowledge. The harness asserts against\n * these without locking the exact wire content, so different fixtures can\n * be added by suites without rewriting the harness.\n */\nexport interface AnnotationReadConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page used by the annotation tests. */\n pageObjectNumber: number;\n /** The total annotation count expected on that page (across all subtypes). */\n expectedAnnotationCount: number;\n /** At least this many `'highlight'` annotations on the page. */\n minHighlightCount: number;\n /** At least this many `'unsupported'` annotations on the page. */\n minUnsupportedCount: number;\n /** At least this many `'circle'` annotations on the page. Defaults to 0. */\n minCircleCount?: number;\n /** At least this many `'square'` annotations on the page. Defaults to 0. */\n minSquareCount?: number;\n /** At least this many `'polygon'` annotations on the page. Defaults to 0. */\n minPolygonCount?: number;\n /** At least this many `'polyline'` annotations on the page. Defaults to 0. */\n minPolylineCount?: number;\n /** At least this many `'line'` annotations on the page. Defaults to 0. */\n minLineCount?: number;\n /** At least this many `'ink'` annotations on the page. Defaults to 0. */\n minInkCount?: number;\n /** At least this many `'free-text'` annotations on the page. Defaults to 0. */\n minFreeTextCount?: number;\n /** At least this many `'caret'` annotations on the page. Defaults to 0. */\n minCaretCount?: number;\n /**\n * `true` if the fixture has at least one weak annotation (no /NM, direct\n * object). Drives the weak-ref + revision tests.\n */\n expectsWeakAnnotation: boolean;\n}\n\nexport interface AnnotationConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: AnnotationReadConformanceFixture;\n}\n\nexport function runAnnotationReadConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation read conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('listRawAll returns one entry per page with valid PageState', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRawAll();\n expect(AnnotationListSnapshotAllPagesSchema.safeParse(snap).success).toBe(true);\n expect(snap.pages.length >= 1).toBe(true);\n const target = snap.pages.find(\n (p) => p.pageState.pageObjectNumber === opts.fixture.pageObjectNumber,\n );\n expect(target !== undefined).toBe(true);\n expect(target!.annotations.length).toBe(opts.fixture.expectedAnnotationCount);\n } finally {\n await doc.close();\n }\n });\n\n test('listRaw on the test page returns the expected counts and DTO shape', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n expect(AnnotationListPageSnapshotSchema.safeParse(snap).success).toBe(true);\n expect(snap.annotations.length).toBe(opts.fixture.expectedAnnotationCount);\n const highlights = snap.annotations.filter((a) => a.subtype === 'highlight');\n expect(highlights.length >= opts.fixture.minHighlightCount).toBe(true);\n const unsupported = snap.annotations.filter((a) => a.subtype === 'unsupported');\n expect(unsupported.length >= opts.fixture.minUnsupportedCount).toBe(true);\n const circles = snap.annotations.filter((a) => a.subtype === 'circle');\n expect(circles.length >= (opts.fixture.minCircleCount ?? 0)).toBe(true);\n const squares = snap.annotations.filter((a) => a.subtype === 'square');\n expect(squares.length >= (opts.fixture.minSquareCount ?? 0)).toBe(true);\n const polygons = snap.annotations.filter((a) => a.subtype === 'polygon');\n expect(polygons.length >= (opts.fixture.minPolygonCount ?? 0)).toBe(true);\n const polylines = snap.annotations.filter((a) => a.subtype === 'polyline');\n expect(polylines.length >= (opts.fixture.minPolylineCount ?? 0)).toBe(true);\n const lines = snap.annotations.filter((a) => a.subtype === 'line');\n expect(lines.length >= (opts.fixture.minLineCount ?? 0)).toBe(true);\n const inks = snap.annotations.filter((a) => a.subtype === 'ink');\n expect(inks.length >= (opts.fixture.minInkCount ?? 0)).toBe(true);\n const freeTexts = snap.annotations.filter((a) => a.subtype === 'free-text');\n expect(freeTexts.length >= (opts.fixture.minFreeTextCount ?? 0)).toBe(true);\n const carets = snap.annotations.filter((a) => a.subtype === 'caret');\n expect(carets.length >= (opts.fixture.minCaretCount ?? 0)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('shape/vertex/line annotations expose their family fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n for (const a of snap.annotations) {\n // Ink carries the geometry styling (/C, /CA, /BS) but NOT /IC, plus\n // its /InkList (a non-empty array of point paths).\n if (a.subtype === 'ink') {\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.strokeWidth).toBe('number');\n expect(typeof a.borderStyle).toBe('string');\n expect(typeof a.opacity).toBe('number');\n expect('interiorColor' in a).toBe(false);\n expect(Array.isArray(a.inkList)).toBe(true);\n expect(a.inkList.length >= 1).toBe(true);\n expect(Array.isArray(a.inkList[0])).toBe(true);\n expect(a.inkList[0]!.length >= 1).toBe(true);\n continue;\n }\n // Free text: text fields (/DA) + nullable /C background + intent.\n if (a.subtype === 'free-text') {\n expect(typeof a.fontFamily).toBe('string');\n expect(typeof a.fontSize).toBe('number');\n expect(typeof a.textAlign).toBe('string');\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect('interiorColor' in a).toBe(true);\n expect(a.intent === 'free-text' || a.intent === 'free-text-callout').toBe(true);\n if (a.intent === 'free-text-callout' && a.calloutLine) {\n expect(a.calloutLine.length === 2 || a.calloutLine.length === 3).toBe(true);\n }\n continue;\n }\n // Caret: color-only style (/C, /CA) + optional /RD, no border/quads.\n if (a.subtype === 'caret') {\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.opacity).toBe('number');\n expect('strokeWidth' in a).toBe(false);\n expect('quadPoints' in a).toBe(false);\n continue;\n }\n // Every stroke/fill family member shares this styling surface.\n const isFilledStyle =\n a.subtype === 'circle' ||\n a.subtype === 'square' ||\n a.subtype === 'polygon' ||\n a.subtype === 'polyline' ||\n a.subtype === 'line';\n if (!isFilledStyle) continue;\n // interiorColor is Color | null; color (/C) is always present.\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.strokeWidth).toBe('number');\n expect(typeof a.borderStyle).toBe('string');\n expect(typeof a.opacity).toBe('number');\n expect('interiorColor' in a).toBe(true);\n\n if (a.subtype === 'polygon' || a.subtype === 'polyline') {\n expect(Array.isArray(a.vertices)).toBe(true);\n expect(a.vertices.length >= 2).toBe(true);\n }\n if (a.subtype === 'polyline') {\n expect(typeof a.lineEndings.start).toBe('string');\n expect(typeof a.lineEndings.end).toBe('string');\n }\n if (a.subtype === 'line') {\n expect(typeof a.linePoints.start.x).toBe('number');\n expect(typeof a.linePoints.end.y).toBe('number');\n expect(typeof a.lineEndings.start).toBe('string');\n expect(typeof a.lineEndings.end).toBe('string');\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('full page list dispatches per-subtype and matches raw counts', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const full = await page.annotations.list();\n expect(AnnotationListPageSnapshotSchema.safeParse(full).success).toBe(true);\n expect(full.annotations.length).toBe(opts.fixture.expectedAnnotationCount);\n } finally {\n await doc.close();\n }\n });\n\n test('every annotation DTO satisfies AnnotationDTOSchema (discriminated union)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n for (const a of snap.annotations) {\n const result = AnnotationDTOSchema.safeParse(a);\n expect(result.success).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('AnnotationDTOSchema rejects an annotation with a foreign subtype', () => {\n const bogus: unknown = {\n subtype: 'pretend-not-real',\n ref: { kind: 'objectNumber', pageObjectNumber: 1, annotObjectNumber: 1 },\n pageObjectNumber: 1,\n index: 0,\n identityQuality: 'durable',\n nm: null,\n flags: emptyFlags(),\n rect: { left: 0, top: 0, right: 0, bottom: 0 },\n contents: null,\n author: null,\n created: null,\n modified: null,\n };\n const result = AnnotationDTOSchema.safeParse(bogus);\n expect(result.success).toBe(false);\n });\n\n if (opts.fixture.expectsWeakAnnotation) {\n test('weak annotations carry identityQuality: weak and ref.kind: index', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n const weak = snap.annotations.find((a) => a.identityQuality === 'weak');\n expect(weak !== undefined).toBe(true);\n expect(weak!.ref.kind).toBe('index');\n } finally {\n await doc.close();\n }\n });\n\n test('a stale revision token throws InvalidReference', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const snap = await page.annotations.list();\n const weak = snap.annotations.find((a) => a.identityQuality === 'weak');\n expect(weak !== undefined).toBe(true);\n const staleRevision = {\n ...snap.pageState.revision,\n generation: snap.pageState.revision.generation + 999,\n };\n // create() will fail in this slice with NotImplemented; the\n // path we exercise here is reading-back via a fabricated\n // index-ref. We can't hit it via a public read API today, so\n // this test is a placeholder until mutations land. It still\n // proves the schema accepts a stale revision shape.\n expect(staleRevision.generation > snap.pageState.revision.generation).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('abort() on listRaw rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('listRaw on an unknown pageObjectNumber throws NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.annotations.listRaw(999_999_999);\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: AnnotationConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\nfunction emptyFlags() {\n return {\n invisible: false,\n hidden: false,\n print: false,\n noZoom: false,\n noRotate: false,\n noView: false,\n readOnly: false,\n locked: false,\n toggleNoView: false,\n lockedContents: false,\n };\n}\n\n// Re-export for convenience: tests can hand a literal snapshot.\nexport type { AnnotationListPageSnapshot, AnnotationDTO };\n","import type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { DocumentActionsSnapshotSchema } from '../dto/PdfAction.schema';\nimport type { ConformanceFixture, ConformanceTestRunner } from './runMetadataConformance';\n\nexport interface ActionsConformanceFixtures {\n document: ConformanceFixture;\n page: ConformanceFixture;\n annotation: ConformanceFixture;\n field: ConformanceFixture;\n /** A page whose only annotation is a Link with a `/S /JavaScript` action.\n * Optional: the javascript-link classification test skips without it. */\n javascriptLink?: ConformanceFixture;\n}\n\nexport interface ActionsConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n fixtures: ActionsConformanceFixtures;\n openKind: 'bytes' | 'id';\n}\n\n/** Action extraction parity. These tests assert data only; no script executes. */\nexport function runActionsConformance(\n runner: ConformanceTestRunner,\n opts: ActionsConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n let engine: Engine;\n\n describe(`actions conformance: ${opts.label}`, () => {\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('reads catalog additional actions and preserves /CO identity', async () => {\n const doc = await open(engine, opts, opts.fixtures.document);\n try {\n expect(Boolean(doc.actions)).toBe(true);\n const snapshot = await doc.actions!.read();\n expect(DocumentActionsSnapshotSchema.safeParse(snapshot).success).toBe(true);\n expect(snapshot.openAction).toBeNull();\n expect(snapshot.willSave?.root?.type).toBe('javascript');\n expect(snapshot.willSave?.root?.script ?? '').toMatch(/Will Save/);\n expect(snapshot.didSave?.root?.script ?? '').toMatch(/Did Save/);\n expect(snapshot.willPrint?.root?.script ?? '').toMatch(/Will Print/);\n expect(snapshot.didPrint?.root?.script ?? '').toMatch(/Did Print/);\n\n const form = await doc.forms.list();\n expect(form.calculationOrder).toEqual([{ kind: 'objectNumber', fieldObjectNumber: 9 }]);\n } finally {\n await doc.close();\n }\n });\n\n test('attaches page /AA to PageLayout', async () => {\n const doc = await open(engine, opts, opts.fixtures.page);\n try {\n const pages = await doc.pages.list();\n expect(pages.pages[0].actions?.open?.root?.type).toBe('goto-embedded');\n expect(pages.pages[0].actions?.close).toBe(undefined);\n expect(pages.pages[1].actions?.open?.root?.type).toBe('goto-embedded');\n expect(pages.pages[1].actions?.close?.root?.type).toBe('goto-embedded');\n } finally {\n await doc.close();\n }\n });\n\n test('attaches activation actions to AnnotationBase, including links', async () => {\n const doc = await open(engine, opts, opts.fixtures.annotation);\n try {\n const firstPage = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(firstPage.pageObjectNumber).annotations.list();\n const button = snapshot.annotations.find(\n (annotation) =>\n annotation.ref.kind === 'objectNumber' && annotation.ref.annotObjectNumber === 7,\n );\n const link = snapshot.annotations.find(\n (annotation) =>\n annotation.ref.kind === 'objectNumber' && annotation.ref.annotObjectNumber === 8,\n );\n expect(button?.actions?.activate?.root?.type).toBe('uri');\n // A link carries BOTH planes: the base-level scripting action model\n // (chain shape, for the orchestrator) and its own normalized target\n // (payload, for navigation). They must agree on the action type.\n expect(link?.subtype).toBe('link');\n expect(link?.actions?.activate?.root?.type).toBe('uri');\n if (link?.subtype === 'link') {\n expect(link.target?.kind).toBe('uri');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('classifies a /S /JavaScript link target, script staying on base.actions', async () => {\n const fixture = opts.fixtures.javascriptLink;\n if (!fixture) return; // fixture not provided for this engine flavour\n const doc = await open(engine, opts, fixture);\n try {\n const firstPage = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(firstPage.pageObjectNumber).annotations.list();\n const link = snapshot.annotations.find((annotation) => annotation.subtype === 'link');\n expect(link?.subtype).toBe('link');\n if (link?.subtype === 'link') {\n // The navigation vocabulary classifies (FPDFAction_GetType alone\n // cannot — it has no JavaScript code)…\n expect(link.target).toEqual({ kind: 'javascript' });\n }\n // …while the script text lives ONLY on the scripting plane's model.\n expect(link?.actions?.activate?.root?.type).toBe('javascript');\n expect(link?.actions?.activate?.root?.script ?? '').toMatch(/app\\.alert/);\n } finally {\n await doc.close();\n }\n });\n\n test('keeps field actions separate from merged widget events', async () => {\n const doc = await open(engine, opts, opts.fixtures.field);\n try {\n const form = await doc.forms.list();\n expect(form.fields).toHaveLength(1);\n expect(form.fields[0].actions?.format?.root?.type).toBe('javascript');\n expect(form.fields[0].actions?.format?.root?.script ?? '').toMatch(/AFDate_FormatEx/);\n const page = (await doc.pages.list()).pages[0];\n const widget = (await doc.page(page.pageObjectNumber).annotations.list()).annotations[0];\n expect(widget.actions).toBe(undefined);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function open(\n engine: Engine,\n opts: ActionsConformanceOptions,\n fixture: ConformanceFixture,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: fixture.id, bytes: await fixture.bytes() });\n }\n return engine.open({ kind: 'id', id: fixture.cloudId ?? fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type {\n AnnotationDraft,\n AnnotationPatch,\n CaretDraft,\n CircleDraft,\n FreeTextDraft,\n HighlightDraft,\n InkDraft,\n LineDraft,\n LinkDraft,\n PolygonDraft,\n PolylineDraft,\n RedactDraft,\n SquareDraft,\n StrikeoutDraft,\n} from '../annotation/kinds';\nimport type { WeakAnnotationEditSession } from '../engine/DocumentAnnotationsService';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { InkList, LinePoints, PdfPoint, PdfRect } from '../geometry/primitives';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport {\n AnnotationCreateResultSchema,\n AnnotationDeleteResultSchema,\n AnnotationMoveResultSchema,\n AnnotationUpdateResultSchema,\n} from '../wire/schemas';\n\n/**\n * Per-fixture knowledge the mutation harness needs. The shared fixture\n * fields (id, bytes, etc.) come from `ConformanceFixture`; the bits below\n * pin the test page. The harness asserts behaviour, not exact wire\n * content, so the same fixture can run against both local (WASM) and\n * cloud (native via @cloudpdf/server) engines.\n */\nexport interface AnnotationMutationConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page used by the mutation tests. */\n pageObjectNumber: number;\n /** Page already has at least one weak annotation (no /NM, direct object). */\n expectsWeakAnnotation: boolean;\n /**\n * QuadPoints to use for the create() smoke test. Coordinates are in\n * PDF user space; pick a small rectangle that fits anywhere on the\n * fixture page so we don't flake on different page sizes.\n */\n createQuad?: HighlightDraft['quadPoints'];\n /**\n * `/Rect` to use for the shape (circle/square) create tests. PDF user\n * space; pick a small box that fits anywhere on the fixture page.\n */\n createShapeRect?: PdfRect;\n /**\n * `/Vertices` to use for the polygon/polyline create tests. PDF user\n * space; must fit inside `createShapeRect` (the rect the engine bakes\n * the appearance into). Defaults to a small triangle.\n */\n createVertices?: PdfPoint[];\n /**\n * `/L` endpoints to use for the line create test. PDF user space; must\n * fit inside `createShapeRect`. Defaults to the rect's diagonal.\n */\n createLinePoints?: LinePoints;\n /**\n * `/InkList` strokes to use for the ink create test. PDF user space; must\n * fit inside `createShapeRect`. Defaults to a single short stroke.\n */\n createInkList?: InkList;\n}\n\nexport interface AnnotationMutationConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: AnnotationMutationConformanceFixture;\n /**\n * `true` for engines that expose the raw RGBA appearance rasters\n * (`renderAppearances`). When set, the shape-create test additionally\n * asserts that creating a shape produces a baked `/AP` the appearance\n * reader can rasterize. The cloud engine ships encoded images instead\n * and leaves this `false`.\n */\n supportsAppearanceRasters?: boolean;\n}\n\nconst DEFAULT_QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\nconst DEFAULT_SHAPE_RECT: PdfRect = { left: 60, bottom: 60, right: 160, top: 140 };\n\n/** A small triangle inside DEFAULT_SHAPE_RECT (valid for polygon: >=3). */\nconst DEFAULT_VERTICES: PdfPoint[] = [\n { x: 70, y: 70 },\n { x: 150, y: 70 },\n { x: 110, y: 130 },\n];\n\n/** A line along the diagonal of DEFAULT_SHAPE_RECT. */\nconst DEFAULT_LINE_POINTS: LinePoints = {\n start: { x: 70, y: 70 },\n end: { x: 150, y: 130 },\n};\n\n/**\n * A knee-jointed callout leader inside DEFAULT_SHAPE_RECT: the called-out\n * point, a knee, then the point touching the text box.\n */\nconst DEFAULT_CALLOUT_LINE: [PdfPoint, PdfPoint, PdfPoint] = [\n { x: 65, y: 65 },\n { x: 90, y: 90 },\n { x: 110, y: 100 },\n];\n\n/** A single freehand stroke inside DEFAULT_SHAPE_RECT (valid for ink). */\nconst DEFAULT_INK_STROKES: InkList = [\n [\n { x: 70, y: 70 },\n { x: 100, y: 120 },\n { x: 130, y: 80 },\n { x: 150, y: 130 },\n ],\n];\n\n/**\n * Mutation conformance suite. Mirrors the read suite: tests are written\n * once and run against any engine that satisfies the public API\n * surface. Both local (worker host + WASM) and cloud (HTTP +\n * @cloudpdf/server) implementations must pass identically.\n *\n * The locked rules being verified here:\n * - `create` is append-only: PDFium drops the new annotation at\n * `index = previousCount`, so no existing index shifts. Treated\n * as non-invalidating — revisions do NOT bump and weak refs\n * captured before the create remain valid.\n * - `update` is non-structural; revisions do NOT bump.\n * - Opportunistic /NM stamp upgrades a weak annotation's ref to\n * `kind: 'nm'` on update; an already-durable annotation's /NM is\n * NEVER touched.\n * - `delete` and `move` are the only index-shifting ops. They bump\n * the per-page revision and, on a page that had weak refs before\n * the mutation, surface `shouldRefetch: 'weakRefsInvalidated'`.\n * - Abort propagates as `AbortError` even before the worker\n * responds.\n */\nexport function runAnnotationMutationConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationMutationConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fix = opts.fixture;\n const quad = fix.createQuad ?? DEFAULT_QUAD;\n const shapeRect = fix.createShapeRect ?? DEFAULT_SHAPE_RECT;\n const vertices = fix.createVertices ?? DEFAULT_VERTICES;\n const linePoints = fix.createLinePoints ?? DEFAULT_LINE_POINTS;\n const inkStrokes = fix.createInkList ?? DEFAULT_INK_STROKES;\n\n describe(`annotation mutation conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('create appends without shifting indices and leaves weak refs valid', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const beforeCount = before.annotations.length;\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: created',\n color: { r: 200, g: 100, b: 50 },\n opacity: 0.5,\n quadPoints: quad,\n };\n const result = await page.annotations.create(draft);\n expect(AnnotationCreateResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // Always durable (engine uses the EPDFPage_CreateAnnot fork helper).\n expect(result.created.identityQuality).toBe('durable');\n expect(result.created.subtype).toBe('highlight');\n expect(result.created.ref.kind).toBe('objectNumber');\n\n // Locked rule: create is append-only, so the page revision does\n // NOT bump and no weak refs become stale — regardless of whether\n // the page had pre-existing weak annotations.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.shouldRefetch).toBe(null);\n expect(result.meta.weakRefsInvalidated).toBe(false);\n expect(result.meta.changed.length).toBe(1);\n\n // The annotation is actually on the page now, at the END of the\n // /Annots array. This is the invariant that justifies the\n // non-invalidating impact: every prior index is preserved.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(beforeCount + 1);\n expect(result.created.index).toBe(beforeCount);\n } finally {\n await doc.close();\n }\n });\n\n test('create + update honor annotation flags (set on create, merge on patch)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Create with a single flag set; the others must default to false.\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: flags',\n color: { r: 10, g: 20, b: 30 },\n opacity: 1,\n quadPoints: quad,\n flags: { print: true },\n };\n const created = await page.annotations.create(draft);\n expect(created.created.flags.print).toBe(true);\n expect(created.created.flags.hidden).toBe(false);\n\n // Patch a different flag: it must merge, leaving `print` intact.\n const hidden = await page.annotations.update(created.created.ref, {\n subtype: 'highlight',\n flags: { hidden: true },\n });\n expect(hidden.updated.flags.hidden).toBe(true);\n expect(hidden.updated.flags.print).toBe(true);\n\n // Clearing one flag leaves the rest untouched.\n const cleared = await page.annotations.update(created.created.ref, {\n subtype: 'highlight',\n flags: { print: false },\n });\n expect(cleared.updated.flags.print).toBe(false);\n expect(cleared.updated.flags.hidden).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('create shape annotations (circle + square) round-trip shape fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const circleDraft: CircleDraft = {\n subtype: 'circle',\n contents: 'mutation conformance: circle',\n rect: shapeRect,\n interiorColor: { r: 255, g: 0, b: 0 },\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 3,\n borderStyle: 'solid',\n opacity: 0.6,\n };\n const circle = await page.annotations.create(circleDraft);\n expect(AnnotationCreateResultSchema.safeParse(circle).success).toBe(true);\n expect(circle.created.subtype).toBe('circle');\n expect(circle.created.identityQuality).toBe('durable');\n expect(circle.created.ref.kind).toBe('objectNumber');\n if (circle.created.subtype === 'circle') {\n expect(circle.created.interiorColor).toMatchObject({ r: 255, g: 0, b: 0 });\n expect(circle.created.color).toMatchObject({ r: 0, g: 0, b: 255 });\n expect(circle.created.strokeWidth).toBe(3);\n expect(circle.created.borderStyle).toBe('solid');\n // /CA stored as f32 — compare at 2dp to absorb float drift.\n expect(Math.round(circle.created.opacity * 100) / 100).toBe(0.6);\n // /Rect round-trips. The chosen bounds are small integers that\n // are exactly representable in f32, so an exact compare is safe.\n expect(circle.created.rect.left).toBe(shapeRect.left);\n expect(circle.created.rect.right).toBe(shapeRect.right);\n expect(circle.created.rect.bottom).toBe(shapeRect.bottom);\n expect(circle.created.rect.top).toBe(shapeRect.top);\n }\n\n const squareDraft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: square',\n rect: shapeRect,\n interiorColor: null,\n color: { r: 0, g: 128, b: 0 },\n strokeWidth: 2,\n borderStyle: 'dashed',\n dashArray: [3, 2],\n opacity: 1,\n };\n const square = await page.annotations.create(squareDraft);\n expect(AnnotationCreateResultSchema.safeParse(square).success).toBe(true);\n expect(square.created.subtype).toBe('square');\n if (square.created.subtype === 'square') {\n // interiorColor omitted/null => no fill.\n expect(square.created.interiorColor).toBe(null);\n expect(square.created.color).toMatchObject({ r: 0, g: 128, b: 0 });\n expect(square.created.borderStyle).toBe('dashed');\n expect(square.created.dashArray).toEqual([3, 2]);\n }\n\n const after = await page.annotations.list();\n const subtypes = after.annotations.map((a) => a.subtype);\n expect(subtypes.includes('circle')).toBe(true);\n expect(subtypes.includes('square')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('cloudy border (/BE) + rect differences (/RD) are tri-state', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // A plain shape reads BOTH optional entries as explicit null — absence\n // is stated, so a read DTO compares structurally against a clearing\n // patch. The draft ALSO states them as null (exactly what the plugin's\n // total projection emits for a fresh solid shape): a draft writer must\n // skip null, never dereference it — the stale-worker regression where\n // solid creates vanished while cloudy ones survived.\n const plainDraft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: cloudy tri-state',\n rect: shapeRect,\n color: { r: 0, g: 128, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n cloudyIntensity: null,\n rectDifferences: null,\n };\n const plain = await page.annotations.create(plainDraft);\n expect(plain.created.subtype).toBe('square');\n if (plain.created.subtype === 'square') {\n expect(plain.created.cloudyIntensity).toBe(null);\n expect(plain.created.rectDifferences).toBe(null);\n }\n\n // A value sets /BE + /RD…\n const rd = { left: 5, top: 5, right: 5, bottom: 5 };\n const cloudy = await page.annotations.update(plain.created.ref, {\n subtype: 'square',\n cloudyIntensity: 2,\n rectDifferences: rd,\n });\n expect(cloudy.updated.subtype).toBe('square');\n if (cloudy.updated.subtype === 'square') {\n expect(cloudy.updated.cloudyIntensity).toBe(2);\n expect(cloudy.updated.rectDifferences).toMatchObject(rd);\n }\n\n // …and null removes them: the cloudy -> solid transition leaves no\n // stale /RD behind (the Adobe \"phantom padding\" regression).\n const solid = await page.annotations.update(plain.created.ref, {\n subtype: 'square',\n cloudyIntensity: null,\n rectDifferences: null,\n });\n expect(solid.updated.subtype).toBe('square');\n if (solid.updated.subtype === 'square') {\n expect(solid.updated.cloudyIntensity).toBe(null);\n expect(solid.updated.rectDifferences).toBe(null);\n }\n\n // Polygon carries /BE too (but never /RD, per ISO 32000) — same tri-state,\n // including the draft path.\n const polyDraft: PolygonDraft = {\n subtype: 'polygon',\n contents: 'mutation conformance: polygon cloudy tri-state',\n rect: shapeRect,\n vertices,\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n cloudyIntensity: 1,\n };\n const poly = await page.annotations.create(polyDraft);\n expect(poly.created.subtype).toBe('polygon');\n if (poly.created.subtype === 'polygon') {\n expect(poly.created.cloudyIntensity).toBe(1);\n }\n const polySolid = await page.annotations.update(poly.created.ref, {\n subtype: 'polygon',\n cloudyIntensity: null,\n });\n expect(polySolid.updated.subtype).toBe('polygon');\n if (polySolid.updated.subtype === 'polygon') {\n expect(polySolid.updated.cloudyIntensity).toBe(null);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('update echoes the appearance verdict: moves preserve /AP, restyles re-bake', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: appearance echo',\n rect: shapeRect,\n color: { r: 200, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n };\n const created = await page.annotations.create(draft);\n\n // A full-projection patch whose only real change is a same-size /Rect\n // move: the engine value-diffs away the unchanged style keys, verifies\n // the rigid translation, and preserves the baked /AP — the raster\n // invalidation signal stays off.\n const moved = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: {\n left: shapeRect.left + 12,\n bottom: shapeRect.bottom - 8,\n right: shapeRect.right + 12,\n top: shapeRect.top - 8,\n },\n color: { r: 200, g: 0, b: 0 },\n strokeWidth: 2,\n opacity: 1,\n });\n expect(moved.appearance).toEqual({ action: 'preserved', changed: false });\n\n // Metadata-only patches never touch /AP.\n const flagged = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n flags: { print: true },\n });\n expect(flagged.appearance).toEqual({ action: 'preserved', changed: false });\n\n // A real style edit re-bakes and says so.\n const restyled = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n interiorColor: { r: 255, g: 214, b: 0 },\n });\n expect(restyled.appearance).toEqual({ action: 'regenerated', changed: true });\n\n // A resize is not a translation — it re-bakes too.\n const resized = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: {\n left: shapeRect.left,\n bottom: shapeRect.bottom,\n right: shapeRect.right + 40,\n top: shapeRect.top,\n },\n });\n expect(resized.appearance).toEqual({ action: 'regenerated', changed: true });\n } finally {\n await doc.close();\n }\n });\n\n test('a partial /DA patch preserves the unpatched font members', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'DA read-modify-write',\n rect: shapeRect,\n fontFamily: 'times-roman',\n fontSize: 14,\n textAlign: 'left',\n color: { r: 200, g: 0, b: 0 },\n };\n const created = await page.annotations.create(draft);\n // `/DA` packs font+size+colour into one string; the writer must\n // read-modify-write, so a partial patch cannot reset the others (the\n // old constant fallbacks turned a size-only patch into 12pt black).\n expect(created.created.subtype).toBe('free-text');\n if (created.created.subtype === 'free-text') {\n expect(created.created.fontFamily).toBe('times-roman');\n }\n const sized = await page.annotations.update(created.created.ref, {\n subtype: 'free-text',\n fontSize: 18,\n });\n expect(sized.updated.subtype).toBe('free-text');\n if (sized.updated.subtype === 'free-text') {\n expect(sized.updated.fontFamily).toBe('times-roman');\n expect(sized.updated.fontSize).toBe(18);\n expect(sized.updated.color).toMatchObject({ r: 200, g: 0, b: 0 });\n }\n const recolored = await page.annotations.update(created.created.ref, {\n subtype: 'free-text',\n color: { r: 0, g: 0, b: 200 },\n });\n if (recolored.updated.subtype === 'free-text') {\n expect(recolored.updated.fontFamily).toBe('times-roman');\n expect(recolored.updated.fontSize).toBe(18);\n expect(recolored.updated.color).toMatchObject({ r: 0, g: 0, b: 200 });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('box transform is tri-state: rect-only moves keep rotation, null flattens', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: SquareDraft = {\n subtype: 'square',\n contents: 'transform tri-state',\n rect: shapeRect,\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n // A 90° rotation whose AABB equals the box (square) — valid pair.\n rotation: 90,\n unrotatedRect: shapeRect,\n };\n const created = await page.annotations.create(draft);\n expect(created.created.subtype).toBe('square');\n if (created.created.subtype === 'square') {\n expect(created.created.rotation).toBe(90);\n }\n\n // The whole group riding one delta is a verified translation: the\n // rotation survives AND the baked /AP is preserved.\n const d = { x: 15, y: -10 };\n const shift = (r: typeof shapeRect) => ({\n left: r.left + d.x,\n bottom: r.bottom + d.y,\n right: r.right + d.x,\n top: r.top + d.y,\n });\n const trioMoved = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: shift(shapeRect),\n rotation: 90,\n unrotatedRect: shift(shapeRect),\n });\n expect(trioMoved.appearance).toEqual({ action: 'preserved', changed: false });\n if (trioMoved.updated.subtype === 'square') {\n expect(trioMoved.updated.rotation).toBe(90);\n }\n\n // A rect-only move PRESERVES the omitted rotation (tri-state law: a\n // patch touches what it states) — the old writer cleared it.\n const rectOnly = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: shapeRect,\n });\n if (rectOnly.updated.subtype === 'square') {\n expect(rectOnly.updated.rotation).toBe(90);\n }\n\n // Explicit null flattens — the ONLY way to remove the rotation.\n const flattened = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rotation: null,\n unrotatedRect: null,\n });\n if (flattened.updated.subtype === 'square') {\n expect(flattened.updated.rotation).toBe(undefined);\n expect(flattened.updated.unrotatedRect).toBe(undefined);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('create vertex + line annotations (polygon/polyline/line) round-trip geometry', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const polygonDraft: PolygonDraft = {\n subtype: 'polygon',\n contents: 'mutation conformance: polygon',\n rect: shapeRect,\n vertices,\n interiorColor: { r: 255, g: 200, b: 0 },\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 0.8,\n };\n const polygon = await page.annotations.create(polygonDraft);\n expect(AnnotationCreateResultSchema.safeParse(polygon).success).toBe(true);\n expect(polygon.created.subtype).toBe('polygon');\n if (polygon.created.subtype === 'polygon') {\n expect(polygon.created.vertices.length).toBe(vertices.length);\n expect(polygon.created.color).toMatchObject({ r: 0, g: 0, b: 255 });\n expect(polygon.created.interiorColor).toMatchObject({ r: 255, g: 200, b: 0 });\n }\n\n const polylineDraft: PolylineDraft = {\n subtype: 'polyline',\n contents: 'mutation conformance: polyline',\n rect: shapeRect,\n vertices,\n interiorColor: null,\n color: { r: 200, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'open-arrow', end: 'closed-arrow' },\n };\n const polyline = await page.annotations.create(polylineDraft);\n expect(AnnotationCreateResultSchema.safeParse(polyline).success).toBe(true);\n expect(polyline.created.subtype).toBe('polyline');\n if (polyline.created.subtype === 'polyline') {\n expect(polyline.created.vertices.length).toBe(vertices.length);\n expect(polyline.created.lineEndings.start).toBe('open-arrow');\n expect(polyline.created.lineEndings.end).toBe('closed-arrow');\n }\n\n const lineDraft: LineDraft = {\n subtype: 'line',\n contents: 'mutation conformance: line',\n rect: shapeRect,\n linePoints,\n interiorColor: null,\n color: { r: 0, g: 128, b: 128 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'none', end: 'open-arrow' },\n };\n const line = await page.annotations.create(lineDraft);\n expect(AnnotationCreateResultSchema.safeParse(line).success).toBe(true);\n expect(line.created.subtype).toBe('line');\n if (line.created.subtype === 'line') {\n // /L stored as f32 — compare rounded to absorb float drift.\n expect(Math.round(line.created.linePoints.start.x)).toBe(Math.round(linePoints.start.x));\n expect(Math.round(line.created.linePoints.end.y)).toBe(Math.round(linePoints.end.y));\n expect(line.created.lineEndings.end).toBe('open-arrow');\n }\n\n const inkDraft: InkDraft = {\n subtype: 'ink',\n contents: 'mutation conformance: ink',\n rect: shapeRect,\n inkList: inkStrokes,\n color: { r: 29, g: 78, b: 216 },\n strokeWidth: 3,\n borderStyle: 'solid',\n opacity: 1,\n };\n const ink = await page.annotations.create(inkDraft);\n expect(AnnotationCreateResultSchema.safeParse(ink).success).toBe(true);\n expect(ink.created.subtype).toBe('ink');\n if (ink.created.subtype === 'ink') {\n expect(ink.created.inkList.length).toBe(inkStrokes.length);\n expect(ink.created.inkList[0]!.length).toBe(inkStrokes[0]!.length);\n expect(ink.created.color).toMatchObject({ r: 29, g: 78, b: 216 });\n expect(ink.created.intent).toBe(null);\n expect(ink.created.blendMode).toBe('normal');\n // Ink has a stroke but no /IC.\n expect('interiorColor' in ink.created).toBe(false);\n }\n\n const after = await page.annotations.list();\n const subtypes = after.annotations.map((a) => a.subtype);\n expect(subtypes.includes('polygon')).toBe(true);\n expect(subtypes.includes('polyline')).toBe(true);\n expect(subtypes.includes('line')).toBe(true);\n expect(subtypes.includes('ink')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('create free-text + callout round-trip text/colour/intent fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Plain free text, no fontColor override => text follows `color`.\n const freeTextDraft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'mutation conformance: free text',\n rect: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 14,\n textAlign: 'center',\n color: { r: 20, g: 40, b: 60 },\n interiorColor: { r: 250, g: 250, b: 210 },\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n };\n const freeText = await page.annotations.create(freeTextDraft);\n expect(AnnotationCreateResultSchema.safeParse(freeText).success).toBe(true);\n expect(freeText.created.subtype).toBe('free-text');\n if (freeText.created.subtype === 'free-text') {\n expect(freeText.created.intent).toBe('free-text');\n expect(freeText.created.fontFamily).toBe('helvetica');\n expect(freeText.created.fontSize).toBe(14);\n expect(freeText.created.textAlign).toBe('center');\n expect(freeText.created.color).toMatchObject({ r: 20, g: 40, b: 60 });\n expect(freeText.created.interiorColor).toMatchObject({ r: 250, g: 250, b: 210 });\n // No override sent => text follows `color`, so fontColor is omitted.\n expect(freeText.created.fontColor === undefined).toBe(true);\n }\n\n // Callout: intent + /CL leader + /LE ending, explicit fontColor\n // override, transparent (null) background.\n const calloutDraft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text-callout',\n contents: 'mutation conformance: callout',\n rect: shapeRect,\n fontFamily: 'times-roman',\n fontSize: 12,\n textAlign: 'left',\n color: { r: 0, g: 0, b: 0 },\n fontColor: { r: 200, g: 0, b: 0 },\n interiorColor: null,\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n calloutLine: DEFAULT_CALLOUT_LINE,\n lineEnding: 'open-arrow',\n };\n const callout = await page.annotations.create(calloutDraft);\n expect(AnnotationCreateResultSchema.safeParse(callout).success).toBe(true);\n expect(callout.created.subtype).toBe('free-text');\n if (callout.created.subtype === 'free-text') {\n expect(callout.created.intent).toBe('free-text-callout');\n expect(callout.created.interiorColor).toBe(null);\n // fontColor differs from color => surfaced as an override.\n expect(callout.created.fontColor).toMatchObject({ r: 200, g: 0, b: 0 });\n expect(callout.created.color).toMatchObject({ r: 0, g: 0, b: 0 });\n expect(callout.created.calloutLine?.length).toBe(DEFAULT_CALLOUT_LINE.length);\n expect(callout.created.lineEnding).toBe('open-arrow');\n }\n\n const after = await page.annotations.list();\n const freeTexts = after.annotations.filter((a) => a.subtype === 'free-text');\n expect(freeTexts.length >= 2).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('update a free-text patches alignment + colours and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'free-text-update-base',\n rect: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 12,\n textAlign: 'left',\n color: { r: 0, g: 0, b: 0 },\n interiorColor: null,\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n } satisfies FreeTextDraft);\n const before = await page.annotations.list();\n\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'free-text',\n textAlign: 'right',\n fontFamily: 'helvetica',\n fontSize: 18,\n color: { r: 0, g: 80, b: 160 },\n interiorColor: { r: 240, g: 240, b: 240 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('free-text');\n if (result.updated.subtype === 'free-text') {\n expect(result.updated.textAlign).toBe('right');\n expect(result.updated.fontSize).toBe(18);\n expect(result.updated.color).toMatchObject({ r: 0, g: 80, b: 160 });\n expect(result.updated.interiorColor).toMatchObject({ r: 240, g: 240, b: 240 });\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('create redact (area + text) round-trips label + colour fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Area redaction (no quads: /Rect is the removal region) with a\n // fully-styled label.\n const areaDraft: RedactDraft = {\n subtype: 'redact',\n contents: 'mutation conformance: area redact',\n rect: shapeRect,\n color: { r: 228, g: 66, b: 52 },\n opacity: 1,\n interiorColor: { r: 0, g: 0, b: 0 },\n overlayText: 'CONFIDENTIAL',\n repeat: true,\n fontFamily: 'helvetica',\n fontSize: 10,\n fontColor: { r: 255, g: 255, b: 255 },\n textAlign: 'center',\n };\n const area = await page.annotations.create(areaDraft);\n expect(AnnotationCreateResultSchema.safeParse(area).success).toBe(true);\n expect(area.created.subtype).toBe('redact');\n if (area.created.subtype === 'redact') {\n expect(area.created.quadPoints.length).toBe(0);\n expect(area.created.color).toMatchObject({ r: 228, g: 66, b: 52 });\n expect(area.created.interiorColor).toMatchObject({ r: 0, g: 0, b: 0 });\n expect(area.created.overlayText).toBe('CONFIDENTIAL');\n expect(area.created.repeat).toBe(true);\n expect(area.created.fontFamily).toBe('helvetica');\n expect(area.created.fontSize).toBe(10);\n expect(area.created.fontColor).toMatchObject({ r: 255, g: 255, b: 255 });\n expect(area.created.textAlign).toBe('center');\n }\n\n // Text redaction (quads) without a label: everything falls back to\n // the ISO defaults — transparent fill, no overlay text, no repeat.\n const textDraft: RedactDraft = {\n subtype: 'redact',\n contents: 'mutation conformance: text redact',\n rect: shapeRect,\n quadPoints: quad,\n };\n const text = await page.annotations.create(textDraft);\n expect(AnnotationCreateResultSchema.safeParse(text).success).toBe(true);\n expect(text.created.subtype).toBe('redact');\n if (text.created.subtype === 'redact') {\n expect(text.created.quadPoints.length).toBe(quad.length);\n expect(text.created.interiorColor).toBe(null);\n expect(text.created.overlayText).toBe(null);\n expect(text.created.repeat).toBe(false);\n // Default marking outline is the red redaction convention.\n expect(text.created.color).toMatchObject({ r: 255, g: 0, b: 0 });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('update a redact patches the label and clears it, non-structurally', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'redact',\n contents: 'redact-update-base',\n rect: shapeRect,\n interiorColor: { r: 0, g: 0, b: 0 },\n overlayText: 'DRAFT',\n fontFamily: 'helvetica',\n fontSize: 8,\n fontColor: { r: 255, g: 255, b: 255 },\n } satisfies RedactDraft);\n const before = await page.annotations.list();\n\n // Restyle the label. fontSize 0 is meaningful for a redaction label\n // (auto-fit) and must round-trip verbatim, unlike free text.\n const restyled = await page.annotations.update(created.created.ref, {\n subtype: 'redact',\n overlayText: 'REDACTED',\n repeat: true,\n fontFamily: 'helvetica',\n fontSize: 0,\n fontColor: { r: 255, g: 240, b: 240 },\n textAlign: 'right',\n interiorColor: { r: 10, g: 10, b: 10 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(restyled).success).toBe(true);\n expect(restyled.updated.subtype).toBe('redact');\n if (restyled.updated.subtype === 'redact') {\n expect(restyled.updated.overlayText).toBe('REDACTED');\n expect(restyled.updated.repeat).toBe(true);\n expect(restyled.updated.fontSize).toBe(0);\n expect(restyled.updated.fontColor).toMatchObject({ r: 255, g: 240, b: 240 });\n expect(restyled.updated.textAlign).toBe('right');\n expect(restyled.updated.interiorColor).toMatchObject({ r: 10, g: 10, b: 10 });\n }\n\n // Clear the label and the fill: null wipes /OverlayText and /IC.\n const cleared = await page.annotations.update(created.created.ref, {\n subtype: 'redact',\n overlayText: null,\n repeat: false,\n interiorColor: null,\n });\n expect(cleared.updated.subtype).toBe('redact');\n if (cleared.updated.subtype === 'redact') {\n expect(cleared.updated.overlayText).toBe(null);\n expect(cleared.updated.repeat).toBe(false);\n expect(cleared.updated.interiorColor).toBe(null);\n }\n\n // Updates never bump the revision.\n expect(cleared.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(cleared.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('create + update a caret round-trips color/opacity/rect differences', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const caretDraft: CaretDraft = {\n subtype: 'caret',\n intent: 'replace',\n contents: 'mutation conformance: caret',\n rect: shapeRect,\n color: { r: 0, g: 128, b: 255 },\n opacity: 0.7,\n rectDifferences: { left: 2, top: 2, right: 2, bottom: 2 },\n };\n const caret = await page.annotations.create(caretDraft);\n expect(AnnotationCreateResultSchema.safeParse(caret).success).toBe(true);\n expect(caret.created.subtype).toBe('caret');\n expect(caret.created.identityQuality).toBe('durable');\n expect(caret.created.ref.kind).toBe('objectNumber');\n if (caret.created.subtype === 'caret') {\n expect(caret.created.intent).toBe('replace');\n expect(caret.created.color).toMatchObject({ r: 0, g: 128, b: 255 });\n expect(Math.round(caret.created.opacity * 100) / 100).toBe(0.7);\n // Caret carries no border or quads.\n expect('strokeWidth' in caret.created).toBe(false);\n expect('quadPoints' in caret.created).toBe(false);\n expect(caret.created.rectDifferences).toMatchObject({\n left: 2,\n top: 2,\n right: 2,\n bottom: 2,\n });\n }\n\n const before = await page.annotations.list();\n const result = await page.annotations.update(caret.created.ref, {\n subtype: 'caret',\n color: { r: 255, g: 0, b: 0 },\n rectDifferences: { left: 4, top: 4, right: 4, bottom: 4 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('caret');\n if (result.updated.subtype === 'caret') {\n expect(result.updated.color).toMatchObject({ r: 255, g: 0, b: 0 });\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n\n // Tri-state: `null` removes /RD entirely (a read then states the absence).\n const rdCleared = await page.annotations.update(caret.created.ref, {\n subtype: 'caret',\n rectDifferences: null,\n });\n expect(rdCleared.updated.subtype).toBe('caret');\n if (rdCleared.updated.subtype === 'caret') {\n expect(rdCleared.updated.rectDifferences).toBe(null);\n }\n\n const after = await page.annotations.list();\n expect(after.annotations.some((a) => a.subtype === 'caret')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('update an ink annotation patches strokes + color and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'ink',\n contents: 'ink-update-base',\n rect: shapeRect,\n inkList: inkStrokes,\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies InkDraft);\n const before = await page.annotations.list();\n\n const newStrokes: InkList = [\n ...inkStrokes,\n [\n { x: 80, y: 90 },\n { x: 120, y: 110 },\n ],\n ];\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'ink',\n inkList: newStrokes,\n color: { r: 220, g: 20, b: 60 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('ink');\n if (result.updated.subtype === 'ink') {\n expect(result.updated.inkList.length).toBe(newStrokes.length);\n expect(result.updated.color).toMatchObject({ r: 220, g: 20, b: 60 });\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('ink highlight intent + blend round-trip and unrelated patches preserve blend', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'ink',\n intent: 'ink-highlight',\n blendMode: 'multiply',\n rect: shapeRect,\n inkList: inkStrokes,\n color: { r: 255, g: 205, b: 69 },\n strokeWidth: 14,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies InkDraft);\n expect(created.created.subtype).toBe('ink');\n if (created.created.subtype !== 'ink') return;\n expect(created.created.intent).toBe('ink-highlight');\n expect(created.created.blendMode).toBe('multiply');\n\n const recolored = await page.annotations.update(created.created.ref, {\n subtype: 'ink',\n color: { r: 250, g: 190, b: 40 },\n });\n expect(recolored.updated.subtype).toBe('ink');\n expect(recolored.updated.blendMode).toBe('multiply');\n\n const screened = await page.annotations.update(created.created.ref, {\n subtype: 'ink',\n blendMode: 'screen',\n });\n expect(screened.updated.subtype).toBe('ink');\n expect(screened.updated.blendMode).toBe('screen');\n } finally {\n await doc.close();\n }\n });\n\n test('update a polyline patches vertices + line endings and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'polyline',\n contents: 'polyline-update-base',\n rect: shapeRect,\n vertices,\n interiorColor: null,\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 1,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'none', end: 'none' },\n } satisfies PolylineDraft);\n const before = await page.annotations.list();\n\n const newVertices: PdfPoint[] = [\n ...vertices,\n { x: vertices[0]!.x + 5, y: vertices[0]!.y + 5 },\n ];\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'polyline',\n vertices: newVertices,\n lineEndings: { start: 'circle', end: 'diamond' },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('polyline');\n if (result.updated.subtype === 'polyline') {\n expect(result.updated.vertices.length).toBe(newVertices.length);\n expect(result.updated.lineEndings.start).toBe('circle');\n expect(result.updated.lineEndings.end).toBe('diamond');\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('update a shape annotation patches color and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'circle',\n contents: 'shape-update-base',\n rect: shapeRect,\n interiorColor: { r: 10, g: 20, b: 30 },\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 1,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies CircleDraft);\n const before = await page.annotations.list();\n\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'circle',\n interiorColor: { r: 200, g: 100, b: 50 },\n strokeWidth: 4,\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('circle');\n if (result.updated.subtype === 'circle') {\n expect(result.updated.interiorColor).toMatchObject({ r: 200, g: 100, b: 50 });\n expect(result.updated.strokeWidth).toBe(4);\n // Unpatched fields are preserved.\n expect(result.updated.borderStyle).toBe('solid');\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n if (opts.supportsAppearanceRasters) {\n test('creating a shape bakes an /AP appearance the reader can rasterize', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'circle',\n contents: 'appearance-gen',\n rect: shapeRect,\n interiorColor: { r: 255, g: 0, b: 0 },\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies CircleDraft);\n\n const appearances = await page.annotations.renderAppearances({ scale: 1 });\n const match = appearances.appearances.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n // The freshly created shape must carry a baked /AP (generated by\n // the mutator), so the appearance reader emits a non-empty raster.\n expect(match !== undefined).toBe(true);\n expect((match?.raster.width ?? 0) > 0).toBeTruthy();\n expect((match?.raster.height ?? 0) > 0).toBeTruthy();\n } finally {\n await doc.close();\n }\n });\n }\n\n test('update on a durable annotation is non-structural and never touches /NM', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n\n const target = before.annotations.find((a) => a.identityQuality === 'durable');\n // Skip the assertion gracefully if the fixture has no durable annot\n // up front; the test fixture used in our suites does (the existing\n // highlights have /NM).\n if (!target) return;\n\n const ref: AnnotationRef = target.ref;\n const newContents = `mutation conformance: updated@${Date.now()}`;\n const patch = subtypeAwarePatch(target.subtype, newContents);\n if (!patch) return;\n\n const result = await page.annotations.update(ref, patch);\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // Same identity, /NM untouched.\n expect(result.updated.ref.kind).toBe(target.ref.kind);\n expect(result.updated.nm).toBe(target.nm);\n\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.shouldRefetch).toBe(null);\n expect(result.meta.weakRefsInvalidated).toBe(false);\n\n // Round-trip the new contents.\n expect(result.updated.contents).toBe(newContents);\n } finally {\n await doc.close();\n }\n });\n\n if (fix.expectsWeakAnnotation) {\n test('update on a weak annotation stamps a UUID v4 /NM and upgrades the ref', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n expect(weak !== undefined).toBe(true);\n if (!weak) return;\n expect(weak.ref.kind).toBe('index');\n\n const newContents = `weak-upgrade@${Date.now()}`;\n const patch = subtypeAwarePatch(weak.subtype, newContents);\n if (!patch) return;\n\n const result = await page.annotations.update(weak.ref, patch);\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // The ref is upgraded to durable. Either nm (engine-stamped) or\n // objectNumber (if the annotation surprisingly had one) is fine.\n expect(\n result.updated.ref.kind === 'nm' || result.updated.ref.kind === 'objectNumber',\n ).toBe(true);\n expect(result.updated.identityQuality).toBe('durable');\n if (result.updated.ref.kind === 'nm') {\n expect(result.updated.nm !== null).toBe(true);\n expect(typeof result.updated.nm).toBe('string');\n // Engine stamps RFC 4122 v4 UUIDs: 8-4-4-4-12 hex with\n // version 4 and variant 10xx. Match loosely.\n expect(\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(\n result.updated.nm!,\n ),\n ).toBe(true);\n }\n\n // Still non-structural.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.shouldRefetch).toBe(null);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('delete by objectNumber removes the annotation and reports a stable id', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n // Create one we own so we don't disturb the fixture's other tests.\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: to-delete',\n quadPoints: quad,\n };\n const created = await page.annotations.create(draft);\n const before = await page.annotations.list();\n\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.delete(created.created.ref);\n try {\n expect(AnnotationDeleteResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // Stable id is reported (we created it; it's durable).\n expect(result.deleted !== null).toBe(true);\n expect(result.deleted?.kind).toBe('objectNumber');\n\n // Structural: revision bumped.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation + 1,\n );\n\n // The annotation is gone.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 1);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n if (fix.expectsWeakAnnotation) {\n test('delete by index of a weak annotation reports deleted: null and refetch reason', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n if (!weak) return;\n expect(weak.ref.kind).toBe('index');\n\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.delete(weak.ref);\n try {\n // The weak annotation MAY have had /NM in some shapes (very\n // legacy PDFs), but the locked semantics say a true weak\n // delete returns null. We assert \"either null or a stable id\"\n // since the fixture controls which side this lands on.\n expect(\n result.deleted === null ||\n result.deleted.kind === 'objectNumber' ||\n result.deleted.kind === 'nm',\n ).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // The page had weak refs before, structural mutation,\n // therefore: shouldRefetch is set.\n expect(result.meta.shouldRefetch?.reason).toBe('weakRefsInvalidated');\n expect(result.meta.weakRefsInvalidated).toBe(true);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n }\n\n test('abort on create rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'will be aborted',\n quadPoints: quad,\n };\n const p = page.annotations.create(draft);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('update with a stale index revision throws InvalidReference', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n if (!weak || weak.ref.kind !== 'index') return;\n\n // Force the revision out of date by minting an *index-shifting*\n // mutation, then trying to update against the stale ref. We\n // deliberately use a throwaway create+delete pair (delete is\n // the rev-bumping op now — create is append-only and does NOT\n // bump revisions, so it can't be used here).\n const throwaway = await page.annotations.create({\n subtype: 'highlight',\n contents: 'rev-bump-throwaway',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n await page.annotations.delete(throwaway.created.ref);\n await weakSession?.release();\n\n const patch = subtypeAwarePatch(weak.subtype, 'should-fail');\n if (!patch) return;\n let caught: unknown;\n try {\n await page.annotations.update(weak.ref, patch);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidReference)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // move() — batch contiguous-block reorder. Locked invariants:\n // - `move([ref], toIndex)` is the single-annotation case; same\n // primitive as multi-move.\n // - One revision bump per batch, regardless of `refs.length`.\n // - Caller-supplied order is preserved at the destination.\n // - Weak refs in the batch are upgraded to durable /NM BEFORE the\n // move; the moved DTOs come out durable and `meta.changed` lists\n // stable ids.\n // - Stale revision, out-of-range, duplicate, and abort all reject.\n // ─────────────────────────────────────────────────────────────────\n\n test('move single durable annotation reorders within the page (single-as-batch)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Seed two durable annotations we can predict ordering for.\n const aDraft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'move-a',\n quadPoints: quad,\n };\n const bDraft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'move-b',\n quadPoints: quad,\n };\n const a = await page.annotations.create(aDraft);\n const b = await page.annotations.create(bDraft);\n const list = await page.annotations.list();\n const beforeRev = list.pageState.revision.generation;\n\n // Find current indices of a and b.\n const aIdx = list.annotations.findIndex(\n (x) =>\n x.ref.kind === 'objectNumber' &&\n a.created.ref.kind === 'objectNumber' &&\n x.ref.annotObjectNumber === a.created.ref.annotObjectNumber,\n );\n const bIdx = list.annotations.findIndex(\n (x) =>\n x.ref.kind === 'objectNumber' &&\n b.created.ref.kind === 'objectNumber' &&\n x.ref.annotObjectNumber === b.created.ref.annotObjectNumber,\n );\n expect(aIdx >= 0 && bIdx >= 0).toBe(true);\n expect(aIdx < bIdx).toBe(true);\n\n // Move A to B's slot. Post-removal index space: A was removed,\n // so B's position becomes bIdx - 1. Targeting bIdx puts A AFTER\n // B's original position. Use `bIdx` as toIndex => A lands right\n // after B in the new order.\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.move([a.created.ref], bIdx);\n try {\n expect(AnnotationMoveResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n expect(result.moved.length).toBe(1);\n\n // Single revision bump per batch.\n expect(result.meta.affectedPages[0].revision.generation).toBe(beforeRev + 1);\n\n // The moved DTO sits at toIndex.\n if (result.moved[0].ref.kind === 'objectNumber') {\n const movedObjNum = result.moved[0].ref.annotObjectNumber;\n if (a.created.ref.kind === 'objectNumber') {\n expect(movedObjNum).toBe(a.created.ref.annotObjectNumber);\n }\n }\n\n // Verify the page now has A at its new position.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(list.annotations.length);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n test('move multi-block preserves caller-supplied order at the destination', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Seed three durable annotations.\n const ids = await Promise.all(\n ['multi-1', 'multi-2', 'multi-3'].map((label) =>\n page.annotations.create({\n subtype: 'highlight',\n contents: label,\n quadPoints: quad,\n }),\n ),\n );\n\n const list = await page.annotations.list();\n const beforeRev = list.pageState.revision.generation;\n\n // Move the three to position 0 in caller order [3, 1, 2].\n const callerOrder = [ids[2].created.ref, ids[0].created.ref, ids[1].created.ref];\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.move(callerOrder, 0);\n try {\n // One revision bump even though three annotations moved.\n expect(result.meta.affectedPages[0].revision.generation).toBe(beforeRev + 1);\n expect(result.moved.length).toBe(3);\n expect(result.meta.changed.length).toBe(3);\n\n // Caller-supplied order preserved at the destination. Indices\n // 0, 1, 2 of the page now hold the moved DTOs in that order.\n const expectedOrder = [ids[2].created.ref, ids[0].created.ref, ids[1].created.ref].map(\n (r) => (r.kind === 'objectNumber' ? r.annotObjectNumber : null),\n );\n\n const movedObjNums = result.moved.map((d) =>\n d.ref.kind === 'objectNumber' ? d.ref.annotObjectNumber : null,\n );\n for (let i = 0; i < expectedOrder.length; i++) {\n expect(movedObjNums[i]).toBe(expectedOrder[i]);\n }\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n if (fix.expectsWeakAnnotation) {\n test('move on a weak annotation upgrades it to durable /NM (one rev bump for batch)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n if (!weak || weak.ref.kind !== 'index') return;\n const beforeRev = before.pageState.revision.generation;\n\n // Move the weak annotation to position 0 (or somewhere\n // non-trivial). The engine must stamp a fresh /NM BEFORE the\n // move so the result is durable.\n const target = weak.ref.index === 0 ? 1 : 0;\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.move([weak.ref], target);\n try {\n expect(result.meta.affectedPages[0].revision.generation).toBe(beforeRev + 1);\n expect(result.moved.length).toBe(1);\n expect(result.moved[0].identityQuality).toBe('durable');\n expect(\n result.moved[0].ref.kind === 'nm' || result.moved[0].ref.kind === 'objectNumber',\n ).toBe(true);\n\n // meta.changed is a stable id, never a weak ref.\n expect(result.meta.changed.length).toBe(1);\n expect(\n result.meta.changed[0].kind === 'nm' ||\n result.meta.changed[0].kind === 'objectNumber',\n ).toBe(true);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n }\n\n test('move with a stale index revision rejects (locked rev-token guard)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'stale-a',\n quadPoints: quad,\n });\n const list = await page.annotations.list();\n const aIdx = list.annotations.findIndex(\n (x) =>\n x.ref.kind === 'objectNumber' &&\n a.created.ref.kind === 'objectNumber' &&\n x.ref.annotObjectNumber === a.created.ref.annotObjectNumber,\n );\n if (aIdx < 0) return;\n\n const staleIndexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: fix.pageObjectNumber,\n index: aIdx,\n revision: list.pageState.revision,\n };\n\n // Bump the revision by an unrelated index-shifting mutation.\n // create is append-only and no longer bumps revisions, so we\n // use a throwaway create+delete pair (the delete does the bump).\n const throwaway = await page.annotations.create({\n subtype: 'highlight',\n contents: 'bump-throwaway',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n await page.annotations.delete(throwaway.created.ref);\n\n let caught: unknown;\n try {\n await page.annotations.move([staleIndexRef], 0);\n } catch (err) {\n caught = err;\n } finally {\n await weakSession?.release();\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidReference)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('move with out-of-range toIndex rejects with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'oor-a',\n quadPoints: quad,\n });\n const list = await page.annotations.list();\n const farTooBig = list.annotations.length + 100;\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n let caught: unknown;\n try {\n await page.annotations.move([a.created.ref], farTooBig);\n } catch (err) {\n caught = err;\n } finally {\n await weakSession?.release();\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('move with duplicate refs rejects with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'dup-a',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n let caught: unknown;\n try {\n await page.annotations.move([a.created.ref, a.created.ref], 0);\n } catch (err) {\n caught = err;\n } finally {\n await weakSession?.release();\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on move rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'abort-a',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const p = page.annotations.move([a.created.ref], 0);\n p.abort('test');\n try {\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a page move does NOT bump per-page RevisionTokens (weak refs survive reorder)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n\n // Revision is annotation liveness, keyed by `pageObjectNumber`. A\n // page move is structural-geometry-only: no page's /Annots array is\n // touched, so no `RevisionToken` bumps and index-kind refs captured\n // before the reorder stay valid. We observe the host page's\n // revision via `annotations.list().pageState` (the move result no\n // longer carries liveness — it returns geometry).\n const page = doc.page(fix.pageObjectNumber);\n const beforeGen = (await page.annotations.list()).pageState.revision.generation;\n\n // Pull some page to the front (prefer one that is NOT the host so\n // we exercise the cross-page case; fall back to the host itself for\n // single-page fixtures).\n const mover =\n list.pages.find((pg) => pg.pageObjectNumber !== fix.pageObjectNumber)?.pageObjectNumber ??\n fix.pageObjectNumber;\n await doc.pages.move([mover], 0);\n\n const afterGen = (await page.annotations.list()).pageState.revision.generation;\n expect(afterGen).toBe(beforeGen);\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // /IRT + /RT relationships (reply vs group). Locked rules:\n // - A draft `inReplyTo` writes /IRT; /RT defaults to 'reply' when\n // `replyType` is omitted (ISO 32000 §12.5.6.2 default).\n // - The DTO surfaces `inReplyTo` (parent ref) + `replyType`; a\n // top-level annotation reports both as null.\n // - Linking reports the (possibly strengthened) parent id in\n // `meta.changed` and is non-structural (no rev bump / refetch).\n // - A cross-page parent is rejected with InvalidArg.\n // ─────────────────────────────────────────────────────────────────\n\n test('create a reply links /IRT and defaults /RT to \"reply\", reporting the parent', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'reply parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n // A freshly created top-level annotation has no relationship.\n expect(parent.created.inReplyTo).toBe(null);\n expect(parent.created.replyType).toBe(null);\n\n const reply = await page.annotations.create({\n subtype: 'highlight',\n contents: 'a reply',\n quadPoints: quad,\n inReplyTo: parent.created.ref,\n } satisfies HighlightDraft);\n expect(AnnotationCreateResultSchema.safeParse(reply).success).toBe(true);\n // /RT absent in the draft normalizes to 'reply'.\n expect(reply.created.replyType).toBe('reply');\n expect(reply.created.inReplyTo === null).toBe(false);\n if (\n reply.created.inReplyTo?.kind === 'objectNumber' &&\n parent.created.ref.kind === 'objectNumber'\n ) {\n expect(reply.created.inReplyTo.annotObjectNumber).toBe(\n parent.created.ref.annotObjectNumber,\n );\n expect(reply.created.inReplyTo.pageObjectNumber).toBe(fix.pageObjectNumber);\n }\n // The parent (already durable) is reported alongside the new reply.\n expect(reply.meta.changed.length).toBe(2);\n // Linking is non-structural: no rev bump, no refetch.\n expect(reply.meta.shouldRefetch).toBe(null);\n expect(reply.meta.weakRefsInvalidated).toBe(false);\n\n // The relationship survives a fresh read.\n const after = await page.annotations.list();\n const readReply = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n reply.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === reply.created.ref.annotObjectNumber,\n );\n expect(readReply?.replyType).toBe('reply');\n expect(readReply?.inReplyTo == null).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('create a grouped subordinate writes /RT /Group', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const primary = await page.annotations.create({\n subtype: 'highlight',\n contents: 'group primary',\n quadPoints: quad,\n } satisfies HighlightDraft);\n\n const caret = await page.annotations.create({\n subtype: 'caret',\n contents: '',\n rect: shapeRect,\n color: { r: 0, g: 0, b: 0 },\n opacity: 1,\n inReplyTo: primary.created.ref,\n replyType: 'group',\n } satisfies CaretDraft);\n expect(AnnotationCreateResultSchema.safeParse(caret).success).toBe(true);\n expect(caret.created.replyType).toBe('group');\n expect(caret.created.inReplyTo === null).toBe(false);\n\n const after = await page.annotations.list();\n const readCaret = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n caret.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === caret.created.ref.annotObjectNumber,\n );\n expect(readCaret?.replyType).toBe('group');\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // Link annotations. Locked rules:\n // - `/Dest` and `/A GoTo` both read as the normalized `goto` arm;\n // destinations carry page OBJECT NUMBERS on the wire (never\n // indices) and raw PDF user-space coordinates.\n // - `target: null` creates a dead link (create-then-edit flow).\n // - A patch RETARGETS by replacing `/A`; the reader gives `/A`\n // precedence so a retarget wins over any stray direct `/Dest`.\n // - Grouped links (v2 \"attached links\") are plain /IRT + /RT\n // /Group — nothing link-specific in the relationship plane.\n // ─────────────────────────────────────────────────────────────────\n\n test('create link annotations round-trip uri, goto/xyz, goto/fitH, and dead targets', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const uri = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://www.embedpdf.com/' },\n } satisfies LinkDraft);\n expect(AnnotationCreateResultSchema.safeParse(uri).success).toBe(true);\n expect(uri.created.subtype).toBe('link');\n if (uri.created.subtype === 'link') {\n expect(uri.created.target).toEqual({ kind: 'uri', uri: 'https://www.embedpdf.com/' });\n }\n\n // /XYZ with a null zoom axis: null means \"retain current\".\n const xyz = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: {\n kind: 'xyz',\n pageObjectNumber: fix.pageObjectNumber,\n left: 30,\n top: 500,\n zoom: null,\n },\n },\n } satisfies LinkDraft);\n expect(xyz.created.subtype).toBe('link');\n if (xyz.created.subtype === 'link') {\n expect(xyz.created.target?.kind).toBe('goto');\n if (xyz.created.target?.kind === 'goto') {\n const dest = xyz.created.target.destination;\n expect(dest.kind).toBe('xyz');\n if (dest.kind === 'xyz') {\n expect(dest.pageObjectNumber).toBe(fix.pageObjectNumber);\n expect(dest.left).toBe(30);\n expect(dest.top).toBe(500);\n expect(dest.zoom).toBe(null);\n }\n }\n }\n\n const fitH = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: { kind: 'fitH', pageObjectNumber: fix.pageObjectNumber, top: 420 },\n },\n } satisfies LinkDraft);\n expect(fitH.created.subtype).toBe('link');\n if (fitH.created.subtype === 'link' && fitH.created.target?.kind === 'goto') {\n expect(fitH.created.target.destination).toEqual({\n kind: 'fitH',\n pageObjectNumber: fix.pageObjectNumber,\n top: 420,\n });\n }\n\n // Dead link: legal to author, reported as-is.\n const dead = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: null,\n } satisfies LinkDraft);\n expect(dead.created.subtype).toBe('link');\n if (dead.created.subtype === 'link') expect(dead.created.target).toBe(null);\n\n // All four survive a fresh page read as link DTOs.\n const after = await page.annotations.list();\n const links = after.annotations.filter((a) => a.subtype === 'link');\n expect(links.length >= 4).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a link patch retargets in both directions (uri→goto, goto→uri) and moves the rect', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://old.example/' },\n } satisfies LinkDraft);\n\n const toGoto = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n target: {\n kind: 'goto',\n destination: { kind: 'fit', pageObjectNumber: fix.pageObjectNumber },\n },\n });\n expect(AnnotationUpdateResultSchema.safeParse(toGoto).success).toBe(true);\n if (toGoto.updated.subtype === 'link') {\n expect(toGoto.updated.target).toEqual({\n kind: 'goto',\n destination: { kind: 'fit', pageObjectNumber: fix.pageObjectNumber },\n });\n }\n\n const movedRect = {\n left: shapeRect.left + 5,\n bottom: shapeRect.bottom + 5,\n right: shapeRect.right + 5,\n top: shapeRect.top + 5,\n };\n const toUri = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n rect: movedRect,\n target: { kind: 'uri', uri: 'https://new.example/' },\n });\n if (toUri.updated.subtype === 'link') {\n expect(toUri.updated.target).toEqual({ kind: 'uri', uri: 'https://new.example/' });\n expect(Math.round(toUri.updated.rect.left)).toBe(Math.round(movedRect.left));\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a link patch clears the target with null — a dead link on re-read', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: { kind: 'fit', pageObjectNumber: fix.pageObjectNumber },\n },\n } satisfies LinkDraft);\n\n const cleared = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n target: null,\n });\n expect(AnnotationUpdateResultSchema.safeParse(cleared).success).toBe(true);\n if (cleared.updated.subtype === 'link') expect(cleared.updated.target).toBe(null);\n\n // Truly dead — a fresh page read agrees (both /A and /Dest gone).\n const after = await page.annotations.list();\n const readBack = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(readBack?.subtype).toBe('link');\n if (readBack?.subtype === 'link') expect(readBack.target).toBe(null);\n\n // And a cleared link can be re-targeted afterwards.\n const revived = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n target: { kind: 'uri', uri: 'https://revived.example/' },\n });\n if (revived.updated.subtype === 'link') {\n expect(revived.updated.target).toEqual({\n kind: 'uri',\n uri: 'https://revived.example/',\n });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a link grouped to a highlight round-trips /IRT + /RT /Group with its target', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'linked text',\n quadPoints: quad,\n } satisfies HighlightDraft);\n\n const link = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://www.embedpdf.com/docs' },\n inReplyTo: parent.created.ref,\n replyType: 'group',\n } satisfies LinkDraft);\n expect(AnnotationCreateResultSchema.safeParse(link).success).toBe(true);\n expect(link.created.replyType).toBe('group');\n expect(link.created.inReplyTo === null).toBe(false);\n if (\n link.created.inReplyTo?.kind === 'objectNumber' &&\n parent.created.ref.kind === 'objectNumber'\n ) {\n expect(link.created.inReplyTo.annotObjectNumber).toBe(\n parent.created.ref.annotObjectNumber,\n );\n }\n\n // Both the relationship AND the target survive a fresh read.\n const after = await page.annotations.list();\n const readLink = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n link.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === link.created.ref.annotObjectNumber,\n );\n expect(readLink?.subtype).toBe('link');\n expect(readLink?.replyType).toBe('group');\n if (readLink?.subtype === 'link') {\n expect(readLink.target).toEqual({ kind: 'uri', uri: 'https://www.embedpdf.com/docs' });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('replace-text round-trips /IT and groups StrikeOut under its Caret', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const caret = await page.annotations.create({\n subtype: 'caret',\n intent: 'replace',\n contents: 'replacement text',\n rect: shapeRect,\n color: { r: 228, g: 66, b: 52 },\n opacity: 1,\n rectDifferences: { left: 0.5, top: 0.5, right: 0.5, bottom: 0.5 },\n } satisfies CaretDraft);\n const strikeout = await page.annotations.create({\n subtype: 'strikeout',\n intent: 'strikeout-text-edit',\n quadPoints: quad,\n color: { r: 228, g: 66, b: 52 },\n opacity: 1,\n inReplyTo: caret.created.ref,\n replyType: 'group',\n } satisfies StrikeoutDraft);\n\n expect(caret.created.subtype).toBe('caret');\n if (caret.created.subtype === 'caret') expect(caret.created.intent).toBe('replace');\n expect(strikeout.created.subtype).toBe('strikeout');\n if (strikeout.created.subtype === 'strikeout') {\n expect(strikeout.created.intent).toBe('strikeout-text-edit');\n }\n expect(strikeout.created.replyType).toBe('group');\n expect(strikeout.created.inReplyTo).toEqual(caret.created.ref);\n\n const after = await page.annotations.list();\n const readCaret = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n caret.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === caret.created.ref.annotObjectNumber,\n );\n const readStrikeout = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n strikeout.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === strikeout.created.ref.annotObjectNumber,\n );\n expect(readCaret?.subtype === 'caret' && readCaret.intent).toBe('replace');\n expect(readStrikeout?.subtype === 'strikeout' && readStrikeout.intent).toBe(\n 'strikeout-text-edit',\n );\n expect(readStrikeout?.replyType).toBe('group');\n expect(readStrikeout?.inReplyTo).toEqual(caret.created.ref);\n } finally {\n await doc.close();\n }\n });\n\n test('patch inReplyTo: null clears /IRT and /RT (back to top-level)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'clear parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n const reply = await page.annotations.create({\n subtype: 'highlight',\n contents: 'clearable reply',\n quadPoints: quad,\n inReplyTo: parent.created.ref,\n } satisfies HighlightDraft);\n expect(reply.created.replyType).toBe('reply');\n\n const cleared = await page.annotations.update(reply.created.ref, {\n subtype: 'highlight',\n inReplyTo: null,\n });\n expect(AnnotationUpdateResultSchema.safeParse(cleared).success).toBe(true);\n expect(cleared.updated.inReplyTo).toBe(null);\n expect(cleared.updated.replyType).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('create with a cross-page /IRT parent throws InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'cross-page parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n if (parent.created.ref.kind !== 'objectNumber') return;\n\n // Same annotation object number, but a deliberately different page:\n // the engine must reject before resolving anything (ISO requires\n // reply and parent on the same page).\n const crossPageRef: AnnotationRef = {\n kind: 'objectNumber',\n pageObjectNumber: fix.pageObjectNumber + 2,\n annotObjectNumber: parent.created.ref.annotObjectNumber,\n };\n let caught: unknown;\n try {\n await page.annotations.create({\n subtype: 'highlight',\n contents: 'bad cross-page reply',\n quadPoints: quad,\n inReplyTo: crossPageRef,\n } satisfies HighlightDraft);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function beginWeakEditIfRequired(\n doc: DocumentHandle,\n pageObjectNumber: number,\n fix: AnnotationMutationConformanceFixture,\n): Promise<WeakAnnotationEditSession | null> {\n if (doc.capabilities.weakAnnotationEditSessions !== 'required' || !fix.expectsWeakAnnotation) {\n return null;\n }\n return doc.annotations.beginWeakEdit([pageObjectNumber]);\n}\n\nasync function openFixture(\n engine: Engine,\n opts: AnnotationMutationConformanceOptions,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\n/**\n * Build a valid `AnnotationPatch` for the supplied subtype that mutates\n * a single field we can read back. Returns `null` for subtypes the\n * harness can't synthesise a patch for (e.g. unsupported); caller\n * gracefully skips.\n */\nfunction subtypeAwarePatch(subtype: string, newContents: string): AnnotationPatch | null {\n switch (subtype) {\n case 'highlight':\n case 'underline':\n case 'squiggly':\n case 'strikeout':\n case 'circle':\n case 'square':\n case 'polygon':\n case 'polyline':\n case 'line':\n case 'ink':\n case 'free-text':\n case 'caret':\n return {\n subtype: subtype as AnnotationPatch['subtype'],\n contents: newContents,\n } as AnnotationPatch;\n default:\n return null;\n }\n}\n","import type {\n ConformanceFixture,\n ConformanceOptions,\n ConformanceTestRunner,\n} from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { FormFieldDTO } from '../forms/field';\nimport {\n FormImportResultSchema,\n FormRepairResultSchema,\n FormSetValueResultSchema,\n} from '../wire/schemas';\nimport { FormSnapshotSchema } from '../forms/schema';\n\n/**\n * The three fixtures the forms suite needs. Shapes (names, object numbers,\n * values) match the pdf-runtime fork's test resources:\n *\n * - `toggleFields` — toggle_fields.pdf: text field `maxlen_text`\n * (/MaxLen 5, value \"abc\"), radio `ntto_radio` (NoToggleToOff, /DV x,\n * widgets x/y), radio `unison_radio` (RadiosInUnison), checkbox\n * `opt_check` (/Opt \"Alpha\", on-state \"On\"), hierarchical text field\n * `billing.name`.\n * - `orphanWidgets` — orphan_widgets.pdf: `linked_text` in /AcroForm\n * /Fields plus RECOVERED `orphan_check` and `orphan_radio`.\n * - `choiceFields` — listbox_form.pdf: `Listbox_MultiSelect` (options\n * Apple..), `Listbox_SingleSelect`.\n */\nexport interface FormConformanceFixtures {\n /** toggle_fields.pdf; `pageObjectNumber` = its single page (object 3). */\n toggleFields: ConformanceFixture & { pageObjectNumber: number };\n orphanWidgets: ConformanceFixture;\n choiceFields: ConformanceFixture;\n /**\n * A second, independent copy of `toggleFields` used as the XFDF import\n * target. Required for `openKind: 'id'` (cloud) — id-opened documents are\n * server-side state, so the suite cannot mint a copy by re-opening the\n * same bytes under a suffixed id the way the bytes transport does.\n */\n importTarget?: ConformanceFixture;\n}\n\nexport interface FormConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixtures: FormConformanceFixtures;\n}\n\nexport function runFormConformance(\n runner: ConformanceTestRunner,\n opts: FormConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`forms conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n await engine.destroy();\n });\n\n async function open(fixture: ConformanceFixture, idSuffix = ''): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await fixture.bytes();\n return engine.open({ kind: 'bytes', id: fixture.id + idSuffix, bytes });\n }\n return engine.open({ kind: 'id', id: fixture.cloudId ?? fixture.id });\n }\n\n function fieldByName(fields: FormFieldDTO[], name: string): FormFieldDTO {\n const field = fields.find((f) => f.name === name);\n expect(Boolean(field)).toBe(true);\n return field!;\n }\n\n test('lists the reconciled field tree with per-family DTOs', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const snapshot = await doc.forms.list();\n // Wire parity: the snapshot must survive its own schema.\n FormSnapshotSchema.parse(snapshot);\n expect(snapshot.formKind).toBe('acroform');\n\n const text = fieldByName(snapshot.fields, 'maxlen_text');\n if (text.family !== 'text') throw new Error('expected text family');\n expect(text.value).toBe('abc');\n expect(text.valueEntry).toEqual({ kind: 'scalar', value: 'abc' });\n expect(text.defaultValueEntry).toEqual({ kind: 'none' });\n expect(text.maxLength).toBe(5);\n expect(text.widgets.length).toBe(1);\n\n const radio = fieldByName(snapshot.fields, 'ntto_radio');\n if (radio.family !== 'radio') throw new Error('expected radio family');\n expect(radio.noToggleToOff).toBe(true);\n expect(radio.value).toBe('x');\n expect(radio.valueEntry).toEqual({ kind: 'scalar', value: 'x' });\n expect(radio.defaultValueEntry).toEqual({ kind: 'scalar', value: 'x' });\n expect(radio.widgets.map((w) => w.onState)).toEqual(['x', 'y']);\n expect(radio.widgets.map((w) => w.checked)).toEqual([true, false]);\n\n const unison = fieldByName(snapshot.fields, 'unison_radio');\n if (unison.family !== 'radio') throw new Error('expected radio family');\n expect(unison.radiosInUnison).toBe(true);\n\n const check = fieldByName(snapshot.fields, 'opt_check');\n if (check.family !== 'checkbox') throw new Error('expected checkbox family');\n expect(check.checked).toBe(false);\n expect(check.exportValue).toBe('Alpha');\n\n // Hierarchical fields surface under their fully qualified name.\n const nested = fieldByName(snapshot.fields, 'billing.name');\n expect(nested.family).toBe('text');\n expect(snapshot.calculationOrder).toEqual([]);\n } finally {\n await doc.close();\n }\n });\n\n test('writes text values and truncates to /MaxLen', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const result = await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'abcde' },\n );\n FormSetValueResultSchema.parse(result);\n expect(result.field.family).toBe('text');\n if (result.field.family === 'text') expect(result.field.value).toBe('abcde');\n expect(result.changedWidgets.length).toBe(1);\n\n const truncated = await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'abcdef' },\n );\n if (truncated.field.family !== 'text') throw new Error('expected text family');\n expect(truncated.field.value).toBe('abcde');\n expect(truncated.changedWidgets).toHaveLength(0);\n\n // Re-read through the (invalidated) snapshot: the write is visible.\n const after = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (after.family === 'text') expect(after.value).toBe('abcde');\n } finally {\n await doc.close();\n }\n });\n\n test('toggles radio groups and honors NoToggleToOff', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const radioRef = { kind: 'fqn', name: 'ntto_radio' } as const;\n const result = await doc.forms.setValue(radioRef, { type: 'toggle', state: 'y' });\n if (result.field.family !== 'radio') throw new Error('expected radio family');\n expect(result.field.value).toBe('y');\n expect(result.field.widgets.map((w) => w.checked)).toEqual([false, true]);\n expect(result.changedWidgets.length).toBe(2); // x -> Off, y -> on\n\n // Clearing a NoToggleToOff group is a validation error.\n await expect(\n doc.forms.setValue(radioRef, { type: 'toggle', state: null }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // Checkbox with /Opt: checking reads back the export value.\n const check = await doc.forms.setValue(\n { kind: 'fqn', name: 'opt_check' },\n { type: 'toggle', state: 'On' },\n );\n if (check.field.family !== 'checkbox') throw new Error('expected checkbox family');\n expect(check.field.checked).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('rejects family/value mismatches without touching the field', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n // Compare against the CURRENT value, not the fixture seed: on\n // transports with durable server state (cloud), earlier tests'\n // legitimate writes persist. The invariant under test is that a\n // rejected write changes NOTHING.\n const before = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (before.family !== 'text') throw new Error('expected text family');\n await expect(\n doc.forms.setValue({ kind: 'fqn', name: 'maxlen_text' }, { type: 'toggle', state: 'On' }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n const field = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (field.family === 'text') expect(field.value).toBe(before.value);\n } finally {\n await doc.close();\n }\n });\n\n test('applies ordered script effects once and produces zero churn for a no-op batch', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n if (!doc.forms.applyEffects) {\n await doc.close();\n return;\n }\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'form.effectsApplied') events.push(event);\n });\n const result = await doc.forms.applyEffects([\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'maxlen_text' },\n value: { type: 'text', value: 'abcdef' },\n },\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'missing.effect.field' },\n value: { type: 'text', value: 'ignored' },\n },\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'maxlen_text' },\n value: { type: 'text', value: 'abcde' },\n },\n ]);\n expect(result.results.map((entry) => entry.status)).toEqual([\n 'applied',\n 'rejected',\n 'unchanged',\n ]);\n expect(result.meta === null).toBe(false);\n expect(events).toHaveLength(1);\n const appliedText = result.results[0]?.fields[0];\n if (appliedText?.family !== 'text') throw new Error('expected text family');\n expect(appliedText.value).toBe('abcde');\n\n const noOp = await doc.forms.applyEffects([\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'maxlen_text' },\n value: { type: 'text', value: 'abcde' },\n },\n ]);\n expect(noOp.results.map((entry) => entry.status)).toEqual(['unchanged']);\n expect(noOp.meta).toBeNull();\n expect(events).toHaveLength(1);\n unsubscribe();\n } finally {\n await doc.close();\n }\n });\n\n test('selects multi-select list box options by export value', async () => {\n const doc = await open(opts.fixtures.choiceFields);\n try {\n const multiRef = { kind: 'fqn', name: 'Listbox_MultiSelect' } as const;\n const result = await doc.forms.setValue(multiRef, {\n type: 'choice',\n values: ['Cherry', 'Apple'],\n });\n if (result.field.family !== 'listbox') throw new Error('expected listbox family');\n // Option order, not input order.\n expect(result.field.selectedValues).toEqual(['Apple', 'Cherry']);\n expect(result.field.valueEntry.kind).toBe('array');\n\n // Multiple values on a single-select list box is a validation error.\n await expect(\n doc.forms.setValue(\n { kind: 'fqn', name: 'Listbox_SingleSelect' },\n { type: 'choice', values: ['foo', 'bar'] },\n ),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n\n test('reset restores /DV or clears the value', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n // ntto_radio carries /DV x.\n await doc.forms.setValue(\n { kind: 'fqn', name: 'ntto_radio' },\n { type: 'toggle', state: 'y' },\n );\n const radio = await doc.forms.reset({ kind: 'fqn', name: 'ntto_radio' });\n if (radio.field.family === 'radio') expect(radio.field.value).toBe('x');\n\n // maxlen_text has no /DV: reset clears.\n await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'zzz' },\n );\n const text = await doc.forms.reset({ kind: 'fqn', name: 'maxlen_text' });\n if (text.field.family === 'text') expect(text.field.value).toBe('');\n } finally {\n await doc.close();\n }\n });\n\n test('round-trips form data across documents via XFDF and FDF', async () => {\n const first = await open(opts.fixtures.toggleFields);\n let second: DocumentHandle | null = null;\n try {\n // A second, independent copy of the same fixture (a dedicated\n // fixture when the transport needs server-side state, else the same\n // bytes under a suffixed id so the two sessions coexist).\n second = opts.fixtures.importTarget\n ? await open(opts.fixtures.importTarget)\n : await open(opts.fixtures.toggleFields, '-import-target');\n const tricky = 'a<b>&\"c\" \\'d\\'';\n await first.forms.setValue(\n { kind: 'fqn', name: 'billing.name' },\n { type: 'text', value: tricky },\n );\n\n const xfdf = await first.forms.exportData('xfdf');\n expect(xfdf.format).toBe('xfdf');\n expect(xfdf.bytes.length > 0).toBe(true);\n\n const imported = await second!.forms.importData(xfdf.bytes);\n FormImportResultSchema.parse(imported);\n expect(imported.fieldsSkipped).toBe(0);\n expect(imported.fieldsApplied > 0).toBe(true);\n const nested = imported.snapshot.fields.find((f) => f.name === 'billing.name');\n if (nested?.family === 'text') expect(nested.value).toBe(tricky);\n\n const fdf = await first.forms.exportData('fdf');\n expect(fdf.format).toBe('fdf');\n const head = String.fromCharCode(...fdf.bytes.slice(0, 5));\n expect(head).toBe('%FDF-');\n } finally {\n await first.close();\n if (second) await second.close();\n }\n });\n\n test('rejects garbage import payloads', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n await expect(\n doc.forms.importData(new TextEncoder().encode('not a form payload')),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n\n test('emits form events on mutations', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type.startsWith('form.')) events.push(event);\n });\n await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'ok' },\n );\n unsubscribe();\n expect(events.length).toBe(1);\n expect(events[0]!.type).toBe('form.valueChanged');\n } finally {\n await doc.close();\n }\n });\n\n test('repair makes recovered fields durable and is idempotent', async () => {\n const doc = await open(opts.fixtures.orphanWidgets);\n try {\n const before = await doc.forms.list();\n expect(before.fields.length).toBe(3);\n expect(before.fields.filter((f) => f.origin === 'recovered').length).toBe(2);\n\n const repair = await doc.forms.repair();\n FormRepairResultSchema.parse(repair);\n expect(repair.fieldsLinked).toBe(2);\n expect(repair.acroformCreated).toBe(false);\n expect(repair.fieldsUnrepairable).toBe(0);\n\n const after = await doc.forms.list();\n expect(after.fields.every((f) => f.origin === 'acroform')).toBe(true);\n\n const again = await doc.forms.repair();\n expect(again.fieldsLinked).toBe(0);\n expect(again.widgetsLinked).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('widgets live the full annotation-plane loop', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const pon = opts.fixtures.toggleFields.pageObjectNumber;\n try {\n // 1. Born as an annotation: inert, styled with the house vocabulary.\n const page = doc.page(pon);\n const created = await page.annotations.create({\n subtype: 'widget',\n rect: { left: 20, bottom: 20, right: 200, top: 44 },\n interiorColor: { r: 246, g: 248, b: 250 },\n color: { r: 31, g: 111, b: 235 },\n strokeWidth: 1,\n fontSize: 10,\n });\n if (created.created.subtype !== 'widget') throw new Error('expected widget DTO');\n expect(created.created.fieldObjectNumber).toBe(0); // inert\n expect(created.created.interiorColor).toEqual({ r: 246, g: 248, b: 250 });\n const widgetRef = created.created.ref;\n if (widgetRef.kind !== 'objectNumber') throw new Error('expected durable ref');\n\n // 2. Adopted by a field -> the DTO joins to the field plane.\n const field = await doc.forms.createField({ family: 'text', name: 'loop_field' });\n await doc.forms.attachWidget(field.field.ref, {\n annotObjectNumber: widgetRef.annotObjectNumber,\n pageObjectNumber: pon,\n });\n const { annotations } = await page.annotations.list();\n const widgetDto = annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === widgetRef.annotObjectNumber,\n );\n if (widgetDto?.subtype !== 'widget') throw new Error('expected widget DTO');\n expect(widgetDto.fieldObjectNumber).toBe(field.field.fieldObjectNumber);\n\n // 3. Restyled/moved through the SAME annotation path as every kind.\n const patched = await page.annotations.update(widgetRef, {\n subtype: 'widget',\n interiorColor: { r: 255, g: 247, b: 219 },\n });\n if (patched.updated.subtype !== 'widget') throw new Error('expected widget DTO');\n expect(patched.updated.interiorColor).toEqual({ r: 255, g: 247, b: 219 });\n\n // 4. Deleting an ATTACHED widget is refused - the field-tree owns it.\n await expect(page.annotations.delete(widgetRef)).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n\n // 5. Detach -> inert again -> ordinary annotation delete succeeds.\n await doc.forms.detachWidget(field.field.ref, {\n annotObjectNumber: widgetRef.annotObjectNumber,\n pageObjectNumber: pon,\n });\n await page.annotations.delete(widgetRef);\n\n // The field survives, unplaced.\n const after = await doc.forms.get(field.field.ref);\n expect(after.widgets.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('createField composes styled widgets atomically', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const pon = opts.fixtures.toggleFields.pageObjectNumber;\n try {\n const created = await doc.forms.createField({\n family: 'radio',\n name: 'authored_radio',\n noToggleToOff: true,\n widgets: [\n {\n pageObjectNumber: pon,\n rect: { left: 20, bottom: 60, right: 40, top: 80 },\n onState: 'yes',\n appearance: { color: { r: 0, g: 0, b: 0 }, strokeWidth: 1 },\n },\n {\n pageObjectNumber: pon,\n rect: { left: 60, bottom: 60, right: 80, top: 80 },\n onState: 'no',\n },\n ],\n });\n if (created.field.family !== 'radio') throw new Error('expected radio');\n expect(created.field.noToggleToOff).toBe(true);\n expect(created.field.widgets.map((w) => w.onState)).toEqual(['yes', 'no']);\n\n // The newborn group fills through the normal value path.\n const filled = await doc.forms.setValue(created.field.ref, {\n type: 'toggle',\n state: 'yes',\n });\n if (filled.field.family !== 'radio') throw new Error('expected radio');\n expect(filled.field.value).toBe('yes');\n\n // updateField: rename + conflict validation.\n await doc.forms.updateField(created.field.ref, {\n family: 'radio',\n name: 'renamed_radio',\n });\n await expect(\n doc.forms.updateField(created.field.ref, { family: 'radio', name: 'unison_radio' }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // deleteField cascades: field gone AND its widgets gone.\n const before = await doc.page(pon).annotations.list();\n const removed = await doc.forms.deleteField(created.field.ref);\n expect(removed.removedWidgets.length).toBe(2);\n const after = await doc.page(pon).annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 2);\n await expect(doc.forms.get({ kind: 'fqn', name: 'renamed_radio' })).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n } finally {\n await doc.close();\n }\n });\n\n test('unknown refs fail with NotFound', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n await expect(doc.forms.get({ kind: 'fqn', name: 'no.such.field' })).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n } finally {\n await doc.close();\n }\n });\n });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { AnnotationAppearanceMode } from '../dto/AnnotationRender';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport type { PageState } from '../revision/PageState';\n\n/**\n * Per-fixture knowledge for the annotation appearance conformance suite. The\n * harness asserts thresholds (not exact wire content) so the same suite runs\n * unchanged against the local and cloud engines and proves they emit the same\n * set of appearances — including weak (index-only) annotations.\n */\nexport interface AnnotationAppearanceConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page whose appearances are rendered. */\n pageObjectNumber: number;\n /** At least this many `/AP` appearances are expected on that page. */\n minAppearanceCount: number;\n /**\n * `true` when the page has at least one weak (index-only) annotation that\n * carries an appearance stream. The whole point of this suite: that weak\n * appearance must still be emitted (it used to be dropped on the wire).\n */\n expectsWeakAppearance: boolean;\n}\n\nexport interface AnnotationAppearanceConformanceOptions extends Omit<\n ConformanceOptions,\n 'fixture'\n> {\n fixture: AnnotationAppearanceConformanceFixture;\n /**\n * `true` for engines that expose the raw RGBA rasters (`renderAppearances`).\n * The local engine's encoder needs a browser Canvas, so under node it can\n * only be exercised via the raw rasters; the cloud engine ships encoded\n * images (`renderAppearanceImages`) and leaves this `false`.\n */\n supportsRawRasters?: boolean;\n}\n\nconst PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];\n\ninterface NormalizedAppearance {\n ref: AnnotationRef;\n mode: AnnotationAppearanceMode;\n width: number;\n height: number;\n /** Raw RGBA bytes (raw-raster engines) or `null`. */\n raster: { data: ArrayBuffer; width: number; height: number; stride: number } | null;\n /** Encoded image bytes (image engines) or `null`. */\n encoded: Uint8Array | null;\n}\n\nexport function runAnnotationAppearanceConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationAppearanceConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const useRaw = opts.supportsRawRasters === true;\n\n describe(`annotation appearance conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('renders the expected set of appearances with valid output', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { pageState, appearances } = await collect(doc, opts, useRaw);\n\n expect(pageState.pageObjectNumber).toBe(opts.fixture.pageObjectNumber);\n expect(appearances.length >= opts.fixture.minAppearanceCount).toBe(true);\n\n for (const appearance of appearances) {\n // Identity is the ref (durable or weak) — never a stableId.\n expect(['objectNumber', 'nm', 'index'].includes(appearance.ref.kind)).toBe(true);\n expect(['normal', 'rollover', 'down'].includes(appearance.mode)).toBe(true);\n expect(appearance.width > 0 && appearance.height > 0).toBe(true);\n\n if (appearance.encoded) {\n // Encoded engines must ship real PNG bytes, not an empty part.\n expect(appearance.encoded.length > PNG_SIGNATURE.length).toBe(true);\n expect(PNG_SIGNATURE.every((b, i) => appearance.encoded![i] === b)).toBe(true);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n if (opts.fixture.expectsWeakAppearance) {\n test('weak (index-only) annotations are emitted, not dropped', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { appearances } = await collect(doc, opts, useRaw);\n const weak = appearances.find((a) => a.ref.kind === 'index');\n expect(weak !== undefined).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n if (useRaw) {\n test('rendered appearances are not blank (non-zero alpha)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { appearances } = await collect(doc, opts, useRaw);\n // Guards the blank-render regression: at least one appearance must\n // have a visible (non-transparent) pixel. Scanning the RGBA alpha\n // byte is decoder-free and unambiguous.\n const anyVisible = appearances.some((a) => a.raster !== null && hasOpaquePixel(a.raster));\n expect(anyVisible).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('abort() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const p = useRaw\n ? page.annotations.renderAppearances({ scale: 1 })\n : page.annotations.renderAppearanceImages({ format: 'png', scale: 1 });\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function collect(\n doc: DocumentHandle,\n opts: AnnotationAppearanceConformanceOptions,\n useRaw: boolean,\n): Promise<{ pageState: PageState; appearances: NormalizedAppearance[] }> {\n const page = doc.page(opts.fixture.pageObjectNumber);\n if (useRaw) {\n const result = await page.annotations.renderAppearances({ scale: 1 });\n return {\n pageState: result.pageState,\n appearances: result.appearances.map((a) => ({\n ref: a.ref,\n mode: a.mode,\n width: a.raster.width,\n height: a.raster.height,\n raster: a.raster,\n encoded: null,\n })),\n };\n }\n const result = await page.annotations.renderAppearanceImages({ format: 'png', scale: 1 });\n return {\n pageState: result.pageState,\n appearances: result.appearances.map((a) => ({\n ref: a.ref,\n mode: a.mode,\n width: a.image.width ?? 0,\n height: a.image.height ?? 0,\n raster: null,\n encoded: a.image.source.kind === 'bytes' ? a.image.source.bytes : new Uint8Array(),\n })),\n };\n}\n\nfunction hasOpaquePixel(raster: {\n data: ArrayBuffer;\n width: number;\n height: number;\n stride: number;\n}): boolean {\n const bytes = new Uint8Array(raster.data);\n for (let y = 0; y < raster.height; y++) {\n const row = y * raster.stride;\n for (let x = 0; x < raster.width; x++) {\n if (bytes[row + x * 4 + 3] !== 0) return true;\n }\n }\n return false;\n}\n\nasync function openFixture(engine: Engine, opts: AnnotationAppearanceConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { AnnotationPatch, HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageListSnapshotSchema, PageMoveResultSchema } from '../wire/schemas';\n\n/**\n * Per-fixture knowledge for the page-reorder suite. The test pages must\n * be addressable by indirect `pageObjectNumber` (every page in our\n * fixtures is). The fixture is expected to have at least 3 pages so the\n * harness can exercise reorder permutations meaningfully.\n */\nexport interface PageReorderConformanceFixture extends ConformanceFixture {\n /** Stable, durable PONs of (at least) three distinct pages. Order\n * here is the *intended caller-visible* order, not the on-disk\n * order; the suite reads `pages.list()` first and works in document\n * order. */\n ponsForReorderTest?: number[];\n /**\n * Page used for the weak-ref-survival assertion. Defaults to the\n * first PON in `ponsForReorderTest`. The fixture page must already\n * have at least one weak annotation (no /NM, direct object) so the\n * harness can capture an `index`-kind ref before the page move and\n * re-use it after.\n */\n weakRefHostPon?: number;\n /** Quad to use for the `create()` step that produces a stable ref\n * the suite uses. */\n createQuad?: HighlightDraft['quadPoints'];\n}\n\nexport interface PageReorderConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: PageReorderConformanceFixture;\n}\n\nconst DEFAULT_QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Page reorder conformance suite. Verifies the architectural invariants\n * locked with the user, do NOT loosen these without re-reading\n * `PageMoveResult` and `DocumentPagesMutator`:\n *\n * 1. `pages.list()` returns every page in display order, addressed\n * by indirect `pageObjectNumber`.\n * 2. `pages.move()` returns the full new order + geometry via\n * `result.layout` (the same shape `pages.list()` returns). There is\n * no document-level revision; the wire never asks the caller for one.\n * 3. Index-based annotation refs survive a page reorder. This is the\n * whole reason per-page revisions stay put across a move: a user\n * shuffling pages mid-edit must not lose a pending highlight. (The\n * \"move never bumps a RevisionToken\" invariant is asserted directly\n * in the annotation mutation suite, where revision liveness lives.)\n * 4. Invalid inputs (duplicate PONs, unknown PONs, out-of-range\n * `destIndex`) reject with `InvalidArg`.\n * 5. Abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageReorderConformance(\n runner: ConformanceTestRunner,\n opts: PageReorderConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fix = opts.fixture;\n const quad = fix.createQuad ?? DEFAULT_QUAD;\n\n describe(`page reorder conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.list() returns every page in display order, durable PONs only', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n expect(PageListSnapshotSchema.safeParse(list).success).toBe(true);\n expect(list.pages.length >= 1).toBe(true);\n\n for (let i = 0; i < list.pages.length; i++) {\n // Strictly contiguous, 0..N-1.\n expect(list.pages[i].index).toBe(i);\n // Pages are durable by construction; PON > 0.\n expect(list.pages[i].pageObjectNumber > 0).toBe(true);\n }\n\n // PONs are unique across the document.\n const seen = new Set<number>();\n for (const p of list.pages) {\n expect(seen.has(p.pageObjectNumber)).toBe(false);\n seen.add(p.pageObjectNumber);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() reorders pages and returns the full post-move order', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 3) return;\n const pons = pickReorderPons(\n before.pages.map((p) => p.pageObjectNumber),\n fix,\n );\n if (!pons) return;\n\n // Move the LAST of the three to the FRONT.\n const target = pons[pons.length - 1];\n const result = await doc.pages.move([target], 0);\n expect(PageMoveResultSchema.safeParse(result).success).toBe(true);\n\n // The result carries the new geometry: same count, contiguous\n // indices, moved page leads.\n const after = result.layout;\n expect(after.pages.length).toBe(before.pages.length);\n expect(after.pages[0].pageObjectNumber).toBe(target);\n for (let i = 0; i < after.pages.length; i++) {\n expect(after.pages[i].index).toBe(i);\n }\n\n // Set of PONs is preserved (no page lost or fabricated).\n const beforePons = new Set(before.pages.map((p) => p.pageObjectNumber));\n const afterPons = new Set(after.pages.map((p) => p.pageObjectNumber));\n expect(beforePons.size).toBe(afterPons.size);\n for (const pon of beforePons) expect(afterPons.has(pon)).toBe(true);\n\n // A subsequent `pages.list()` agrees with the returned layout\n // (the move result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(relisted.pages.map((p) => p.pageObjectNumber)).toEqual(\n after.pages.map((p) => p.pageObjectNumber),\n );\n } finally {\n await doc.close();\n }\n });\n\n test('weak index-based annotation refs survive a page reorder', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n\n // Pick a host page and create a fresh annotation we can address\n // by index after the move. The created annotation is durable\n // (so we use its index ref via FPDFPage_GetAnnot, which yields\n // a working index-style ref bound to the current revision).\n const hostPon = fix.weakRefHostPon ?? list.pages[0].pageObjectNumber;\n const hostPage = doc.page(hostPon);\n const beforePageList = await hostPage.annotations.list();\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'page-reorder survives this',\n quadPoints: quad,\n };\n const created = await hostPage.annotations.create(draft);\n\n // Capture the *post-create* page state. Neither create\n // (append-only, non-invalidating) nor pages.move bumps the\n // host page's revision, so the revision we capture here is\n // the same one a fresh `list()` would return after the move.\n // We bind the index ref to that revision and use it as a\n // weak ref across the page reorder.\n const afterCreate = await hostPage.annotations.list();\n const targetIndex = afterCreate.annotations.findIndex(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(targetIndex >= 0).toBe(true);\n\n const indexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: hostPon,\n index: targetIndex,\n revision: afterCreate.pageState.revision,\n };\n\n // Move some OTHER page (not the host page) to the front. The\n // host page's revision must stay put.\n const otherPon = list.pages.find((p) => p.pageObjectNumber !== hostPon)?.pageObjectNumber;\n if (otherPon === undefined) return;\n await doc.pages.move([otherPon], 0);\n\n // Use the captured weak-style ref to update the annotation.\n // This is the locked invariant: per-page RevisionToken survives\n // a page reorder, so an index ref captured before the move\n // remains valid after.\n const patch: AnnotationPatch = {\n subtype: 'highlight',\n contents: 'still alive',\n };\n const update = await hostPage.annotations.update(indexRef, patch);\n expect(update.updated.contents).toBe('still alive');\n\n // Also: the annotation index inside the host page is unchanged\n // (the host page's /Annots array was never touched).\n const afterMove = await hostPage.annotations.list();\n expect(afterMove.annotations.length).toBe(beforePageList.annotations.length + 1);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n const target = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.move([target, target], 0);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() rejects out-of-range destIndex with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n const target = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n // Post-removal count is `pages.length - 1`; destIndex one past that\n // is out of range.\n await doc.pages.move([target], list.pages.length);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n // Pick a PON that is guaranteed to not exist.\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.move([bogus], 0);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.move() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n const target = list.pages[0].pageObjectNumber;\n const p = doc.pages.move([target], 0);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(\n engine: Engine,\n opts: PageReorderConformanceOptions,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\n/**\n * Choose three PONs to exercise reorder operations against. Prefers\n * the fixture-supplied ones, falls back to \"first three in document\n * order\" otherwise.\n */\nfunction pickReorderPons(\n documentPons: number[],\n fix: PageReorderConformanceFixture,\n): number[] | null {\n if (fix.ponsForReorderTest && fix.ponsForReorderTest.length >= 3) {\n return fix.ponsForReorderTest.slice(0, 3);\n }\n if (documentPons.length < 3) return null;\n return documentPons.slice(0, 3);\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { AnnotationPatch, HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageRotateResultSchema } from '../wire/schemas';\n\nconst QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Page rotate conformance suite. Verifies the architectural invariants —\n * do NOT loosen these without re-reading `PageRotateResult`:\n *\n * 1. Rotation is ABSOLUTE and idempotent: `rotate(pons, 90)` twice is\n * `rotate(pons, 90)` once. The wire never speaks \"turn by\".\n * 2. Rotation is presentation metadata over NORMALIZED content: the\n * layout's `width`/`height` stay un-rotated, order and identity are\n * untouched, and per-page `RevisionToken`s survive (an index-based\n * annotation ref captured before the rotate works after it).\n * 3. The result returns the full new `layout`; a subsequent `list()`\n * agrees with it.\n * 4. Invalid inputs (bad rotation value, duplicate PONs, unknown PONs)\n * reject with `InvalidArg` / `NotFound`.\n * 5. Abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageRotateConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page rotate conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.rotate() sets the absolute rotation and returns the full layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const target = before.pages[0];\n\n const result = await doc.pages.rotate([target.pageObjectNumber], 90);\n expect(PageRotateResultSchema.safeParse(result).success).toBe(true);\n\n const after = result.layout;\n const rotated = after.pages.find((p) => p.pageObjectNumber === target.pageObjectNumber);\n expect(rotated?.rotation).toBe(90);\n\n // Presentation metadata only: un-rotated dims, order, and the PON\n // set are all untouched.\n expect(rotated?.size.width).toBe(target.size.width);\n expect(rotated?.size.height).toBe(target.size.height);\n expect(after.pages.map((p) => p.pageObjectNumber)).toEqual(\n before.pages.map((p) => p.pageObjectNumber),\n );\n\n // A subsequent list() agrees (the result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(\n relisted.pages.find((p) => p.pageObjectNumber === target.pageObjectNumber)?.rotation,\n ).toBe(90);\n } finally {\n await doc.close();\n }\n });\n\n test('absolute rotation is idempotent: setting the same value twice is a no-op', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n const first = await doc.pages.rotate([pon], 180);\n const second = await doc.pages.rotate([pon], 180);\n expect(second.layout.pages.map((p) => [p.pageObjectNumber, p.rotation])).toEqual(\n first.layout.pages.map((p) => [p.pageObjectNumber, p.rotation]),\n );\n } finally {\n await doc.close();\n }\n });\n\n test('one rotation applies to EVERY listed page (the multi-select gesture)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n const pons = list.pages.slice(0, 2).map((p) => p.pageObjectNumber);\n const result = await doc.pages.rotate(pons, 270);\n for (const pon of pons) {\n expect(result.layout.pages.find((p) => p.pageObjectNumber === pon)?.rotation).toBe(270);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('weak index-based annotation refs survive a rotate (no revision bump)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const hostPon = list.pages[0].pageObjectNumber;\n const hostPage = doc.page(hostPon);\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'rotate survives this',\n quadPoints: QUAD,\n };\n const created = await hostPage.annotations.create(draft);\n const afterCreate = await hostPage.annotations.list();\n const targetIndex = afterCreate.annotations.findIndex(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(targetIndex >= 0).toBe(true);\n\n const indexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: hostPon,\n index: targetIndex,\n revision: afterCreate.pageState.revision,\n };\n\n // Rotate the HOST page itself — the strongest version of the\n // invariant: even the rotated page's revision stays put.\n await doc.pages.rotate([hostPon], 90);\n\n const patch: AnnotationPatch = { subtype: 'highlight', contents: 'still alive' };\n const update = await hostPage.annotations.update(indexRef, patch);\n expect(update.updated.contents).toBe('still alive');\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects an invalid rotation value with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n // 45 is not a legal /Rotate value; the type forbids it, the wire\n // must too.\n await doc.pages.rotate([pon], 45 as never);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.rotate([pon, pon], 90);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.rotate([bogus], 90);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.rotate() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n const p = doc.pages.rotate([pon], 90);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { AnnotationPatch, HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageDeleteResultSchema } from '../wire/schemas';\n\nconst QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Page delete conformance suite. Verifies the architectural invariants —\n * do NOT loosen these without re-reading `PageDeleteResult`:\n *\n * 1. `pages.delete()` removes exactly the listed pages and returns the\n * full surviving layout; a subsequent `list()` agrees.\n * 2. Deleted PONs are RETIRED: addressing a deleted page afterwards is a\n * clean `NotFound` (an API-level error, never native-memory danger).\n * 3. SURVIVING pages keep identity and `RevisionToken`s — an index-based\n * annotation ref on an unrelated page survives a neighbour's deletion.\n * 4. Deleting every page is rejected (`InvalidArg`) — a document keeps at\n * least one page.\n * 5. Duplicate / unknown PONs reject with `InvalidArg` / `NotFound`;\n * abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageDeleteConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page delete conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.delete() removes the page and returns the surviving layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const victim = before.pages[1].pageObjectNumber;\n\n const result = await doc.pages.delete([victim]);\n expect(PageDeleteResultSchema.safeParse(result).success).toBe(true);\n\n const after = result.layout;\n expect(after.pages.length).toBe(before.pages.length - 1);\n expect(after.pageCount).toBe(before.pageCount - 1);\n expect(after.pages.some((p) => p.pageObjectNumber === victim)).toBe(false);\n\n // Survivors keep their relative order, contiguous 0..N-1 indices.\n const expectedOrder = before.pages\n .map((p) => p.pageObjectNumber)\n .filter((pon) => pon !== victim);\n expect(after.pages.map((p) => p.pageObjectNumber)).toEqual(expectedOrder);\n for (let i = 0; i < after.pages.length; i++) {\n expect(after.pages[i].index).toBe(i);\n }\n\n // A subsequent list() agrees (the result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(relisted.pages.map((p) => p.pageObjectNumber)).toEqual(expectedOrder);\n } finally {\n await doc.close();\n }\n });\n\n test('addressing a deleted page afterwards is a clean NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const victim = before.pages[1].pageObjectNumber;\n await doc.pages.delete([victim]);\n\n let caught: unknown;\n try {\n await doc.page(victim).annotations.list();\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('surviving pages keep their weak index-based annotation refs', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n\n const hostPon = list.pages[0].pageObjectNumber;\n const victimPon = list.pages[1].pageObjectNumber;\n const hostPage = doc.page(hostPon);\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'neighbour deletion survives this',\n quadPoints: QUAD,\n };\n const created = await hostPage.annotations.create(draft);\n const afterCreate = await hostPage.annotations.list();\n const targetIndex = afterCreate.annotations.findIndex(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(targetIndex >= 0).toBe(true);\n\n const indexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: hostPon,\n index: targetIndex,\n revision: afterCreate.pageState.revision,\n };\n\n await doc.pages.delete([victimPon]);\n\n const patch: AnnotationPatch = { subtype: 'highlight', contents: 'still alive' };\n const update = await hostPage.annotations.update(indexRef, patch);\n expect(update.updated.contents).toBe('still alive');\n } finally {\n await doc.close();\n }\n });\n\n test('deleting EVERY page is rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let caught: unknown;\n try {\n await doc.pages.delete(list.pages.map((p) => p.pageObjectNumber));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.delete() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.delete([pon, pon]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.delete() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.delete([bogus]);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.delete() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n const pon = list.pages[1].pageObjectNumber;\n const p = doc.pages.delete([pon]);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { DocumentEvent } from '../events/DocumentEvent';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { PageFlattenResultSchema } from '../wire/schemas';\nimport type { ConformanceOptions, ConformanceTestRunner } from './runMetadataConformance';\n\n/** Transport-neutral coverage for the content + annotation flatten rail. */\nexport function runPageFlattenConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page flatten conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('flattens eligible appearances once without changing layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.flatten) return;\n const layoutBefore = await doc.pages.list();\n const pageObjectNumber = layoutBefore.pages[0].pageObjectNumber;\n const annotationsBefore = await doc.page(pageObjectNumber).annotations.list();\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'pages.flattened') events.push(event);\n });\n\n const result = await doc.pages.flatten([pageObjectNumber], 'display');\n expect(PageFlattenResultSchema.safeParse(result).success).toBe(true);\n expect(result.pageObjectNumbers).toEqual([pageObjectNumber]);\n expect(result.usage).toBe('display');\n expect(result.results.map((item) => item.status)).toEqual(['applied']);\n expect(result.meta === null).toBe(false);\n expect(events).toHaveLength(1);\n\n const layoutAfter = await doc.pages.list();\n expect(layoutAfter).toEqual(layoutBefore);\n const annotationsAfter = await doc.page(pageObjectNumber).annotations.list();\n expect(annotationsAfter.annotations.length < annotationsBefore.annotations.length).toBe(\n true,\n );\n expect(\n annotationsAfter.pageState.revision.generation >\n annotationsBefore.pageState.revision.generation,\n ).toBe(true);\n\n const noOp = await doc.pages.flatten([pageObjectNumber], 'display');\n expect(noOp.results.map((item) => item.status)).toEqual(['unchanged']);\n expect(noOp.meta).toBeNull();\n expect(events).toHaveLength(1);\n unsubscribe();\n\n await expect(doc.pages.flatten([pageObjectNumber, pageObjectNumber])).rejects.toMatchObject(\n {\n code: EngineErrorCode.InvalidArg,\n },\n );\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { HighlightDraft, RedactDraft } from '../annotation/kinds';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { RedactionApplyResultSchema } from '../wire/schemas';\nimport type { ConformanceOptions, ConformanceTestRunner } from './runMetadataConformance';\n\n/**\n * Transport-neutral coverage for the destructive redaction-apply rail.\n * Runs against a fixture page with NO pre-existing annotations so the\n * collateral counts are exact. Content-removal fidelity itself is pinned by\n * the native embeddertests; this suite pins the transport contract: scopes,\n * statuses, counts, revision bumps, events, and preflight rejection.\n */\nexport function runRedactionApplyConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n // Geometry: the highlight sits fully inside the redact rect, so applying\n // the redaction removes it as collateral (positive-area intersection).\n const REDACT_RECT = { left: 50, bottom: 50, right: 170, top: 150 };\n const COLLATERAL_QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 70, y: 120 },\n p2: { x: 150, y: 120 },\n p3: { x: 70, y: 80 },\n p4: { x: 150, y: 80 },\n },\n ];\n\n describe(`redaction apply conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('annotations scope applies the marked redaction and counts collateral', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.redaction) return;\n const layoutBefore = await doc.pages.list();\n const pageObjectNumber = layoutBefore.pages[0].pageObjectNumber;\n const page = doc.page(pageObjectNumber);\n\n const collateral = await page.annotations.create({\n subtype: 'highlight',\n quadPoints: COLLATERAL_QUAD,\n } satisfies HighlightDraft);\n expect(collateral.created.subtype).toBe('highlight');\n\n const marked = await page.annotations.create({\n subtype: 'redact',\n rect: REDACT_RECT,\n interiorColor: { r: 0, g: 0, b: 0 },\n overlayText: 'REDACTED',\n fontColor: { r: 255, g: 255, b: 255 },\n } satisfies RedactDraft);\n expect(marked.created.subtype).toBe('redact');\n\n const before = await page.annotations.list();\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'redaction.applied') events.push(event);\n });\n\n const result = await doc.redaction.apply({\n kind: 'annotations',\n refs: [marked.created.ref],\n });\n expect(RedactionApplyResultSchema.safeParse(result).success).toBe(true);\n expect(result.results).toHaveLength(1);\n expect(result.results[0].pageObjectNumber).toBe(pageObjectNumber);\n expect(result.results[0].status).toBe('applied');\n // Exactly the highlight counts: the consumed REDACT never does.\n expect(result.results[0].removedAnnotationCount).toBe(1);\n expect(result.removedAnnotationCount).toBe(1);\n expect(result.meta === null).toBe(false);\n expect(events).toHaveLength(1);\n unsubscribe();\n\n // Both the redaction and its collateral are gone; layout is not a\n // casualty; the page revision advanced (weak refs invalidated).\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 2);\n expect(after.pageState.revision.generation > before.pageState.revision.generation).toBe(\n true,\n );\n expect(await doc.pages.list()).toEqual(layoutBefore);\n } finally {\n await doc.close();\n }\n });\n\n test('pages scope applies everything once and validates its input', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.redaction) return;\n const layout = await doc.pages.list();\n const pageObjectNumber = layout.pages[0].pageObjectNumber;\n const page = doc.page(pageObjectNumber);\n\n await page.annotations.create({\n subtype: 'redact',\n rect: REDACT_RECT,\n interiorColor: { r: 0, g: 0, b: 0 },\n } satisfies RedactDraft);\n\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'redaction.applied') events.push(event);\n });\n\n const applied = await doc.redaction.apply({\n kind: 'pages',\n pageObjectNumbers: [pageObjectNumber],\n });\n expect(applied.results.map((item) => item.status)).toEqual(['applied']);\n expect(applied.removedAnnotationCount).toBe(0);\n expect(events).toHaveLength(1);\n\n // A page with no redactions left is unchanged: no artifact, no event.\n const noOp = await doc.redaction.apply({\n kind: 'pages',\n pageObjectNumbers: [pageObjectNumber],\n });\n expect(noOp.results.map((item) => item.status)).toEqual(['unchanged']);\n expect(noOp.meta).toBeNull();\n expect(events).toHaveLength(1);\n unsubscribe();\n\n await expect(\n doc.redaction.apply({\n kind: 'pages',\n pageObjectNumbers: [pageObjectNumber, pageObjectNumber],\n }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // Preflight rejects a ref that is not a REDACT annotation before\n // anything is written.\n const notRedact = await page.annotations.create({\n subtype: 'highlight',\n quadPoints: COLLATERAL_QUAD,\n } satisfies HighlightDraft);\n await expect(\n doc.redaction.apply({ kind: 'annotations', refs: [notRedact.created.ref] }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\n\n/** `%PDF` — every extracted document must lead with the PDF header. */\nconst PDF_MAGIC = [0x25, 0x50, 0x44, 0x46];\n\n/**\n * Page extract conformance suite. `pages.extract?` is OPTIONAL on the\n * contract (the `downloadLayer?` pattern) — the suite runs only when the\n * implementation provides it, so a cloud engine that has not shipped the\n * server endpoint yet skips cleanly instead of failing.\n *\n * Invariants:\n * 1. `pages.extract([pon])` returns standalone PDF bytes (magic header).\n * 2. The SOURCE document is untouched: identical layout before/after,\n * and page revisions do not bump (extract is a read).\n * 3. Caller order is preserved and page geometry survives the copy\n * (asserted by re-opening the extracted bytes — bytes-open engines\n * only, since a cloud engine cannot re-open loose bytes).\n * 4. Empty / duplicate PONs reject `InvalidArg`; unknown PONs reject\n * `NotFound` (or `InvalidArg`); abort propagates as `AbortError`.\n */\nexport function runPageExtractConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page extract conformance: ${opts.label}`, () => {\n let engine: Engine;\n let supported = false;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await openFixture(engine, opts);\n supported = probe.pages.extract !== undefined;\n await probe.close();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.extract() returns standalone PDF bytes and leaves the source untouched', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const target = before.pages[before.pages.length - 1];\n\n const bytes = await doc.pages.extract!([target.pageObjectNumber]);\n expect(bytes.length > PDF_MAGIC.length).toBe(true);\n expect(Array.from(bytes.slice(0, PDF_MAGIC.length))).toEqual(PDF_MAGIC);\n\n // Extract is a READ: the source layout is exactly what it was.\n const after = await doc.pages.list();\n expect(after.pages.map((p) => p.pageObjectNumber)).toEqual(\n before.pages.map((p) => p.pageObjectNumber),\n );\n expect(after.pageCount).toBe(before.pageCount);\n } finally {\n await doc.close();\n }\n });\n\n test('extracted bytes re-open as a document with the requested pages, in caller order', async () => {\n if (!supported || opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let extracted: DocumentHandle | null = null;\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n // Reversed order on purpose: output order is CALLER order.\n const p0 = list.pages[0];\n const p1 = list.pages[1];\n const bytes = await doc.pages.extract!([p1.pageObjectNumber, p0.pageObjectNumber]);\n\n extracted = await engine.open({ kind: 'bytes', id: `${opts.fixture.id}-extracted`, bytes });\n const out = await extracted.pages.list();\n expect(out.pageCount).toBe(2);\n expect(out.pages[0].size).toEqual(p1.size);\n expect(out.pages[1].size).toEqual(p0.size);\n } finally {\n if (extracted) await extracted.close();\n await doc.close();\n }\n });\n\n test('pages.extract() rejects empty input with InvalidArg', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.pages.extract!([]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.extract() rejects duplicate PONs with InvalidArg', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.extract!([pon, pon]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.extract() rejects unknown PON with NotFound or InvalidArg', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.extract!([bogus]);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.extract() rejects with AbortError', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const p = doc.pages.extract!([list.pages[0].pageObjectNumber]);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { FileAttachmentAnnotationDTO, TextAnnotationDTO } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport type { PageObjectNumber } from '../identity/PageObjectNumber';\n\n/**\n * Attachment conformance suite. Fixture requirement: a document whose\n * `/EmbeddedFiles` name tree contains AT LEAST ONE embedded file.\n *\n * Both attachment surfaces are OPTIONAL on the contract (the\n * `downloadLayer?` pattern), probed independently and skipped cleanly:\n * - `doc.attachments?` — document-level EmbeddedFiles (list/download)\n * - `page.annotations.downloadFile?` — annotation-level file bytes\n *\n * Invariants:\n * 1. `list()` reflects the name tree: positional indices, non-empty\n * names, and repeated calls agree (a read).\n * 2. `download(index)` round-trips the listed metadata and returns\n * exactly `size` decoded bytes when the fixture declares one.\n * 3. Unknown indices reject with an `EngineError`.\n * 4. A created file-attachment annotation round-trips its file:\n * metadata inline on the DTO (never bytes), bytes byte-identical\n * through `downloadFile(ref)`.\n * 5. A created text (sticky-note) annotation round-trips icon + color.\n */\nexport function runAttachmentConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`attachment conformance: ${opts.label}`, () => {\n let engine: Engine;\n let docSupported = false;\n let annotSupported = false;\n let firstPon: PageObjectNumber;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await openFixture(engine, opts);\n docSupported = probe.attachments !== undefined;\n const pages = await probe.pages.list();\n firstPon = pages.pages[0].pageObjectNumber;\n annotSupported = probe.page(firstPon).annotations.downloadFile !== undefined;\n await probe.close();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('attachments.list() reflects the /EmbeddedFiles name tree and is a stable read', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const items = await doc.attachments!.list();\n expect(items.length > 0).toBe(true);\n items.forEach((item, position) => {\n expect(item.index).toBe(position);\n expect(item.key.length > 0).toBe(true);\n expect(item.name.length > 0).toBe(true);\n });\n // Keys are unique by construction — they are the durable refs.\n expect(new Set(items.map((i) => i.key)).size).toBe(items.length);\n // A read: calling again observes the identical snapshot.\n expect(await doc.attachments!.list()).toEqual(items);\n } finally {\n await doc.close();\n }\n });\n\n test('attachments.download() round-trips the listed metadata and decoded size', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const items = await doc.attachments!.list();\n for (const item of items) {\n const content = await doc.attachments!.download({ kind: 'key', key: item.key });\n expect(content.name).toBe(item.name);\n if (item.mimeType !== undefined) {\n expect(content.mimeType).toBe(item.mimeType);\n }\n if (item.size !== undefined) {\n expect(content.bytes.length).toBe(item.size);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('attachments.download() rejects an unknown key', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n await expect(\n doc.attachments!.download({ kind: 'key', key: 'conformance-no-such-key.bin' }),\n ).rejects.toBeInstanceOf(EngineError);\n } finally {\n await doc.close();\n }\n });\n\n test('create() and delete() round-trip the name tree; keys survive index shifts', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n if (doc.attachments!.create === undefined || doc.attachments!.delete === undefined) {\n await doc.close();\n return;\n }\n try {\n const before = await doc.attachments!.list();\n const data = new Uint8Array(512);\n for (let i = 0; i < data.length; i++) data[i] = (i * 7 + 3) & 0xff;\n\n // \"0-…\" sorts before the fixture's entries, shifting their indices —\n // the sharpest difference from append-only annotation creates.\n const { created } = await doc.attachments!.create!({\n data,\n name: '0-conformance.bin',\n mimeType: 'application/octet-stream',\n description: 'added by conformance',\n });\n expect(created.key).toBe('0-conformance.bin');\n expect(created.name).toBe('0-conformance.bin');\n expect(created.mimeType).toBe('application/octet-stream');\n expect(created.description).toBe('added by conformance');\n expect(created.size).toBe(data.length);\n\n const after = await doc.attachments!.list();\n expect(after.length).toBe(before.length + 1);\n // Pre-existing keys still resolve even though their indices shifted.\n for (const item of before) {\n const match = after.find((i) => i.key === item.key);\n expect(match !== undefined).toBe(true);\n }\n\n // Duplicate keys reject — keys are the identity.\n await expect(\n doc.attachments!.create!({ data, name: '0-conformance.bin' }),\n ).rejects.toBeInstanceOf(EngineError);\n\n // The created file round-trips byte-identically.\n const content = await doc.attachments!.download({ kind: 'key', key: created.key });\n expect(content.bytes.length).toBe(data.length);\n expect(content.bytes.every((byte, i) => byte === data[i])).toBe(true);\n\n // Delete by key; the key stops resolving and the rest are intact.\n const { deleted } = await doc.attachments!.delete!({ kind: 'key', key: created.key });\n expect(deleted).toEqual({ kind: 'key', key: created.key });\n const final = await doc.attachments!.list();\n expect(final.map((i) => i.key)).toEqual(before.map((i) => i.key));\n await expect(\n doc.attachments!.delete!({ kind: 'key', key: created.key }),\n ).rejects.toBeInstanceOf(EngineError);\n } finally {\n await doc.close();\n }\n });\n\n test('a created file-attachment annotation round-trips its file through downloadFile()', async () => {\n if (!annotSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const annotations = doc.page(firstPon).annotations;\n const data = new Uint8Array(2048);\n for (let i = 0; i < data.length; i++) data[i] = (i * 31 + 7) & 0xff;\n\n const { created } = await annotations.create({\n subtype: 'file-attachment',\n rect: { left: 40, bottom: 40, right: 60, top: 60 },\n file: {\n data,\n name: 'conformance.bin',\n mimeType: 'application/octet-stream',\n description: 'attachment conformance payload',\n },\n icon: 'paperclip',\n color: { r: 220, g: 38, b: 38 },\n contents: 'conformance attachment',\n });\n\n // Metadata rides the DTO; bytes never do.\n const dto = created as FileAttachmentAnnotationDTO;\n expect(dto.subtype).toBe('file-attachment');\n expect(dto.icon).toBe('paperclip');\n expect(dto.color).toEqual({ r: 220, g: 38, b: 38 });\n expect(dto.file.name).toBe('conformance.bin');\n expect(dto.file.mimeType).toBe('application/octet-stream');\n expect(dto.file.description).toBe('attachment conformance payload');\n expect(dto.file.size).toBe(data.length);\n\n // Bytes come back byte-identical through the explicit download.\n const content = await annotations.downloadFile!(dto.ref);\n expect(content.name).toBe('conformance.bin');\n expect(content.bytes.length).toBe(data.length);\n expect(Array.from(content.bytes.slice(0, 16))).toEqual(Array.from(data.slice(0, 16)));\n expect(content.bytes.every((byte, i) => byte === data[i])).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a created text annotation round-trips icon, color, and contents', async () => {\n if (!annotSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const annotations = doc.page(firstPon).annotations;\n const { created } = await annotations.create({\n subtype: 'text',\n rect: { left: 100, bottom: 100, right: 120, top: 120 },\n icon: 'comment',\n color: { r: 250, g: 204, b: 21 },\n contents: 'conformance note',\n });\n const dto = created as TextAnnotationDTO;\n expect(dto.subtype).toBe('text');\n expect(dto.icon).toBe('comment');\n expect(dto.color).toEqual({ r: 250, g: 204, b: 21 });\n expect(dto.contents).toBe('conformance note');\n\n // Icon is patchable; the file half of an attachment is not, and\n // the same presentation-only patch path applies to notes.\n const { updated } = await annotations.update(dto.ref, {\n subtype: 'text',\n icon: 'help',\n });\n expect((updated as TextAnnotationDTO).icon).toBe('help');\n } finally {\n await doc.close();\n }\n });\n });\n\n async function openFixture(engine: Engine, options: ConformanceOptions): Promise<DocumentHandle> {\n if (options.openKind === 'bytes') {\n return engine.open({\n kind: 'bytes',\n id: options.fixture.id,\n bytes: await options.fixture.bytes(),\n });\n }\n return engine.open({ kind: 'id', id: options.fixture.cloudId ?? options.fixture.id });\n }\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\n\n/**\n * Page insert conformance. `pages.insert?` is optional only until the cloud\n * endpoint ships (it is slated REQUIRED-parity — a cloud viewer must be able\n * to add pages); the suite runs wherever the implementation exists.\n *\n * Invariants:\n * 1. Every page of the source bytes is COPIED in at `destIndex` (omitted →\n * append), in source order; the result lists the fresh PONs in\n * insertion order and they agree with the returned layout.\n * 2. Pre-existing pages keep their identity: same PONs before and after,\n * in the expected positions (an insert never invalidates neighbours).\n * 3. The mutation persists through save → re-open (bytes engines only).\n * 4. Empty bytes / malformed bytes / out-of-range destIndex reject with\n * InvalidArg / MalformedPdf, leaving the document untouched.\n */\nexport function runPageInsertConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page insert conformance: ${opts.label}`, () => {\n let engine: Engine;\n let supported = false;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await openFixture(engine, opts);\n supported = probe.pages.insert !== undefined && probe.pages.extract !== undefined;\n await probe.close();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('appends every source page with fresh PONs; existing pages keep identity', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const beforePons = before.pages.map((p) => p.pageObjectNumber);\n // Self-source: extract the first page, insert it back (append).\n const single = await doc.pages.extract!([beforePons[0]]);\n\n const result = await doc.pages.insert!(single);\n expect(result.insertedPageObjectNumbers.length).toBe(1);\n expect(result.layout.pageCount).toBe(before.pageCount + 1);\n // Existing pages: same identity, same leading positions.\n expect(\n result.layout.pages.slice(0, before.pageCount).map((p) => p.pageObjectNumber),\n ).toEqual(beforePons);\n // The appended copy is a FRESH object number at the tail.\n const newPon = result.insertedPageObjectNumbers[0];\n expect(beforePons.includes(newPon)).toBe(false);\n expect(result.layout.pages[before.pageCount].pageObjectNumber).toBe(newPon);\n // The copy inherits the source page's geometry.\n expect(result.layout.pages[before.pageCount].size).toEqual(before.pages[0].size);\n } finally {\n await doc.close();\n }\n });\n\n test('destIndex places the block mid-document, in source order', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const beforePons = before.pages.map((p) => p.pageObjectNumber);\n const two = await doc.pages.extract!([beforePons[0], beforePons[1]]);\n\n const result = await doc.pages.insert!(two, 1);\n expect(result.insertedPageObjectNumbers.length).toBe(2);\n const pons = result.layout.pages.map((p) => p.pageObjectNumber);\n expect(pons[0]).toBe(beforePons[0]);\n expect(pons.slice(1, 3)).toEqual(result.insertedPageObjectNumbers);\n expect(pons.slice(3)).toEqual(beforePons.slice(1));\n } finally {\n await doc.close();\n }\n });\n\n test('the inserted pages persist through save → re-open', async () => {\n if (!supported || opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let reopened: DocumentHandle | null = null;\n try {\n const before = await doc.pages.list();\n const single = await doc.pages.extract!([before.pages[0].pageObjectNumber]);\n await doc.pages.insert!(single);\n const bytes = await doc.download();\n\n reopened = await engine.open({\n kind: 'bytes',\n id: `${opts.fixture.id}-insert-reopen`,\n bytes,\n });\n const after = await reopened.pages.list();\n expect(after.pageCount).toBe(before.pageCount + 1);\n } finally {\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test('empty bytes reject with InvalidArg; garbage rejects with MalformedPdf', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.pages.insert!(new Uint8Array(0));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n\n caught = undefined;\n try {\n await doc.pages.insert!(new TextEncoder().encode('not a pdf at all'));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.MalformedPdf)).toBe(true);\n\n // Untouched after both rejections.\n const list = await doc.pages.list();\n expect(list.pageCount > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('out-of-range destIndex rejects with InvalidArg', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const single = await doc.pages.extract!([before.pages[0].pageObjectNumber]);\n let caught: unknown;\n try {\n await doc.pages.insert!(single, before.pageCount + 1);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\n\nconst APP = 'EMBD_ConformanceTest';\nconst SIBLING_APP = 'EMBD_ConformanceSibling';\n\n/**\n * `/PieceInfo` conformance (doc + page level). The service is OPTIONAL on\n * the contract (`downloadLayer?` pattern) — the suite runs only where the\n * implementation provides it, so an engine that has not shipped it yet\n * skips cleanly.\n *\n * Invariants:\n * 1. The full value vocabulary round-trips at both levels: string,\n * number, boolean, name, string-array — read back with the same tags.\n * 2. Writes PERSIST: download() → re-open → identical read (bytes-open\n * engines only, since cloud cannot re-open loose bytes).\n * 3. `null` deletes a key; sibling keys and sibling applications\n * survive both key deletes and whole-entry clears.\n * 4. An absent application reads as `null`; `applications()` enumerates\n * what is present; every write refreshes `lastModified`.\n */\nexport function runPieceInfoConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`pieceInfo conformance: ${opts.label}`, () => {\n let engine: Engine;\n let supported = false;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await openFixture(engine, opts);\n supported = probe.pieceInfo !== undefined;\n await probe.close();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('doc-level: the full value vocabulary round-trips with tags intact', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n await doc.pieceInfo!.update(APP, {\n name: 'Standard Stamps',\n schema: 1,\n shared: true,\n kind: { name: 'StampLibrary' },\n tags: ['legal', 'finance'],\n });\n const snap = await doc.pieceInfo!.read(APP);\n expect(snap).toBeTruthy();\n expect(snap!.entries).toEqual({\n name: { type: 'string', value: 'Standard Stamps' },\n schema: { type: 'number', value: 1 },\n shared: { type: 'boolean', value: true },\n kind: { type: 'name', value: 'StampLibrary' },\n tags: { type: 'string-array', value: ['legal', 'finance'] },\n });\n expect(typeof snap!.lastModified).toBe('string');\n } finally {\n await doc.close();\n }\n });\n\n test('page-level: the stamp schema round-trips on a page', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const page = doc.page(list.pages[0].pageObjectNumber);\n await page.pieceInfo!.update(APP, { name: 'Witness', subject: 'Getuige' });\n const snap = await page.pieceInfo!.read(APP);\n expect(snap!.entries).toEqual({\n name: { type: 'string', value: 'Witness' },\n subject: { type: 'string', value: 'Getuige' },\n });\n // The doc-level holder is a DIFFERENT dictionary: untouched.\n expect(await doc.pieceInfo!.read(APP)).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('writes persist through save → re-open', async () => {\n if (!supported || opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let reopened: DocumentHandle | null = null;\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n await doc.pieceInfo!.update(APP, { name: 'Standard Stamps' });\n await doc.page(pon).pieceInfo!.update(APP, { name: 'Witness', subject: 'Getuige' });\n const bytes = await doc.download();\n\n reopened = await engine.open({ kind: 'bytes', id: `${opts.fixture.id}-pi-reopen`, bytes });\n const relist = await reopened.pages.list();\n const docSnap = await reopened.pieceInfo!.read(APP);\n expect(docSnap!.entries.name).toEqual({ type: 'string', value: 'Standard Stamps' });\n const pageSnap = await reopened.page(relist.pages[0].pageObjectNumber).pieceInfo!.read(APP);\n expect(pageSnap!.entries.subject).toEqual({ type: 'string', value: 'Getuige' });\n } finally {\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test('null deletes a key; clear removes an entry; siblings survive', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n await doc.pieceInfo!.update(APP, { name: 'A', keep: 'B' });\n await doc.pieceInfo!.update(SIBLING_APP, { other: 'C' });\n\n await doc.pieceInfo!.update(APP, { name: null });\n const afterDelete = await doc.pieceInfo!.read(APP);\n expect(Object.keys(afterDelete!.entries)).toEqual(['keep']);\n\n const apps = await doc.pieceInfo!.applications();\n expect(apps.includes(APP)).toBe(true);\n expect(apps.includes(SIBLING_APP)).toBe(true);\n\n await doc.pieceInfo!.clear(APP);\n expect(await doc.pieceInfo!.read(APP)).toBe(null);\n // The sibling application is untouched by the clear.\n const sibling = await doc.pieceInfo!.read(SIBLING_APP);\n expect(sibling!.entries.other).toEqual({ type: 'string', value: 'C' });\n } finally {\n await doc.close();\n }\n });\n\n test('an application that was never written reads as null', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n expect(await doc.pieceInfo!.read('EMBD_NeverWritten')).toBe(null);\n const list = await doc.pages.list();\n expect(\n await doc.page(list.pages[0].pageObjectNumber).pieceInfo!.read('EMBD_NeverWritten'),\n ).toBe(null);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { DocumentEvent } from '../events/DocumentEvent';\n\nconst QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Document event stream conformance suite. Verifies the invariants the\n * collaboration design rests on — do NOT loosen these without re-reading\n * `DocumentEvent`:\n *\n * 1. EXACTLY ONCE: every confirmed mutation produces exactly one event,\n * in mutation order, regardless of engine (local worker or cloud HTTP).\n * 2. GROUND TRUTH: a failed mutation publishes nothing; events fire only\n * after confirmation.\n * 3. RESULTS RIDE VERBATIM: each event embeds the result the caller\n * received, deep-equal field for field.\n * 4. PROVENANCE: own mutations are `origin.kind: 'local'` with a stable\n * per-engine-instance `sessionId`.\n * 5. Unsubscribe stops delivery.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runDocumentEventsConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`document events conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('every confirmed mutation publishes exactly one event, results verbatim', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n\n const list = await doc.pages.list();\n if (list.pages.length < 3) return;\n const pon = list.pages[0].pageObjectNumber;\n const page = doc.page(pon);\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'events conformance',\n quadPoints: QUAD,\n };\n const created = await page.annotations.create(draft);\n const updated = await page.annotations.update(created.created.ref, {\n subtype: 'highlight',\n contents: 'updated',\n });\n const rotated = await doc.pages.rotate([pon], 90);\n const victim = list.pages[2].pageObjectNumber;\n const deleted = await doc.pages.delete([victim]);\n const meta = await doc.metadata.update({ title: 'events conformance' });\n\n expect(events.map((event) => event.type)).toEqual([\n 'annotation.created',\n 'annotation.updated',\n 'pages.rotated',\n 'pages.deleted',\n 'metadata.updated',\n ]);\n\n // The embedded results are the returned results, field for field.\n const [evCreated, evUpdated, evRotated, evDeleted, evMeta] = events;\n if (evCreated.type === 'annotation.created') {\n expect(evCreated.pageObjectNumber).toBe(pon);\n expect(evCreated.created).toEqual(created.created);\n expect(evCreated.meta).toEqual(created.meta);\n }\n if (evUpdated.type === 'annotation.updated') {\n expect(evUpdated.updated).toEqual(updated.updated);\n }\n if (evRotated.type === 'pages.rotated') {\n expect(evRotated.pageObjectNumbers).toEqual([pon]);\n expect(evRotated.rotation).toBe(90);\n expect(evRotated.layout).toEqual(rotated.layout);\n expect(evRotated.cache).toEqual(rotated.cache);\n }\n if (evDeleted.type === 'pages.deleted') {\n expect(evDeleted.pageObjectNumbers).toEqual([victim]);\n expect(evDeleted.layout).toEqual(deleted.layout);\n }\n if (evMeta.type === 'metadata.updated') {\n expect(evMeta.metadata).toEqual(meta.metadata);\n }\n\n // Provenance: own mutations, one engine instance.\n for (const event of events) {\n expect(event.origin.kind).toBe('local');\n expect(typeof event.origin.sessionId).toBe('string');\n expect(event.origin.sessionId.length > 0).toBe(true);\n expect(event.origin.sessionId).toBe(events[0].origin.sessionId);\n expect(typeof event.origin.ts).toBe('number');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a FAILED mutation publishes nothing (events are ground truth)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n const list = await doc.pages.list();\n let caught: unknown;\n try {\n // Deleting every page is rejected — see PageDeleteInput.\n await doc.pages.delete(list.pages.map((p) => p.pageObjectNumber));\n } catch (err) {\n caught = err;\n }\n expect(caught !== undefined).toBe(true);\n expect(events.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('unsubscribe stops delivery', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => events.push(event));\n unsubscribe();\n const list = await doc.pages.list();\n await doc.pages.rotate([list.pages[0].pageObjectNumber], 180);\n expect(events.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { PageTextSnapshot } from '../dto/PageTextSnapshot';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport { PageTextSnapshotSchema } from '../wire/schemas';\n\n/**\n * Per-fixture expectations for the text-extraction harness. Concrete\n * suites supply the page identity + a substring the harness asserts\n * exists in the extracted text. The harness deliberately avoids\n * locking the exact string so different fixtures (or PDFium upgrades\n * that change whitespace handling) don't require harness edits.\n */\nexport interface PageTextConformanceFixture extends ConformanceFixture {\n /** PDF indirect object number of the page used by the text tests. */\n pageObjectNumber: number;\n /**\n * Substring guaranteed to appear in the extracted text. The harness\n * uses `.includes(needle)`; suites should pick something distinctive\n * but not whitespace-sensitive.\n */\n expectedSubstring: string;\n /** Minimum char count the harness expects (sanity floor). */\n minCharCount: number;\n}\n\nexport interface PageTextConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: PageTextConformanceFixture;\n}\n\nexport function runPageTextConformance(\n runner: ConformanceTestRunner,\n opts: PageTextConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page text conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('read() returns a PageTextSnapshot with non-empty text', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const snap = await page.text.read();\n expect(PageTextSnapshotSchema.safeParse(snap).success).toBe(true);\n expect(snap.charCount >= opts.fixture.minCharCount).toBe(true);\n expect(snap.text.length > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('extracted text contains the expected substring', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const snap = await page.text.read();\n expect(snap.text.includes(opts.fixture.expectedSubstring)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('read() on an unknown pageObjectNumber throws NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n const ghost = doc.page(999_999_999);\n await ghost.text.read();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() on read rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const p = page.text.read();\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('read after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n const page = doc.page(opts.fixture.pageObjectNumber);\n await doc.close();\n let caught: unknown;\n try {\n await page.text.read();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: PageTextConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\nexport type { PageTextSnapshot };\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport {\n isRotatedGeometryRun,\n type PageGeometrySnapshot,\n type RotatedGeometryRun,\n} from '../dto/PageGeometrySnapshot';\nimport { pdfQuadBounds } from '../geometry/convert';\nimport type { Engine } from '../engine/Engine';\nimport { PageGeometrySnapshotSchema } from '../wire/schemas';\n\nconst FLAG_EMPTY = 2;\n/** Absolute tolerance for coordinate assertions (PDF points). */\nconst COORD_TOLERANCE = 1e-3;\n/** Tolerance for baseline-angle assertions (radians). */\nconst ANGLE_TOLERANCE = 1e-3;\n\n/**\n * Per-fixture expectations for the oriented-text geometry harness. One\n * fixture per call, mirroring the other conformance suites; the fixture\n * declares what its dominant text orientation must read back as.\n */\nexport interface PageGeometryOrientationFixture extends ConformanceFixture {\n /** PDF indirect object number of the page under test. */\n pageObjectNumber: number;\n expectation:\n | {\n /** Every run is the upright variant; no glyph carries oriented cells. */\n kind: 'upright';\n }\n | {\n /** The page loads and every glyph is degenerate (zeroed + empty flag). */\n kind: 'empty-only';\n }\n | {\n kind: 'rotated';\n /** Baseline angles (radians, CCW, PDF y-up) rotated runs may carry. */\n rotations: number[];\n ascentFlip: boolean;\n /**\n * Assert sheared cells: with `rotations` ≈ [0], a non-zero start-edge\n * x-offset proves the parallelogram (an AABB could not express it).\n */\n sheared?: boolean;\n /** Minimum number of rotated runs the page must produce (default 1). */\n minRotatedRuns?: number;\n };\n}\n\nexport interface PageGeometryOrientationOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: PageGeometryOrientationFixture;\n}\n\nexport function runPageGeometryOrientationConformance(\n runner: ConformanceTestRunner,\n opts: PageGeometryOrientationOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page geometry orientation conformance: ${opts.label} [${opts.fixture.id}]`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const readSnapshot = async (): Promise<{\n snapshot: PageGeometrySnapshot;\n close: () => Promise<void>;\n }> => {\n const doc = await openFixture(engine, opts);\n const snapshot = await doc.page(opts.fixture.pageObjectNumber).geometry.read();\n return { snapshot, close: () => doc.close() };\n };\n\n test('snapshot round-trips the wire schema', async () => {\n const { snapshot, close } = await readSnapshot();\n try {\n const parsed = PageGeometrySnapshotSchema.safeParse(snapshot);\n expect(parsed.success).toBe(true);\n if (parsed.success) {\n // Strip-mode parsing must not lose anything the reader emitted —\n // a rotated run silently coerced to upright would fail this.\n expect(parsed.data).toEqual(snapshot);\n }\n } finally {\n await close();\n }\n });\n\n test('run charStart indices tile the page glyph sequence', async () => {\n const { snapshot, close } = await readSnapshot();\n try {\n let next = 0;\n for (const run of snapshot.runs) {\n expect(run.charStart).toBe(next);\n next += run.glyphs.length;\n }\n } finally {\n await close();\n }\n });\n\n test('runs match the fixture orientation expectation', async () => {\n const { snapshot, close } = await readSnapshot();\n try {\n const expectation = opts.fixture.expectation;\n if (expectation.kind === 'upright') {\n for (const run of snapshot.runs) {\n expect(isRotatedGeometryRun(run)).toBe(false);\n if (isRotatedGeometryRun(run)) continue;\n for (const glyph of run.glyphs) {\n expect('looseQuad' in glyph).toBe(false);\n if (glyph.flags & FLAG_EMPTY) {\n // Degenerate glyphs keep the legacy zeroed-box convention.\n expect(glyph.looseBox).toEqual({ left: 0, bottom: 0, right: 0, top: 0 });\n }\n }\n }\n return;\n }\n\n if (expectation.kind === 'empty-only') {\n for (const run of snapshot.runs) {\n expect(isRotatedGeometryRun(run)).toBe(false);\n if (isRotatedGeometryRun(run)) continue;\n for (const glyph of run.glyphs) {\n expect(glyph.flags & FLAG_EMPTY).toBe(FLAG_EMPTY);\n expect(glyph.looseBox).toEqual({ left: 0, bottom: 0, right: 0, top: 0 });\n }\n }\n return;\n }\n\n const rotatedRuns = snapshot.runs.filter(isRotatedGeometryRun);\n expect(rotatedRuns.length >= (expectation.minRotatedRuns ?? 1)).toBe(true);\n\n for (const run of rotatedRuns) {\n expect(\n expectation.rotations.some((angle) =>\n angleClose(run.rotation, angle, ANGLE_TOLERANCE),\n ),\n ).toBe(true);\n expect(run.ascentFlip).toBe(expectation.ascentFlip);\n assertRotatedRunGeometry(run);\n }\n\n if (expectation.sheared) {\n const shearedGlyphs = rotatedRuns\n .flatMap((run) => run.glyphs)\n .filter(\n (glyph) =>\n (glyph.flags & FLAG_EMPTY) === 0 &&\n Math.abs(glyph.looseQuad.p3.x - glyph.looseQuad.p1.x) > 1,\n );\n expect(shearedGlyphs.length > 0).toBe(true);\n }\n } finally {\n await close();\n }\n });\n\n function assertRotatedRunGeometry(run: RotatedGeometryRun): void {\n for (const glyph of run.glyphs) {\n if (glyph.flags & FLAG_EMPTY) {\n expect(glyph.looseQuad).toEqual({\n p1: { x: 0, y: 0 },\n p2: { x: 0, y: 0 },\n p3: { x: 0, y: 0 },\n p4: { x: 0, y: 0 },\n });\n continue;\n }\n const q = glyph.looseQuad;\n // The cell is a parallelogram: both baseline-direction edges match,\n // and both side edges match (slots: p1 US, p2 UE, p3 LS, p4 LE).\n expect(Math.abs(q.p2.x - q.p1.x - (q.p4.x - q.p3.x)) <= COORD_TOLERANCE).toBe(true);\n expect(Math.abs(q.p2.y - q.p1.y - (q.p4.y - q.p3.y)) <= COORD_TOLERANCE).toBe(true);\n // Contained in the run's page-space AABB.\n const bounds = pdfQuadBounds(q);\n expect(bounds.left >= run.rect.left - COORD_TOLERANCE).toBe(true);\n expect(bounds.right <= run.rect.right + COORD_TOLERANCE).toBe(true);\n expect(bounds.bottom >= run.rect.bottom - COORD_TOLERANCE).toBe(true);\n expect(bounds.top <= run.rect.top + COORD_TOLERANCE).toBe(true);\n }\n }\n });\n}\n\nfunction angleClose(a: number, b: number, tolerance: number): boolean {\n const delta = a - b;\n return Math.abs(Math.atan2(Math.sin(delta), Math.cos(delta))) <= tolerance;\n}\n\nasync function openFixture(engine: Engine, opts: PageGeometryOrientationOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport { foldText } from '../search/fold';\nimport type { SearchMatch, SearchSlice } from '../search/types';\nimport { SearchSliceSchema } from '../wire/schemas';\n\n/**\n * Per-fixture expectations for the search harness. Suites supply a\n * literal known to be on a specific page, one known to be nowhere, and a\n * regex with a predictable hit — the harness asserts behavior (offsets,\n * rects, snippets, cursor mechanics, dialect rejection), never exact\n * match counts, so PDFium text-extraction tweaks don't require edits.\n */\nexport interface SearchConformanceFixture extends ConformanceFixture {\n /** Literal present in the document at least once. */\n presentLiteral: string;\n /** A page (pon) guaranteed to carry a `presentLiteral` match. */\n presentPageObjectNumber: number;\n /** Literal guaranteed to match nowhere. */\n absentLiteral: string;\n /** Dialect-valid regex with at least one match in the document. */\n presentRegex: string;\n}\n\nexport interface SearchConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: SearchConformanceFixture;\n}\n\nexport function runSearchConformance(\n runner: ConformanceTestRunner,\n opts: SearchConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fixture = opts.fixture;\n\n /** Drive the cursor loop to exhaustion; assert each slice parses. */\n async function collectAll(\n doc: Awaited<ReturnType<Engine['open']>>,\n request: Parameters<typeof doc.search.query>[0],\n ): Promise<{ matches: SearchMatch[]; slices: SearchSlice[] }> {\n const matches: SearchMatch[] = [];\n const slices: SearchSlice[] = [];\n let cursor: string | undefined;\n for (;;) {\n const slice = await doc.search.query({ ...request, cursor });\n expect(SearchSliceSchema.safeParse(slice).success).toBe(true);\n matches.push(...slice.matches);\n slices.push(slice);\n if (slice.nextCursor === null) return { matches, slices };\n cursor = slice.nextCursor;\n }\n }\n\n describe(`search conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('finds the present literal with sane matches', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches } = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n });\n expect(matches.length > 0).toBe(true);\n expect(matches.some((m) => m.pageObjectNumber === fixture.presentPageObjectNumber)).toBe(\n true,\n );\n for (const m of matches) {\n expect(m.charCount > 0).toBe(true);\n expect(m.segments.length > 0).toBe(true);\n for (const s of m.segments) {\n expect(s.rect.right > s.rect.left).toBe(true);\n expect(s.rect.top > s.rect.bottom).toBe(true);\n // The pair is one constructor's output — enforce it stayed that way.\n const xs = [s.quad.p1.x, s.quad.p2.x, s.quad.p3.x, s.quad.p4.x];\n const ys = [s.quad.p1.y, s.quad.p2.y, s.quad.p3.y, s.quad.p4.y];\n expect(Math.abs(s.rect.left - Math.min(...xs)) < 1e-3).toBe(true);\n expect(Math.abs(s.rect.right - Math.max(...xs)) < 1e-3).toBe(true);\n expect(Math.abs(s.rect.bottom - Math.min(...ys)) < 1e-3).toBe(true);\n expect(Math.abs(s.rect.top - Math.max(...ys)) < 1e-3).toBe(true);\n expect(s.advance === 1 || s.advance === -1).toBe(true);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('matching is case-insensitive by default', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const lower = await collectAll(doc, {\n query: { text: fixture.presentLiteral.toLowerCase() },\n });\n const upper = await collectAll(doc, {\n query: { text: fixture.presentLiteral.toUpperCase() },\n });\n expect(lower.matches.length).toBe(upper.matches.length);\n expect(lower.matches.length > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test(\"'full' snippets reproduce the matched text; 'rects' carries none\", async () => {\n const doc = await openFixture(engine, opts);\n try {\n const full = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n mode: 'full',\n });\n for (const m of full.matches) {\n expect(!!m.snippet).toBe(true);\n const s = m.snippet!;\n const hit = s.text.slice(s.matchStart, s.matchStart + s.matchLength);\n // Fold both sides: the snippet keeps the page's original case\n // and (1:1-flattened) whitespace.\n expect(foldText(hit).folded).toBe(foldText(fixture.presentLiteral).folded);\n }\n const rects = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n mode: 'rects',\n });\n expect(rects.matches.length).toBe(full.matches.length);\n for (const m of rects.matches) expect(m.snippet === undefined).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('the absent literal exhausts with zero matches', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches, slices } = await collectAll(doc, {\n query: { text: fixture.absentLiteral },\n });\n expect(matches.length).toBe(0);\n const last = slices[slices.length - 1];\n expect(last.nextCursor).toBe(null);\n expect(last.totalPages > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a one-page budget walks the whole document via the cursor', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const whole = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n });\n const sliced = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n budget: { maxPages: 1 },\n });\n expect(sliced.matches.length).toBe(whole.matches.length);\n const last = sliced.slices[sliced.slices.length - 1];\n expect(last.scannedPages).toBe(last.totalPages);\n expect(sliced.slices.length).toBe(last.totalPages);\n } finally {\n await doc.close();\n }\n });\n\n test('startPage rotates the scan order (viewport-first)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const slice = await doc.search.query({\n query: { text: fixture.presentLiteral },\n startPage: fixture.presentPageObjectNumber,\n budget: { maxPages: 1 },\n });\n expect(slice.matches.length > 0).toBe(true);\n expect(slice.matches[0].pageObjectNumber).toBe(fixture.presentPageObjectNumber);\n } finally {\n await doc.close();\n }\n });\n\n test('a cursor replayed against a different query is rejected', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const first = await doc.search.query({\n query: { text: fixture.presentLiteral },\n budget: { maxPages: 1 },\n });\n expect(first.nextCursor !== null).toBe(true);\n let caught: unknown;\n try {\n await doc.search.query({\n query: { text: fixture.absentLiteral },\n cursor: first.nextCursor!,\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a malformed cursor is rejected', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.search.query({\n query: { text: fixture.presentLiteral },\n cursor: 'not a cursor',\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('regex queries match with offsets and rects', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches } = await collectAll(doc, {\n query: { text: fixture.presentRegex, regex: true },\n });\n expect(matches.length > 0).toBe(true);\n for (const m of matches) {\n expect(m.charCount > 0).toBe(true);\n expect(m.segments.length > 0).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('regex flags are restrictions: matchCase and wholeWord return subsets', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const all = await collectAll(doc, {\n query: { text: fixture.presentRegex, regex: true },\n });\n const key = (m: SearchMatch) => `${m.pageObjectNumber}:${m.charStart}:${m.charCount}`;\n const allKeys = new Set(all.matches.map(key));\n // Each flag can only REMOVE matches, never invent them — true for\n // any fixture pattern, so the suite needs no per-fixture counts.\n for (const flags of [{ matchCase: true }, { wholeWord: true }]) {\n const restricted = await collectAll(doc, {\n query: { text: fixture.presentRegex, regex: true, ...flags },\n });\n expect(restricted.matches.length <= all.matches.length).toBe(true);\n for (const m of restricted.matches) expect(allKeys.has(key(m))).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('regex + matchDiacritics is rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.search.query({\n query: { text: fixture.presentRegex, regex: true, matchDiacritics: true },\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('dialect violations are rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n for (const pattern of ['(a)\\\\1', '(?=x)y', '(']) {\n let caught: unknown;\n try {\n await doc.search.query({ query: { text: pattern, regex: true } });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('an empty needle returns an exhausted, empty slice', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const slice = await doc.search.query({ query: { text: ' ' } });\n expect(slice.matches.length).toBe(0);\n expect(slice.nextCursor).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() on query rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.search.query({ query: { text: fixture.presentLiteral } });\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('query after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.search.query({ query: { text: fixture.presentLiteral } });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: SearchConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n AnnotationListPageSnapshot,\n AnnotationListSnapshotAllPages,\n} from '../annotation/AnnotationListSnapshot';\nimport type { AnnotationDTO } from '../annotation/kinds';\n\n/**\n * Returns a list of human-readable difference strings between two\n * snapshots. Empty array means parity. Used by `engine-node.ts` to assert\n * that local and cloud emit identical annotations for the same fixture.\n *\n * `RevisionToken.docSessionId` is intentionally NOT compared — sessions\n * are disjoint. We do compare `pageObjectNumber` and `generation` (which\n * should be 0 for fresh reads on both sides). Page order is no longer part\n * of `PageState`; it lives in `PageLayout.index` (see `pages.list()`).\n */\nexport function diffAnnotationListSnapshot(\n a: AnnotationListPageSnapshot,\n b: AnnotationListPageSnapshot,\n): string[] {\n const errs: string[] = [];\n\n if (a.pageState.pageObjectNumber !== b.pageState.pageObjectNumber) {\n errs.push(\n `pageState.pageObjectNumber mismatch: ${a.pageState.pageObjectNumber} vs ${b.pageState.pageObjectNumber}`,\n );\n }\n if (\n JSON.stringify(a.pageState.weakAnnotationState) !==\n JSON.stringify(b.pageState.weakAnnotationState)\n ) {\n errs.push(\n `pageState.weakAnnotationState mismatch: ${JSON.stringify(\n a.pageState.weakAnnotationState,\n )} vs ${JSON.stringify(b.pageState.weakAnnotationState)}`,\n );\n }\n if (a.pageState.revision.generation !== b.pageState.revision.generation) {\n errs.push(\n `pageState.revision.generation mismatch: ${a.pageState.revision.generation} vs ${b.pageState.revision.generation}`,\n );\n }\n if (a.annotations.length !== b.annotations.length) {\n errs.push(`annotations.length mismatch: ${a.annotations.length} vs ${b.annotations.length}`);\n }\n\n const n = Math.min(a.annotations.length, b.annotations.length);\n for (let i = 0; i < n; i++) {\n const aa = a.annotations[i]!;\n const bb = b.annotations[i]!;\n diffAnnotation(i, aa, bb, errs);\n }\n\n return errs;\n}\n\nexport function diffAnnotationListSnapshotAll(\n a: AnnotationListSnapshotAllPages,\n b: AnnotationListSnapshotAllPages,\n): string[] {\n const errs: string[] = [];\n if (a.pages.length !== b.pages.length) {\n errs.push(`pages.length mismatch: ${a.pages.length} vs ${b.pages.length}`);\n }\n const n = Math.min(a.pages.length, b.pages.length);\n for (let i = 0; i < n; i++) {\n const pageErrs = diffAnnotationListSnapshot(a.pages[i]!, b.pages[i]!);\n for (const e of pageErrs) {\n errs.push(`page[${i}]: ${e}`);\n }\n }\n return errs;\n}\n\nfunction diffAnnotation(i: number, a: AnnotationDTO, b: AnnotationDTO, errs: string[]): void {\n if (a.subtype !== b.subtype) {\n errs.push(`annotations[${i}].subtype mismatch: ${a.subtype} vs ${b.subtype}`);\n return;\n }\n if (a.identityQuality !== b.identityQuality) {\n errs.push(\n `annotations[${i}].identityQuality mismatch: ${a.identityQuality} vs ${b.identityQuality}`,\n );\n }\n if (a.ref.kind !== b.ref.kind) {\n errs.push(`annotations[${i}].ref.kind mismatch: ${a.ref.kind} vs ${b.ref.kind}`);\n }\n if (a.ref.kind === 'objectNumber' && b.ref.kind === 'objectNumber') {\n if (a.ref.annotObjectNumber !== b.ref.annotObjectNumber) {\n errs.push(\n `annotations[${i}].ref.annotObjectNumber mismatch: ${a.ref.annotObjectNumber} vs ${b.ref.annotObjectNumber}`,\n );\n }\n }\n if (a.nm !== b.nm) {\n errs.push(`annotations[${i}].nm mismatch: ${a.nm} vs ${b.nm}`);\n }\n}\n"],"mappings":";;;;;;;;;;AA4DA,SAAgB,uBACd,QACA,MACM;CACN,MAAM,EAAE,UAAU,MAAM,WAAW,UAAU,WAAW;CAExD,SAAS,yBAAyB,KAAK,eAAe;EACpD,IAAI;EAEJ,UAAU,YAAY;GACpB,SAAS,MAAM,KAAK,WAAW;EACjC,CAAC;EAED,SAAS,YAAY;GACnB,IAAI,QAAQ,MAAM,OAAO,QAAQ;EACnC,CAAC;EAED,KAAK,sCAAsC,YAAY;GACrD,MAAM,MAAM,MAAMA,eAAY,QAAQ,IAAI;GAC1C,IAAI;IACF,MAAM,OAAO,MAAM,IAAI,SAAS,KAAK;IACrC,OAAO,IAAI,CAAC,CAAC,cAAc,KAAK,QAAQ,QAAQ;IAChD,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,wBAAwB;GACvD,UAAU;IACR,MAAM,IAAI,MAAM;GAClB;EACF,CAAC;EAED,KAAK,qDAAqD,YAAY;GACpE,MAAM,MAAM,MAAMA,eAAY,QAAQ,IAAI;GAC1C,IAAI;IACF,MAAM,IAAI,IAAI,SAAS,KAAK;IAC5B,EAAE,MAAM,MAAM;IACd,MAAM,OAAO,CAAC,CAAC,CAAC,QA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