Authorize and atomically adopt document image resources during import

This commit is contained in:
2026-11-09 18:17:24 +08:00
parent eafc5ee694
commit 73b132f71e
6 changed files with 53 additions and 17 deletions
+16 -6
View File
@@ -351,15 +351,25 @@ 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. Current resource-bearing records
report `import_resource_authorization_required`; other records can import with an
explicit partial result. This is not complete asset round-trip support. Preparation
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.
ImportRunner hosts may provide async `beforeCommit(units, job, signal)` for read-only
preparation such as resource permission checks. It returns Availability; a denial
uses normal independent-group failure isolation. A successful result still must
pass cancellation/hold/generation/status checks before the synchronous commit.
No document, history or committed source progress advances while it waits. This
hook alone does not authorize or adopt exported image references; that integration
is still pending.
No document, history or committed source progress advances while it waits. The document import host now uses this hook to authorize/adopt resource references as described below.
Document resource adoption now resolves fresh permission through the workspace
AssetDepot before each candidate commit, verifies original bytes/digest, and
canonicalizes `assetId` image URLs through the current authority. It retains at
most 32 MiB of prepared bytes per group (a single in-progress authority read may
add its separately limited 20 MiB); over-capacity groups fail explicitly. Authority
or depot absence remains an explicit partial-record failure. Cancellation and
generation fences run before the synchronous transaction. New bindings, adopted
byte ownership, elements, history, ledger and job progress publish together;
rejected transactions restore prior temporary bytes and leave no binding. Existing
owned resources must match immutable stored metadata; no fake upload is created.
Cached bytes never replace fresh permission resolution. Recovery remains v15.