Orleans.Lattice.Backup architecture
This page documents Orleans.Lattice.Backup 10.5.0, in the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at architecture.md, and llms.txt lists every page.This page describes the end-to-end capture, incremental, restore, scheduling, and sink pipelines by behaviour, and the core Lattice seams they attach to. Public types are named; the engine, coordination grains, collectors, authorizer, and inventory registry are internal and are described by their effect.
Where it attaches
The backup engine is a set of silo-singleton services and per-scope coordination grains layered strictly above the core data plane. It reuses the core primitives unchanged rather than reaching around them:
- The snapshot cursor gives a capture its point-in-time isolation. A capture opens through the public snapshot-cursor surface, so it inherits the core zero-observable-writes read, the saturation shedding, and the core replay-budget guard (a snapshot open is refused when the deepest shard's baseline would exceed
LatticeOptions.MaxSnapshotReplayEntries). Before it opens the cursor, a capture also compares the scope's live entry count against the same budget and fails fast, before any snapshot is pinned or data is read, when the scope would exceed it. - The write-ahead log gives an incremental capture its resume points. The base backup's manifest records the per-partition WAL offsets of its consistency cut; an incremental reads forward from those offsets.
- The last-writer-wins merge and bulk-load shard seams give a restore its causal fidelity. Entries replay through the same HLC-preserving merge and bulk-load entry points the data plane uses, so every entry's hybrid-logical-clock, version vector, origin cluster id, expiry, and tombstone flag land bit-identical to the capture.
- The access gate gives every operation its authorization. Backup and restore are dedicated capabilities evaluated against the same gate the data path consults.
- The tree registry gives the sink, catalog, and shadow-cutover restore their storage. The reserved
sys-backup-*trees are ordinary dogfoodedILatticetrees that self-register and carry the coresys-catalog-hiding prefix. - The view infrastructure gives the catalog its audit trail.
AddLatticeBackupensures views are present so a durable per-key history view over the catalog tree records every manifest catalogued and removed.
Full capture pipeline
ILatticeBackupCaptureService.CaptureAsync runs a capture in ordered steps (the phase names after the first step are the values of the phase metric tag; see Observability):
- Authorize. The scope is authorized fail-closed against the
Backupcapability over exactly the keys it captures, before any data is touched. A whole-tree scope is a whole-tree check; a prefix scope is a range check over every key that starts with the prefix; a key scope is a point check at the key. A failure here is taggedsnapshot-open. - Snapshot open. The in-scope size is checked against the replay budget, the per-partition WAL head frontier is recorded, and a point-in-time cursor is opened over the scope. This is the phase that sheds under saturation or is rejected by the replay-budget guard. The open holds a saga decision gate on the tree while it captures each shard, so an atomic batch is never split across the backup: every batch is captured either on all its keys or on none (see Snapshot cursors). Writes are never blocked by a capture; a saga whose commit or abort decision falls inside the capture waits for it, so saga latency during a capture grows by up to the capture's duration.
- Export. In-scope entries are streamed out of the pinned snapshot, page by page, with their full last-writer-wins / CRDT metadata, straight into an artifact in the configured sink under a per-capture artifact id. The stream is hashed as it flows, so a large tree is never materialized whole.
- Sink write. The self-describing manifest - whose id is the payload's SHA-256 content address - is written to the sink, through the scope's scheduler grain, which serialises it per backup id with retention, deletes and other captures of the same id (see Scheduling and retention).
- Manifest commit. The manifest is registered in the catalog, keyed by the backup id. Committing the manifest is the point at which the backup becomes enumerable through the catalog; a restore by id can already resolve it once step 4 has written the manifest, because a restore that misses the catalog reads the manifest from the sink.
The manifest that results records the consistency cut (WAL sequence, HLC timestamp, per-origin frontier, and per-partition WAL offsets; on a full capture the HLC timestamp is the highest HLC over the captured entries - see BackupConsistencyCut), the shard topology, a per-key shape and merge-mode map, per-origin provenance high-water marks, the capturing cluster's id, and an optional compression-dictionary reference. The id is the content address of the backup, so an identical retry derives the same id and registers once, keeping the first registration's capture time and recording its own as LastCapturedAtUtc, which retention ranks by; the artifact id is not content-addressed, so the retry's payload is written again under a fresh artifact id that the re-registered manifest references. The content address names no scope, so when a full backup's id already belongs to a backup of a different scope - identical content captured in two scopes, such as two empty trees - the capture takes its scope-qualified id instead (content addressing), and keeps re-deriving it.
Backup set and the cross-tree fence
CaptureSetAsync captures one full backup per scope under a single BackupSetManifest. A single-tree set, or a set with CrossTreeConsistent left false, issues no extra coordination and captures each member with the cheap per-tree cut. Set membership is not stored as a set: the manifest is returned but never persisted, and the only durable trace is the SetId / SetName / SetCreatedAtUtc stamp pushed onto each member's own manifest. A single-tree set is deliberately left unstamped, so it is also given no SetId - an id minted for it would match no catalog row and resolve to no member trees.
When the flag is set over more than one tree, the set is captured inside a single shared cross-tree causal fence. Each attempt runs in this order:
- Fence. Every member tree's saga decision registry is fenced: a new cross-tree atomic write cannot register on the set. It is refused, not retried or queued - its sub-sagas are rolled back and the write throws
InvalidOperationException- so the caller retries it once the capture completes. Decisions are still recorded, which is what lets the next step finish. - Drain. The capture waits for every in-flight cross-tree atomic saga touching the set to reach a terminal decision on every member. Under the fence nothing new can start, so the drain terminates.
- Gate. One saga decision gate is acquired across every member: from here no saga decision is recorded on any member, and each member's registry snapshots its decisions.
- Re-check. Under the gate, no cross-tree saga may still be awaiting its decision on any member. One that is - finalized on one member before the gate but not on another - would be captured on one side on the first member and the other side on the second, so the attempt is discarded.
- Pin. Each member's point-in-time snapshot is opened under the set's gate, one tree after another. Opening a snapshot is what fixes what the backup holds: it freezes the tree's per-shard baselines and resolves every saga still pending in them against the member's own decisions at the gate. Nothing is written to the sink yet. While the members pinned so far stay within
LatticeBackupOptions.CrossTreeSetPinnedEntryBudgetentries their baselines stay in memory; a member that takes the total past it is spilled - its baselines are persisted to the durable snapshot-baseline store and its in-memory snapshot leaves evicted - before the next tree is opened, so a large estate never holds every tree in memory at once. - Re-observe and release. The attempt is accepted only when no cross-tree saga registered on the set while the members were pinned (each registry's monotonic epoch is unchanged and nothing is in flight) and the gate was held without a lapse on every member throughout. The gate and the fence are then released. New cross-tree atomic writes on the set are therefore refused from step 1 to here - the drain included - and saga decisions on the set's trees wait only through steps 3 to 6, while the members are pinned (including any spill past the budget), not while they are written (issue #6067). Everything a pin needs that does not have to coincide with its open - authorizing the member, charging the capture, the snapshot size check, and reading its WAL head frontier - is done for every member once, before step 1, so none of it is paid under the gate.
- Write. Every member still held in memory is spilled, so none can be collected while it waits its turn, and the members are then drained to the sink one at a time, each released as soon as it is written, while the leak-guard TTLs of the members still queued are kept alive (
LatticeOptions.SnapshotBaselineTtl,LatticeOptions.CursorIdleTtl). Live writes and transactions run normally throughout: each member is read from its frozen snapshot.
So a cross-tree atomic write is never torn across the set boundary: for each such batch, either all members are present at or under the fence or none are, whichever way its per-tree terminal broadcasts interleave with the member captures. A single-tree backup makes no cross-tree promise: a cross-tree atomic write not yet finalized on the tree when its capture gates the tree reads pre-saga in that backup, even if the write's coordinator decides during the capture. Each attempt's drain wait is bounded by LatticeBackupOptions.CrossTreeFenceDrainTimeout and polled at CrossTreeFencePollInterval, and the capture makes at most MaxCrossTreeFenceAttempts attempts: an attempt is discarded and retried when a cross-tree saga is still awaiting its decision under the gate, when a new cross-tree saga registers on the set during the capture window, when one is still in flight when the attempt re-observes, or when the gate was not held throughout. A drain that times out, or a final attempt that is discarded, fails the capture with LatticeBackupCrossTreeFenceException. A discarded attempt has written nothing - its members were only pinned - so discarding it closes its snapshots and the next attempt pins every tree again. A member's catalog row waits for the set's membership stamp, so a set that fails while its members are being written catalogues the members it had already written as ordinary, unstamped backups, which stay listable (issue #5449). The selected fence and its drain statistics are recorded on the set manifest as a BackupSetFence, whose HlcTimestamp is the wall-clock tick count at which the fence was selected. The fence is a quiescence window rather than a shared snapshot: each member is still captured by its own point-in-time snapshot, opened one tree after another, so it keeps cross-tree atomic writes whole but is not a single point-in-time cut across the trees for writes that touch only one of them.
Scheduled backup sets
A backup-set schedule (ILatticeBackupControl.ScheduleBackupSetAsync, issue #6067) captures one backup set per interval over a named list of scopes, or over every user tree in the caller's tenant - either re-resolved at every run, so trees created later are included, or pinned when the schedule is registered. Each schedule is one grain, keyed by its tenant-composed name. Like a per-tree schedule it is driven by a durable reminder whose tick dispatches the run onto an interleaved grain timer and returns, runs system-origin, and coalesces a tick (or a run-now request) that arrives mid-run into the running one. Re-registering with an unchanged interval keeps the reminder, and so the timing of the next run. A run that fails because the cross-tree fence could not be established is retried LatticeBackupOptions.SetScheduleFenceRetries times, SetScheduleFenceRetryDelay apart.
Set membership is recorded durably. A set member's own SetId stamp is not enough for a schedule: a later set that captures an unchanged tree reproduces the same content-addressed backup and moves the stamp to itself. The schedule therefore records each retained set's exact tree -> backup membership, a cluster-wide index maps set ids to schedules, and the set resolver behind RestoreSetAsync consults it before falling back to a stamp scan, so every retained set restores whole.
Retention keeps and prunes whole sets: the newest set always, the newest RetentionKeepLast, and every set captured within RetentionMaxAge. The members of every retained set are held - durably, on each member scope's scheduler - from per-tree retention. A pruned set's member backup is deleted only when no retained set still names it, no other schedule holds it, and its catalog row still records that set's capture (so no later capture has taken it over); each delete runs through the backup's per-id hold like an operator delete.
When to use which: schedule a set when trees are written together - by cross-tree atomic writes, or by rows in several trees that refer to each other - and must restore to one coherent point; keep per-tree schedules for independent trees, and for incremental chains, which sets do not offer.
Incremental capture pipeline
ILatticeBackupIncrementalCaptureService.CaptureIncrementalAsync emits a forward-WAL differential layered on a base backup. It reads the base manifest from the sink, inherits the base's scope, resumes from the base backup's per-partition WAL offsets, and folds the entries that changed since the base cut into a delta artifact. The delta is written as the same uniform entry-array artifact shape a full backup uses, so the restore chain decodes a base and its increments through one path. The manifest records the base id as BaseBackupId, and the increment's id folds that base id into the content address of its delta payload.
The incremental falls back to a full capture when it cannot produce a sound delta: when the base resume point has been trimmed off the WAL (WAL fall-off), when a range delete surfaces in the delta window (a range delete cannot be expressed as a forward-entry delta without risking a missed removal), when the base chain was captured on a different cluster (an incremental chain is bound to its base's capturing cluster, so a request to extend it elsewhere starts a fresh chain rather than forking the lineage), or when the base was captured by a version that did not record the atomic batches it held back as undecided (such a base cannot hand them on, so an increment on it could omit a batch that committed after it; the first capture on an upgraded chain therefore starts a fresh one, #4686). It also falls back after draining when a committed atomic write's prepared writes precede the delta window, when the saga decision gate the drain resolves atomic writes against was not held for the whole drain, or when a retention pass began pruning the base while the delta drained (the increment's manifest is withdrawn and its artifact deleted rather than published with no base). A fallback is recorded as a capture retry with an incremental-fallback reason.
Restore pipeline
ILatticeBackupRestoreService.RestoreAsync replays a manifest chain into a target tree (the bold names are the values of the restore phase metric tag: read, verify, and merge). It offers the request to the coordinated-restore seam (see below) only once the target manifest is resolved and the restore is authorized, so a replicated target is handed to the coordinated path only on behalf of an authorized caller:
- Read. The target manifest is resolved - catalog first, then the sink - and the restore is authorized fail-closed on both of the trees it names, before anything is installed: the Restore capability over the target tree, and - only when the restore retargets the backup onto a different tree - the Backup capability over the tree that manifest was captured from. Only then is the request offered to the coordinated-restore seam. When the seam declines, the rest of the manifest chain is read, base-first - a full backup, or a base plus ordered increments up to the chosen point - and every distinct source tree in it is authorized too. See Authorization.
- Verify. Every referenced artifact is validated against its recorded content digest. Any mismatch aborts the restore with
LatticeRestoreValidationExceptionbefore anything is installed. - Merge. The entries are applied through the HLC-preserving seams, either in place - a bottom-up bulk-load when the target tree has never been registered and a single full whole-tree backup is restored with no narrower sub-scope, otherwise a last-writer-wins merge that converges with whatever the target already holds - or via an atomic shadow-cutover that builds a fresh physical tree (bulk-loaded from a single full backup, merged from a chain with increments) and swaps the target's registry alias to it in one step.
A bulk-load builds each shard with one call to that shard's root, and a load's size is unbounded, so the call can outrun the Orleans response timeout while the shard root keeps building. The restore does not re-issue it. That call would only queue behind the running one, which the shard root, a non-reentrant grain, must finish first. Instead, the restore polls the shard root for that load's status (after 1 s, 2 s, then every 5 s). It returns once the load has completed, keeps waiting while the load runs, and re-issues the load, at most twice, only when the shard root no longer runs it. The wait is bounded at 30 minutes, ends early if the restore is cancelled, and each wait and its end are logged (#5812). A load reads as complete only once it has published its tree and closed its bulk switch, so the restore never proceeds while a load's tail is still running. A load whose tail failed after it published reads as not running, so the restore re-issues it, and the re-issue closes the switch. If nobody re-issues it, the shard root closes the switch on its own a few seconds later, also after a restart. A status read that fails transiently is read again within the same bound. A shard root on lattice 10.2.0 cannot report a load's status: it answers with the definite unknown-method failure, and the timeout then fails the build attempt, as before.
A restore is idempotent: re-running the same request converges to the same state. A shadow-cutover restore records the physical tree it built (ShadowPhysicalTreeId) and the physical tree the alias resolved to beforehand (PreviousPhysicalTreeId).
RevertRestoreAsync undoes a shadow-cutover by swapping the registry alias back to PreviousPhysicalTreeId, restoring the pre-restore state. The cutover and the revert each move the alias and the shard map that describes the tree it points at in one registry write, so a reader resolving routing during either never pairs the shadow with the previous tree's map or the reverse. It is idempotent and rejects a result that did not come from a shadow-cutover restore. Authorization covers the logical target tree, while the physical tree ids on the result are caller-supplied, so they are re-resolved against the registry before the alias moves: a physical tree that is neither the target, nor a shadow the engine stamped for that target, nor the target's current physical tree, nor the pre-restore copy the target's current, not-yet-final restore recorded server-side at its cutover is refused. The last admits a revert to a copy of any provenance - un-aliased, remediated, resized, or an earlier restore's shadow - without trusting the caller-supplied id. That keeps a caller authorized to restore one tree from redirecting it onto another tree's shards, which the data-plane gate - bound to the logical tree id - would then serve under the redirected tree's own policy.
A revert whose shadow was already superseded by an unrelated physical copy is refused before it takes an alias reservation or changes lineage (#4860). Its core swap rechecks the binding and fences the observed physical identity, including legacy shadows without a recorded replaced map. This is not an epoch-based ABA fence or a transaction spanning every service await: an administrative alias move racing after the early check can still cause a later refusal. Do not use a superseded restore result to roll back a newer publication.
A shadow-cutover restore and a revert each hold the target tree's alias reservation - a restore from the moment it registers its shadow tree, a revert from just before it moves the alias - and release it when they complete. While it is held, a delete of the tree is refused with InvalidOperationException, as is a resize, a blocking schema remediation, or a different restore or revert of it, each of which takes the same reservation; a tracked schema remediation or migration instead waits for the reservation, up to LatticeSchemaEnforcementOptions.AliasReservationWaitTimeout (see Schema operations). A restore or revert that fails part-way keeps the reservation: it is released only when the same request is retried to completion or, for a restore, when its aborted shadow is garbage-collected through ILatticeCoordinatedRestoreEngine.DeleteShadowAsync (which a coordinated restore runs when it aborts), so a revert, or a local restore whose shadow is never garbage-collected, that is refused again on every retry - by the ownership guard, say - leaves the tree's delete and its other alias changes refused. The shadow tree outlives a failure too: a shadow-cutover restore registers it before it takes the reservation, so a restore that fails or is refused after that point - including one refused outright because the tree is deleted or another operation holds the reservation - leaves it registered, empty when nothing was built, until the same request is retried to completion, which reuses it, or the aborted shadow is garbage-collected (as a coordinated restore does when it aborts). A restore or revert is likewise refused with InvalidOperationException while the tree is deleted or a delete of it is pending. The restore's alias swap, and a revert that re-points the alias rather than removing it, also consult the registered tree ownership guard, whose refusal throws LatticeTreeOwnershipDeniedException. See Deleting an aliased tree.
Because a restore preserves each entry's origin cluster id and provenance, a restored tree replays its captured per-origin history faithfully rather than presenting as a single new origin. That preservation is necessary but, for a replicated tree, not sufficient on its own: a single cluster restoring in isolation can have its restored cut re-advanced by the cross-cluster union of the other peers. Restoring a tree that is currently replicated is therefore promoted to an all-or-nothing coordinated restore across the tree's current peers - every cluster builds its shadow, then commits the cutover together under a shared write fence, or all clusters compensate back to their pre-restore state. Restoring an unreplicated tree needs no such coordination and takes the plain local path above. A backup set with at least one replicated member restores every member tree as one group under the same coordinated cutover; a set with no replicated member restores its members one after another, each through its own local shadow-cutover.
Retiring restore copies
A shadow-cutover restore leaves its previous copy in place so it can be reverted, and a revert leaves the shadow in place. Each copy keeps its shards, its write-ahead log and its per-tree background loops, so copies no revert can reach would otherwise accumulate with every restore and undo. Lattice retires them (#6103).
Only one restore of a tree is revertible at a time: the one whose shadow the tree resolves to now. Its commit records the copy it reverts to on the shadow's registry entry. That restore becomes final - RevertRestoreAsync refuses it with InvalidOperationException - when a later restore of the tree commits, when the caller releases it with ReleaseRestoreAsync or ReleaseRestoreSetAsync, or when LatticeBackupOptions.RestoreRevertRetention has elapsed since its commit. A revert that would return to a copy already retired is refused the same way, before anything moves, so restore, restore again and revert reaches the first restore, while a further revert of that first restore is refused.
Every copy of the tree that is neither its alias target nor the copy the revertible restore returns to is then retired: each registered restore shadow of the tree (classified by its restore provenance, never by its name), and the tree's own original shards once a restore replaced them, unless an explicit alias recorded a way back to them. Retirement marks the copy's shards deleted, stops its compaction, shard-healing and hot-shard loops, and purges its shards, log and registry entry after LatticeOptions.SoftDeleteDuration, as a resize retires the copy it replaced. The tree's own shards keep the tree's registry entry and compaction schedule.
Retirement is gradual. A commit, a revert or a release schedules the tree's retirement grain, which retires at most one copy a minute, each under the tree's alias reservation, re-reading the registry under it; a failed pass backs off exponentially, up to an hour. A restore or revert that meets a retirement holding the reservation waits for it briefly instead of failing. An estate-wide sweep, every LatticeBackupOptions.RestoreCopySweepInterval (one day by default), schedules each tree holding a restore shadow, one tree a minute apart, so copies left behind by an earlier build are cleaned up without an operator. Restoring the same backup again after a revert reuses its shadow, recovering it first if it was retired; while its purge is running, that restore is refused until the purge completes.
Retirement fails safe. It retires nothing of a tree whose current restore was committed before the revert target was recorded, until that restore is reverted, superseded, released or its revert window ends (timed from when retirement first sees it), and nothing of a tree whose alias target a restore did not build - a resize, a schema remediation or an explicit alias - because that operation's own lifecycle may still need a restore copy. AuditRestoreCopiesAsync reports a tree's copies and any such hold; RepairRestoreCopiesAsync schedules the retirement at once.
Scheduling and retention
ILatticeBackupScheduler is the public front door; the actual coordination is a single per-scope grain keyed by BackupScopeKey.For(scope). Keying the grain by the scope key gives the scope one coordinator, whose activation-local guards keep its own captures from overlapping - a trigger issued while a capture is in flight returns null rather than starting a second one - and its own retention passes likewise. The guards do not serialize captures against retention: the capture-driving and scheduled-cycle methods interleave, and a capture through the backup API drains outside the coordinator, so a retention pass can run while a capture of the same scope is in flight. The retention fence below exists for exactly that overlap. What the coordinator does serialize is each backup id: every publish to the catalog and sink - a capture's manifest and row, a set's membership stamp, a catalog rebuild's registration - and every delete - a retention pass, an operator delete, a catalog scrub - runs on the scope's coordinator under a hold on its id. A publish waits while a pass or a delete holds its id, and a pass never dooms an id a capture is publishing, so a capture that republishes a backup's content-addressed id never meets a pass deleting it. One call waits at most a few seconds and the caller retries it, so a pass deleting a large backup from a slow sink delays a capture without failing it.
EnsureScheduleAsync registers Orleans reminders for the scope's configured full and incremental cadences (clamped up to the one-minute reminder minimum). Registering a schedule - through EnsureScheduleAsync or ScheduleRecurringBackupAsync - authorizes the caller's Backup capability over the scope, because the reminder that later fires carries no caller: each reminder-fired cycle runs system-origin, so the trust decision is taken at registration. Each scheduled cycle runs the capture and, when retention is enabled, a retention pass afterwards. A reminder tick starts its cycle on an interleaved grain timer and returns at once, so a capture longer than the reminder's response timeout never holds the reminder call; a tick that fires while the previous reminder-driven cycle is still running starts nothing and is counted as an overrun and a skip, so a schedule shorter than its captures runs one cycle at a time rather than queueing them back to back. Coalescing is per kind: a full cycle subsumes an incremental one, but not the reverse, so a full tick that fires during an incremental cycle is deferred rather than skipped - counted as an overrun only - and runs one full cycle as soon as the incremental cycle ends, and a scope with both schedules never loses its full backup. PruneAsync evaluates the chain against RetentionKeepLast and RetentionMaxAge and prunes only backups that fail every enabled rule, always preserving the base chain of a retained increment; it returns a BackupRetentionReport. A pass ranks a backup by when it was last captured (LastCapturedAtUtc, else CreatedAtUtc), so a backup a capture has just republished is never pruned as old. It reserves every prunable backup's id when it decides to prune it, removes each one's catalog row before it deletes anything, keeps (and restores) any such backup that an incremental backup outside the pass - including one still being captured - builds on, and deletes the rest tip first; an incremental capture re-reads its base's catalog row before it publishes and falls back to a full backup if a pass has begun pruning the base. One pass runs per scope at a time, and it reads the catalog only once it holds the scope's retention guard (retention rule semantics).
Per-scope schedule registration and last-run status are tracked so the control facade and the observable gauges can report a scope's health (see BackupSchedulerRuntimeStatus).
The sink seam
ILatticeBackupSink is the storage boundary. It stores two kinds of content - streamed artifacts and self-describing, content-addressed manifests - and its artifact surface is chunk-streaming on both write and read so a large payload never buffers whole. AddLatticeBackup installs the default in-cluster sink, which dogfoods the reserved sys-backup-store tree, storing manifests and streamed artifact chunks as ordinary rows. A durable external sink (for example Azure Blob Storage) implements the same interface and replaces the registration; because the engine talks only to the seam, it stays unaware of the sink's backend.
Content addressing (BackupContentHash, lowercase hex SHA-256) is what makes the pipeline idempotent at the backup level: identical payload bytes derive an identical backup (manifest) id, so a retried capture re-registers the same backup rather than a duplicate, and re-registering a manifest is harmless. A republish is serialised per id with retention and deletes (see Scheduling and retention), and identical content in two scopes is kept apart by a scope-qualified id (content addressing). Artifact ids are deliberately not content-addressed - each capture names its artifact {treeId}-{scopeKind}-{ticks}-{guid}, where the scope kind is WholeTree, Prefix, or Key - so a retried capture writes its payload again under a fresh artifact id, and the artifact the earlier attempt wrote is left orphaned in the sink. The recorded artifact digest is what a restore and a health check verify the bytes against.
The catalog
ILatticeBackupCatalogStore is the in-cluster index of manifests, persisted into the reserved sys-backup-catalog tree keyed by backup id. Every mutation runs through the standard write path, so it is captured by the durable per-key history view enabled by default - the record of what was catalogued and removed stays auditable beyond the source WAL window. Because the catalog tree carries the sys- prefix it is hidden from the default state-catalog surface, so the backup control API is the sole enumeration point for backups.
Authorization
Backup and restore are dedicated capabilities (Backup for capture, Restore for author / bulk-load) evaluated against the registered core access gate through the shared enforcement helper the data plane already uses. This means the backup path inherits the gate's behaviour exactly: the system-origin bypass for infrastructure-authored turns, the zero-cost short-circuit when only the no-op core gate is registered (a cluster with no authorization add-on pays nothing), caller-subject resolution through the membership seam, and the bootstrap-administrator break-glass. A scope is authorized over its whole extent, and a partial or filtered allow is refused fail-closed, exactly as a bulk-load or admin operation is: a prefix scope needs a grant covering every key under the prefix, so an exact-key grant on the prefix string does not authorize it and a deny carve-out anywhere below the prefix refuses it.
A restore names two trees, and both are governed. The tree written into is authorized for Restore. The tree the backup was captured from - the manifest's own recorded scope - is authorized for Backup, the same capability every other manifest-consuming verb (describe, delete, export artifact, health) gates on, and the authority the caller would have needed to capture that manifest itself. Without it a caller holding Restore over a tree it owns could have the contents of a tree it holds nothing on replayed into a tree it controls, gated only on knowing a backup id. Two properties keep the rule tight. The captured-source check is skipped when source and target are the same tree, so the ordinary same-tree point-in-time rollback needs no Backup grant and only a genuine cross-tree retarget - clone, disaster recovery into a fresh id, environment seeding - requires one. And the scope put to the gate is the effective restore scope retargeted back onto the source tree, so a sub-scoped restore authorizes only the range actually replayed, never the whole captured scope. Every distinct source tree in the manifest chain is checked, not just the tip's: an increment inherits its base's scope on the capture path, but the sink is a trust boundary, so the chain is gated rather than inferred. RevertRestoreAsync and CommitShadowAsync consult no manifest - they move a registry alias between physical trees whose provenance is separately asserted against the target - so they gate the target alone.
These checks run before a restore into a replicated tree is handed to the coordinated path, and RestoreSetAsync authorizes the Restore capability over every member tree before it dispatches anything, so a refused caller never reaches the coordinated path's admission probe, a peer, or its coordinator. That admission probe (ILatticeCoordinatedRestoreEngine.ProbeAdmissionAsync) makes the same Restore check over the effective restore scope as the shadow build does. See Coordinated restore for how the coordinated path refuses or aborts.
Reserved namespace
The sys-backup-store, sys-backup-catalog, and sys-backup-health trees, and the catalog's history and index views (sys-backup-catalog-history, sys-backup-catalog-index), are reserved under the sys-backup- prefix. An application tree that shadowed that namespace could corrupt the catalog, so LatticeBackupReservedTrees lets an application validate its own tree ids against the reserved prefix (mirroring the guards the membership and authorization packages enforce on their own reserved namespaces).