Allow durable imports and deep copies in certified loading scopes

This commit is contained in:
2026-11-09 13:39:39 +08:00
parent 945aaea504
commit a66933775e
23 changed files with 234 additions and 62 deletions
+32 -2
View File
@@ -57,7 +57,7 @@ textarea, history and viewport when the full model arrives. App navigation cance
view's stream and asks the retained project owner to complete through a fresh read.
Reload recovers the durable prefix when that project is opened again. This is not a
persistent HTTP cursor or a workspace-wide startup scan. Version-3 scoped ACK/chunk
coordination is described below; broader structural permissions remain unfinished.
coordination and later scope-based structure/import permissions are described below.
Scope-aware queries are obtained from `engine.editor.getQueries()` and share the
same publication boundary as the root. `lookupElement(id)` returns `present`,
@@ -108,7 +108,7 @@ capture when the affected owners are ready. Existing-element removal/reparenting
requires the entire captured source closure; a missing incoming edge is not proof
that no edge exists. Declared references are checked against the transaction's final
model. Shared loaded asset references are permitted; new uploads, generation,
progressive import/copy admission and complete export remain gated during loading.
complete export remain gated in version 4. Version 5 adds import/copy admission as described below.
ACK validation reconstructs the exact protocol-2 effects of applied logical intents
on the original source; late source blocks cannot erase births, restorations or tree
@@ -122,3 +122,33 @@ remains unloaded until received. An old tombstone alone cannot classify a captur
restored ID as absent. Absence does not make an old ID available for fresh creation.
The identity manifest costs O(N) header bytes and memory and still obeys the existing
8 MiB line / 64 MiB response limits; this does not make database acquisition lazy.
Loading version 5 (recovery format 11) also retains the complete captured
`sourceCanvases` topology from the existing stream header, even for partitions
whose entry payloads are not published yet. With counts and `elementOwners`, the
page now selects this version. Existing v1–v4 recovery images retain their original
contracts; future format 12 is rejected.
`engine.imports.canStart(canvasId)` and `canDuplicate(selection, {viewCanvasId})`
return availability for UI controls, including policy and lifecycle checks. The
actual methods recheck admission. Native NDJSON import requires a complete target
owner. Deep copy requires complete selected subtrees and captured ancestor owners,
so upper-canvas incoming edges are copied from the same original endpoint into
the new partition. A declared but unpublished child is not an empty partition.
Unrelated incomplete partitions do not prevent these jobs from starting.
The existing ImportJob/source Blob/runner, history and scheduler are reused.
`source.loadingAdmission` records the source token, latest captured logical
operation sequence, and sorted required canvas IDs. On partial recovery it must
match the retained read and proved scopes. Before copy planning/resume, the source
topology is checked against that historical logical cut, independently of newer
source chunks and local edits. Source SHA, stable mappings and generation checks
continue to protect payloads and late callbacks. This is provenance metadata,
not another queue or a lock held during parsing.
Pause/reopen/resume retains source bytes and identities. Cancellation keeps already
published content and does not restart; undo remains independent of the source
parser. All content sends through the normal durability and frozen-request barriers.
Full-source completion removes the loading marker and read baseline without
replacing job/history state. New image uploads and generation remain gated while
loading; loaded shared resource references obey the existing structural rules.