lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README

README.md (36969B)


      1 # radroots_storage_sqlite
      2 
      3 The separate execution-workspace database creates exact outbox schema generation 11.
      4 Chat and initial `listing.publish` share the operation journal, protected
      5 preparation and owned bounded worker. Seller authentication and a retained T0
      6 coordinate decision precede public issuance. A conflicting initial publish
      7 cannot replace that decision or reach a new signature. T2 rechecks the original
      8 T0/T1/claim/obtained graph, then atomically retains its exact signed listing
      9 revision and pending direct-publication work. It creates no private message,
     10 recipient, wrapping identity, stock allocation or relay acknowledgement.
     11 
     12 Exact generation 7/8/9 catalogs preserve their original encrypted records and
     13 private continuation without catalog rewrites. Original public T1/S remains
     14 readable where supported. Unsupported new public admission, binding, issuance
     15 or installation refuses explicitly; retained claims never permit reissue.
     16 Actual transport dispatch and ordinary listing execution are separate stages.
     17 
     18 SQLite storage backend for Radroots.
     19 
     20 Startup and migration preserve typed `SpaceInsufficient` for numeric SQLite
     21 capacity failures and typed capacity I/O failures. Existing corruption and
     22 validation errors remain distinct. Capacity does not prove rollback: inspect
     23 the original store before retrying, and retain pending or ambiguous work.
     24 
     25 Projection document inventory uses the existing canonical projection table.
     26 Each page releases its read snapshot before returning a continuation. Metadata
     27 is bounded before decoding; the 16 MiB payload budget is charged before each
     28 value is loaded, including values that fail digest verification. Corrupt
     29 payloads retain an explicit locator, while unpageable corrupt keys or
     30 generations fail the query. Cross-page mutation fencing remains caller-owned.
     31 
     32 Runtime schema v15 permits late verified authored signatures to remain durable
     33 alongside a signing stop. The logical snapshot preserves cancelled or terminal
     34 state; a separate SQL stop column preserves the original signed/raw constraint.
     35 Prior snapshots, receipt identities, migration bytes and checksums remain
     36 unchanged. Older schema policies reject the new version. An update guard prevents
     37 replacement of the first signed bytes or removal of the retained signing stop.
     38 
     39 Recording a late fact verifies the backend's immutable original claim receipt
     40 inside the same transaction as the artifact, eligible delivery bindings and new
     41 receipt. Expiry does not invalidate evidence, and evidence does not renew work
     42 authority. Explicitly stopped delivery plans remain stopped. A success receipt
     43 is returned only after the actual SQLite COMMIT.
     44 
     45 The backend owns separate `runtime.sqlite` and `private.sqlite` files. Writable
     46 opens hold a process advisory lock, use WAL with bounded busy handling, and
     47 apply only the governed forward migrations. Fresh stores require a
     48 host-supplied `SourceGeneration` and creation timestamp; the crate never reads
     49 hidden entropy or a wall clock.
     50 
     51 Runtime schema v14 adds generic schema/scope metadata and an index for bounded
     52 draft-head queries. Migration preserves every original revision snapshot,
     53 including corrupt historical evidence. Known foreign schemas and scopes are
     54 filtered before decoding; unknown historical schemas expose only an opaque
     55 author-bound corruption locator. Each page releases its read snapshot before
     56 returning a continuation and reads at most 16 MiB of serialized snapshots.
     57 
     58 Draft submission uses the existing WAL/FULL writer and authored tables. One
     59 transaction writes the immutable intent, operation, artifacts, delivery plans,
     60 ordinary Prepare receipt and source-association receipt. Exact replay precedes
     61 source-head CAS, including after reopen or later editing. Existing atomic
     62 receipt snapshots retain their 4 MiB limit; oversized submissions fail without
     63 partial writes. No additional public database or connection API is introduced.
     64 
     65 Every connection in both owned pools uses `synchronous=FULL` and requests
     66 `fullfsync=ON`; writable stores retain WAL. Authored append acknowledges only
     67 after a successful SQLite COMMIT, or an exact replay of an already committed
     68 revision. Connection-policy validation rejects a missing full-sync request.
     69 The existing owner supplies this policy without a second database or journal.
     70 
     71 Qualification covers actual deferred-constraint COMMIT failure, bounded SQLite
     72 page-capacity exhaustion, lock contention, denied writes, closed/read-only
     73 stores, and child process termination before and after acknowledgment. Failed writes retain the
     74 previous revision and return a typed failure without a success receipt. These
     75 tests do not fill the host disk or establish physical power-loss survival.
     76 SQLite requests `F_FULLFSYNC` where its VFS supports it and may fall back to
     77 `fsync`; actual filesystem, device and power-cut behavior remains a separate
     78 host qualification. Native protected-data policy remains the host's concern.
     79 
     80 Backend status and the last integrity result are passive. Hosts invoke
     81 `check_integrity` explicitly with their own positive timestamp when they want
     82 full SQLite and foreign-key validation across both owned files. `close` drains
     83 both pools and releases writable authority explicitly and idempotently.
     84 
     85 Backup capture requires an explicit existing host-owned root configured with
     86 `OpenOptions::with_backup_root`. V1 capture creates a deterministic staging
     87 bundle, uses SQLite's online snapshot mechanism for each policy-selected
     88 member, synchronizes captured files and directories, and returns exact lengths
     89 and SHA-256 digests in the backend-neutral manifest. Protected storage is
     90 included only when the plan requests it explicitly.
     91 
     92 Restore first copies a finalized bundle into create-new files adjacent to the
     93 live databases and verifies their exact digests, schema catalogs, SQLite
     94 integrity, and foreign keys without changing live state. Finalization closes
     95 the owned pools while retaining writer authority, persists a versioned recovery
     96 marker, atomically replaces each policy-selected member, and requires callers
     97 to reopen the closed backend. Writable open completes an interrupted marked
     98 replacement before opening connections; read-only open fails closed until that
     99 recovery is complete.
    100 
    101 Legacy migration starts only from an explicit, forward-only import plan on an
    102 open writable backend. Before any target mutation, the backend captures every
    103 caller-identified predecessor database through SQLite's WAL-consistent online
    104 snapshot operation into a create-new staging directory, verifies SQLite and
    105 foreign-key integrity, records exact source provenance, lengths, and SHA-256
    106 digests in a mode-`0600` manifest, synchronizes the evidence, and atomically
    107 finalizes the immutable bundle. Import identities and timestamps are supplied
    108 by the host; collisions, owned-database aliases, and unsupported paths fail
    109 closed.
    110 
    111 Classification revalidates the finalized manifest, member inventory, hashes,
    112 SQLite integrity, and foreign keys before inspecting any schema. Event-store
    113 versions 1 through 4 require the exact governed catalog and, when present, the
    114 exact contiguous migration ledger; outbox, private, and Studio predecessors
    115 require their exact catalog and application version. Unknown objects, mixed
    116 source families, checksum drift, and newer schemas fail closed. Studio records
    117 are explicitly classified for host handoff and are never imported into SDK
    118 storage.
    119 
    120 Beginning an import writes only governed recovery metadata. Runtime schema v6
    121 binds one retained import journal to the target generation, finalized manifest,
    122 and ordered classification digest, plus one exact member row per predecessor
    123 source. SQLite guards immutable identity, one-shot conflicts, legal monotonic
    124 state transitions, timestamps, staged counts, and retained audit history.
    125 Repeated begin calls resume the exact journal; conflicting attempts fail
    126 closed.
    127 
    128 Runtime schema v7 adds isolated, append-only event-import staging. Each bounded
    129 page revalidates the immutable evidence, decodes and identifier-checks the
    130 legacy signed events, preserves their exact JSON and untrusted predecessor
    131 admission evidence, and atomically advances an eight-byte legacy sequence
    132 cursor with its durable row count. Restart resumes after that exact cursor and
    133 a completed retry is a no-op. Staging never mutates the live canonical event
    134 table or upgrades predecessor verification claims.
    135 
    136 Runtime schema v8 stages the predecessor outbox as an ordered five-table
    137 graph. A table-discriminated cursor advances through operations, events,
    138 delivery plans, targets, and attempts; every child is accepted only after its
    139 exact parent, and attempts must bind a target from the same plan. Governed
    140 column-order JSON-array records preserve nullable and scalar predecessor data
    141 without writing the live operation journal, outbox, or delivery evidence.
    142 
    143 Private schema v2 stages secret-bearing predecessor records only inside
    144 `private.sqlite`. Runtime and private commits use an explicit replay protocol:
    145 enter runtime staging, idempotently commit and byte-verify one private page,
    146 then compare-and-swap the runtime table cursor and count. A process loss after
    147 the private commit therefore replays the exact page from the old runtime cursor
    148 without duplicating counts or exposing secret-bearing staging in
    149 `runtime.sqlite`.
    150 
    151 Classified Studio state is never imported into either owned database. The
    152 backend instead returns an immutable evidence descriptor bound to the import,
    153 target generation, manifest, source digest, schema catalog, and byte length.
    154 Only an exact host receipt carrying that handoff identity and a non-zero opaque
    155 host-store commitment advances the Studio journal member to ready; exact retry
    156 is idempotent and conflicting acknowledgement fails closed.
    157 
    158 Before finalization, `validate_legacy_import` revalidates the immutable evidence,
    159 requires every member to be ready, matches each staged count to its exact source
    160 count, and hashes framed member cursors plus every runtime/private staging row
    161 under write-stable snapshots. The returned digest is the deterministic commit
    162 identity; validation itself mutates nothing.
    163 
    164 Finalization seals that identity private-first, then completes the runtime
    165 journal and all members in one transaction. A crash after the private marker
    166 replays and verifies it while the runtime journal remains ready; a lost success
    167 response reconstructs the exact receipt from both commit markers. Immutable
    168 legacy staging remains retained as owned migration evidence, while live product
    169 tables are not dual-written and predecessor evidence is not deleted.
    170 
    171 The qualification matrix includes every supported predecessor family, mixed
    172 four-source operation, bounded page interruption and reopen, invalid-row
    173 rollback, unsupported-schema and identity conflicts, private-first recovery,
    174 lost-success retry, source retention, and live-table isolation.
    175 
    176 ```rust,no_run
    177 use radroots_storage::event::SourceGeneration;
    178 use radroots_storage_sqlite::{OpenMode, OpenOptions, Paths, SqliteStorage};
    179 
    180 # async fn open(directory: &std::path::Path) -> Result<(), radroots_storage_sqlite::Error> {
    181 let paths = Paths::from_directory(directory)?;
    182 let generation = SourceGeneration::new([7; 32]).expect("non-zero generation");
    183 let storage = SqliteStorage::open(
    184     OpenOptions::new(paths, OpenMode::Create)
    185         .with_source_generation(generation, 1_700_000_000_000)?,
    186 ).await?;
    187 # drop(storage);
    188 # Ok(())
    189 # }
    190 ```
    191 
    192 Atomic paired authored revisions use the existing runtime revision tables in one
    193 `BEGIN IMMEDIATE` transaction. Both insertions commit together; mismatched or
    194 partial replay rolls back. Complete replay returns immutable historical rows and
    195 does not establish current application authority. No migration or second storage
    196 owner is introduced. Callers may recover an unknown commit result by replaying
    197 the exact pair.
    198 
    199 Open inspects both existing database schemas through read-only connections before
    200 configuring writable connections or applying either pending migration. A future
    201 version, foreign namespace, invalid catalog, ineligible authored migration or
    202 incompatible source generation therefore leaves both original files intact. Each accepted migration still
    203 rechecks metadata and applies its pending suffix atomically in its own database;
    204 this does not claim a cross-database atomic commit. An interrupted compatible
    205 upgrade resumes from its committed version on the next open.
    206 
    207 On Unix, `workspace::NativeWorkspace` owns an explicit separate local buyer
    208 outbox namespace. Initialization generates random workspace/executor/grant
    209 identities and a protected 32-byte credential; it cannot restore an existing
    210 order or create seller stock authority. Existing open requires the independently
    211 retained selection and never enrolls a new grant. The grant and credential
    212 verifier use the existing context-bound authenticated envelope and an explicitly
    213 selected persistent secret provider. Plaintext credentials are not stored.
    214 
    215 One bounded native worker owns the SQLite connection and persistent namespace
    216 lock. Dropped authentication observers cannot cancel its work or release writer
    217 authority. Close permanently stops admission, drains admitted requests, checks
    218 the WAL checkpoint and awaits connection closure before releasing the lock.
    219 Cancelled close can be awaited again. Dropping the handle is not close evidence.
    220 Revocation commits a protected grant revision and survives reopening. This
    221 attachment alone supplies no network pairing, firm stock, transfer, restore or
    222 browser qualification.
    223 
    224 
    225 The separate `OperationJournal` implementation durably admits non-stock chat
    226 preparations and binds complete immutable signing plans before dispatch. It
    227 rechecks the current protected grant, original preparation and all indexed facts
    228 under `BEGIN IMMEDIATE`, with provider work outside that transaction. A fixed
    229 first-issue window never restarts on replay. Already-bound bytes remain queryable
    230 and replayable after expiry under current access; this grants no new issuance.
    231 
    232 The current workspace schema is version 7. Older namespaces are preserved and
    233 refused for explicit cutover, without an automatic state rewrite. Complete plans
    234 use a protected manifest and at most twenty-four 16 KiB protected data parts,
    235 with context binding the full workspace/operation/plan identity and part index.
    236 Existing secret-material/envelope bounds remain intact. Queued and in-flight
    237 request reservations share a 4 MiB byte cap alongside the 32-slot queue limit.
    238 Known rollback, confirmed commit and unknown completion remain distinct.
    239 Plan binding performs no signer dispatch, business installation or delivery.
    240 
    241 
    242 Native first claims retain a full-width attempt identity and exact command,
    243 plan, recipient, intent, original deadline and transaction bindings before any
    244 signer invocation. A retained claim reports potential issuance and cannot permit
    245 another invocation. Signing remains outside this storage owner.
    246 
    247 Obtained seal capture independently verifies the signature and every signed
    248 field against the actual protected claim. Its original scoped credential may
    249 append already obtained matching bytes after revocation or expiry without an
    250 observation clock; this grants no new issuance or read rights. The first raw
    251 representation and optional observation are immutable. Borrowed capture input
    252 keeps the caller's original through error or unknown completion. Evidence uses
    253 a protected manifest and at most four 16 KiB data parts, bounded before reads.
    254 
    255 
    256 The native operation snapshot reads and authenticates the original preparation,
    257 optional plan and complete expected peer/self outcomes before taking a write
    258 lock. It rechecks current access, all retained and absent facts and whole-graph
    259 counts under one `BEGIN IMMEDIATE`, rejecting extra or orphan rows. It performs
    260 no signing or graph mutation and confirms rollback before returning. Window
    261 expiry does not erase retained facts. The existing owner drains accepted reads
    262 after a lost observer and closes explicitly. Schema 7 has twenty exact objects
    263 and preserves/refuses predecessors without automatic rewriting.
    264 
    265 Native T2 uses that same connection owner. It authenticates the complete original
    266 graph, protects fixed installation/work records before the transaction, then
    267 rechecks current access and every retained/absent fact under `BEGIN IMMEDIATE`.
    268 It atomically retains one `chat_messages` entry and distinct recipient work in
    269 `chat_publication_work`, referencing exact retained seals and original routes.
    270 The original private body stays protected in T0 instead of being duplicated.
    271 Later recipient capture may append missing work without replacing the original
    272 message installation. Already obtained evidence may install after the original
    273 first-issue window, under current access; no new signature is requested.
    274 
    275 Each T2 protected plaintext is at most 16 KiB. One message plus at most two work
    276 records cap protected materialization below 1 MiB; excess sentinels reject more
    277 than one message or two work rows without unbounded scans. Exact replay preserves
    278 original ciphertext and transaction identities. Known rollback, confirmed commit
    279 and anchored unknown completion remain distinct, and accepted work survives
    280 observer loss.
    281 
    282 Native D uses the same owner. Before retention it authenticates the original
    283 work, selected signed DM routes and outer signature, derives the temporary key's
    284 public identity and decrypts the outer against exact original retained seal
    285 bytes. Original actor, peer and selected-recipient keys are refused as temporary
    286 authors, including for a self copy. The temporary wrapping key is never
    287 persisted. Each protected frame is
    288 bounded to 393216 bytes in at most twenty-four 16 KiB parts, with a manifest,
    289 full original work linkage, exact representation digest, complete target intent
    290 and immutable endpoint attempt numbers. Its protected aggregate is at most
    291 2 MiB. Twelve potential invocations per recipient/canonical endpoint and at most
    292 384 operation target slots bound retention; replay spends no additional slot.
    293 
    294 The first full target set and completion policy remain fixed per recipient work.
    295 Each exact attempt retains a separate subset, and only that subset spends slots
    296 or may be passed to selected delivery. Original acceptance facts accumulate
    297 across retries under the full policy, without optional exhausted targets blocking
    298 required targets. A distinct current-access attempt may use a fresh delivery
    299 deadline; it changes neither an older attempt nor participant issuance.
    300 
    301 Only those exact retained bytes can become transport input. Original per-target
    302 observations append independently in at most six classes per slot, each in a
    303 bounded protected record. Missing ACKs and uncertain transport outcomes never
    304 reverse installation or release participant claims. Late capture authenticates
    305 the original credential and protected attempt without acquiring a fresh deadline,
    306 clock observation, scheduling lease or read permission. The first original time,
    307 including null, remains immutable. Current-access snapshots fence the complete
    308 T0/T1/S/T2/D graph and all target observations before projecting bounded summaries.
    309 Reopen performs no publication. Ordinary library-owned inbox orchestration,
    310 browser/bindings, consumer adoption and final qualification remain separate work.
    311 
    312 ## Fresh native seller stock authority
    313 
    314 `StockEnrollment::prepare` creates a one-shot unrelated fresh seller workspace selection,
    315 protected credential and original creation transaction ID without touching the
    316 namespace. Retain those values through protected host handling before awaiting
    317 `NativeWorkspace::initialize_seller_stock`. This explicit factory uses
    318 `stock_execution_v1.sqlite` and `.stock_execution_v1.lock` in a new owner-only
    319 directory. Its exact version-14 catalog has separate protected authority and
    320 grant records. Grant scope, route, genesis, credential and AEAD context are
    321 separate from ordinary outboxes. The same bounded native worker owns the
    322 connection, admitted work, close completion and persistent writer lock.
    323 
    324 Creation uses WAL, FULL synchronization, foreign keys and `BEGIN IMMEDIATE`.
    325 Provider work completes outside the transaction. Use a local filesystem that
    326 honors SQLite locking and synchronization; network filesystems and copied live
    327 WAL sets are not qualified. Missing or malformed namespaces are never reset or
    328 adopted. A failed or cancelled constructor is not evidence of absence: reopen
    329 with `open_seller_stock` and query `stock_authority` with the original retained
    330 selection and credential. The confirmed receipt preserves the original
    331 transaction ID. Creation consumes the sole prepared grant before IO; that enrollment cannot
    332 create a second authority namespace, including after caller cancellation.
    333 
    334 Authentication rechecks the protected current authority and grant. Revocation
    335 atomically compares and replaces both protected snapshots and advances the
    336 revocation generation. An uncertain commit fences further access on that
    337 worker until close and explicit reopen. This enrollment boundary provides no
    338 pool allocation, old-order recovery, transfer, signing or business confirmation;
    339 ordinary outbox journal jobs are refused on the stock namespace.
    340 
    341 ## Owner-private inventory transactions
    342 
    343 The current stock factory creates exact catalog version14 and protected authority
    344 payload version14. Retained enrollment-only version1 still authenticates and
    345 revokes with its original codec; its inventory ports refuse unsupported work.
    346 Retained inventory version2 keeps its original pool-creation records and refuses
    347 new correction commands. Catalogs1–13 retain their exact original codecs and
    348 capabilities; current multipart operation framing uses version5.
    349 No namespace is automatically migrated. Ordinary outbox catalogs are separate.
    350 
    351 `InventoryStore` admits `InventoryRequest` with the exact captured command,
    352 current stock-owner binding, credential and independently retained minimum
    353 inventory checkpoint. The backend verifies that minimum against its protected
    354 root and authenticated retained history before reads, replay or new writes.
    355 Protected operation links must connect that minimum to the current root; SQL
    356 index fields alone cannot establish ancestry. A constant-memory fingerprint
    357 rechecks the exact validated rows inside the transaction after provider IO.
    358 The trusted host
    359 must preserve acknowledged checkpoints through protected custody; metadata
    360 construction alone does not establish checkpoint provenance. Bootstrap and
    361 transfer qualification remain separate requirements.
    362 
    363 `stock.create_pool` captures an explicit `tick_scale` canonical integer string
    364 from0 through6 alongside its unit and exact `initial_quantity`. Each counts
    365 require scale0. The command digest includes precision and every semantic context
    366 field; correlation remains diagnostic. No implicit conversion or rounding occurs.
    367 A confirmed `InventoryReceipt` identifies the exact command effect class,
    368 original transaction, pool effect and acknowledged checkpoint. Its snapshot describes that
    369 original effect; use the current pool query for a later projection.
    370 
    371 One `BEGIN IMMEDIATE` transaction CAS-checks protected authority and grant,
    372 current clock, minimum checkpoint, idempotency and pool identity, then writes
    373 protected pool/operation/movement records and advances the protected root.
    374 No signer or network work occurs. An empty pool has zero stock and no physical
    375 movement. Replay returns the original effect before fresh deadline checks.
    376 Known failures confirm rollback; unknown completion fences the owner until
    377 reopen and reconciliation by its original operation and digest. Firm commitments,
    378 held-stock correction/deficit policy, complete commerce and transfer remain pending.
    379 
    380 `stock.adjust` captures an explicit add/remove direction and `stock.spoil`
    381 captures physical waste. Both retain a positive exact amount, expected pool
    382 version and private reason. The pool's fixed unit/precision resolves exact ticks;
    383 neither command converts or rounds. Available backing moves to cumulative waste
    384 or removed stock; positive corrections increase cumulative introduced stock.
    385 Depletion never frees lifetime introduced capacity or silently spends held or
    386 quarantined backing. Held-stock depletion still needs the qualified obligation
    387 and deficit transition; an available-stock underflow is refused.
    388 
    389 The same native transaction retains the original before/after projection,
    390 command and movement, updates the exact protected pool by version/bytes CAS,
    391 and advances protected progress. Replay reauthenticates and returns that original
    392 effect before comparing fresh versions or deadlines. Catalog identity is
    393 rechecked with protected snapshots inside the transaction, after provider IO.
    394 The ordinary facade and complete commerce behavior remain in implementation.
    395 
    396 ## Initial native acceptance and signing-plan retention
    397 
    398 `stock_order_history` and `stock_order_request` require independently retained
    399 inventory, private-source and public-listing checkpoint minima. Their snapshots
    400 return all three checkpoints. Local peer or self records enter causal coverage
    401 only after original signed output is actually retained and independently
    402 verified. They share the incoming-record graph and deduplicate by logical record
    403 identity across recipients and encodings. An intent or unknown dispatch adds no
    404 record. An actual local signature advances causal history before installation;
    405 it does not itself install an agreement or prove delivery. Full protected
    406 inventory ancestry and final transaction witnesses guard this local coverage,
    407 including refusal of an acknowledged local-tail rollback when incoming-source
    408 checkpoints have not changed.
    409 
    410 `prepare_stock_acceptance` retains the exact authorized command, original
    411 request/quote/Terms and causal observation. Current issued consent is required.
    412 Complete automatic or explicit allocation, preparatory pool holds and the order
    413 decision fence commit atomically; only explicit future promises have no hold.
    414 Original recovery precedes fresh allocation and deadline checks. Its receipt
    415 exposes the original unsigned commitment rumor without implying signing.
    416 
    417 `bind_stock_signing_intents` accepts a cryptographically qualified complete
    418 peer/self plan and compares it with that protected T0. It retains both exact
    419 intent digests and all original plan bytes in one protected journal advance,
    420 with final permission, deadline and row-witness checks. Stock does not move
    421 again. `stock_signing_plan` reads the original plan through current consent;
    422 replacement RecoverOnly access cannot create missing intents. Uncertain commit
    423 requires drain/reopen and original-identity reconciliation.
    424 
    425 `claim_stock_signing_attempt` commits one protected claim per original recipient
    426 before returning a single-use dispatch permit. Existing/recovered claims return
    427 reports without a new permit. Exact obtained signatures are independently
    428 verified again against the backend claim and appended through the borrowed
    429 `capture_stock_signing_evidence` input. Fresh T1 and dispatch claims also check
    430 current backing against protected history and compare each pool again at commit;
    431 legitimate changes to available stock do not reconstruct the original allocation.
    432 Capture requires the original scoped
    433 credential, preserves the first optional observation time and every distinct
    434 valid original encoding, and survives expiry, revocation and unavailable clocks.
    435 It grants no new read, signing, installation or delivery permission. Current
    436 consent governs `stock_signing_evidence` reads. Uncertain commits fence the
    437 owner until drain/reopen and reconciliation; the caller retains its input.
    438 `stock_signing_evidence_page` discovers up to 32 authenticated references per
    439 page by original operation and recipient, so recovery can retrieve exact bytes
    440 without retaining a caller-side digest or requesting another signature.
    441 Installation and stock conversion use the separate explicit transition below;
    442 transport delivery remains pending.
    443 
    444 `stock_operation_snapshot` authenticates original T0/T1, both recipient claims,
    445 and each recipient's evidence count and first exact artifact in one coherent
    446 observation. A bound plan, unknown claim and obtained artifact remain distinct
    447 from installation. Current RecoverOnly consent can inspect original progress
    448 after the first-issue deadline. Evidence selectors, page row sets, counts and
    449 absence facts are compared again after provider work inside the final read
    450 transaction. A recovery view never returns a fresh dispatch permit.
    451 
    452 
    453 Initial seller agreement installation uses `install_stock_agreement` on the same
    454 bounded native owner. Catalog12 introduced this transition; current catalog14
    455 retains formats1–13 without upgrading them. The original preparation fence remains
    456 immutable. Separate authenticated
    457 agreement and per-recipient work indexes bind original T0/T1 and retained S.
    458 Installation requires actual peer seal evidence; a missing self copy remains
    459 waiting work and cannot justify releasing the peer obligation. One transaction
    460 converts only the original allocation quantities from preparatory to committed
    461 holds, appends movements, installs the original record and creates both work
    462 references. Current exact recovery consent and all original/current pool and
    463 identity witnesses are confirmed after provider IO. No signer or transport runs
    464 under the transaction. Replaying or reopening returns the original installation;
    465 uncertain commit fences the owner until drain/reopen. `stock_operation_snapshot`
    466 reports installation separately from signing and delivery facts. This initial
    467 primitive does not implement amendments, handovers, fulfillment releases, deficits, browser
    468 stock or complete ordinary caller orchestration.
    469 Fresh installation also refuses an observed time before its original bound
    470 plan, before any write; recovery of an existing installation remains historical.
    471 
    472 Cleanup request/result types belong to `radroots_storage::inventory`.
    473 The `InventoryStore` transaction/query ports dispatch to this same native owner;
    474 the former native workspace type exports have been removed.
    475 
    476 `abort_proven_unissued` explicitly releases an original preparation only after
    477 authenticating absence of both recipient claims through protected history. T1
    478 may be absent or bound. A claim, unknown dispatch, obtained artifact or installed
    479 agreement refuses release; a caller assertion or missing response proves nothing.
    480 Current exact recovery consent and scope are required, including replacement
    481 RecoverOnly consent after first-issue expiry. Fresh cleanup time cannot precede
    482 original T0 or T1. No signer or transport is invoked.
    483 
    484 One transaction returns only the original quantities from preparatory to
    485 available, preserving other orders and current stock corrections, and appends
    486 the abort, movements, current-order projection and protected root. Future promises
    487 create no stock. Uncertain completion fences the owner; dropped observers leave
    488 admitted work owned until drain. `stock_preparation_abort`, original preparation
    489 replay and `stock_operation_snapshot().aborted()` retain the explicit outcome.
    490 Original abort replay does not repeat release.
    491 
    492 Catalog13 retains preparation fences by actor/operation and authenticates its
    493 derived current-order projection from complete history. A new initial preparation
    494 for the same order requires an actual prior abort, new operation and consent,
    495 and fresh source and causal checks. Installation prevents another initial
    496 preparation. Fresh T1, claim and installation for an aborted original refuse;
    497 original history remains readable. These primitives do not yet provide the
    498 complete ordinary caller workflow, claimed-attempt reconciliation, amendments,
    499 fulfillment, browser stock or platform resource qualification.
    500 
    501 `authorize_stock_exact_replay` returns a non-cloneable `StockExactReplayPermit`
    502 only for an existing protected catalog13/14 claim whose retained T1 permits local
    503 exact replay. A short read transaction rechecks current ExecuteAndRecover
    504 consent, original actor/resources, acknowledged minimum, original window and
    505 non-regressing time, order eligibility, backing and raw/root/grant/claim witnesses.
    506 RecoverOnly can read original claims but cannot mint this first-capable replay
    507 permission. Authorization creates no claim, stock movement or root update and
    508 cannot upgrade NonReplayable or predecessor records. The bounded worker owns
    509 accepted authorization after observer loss and drains before close.
    510 
    511 The permit transfers exact original data to the separately qualified provider
    512 after SQL ends. Obtained S uses existing append-only capture and original T2;
    513 indeterminate/refused recovery keeps the original claim nonspendable. No result
    514 of a recovery refusal proves original nonissuance or authorizes cleanup. Complete
    515 ordinary commerce ownership, proven-negative reconciliation and final cross-host
    516 and resource acceptance remain separate requirements.
    517 
    518 T0 request, preparation report and outcome now belong to
    519 `radroots_storage::inventory`; predecessor native type exports are removed.
    520 `NativeWorkspace::prepare_stock_acceptance` and the generic
    521 `InventoryStore::prepare_stock_acceptance` method dispatch to the same existing
    522 bounded worker and protected transaction. Native consent, source/allocation,
    523 holds, original replay and commit classification remain authoritative. Catalog13,
    524 stored bodies and the512KiB worker charge are unchanged. Ordinary outboxes refuse
    525 this stock port. Metadata constructors provide no dispatch or installation right.
    526 
    527 Obtained stock evidence uses the shared `InventoryStore::capture_stock_evidence`
    528 port and Storage append reports. The low-level verified `StockEvidenceCapture`
    529 adapter converts into a shared request; the existing native worker verifies that
    530 request again against the actual protected original before append. Both entry
    531 points use the same transaction and256KiB charge. Foreign selectors or invalid
    532 wire cannot become evidence for another claim. Original optional observation,
    533 distinct valid encodings, idempotency, late capture and unknown-commit fencing
    534 retain their existing semantics. Catalog13 and stored encodings/hashes remain
    535 unchanged. Public native receipt/outcome aliases are removed. Borrowed inputs
    536 survive errors; full ordinary task/capture ownership remains separate work.
    537 
    538 Original stock evidence reconciliation uses the generic journal's same-owner
    539 connection recovery machinery through `InventoryStore::reconcile_stock_evidence`.
    540 It authenticates retained capture credentials before confirmed close, preserves
    541 the writer lease and cached authorization through refused read-only preflight,
    542 and validates a replacement against the existing namespace. It never initializes
    543 or migrates a store. Only a confirmed original capture clears database uncertainty;
    544 errors/unknown results keep the fence. No current issuance clock, new claim,
    545 signature or stock release is obtained. Ordinary outboxes refuse this port.
    546 
    547 `StockDispatchPermit::dispatch` consumes the newly committed first-dispatch
    548 permit and owns one `ExactIssuer` invocation, enforcing the original callback
    549 binding before classifying its output. Only this path constructs the native
    550 non-cloneable `StockUnissuedInvocation` for a matching pre-dispatch refusal.
    551 Obtained artifacts remain owned; foreign callbacks become bounded rejections,
    552 and indeterminate results retain the original claim. Existing/reopened claims,
    553 caller-created reports and exact-recovery refusals cannot create this live
    554 observation. Qualification concerns the actual selected issuer; a custom trait
    555 implementation supplies no execution evidence or guarantee about unrelated
    556 root-key use. The predecessor intent-extraction method consumes the same permit
    557 and supplies no unissued observation while its composing callers await cutover.
    558 
    559 The live observation alone is not durable evidence and cannot authorize release.
    560 Catalog14 adds a separate protected original-refusal journal family. Its105-byte
    561 body binds the actual original claim entry, transaction, head and fixed reason;
    562 its SQL projection is independently authenticated in the protected ancestry.
    563 `capture_stock_original_unissued` borrows the owned observation and retained
    564 credential; failed writes leave that observation available. It requires no
    565 fresh clock, grant or issuance window. `reconcile_stock_original_unissued`
    566 resolves uncertainty through the same retained namespace owner, and
    567 `stock_original_unissued` reads authenticated original facts. Reports distinguish
    568 confirmed append from transaction uncertainty; duplicates preserve the original
    569 receipt. Old catalogs/root contexts1–13 are retained without automatic upgrade.
    570 
    571 The original refusal does not prove operation-wide nonissuance or prevent later
    572 valid S from being retained. It has no stock effect. The absent-claims-only abort
    573 rule remains conservative. Shared caller retention/cutover, predecessor removal
    574 and safe claimed-abort/late-S reconciliation remain required before releasing
    575 claimed preparatory stock.