Stream exported document records with versioned recovery

This commit is contained in:
2026-11-09 20:01:32 +08:00
parent 7f0d8e7983
commit be6a092c40
13 changed files with 262 additions and 22 deletions
+16 -8
View File
@@ -341,7 +341,7 @@ array. Array record errors are distinct from document schema/reference failures.
JSON array jobs preserve the original Blob and integrity digest, parserVersion 3,
byte cursor, stable IDs, pending dependencies and failures using the same ImportJob
and commit boundary as NDJSON. Such roots use recovery envelope 14; readers accept
1–14 and reject 15. Downgrading an array-bearing image to 13 rejects. This changes
1–16 and reject 17. Downgrading an array-bearing image to 13 rejects. This changes
neither IndexedDB schema v4 nor the server wire protocol. Native array items have
the same `{kind,key,record}` schema as NDJSON; `$target` denotes the chosen canvas.
@@ -349,12 +349,19 @@ the same `{kind,key,record}` schema as NDJSON; `$target` denotes the chosen canv
format v1. The JSON picker distinguishes object envelopes from record arrays.
Source canvas ownership and references map to fresh IDs; its root maps to the
explicit target, and tombstones are not copied into the target. The original
file/digest and parserVersion 4 persist; the ordinal cursor resumes against the
same indexed bytes. Document jobs use recovery v15 (readers accept 1–15, reject
16), without changing DB v4 or the wire protocol. Resource-bearing records use fresh authorization when the host provides a depot
and authority; missing capabilities or denied resources produce explicit partial
results. Complete service acceptance remains pending. Preparation
still scans the envelope before progressive payload decoding and insertion.
file/digest and parserVersion persist. New jobs use parser 5: after the version,
project and canvas headers, records are scanned and decoded on demand rather than
indexing the full elements array first. The ordinal cursor resumes against the
same bytes. Legal prefixes survive malformed array/footer tails with an explicit
partial result. Headers following the elements array require indexed preparation
to establish ownership first. Legacy parser 4 jobs keep their indexed interpreter.
New document jobs use recovery v16; legacy document jobs keep v15 (readers accept
1–16, reject 17), without changing DB v4 or the wire protocol. Resource-bearing
records use fresh authorization when the host provides a depot and authority;
missing capabilities or denied resources produce explicit partial results.
Complete service acceptance remains pending. Source SHA verification still reads
the original file before the runner starts; this removes the second full range
scan, not the remaining integrity startup barrier.
ImportRunner hosts may provide async `beforeCommit(units, job, signal)` for read-only
preparation such as resource permission checks. It returns Availability; a denial
@@ -481,4 +488,5 @@ Native import scanners share `ImportScheduling` (`now`, `yieldTask`,
threshold also yields when the clock does not advance. Cancellation is checked
again after each real task yield. Byte/ordinal cursors, parser versions and source
fingerprints are unchanged. This is a soft budget: a bounded JSON decode is
indivisible, and document-envelope range indexing still precedes record display.
indivisible. Legacy and out-of-order document headers retain indexed preparation;
canonical parser 5 headers allow progressive payload scanning.