Skip to content

Integrate indexed remote reads and large-file staging - #613

Merged
forhappy merged 127 commits into
crab-v2from
codex/indexed-staging-single-pr
Oct 16, 2026
Merged

forhappy merged 127 commits into
crab-v2from
codex/indexed-staging-single-pr

Conversation

@forhappy

@forhappy forhappy commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Repository browsing and large-file publication performed work proportional to unrelated history. Native add and Git-clean also retained separate payload lifetimes. This PR adds authenticated selected reads, persistent Xet catalog updates and one streaming staging owner, while preserving visibility, rollback and retained-payload guarantees.

One PR targeting crab-v2. The two requested large-file audit reports and later user-owned advisor-plan edits are excluded. No merge into main is requested.

Behavior

  • Path-state, commit graph, object locator, visibility and Xet catalog queries use authenticated pages. Captured refs authorize visibility; physical index presence alone cannot. Corruption, absence, incomplete authority, raw paths, operation budgets and reader cleanup remain distinct contracts.
  • First-parent file history/blame follows relevant change points and reuses immutable comparisons. Multiple-parent blame, whole-file rename following and actual source-line attribution remain unfinished.
  • Native add and Git-clean share streaming ingestion and staged payload ownership. Their Git framing/index transactions remain separate. Rollback, durable handoffs, complete historical recipes and flush-before-publication ordering remain required; publication retires only captured owners.
  • Checkpoint format 9 uses persistent content-addressed catalog trees, reuses unchanged subtrees and verifies new pages before checkpoint/history/root visibility. File-binding precedence, immutable descriptor conflicts and reverse-placement order remain canonical. CLI/shared/protected publication and hydration use selected dependency closures.
  • Capsule chunk hints use an authenticated global COW tree. Hints require current source membership and fresh origin identity. Missing pages can trigger recapture only after the advisory root changes; unchanged-root damage remains an error.
  • Historical verification streams the pinned checkpoint catalog and resolves its file bindings in batches. Exact dependency counts and encoded-byte totals come from the completed proof; its authenticated checkpoint inventory is reused without a second physical walk. Empty durable descriptors remain counted. Source authentication, ref visibility, verified Git installation and whole-file/LFS hashing remain prerequisites.
  • Selected recovery mapping checks use batches of 64 against one captured lookup, preserving duplicate occurrences, order, genuine misses and dependency errors. Complete post-fetch shard discovery shares that metadata capture and streams shard identities instead of materializing every recipe. Generation-only caching remains disabled for per-ref heads.
  • Shard compaction authenticates complete stored shards, including optional bloom bytes, before handing native bodies to Xet’s EOF-based file loader. This fixes compaction of default native-push shards while retaining complete-object identity checks. Plain/bloom and tampered-trailer regression coverage uses the same existing parser as shard synchronization.
  • Historical restore unions durable catalog roots through authenticated streaming columns and persistent edits. Newer file bindings retain precedence; file sizes, immutable descriptors and canonical reverse placements remain checked. Both input closures and every batch share encoded/logical admission. Nested recipe digests ignore valid page partitioning and are cached only after complete scans for this operation, so aliases do not repeat full comparisons. Prepared current pages are reused for publication. The final winning union recipes are byte-verified against the already authenticated historical Git refs before any checkpoint/root/ref transition; a corrupt current replacement cannot inherit the old recipe's proof.
  • Full catalog inspection uses bounded private spill. GC and readiness share the verified descriptor cursor. Current fsck groups final file bindings by shard, checks every decoded xorb chunk, exact shard/xorb metadata, file sizes and reconstruction terms, then uses the canonical Git/whole-file/LFS byte proof. It retains one shard and bounded binding batches instead of a complete recipe map or a full file scan per shard. Constructor admission and the data phase may each inspect metadata; that cost remains explicit. Normal GC/readiness do not pay for grouping.
  • GC follows current, historical and retained catalog closures. Admitted provider deletes drain before fences release. Auth-issued view-local hint cleanup verifies scope, acquires global admission before repository admission, preserves live/exact IDs and immutable-object grace, and fails on corrupt current pages. Shared-global hint maintenance retains bucket ownership.
  • Publishers check lease cancellation before visibility and preserve acknowledged commits through late cancellation or cleanup failures. Native push no longer writes the unused advisory push-state hint that could falsely report a committed push as failed.

Ownership and delivery ledger: crab/docs/architecture/indexed-remote-reads.md. Packed-delta decoding and remaining catalog-rewrite callers still materialize logical catalogs; aggregate uncheckpointed-delta intake remains a gate. The durable restore union retains no complete recipe map. Its final byte proof adds administrative work rather than establishing a latency improvement. Published tags lack the capsule codec; retired unshipped formats through 8 are rejected without a fallback reader. Earlier SQLite WAL-safety and Cellule-pin work remains visible in the dependency diff; this restore slice changes no manifest, lockfile, dependency, configuration or remote format.

Validation

Latest frozen source 408e38fe06a8643eaa5eac657b69699a879de150b286e3fbe0c0da6ec88ab275, debug binary SHA256 1f5f212cd9d5ff403ef7d1606a1fd575a339541c38db6577bd43d03d3f74713d: 721 affected tests pass (metadata57, checkpoint catalog11, capture1, read237, shared checkpoint9, GC134, fsck70, mirror75, metadb35, shard sync28, recovery command34, compaction18, historical recovery12). Minimal-feature checks, strict metadata/read library Clippy, normal publication/CLI Clippy, final binary build and format pass. Normal CLI Clippy still reports81 warnings; it is not a strict pass. The related enlarged restore-future/underscore warnings were corrected. No source changes occurred during the passing qualification.

An earlier run timed out on two five-second cache-startup waits (235/237 passed). The isolated three tests, full default-concurrency237-test rerun, five repeated three-test runs, and final237-test run pass without deadline/test changes. The earlier failed receipt is retained; its cause remains unproven.

Fresh RustFS validation on that exact source/binary passes 224 commands /117 checks. Real native/Git uploads and checkpoints,64-entry selected recovery batches with duplicates/mismatches/misses, cold current/historical bytes, missing/corrupt catalog/shard/xorb rejection, deep metadata rebuild, exhaustive replica verification and cleanup all pass. Real shard compaction changes the winning bindings; historical preview preserves visibility, apply restores the original refs, a cold clone reconstructs original bytes, then a fresh Git-clean edit/commit/push in the restored epoch passes full fsck and an independent cold byte oracle. Source/binary identities remain unchanged and logs pass the credential-disclosure check. This16MiB fixture is Level3 component proof, not10GiB/release or hosted-latency qualification.

The first live run stopped at real compaction (201 commands/92 prior checks) because native-push bloom trailers reached Xet's EOF-based loader. The new regression reproduces that error before the fix; all18 compaction cases and the fresh live run pass after using the existing trailer parser following complete-object authentication. The failed receipt is retained.

Prior RustFS component evidence covers selected catalog lifecycle, native/Git staging and exact retirement, current/historical cold reconstruction, protected publication, scoped GC, cache-service behavior, SIGINT and acknowledged-publication fault handling. Deterministic fixed catalog edits at 100/10,000/100,000 entries stay within 256 KiB read/write bounds; fixed hint edits stay within 512 KiB. The distinct-recipe spill fixture reads 15.8 MB and enforces temporary-space admission. These are component/request bounds, not complete opening/history or hosted-latency acceptance.

The recreated format-9 two-file 10 GiB matrix is in progress on its frozen hint/catalog revision and debug binary. Entropy/native passes 75 commands / 57 checks, including all four versions' stage/push/ref/retirement checks, eight cold byte oracles and full remote fsck with zero errors/repairs. Entropy/Git is running; four repeated/zero cases remain planned. The prior cleanup-interrupted runs remain failed/incomplete. This does not qualify the final combined revision, release performance or hosted-S3 latency.

Remaining merge gates and priorities

  1. Finish remaining maintenance conversion and bound opening, ref-count and uncompacted-history amplification.
  2. Complete combined lifecycle, fresh-install, crash/restart, concurrent publication, retained-reader and final-source release-mode 10 GiB qualification. RustFS is authorized; hosted-S3 latency remains unproven.
  3. Implement multiple-parent blame, whole-file rename following, correct source paths/lines and versioned whitespace/ignored-revision semantics, with native line-porcelain oracles.
  4. Resolve CI. The tracked architecture checker still fails on exactly two pending inventory corrections: the qualified crab-storage test-support dev edge and rusqlite 0.39/bundled/fallible_uint versus the stale 0.34/bundled expectation. The tracked checker is unchanged; its unapplied two-line proposal passes all architecture checks on this source. Inventory changes still need explicit approval under repository rules. At3b79f76, the CI guardrail job reproduces exactly these two failures; the remaining new-head checks are in progress. At11d088, macOS/Windows protocol, RustFS GC race/crash, Server Cell recovery and other component gates passed; the Compose image exercise stopped after five ECR AWS CLI image pull attempts returned a data-limit/rate-limit error; that run did not complete the recovery gate. The earlier cluster node-loss/recovery failure also requires a successful new-head gate. New-head CI and appropriate full/cross-platform proof remain required. Extended CLI lib/test Clippy has a separately recorded pre-existing failure; it is not reported as passing.

Is this the best fix? Shared ownership, authenticated persistent pages and operation-scoped spill address the measured duplication/scanning without a second integrity policy or authoritative fallback. Historical accounting reuses the authenticated inspection ledger; recovery point checks and complete shard enumeration share the same capture owner. Durable restore union and final winning-recipe verification share these owners; remaining catalog rewriters, packed-delta intake and opening/history amplification still need qualification and conversion. Compaction removes the optional trailer at the native-loader boundary after authentication, using the existing format owner and sibling contract. The union removes map retention while preserving complete inspection and explicit resource limits; it does not claim constant-cost full maintenance. Final merge approval remains deferred until the open gates pass. Unrelated PRs #505 and #522 remain outside this initiative.

Replace unreleased whole-layer path-state data with authenticated pages.
Keep layer object ownership for checkpoints, publication and GC; rebuild
retired derived formats under the existing maintenance owner.
Import authenticated path-state records, nodes and edges without
materializing the complete index or rereading retained Git commits.

Keep projection actors runtime-owned so cold state reads cannot wait
for background ingestion. Scheduler cleanup releases only unused
activations; migration and shutdown preserve explicit drain barriers.

Append schema migration 3 without changing earlier SQL digests.
Preserve summaries and epoch membership; remove unconsumed Git data.
Keep released manifest encoding; page capsule lookup dependencies.

BREAKING CHANGE: Rust descriptor literals require optional page and
ordinal-identity fields. Unshipped path page refs use the shared PageRef
type. Version-1 stored graph bytes remain unchanged.
Use captured ref roots and admitted page reads for foreground graph queries.

BREAKING CHANGE: commits_reachable_from is asynchronous; callers must await its proof. Crate API versioning remains required before publication.
Use complete metadata capture for origin-backed readers before the first checkpoint. Preserve visibility ordering and range-install thin delta chains instead of requiring resident pack bodies.
Cold full-OID resolution reread ancestry pages to prove that a captured ref tip reaches itself. Reuse the root validated during opening while preserving entry admission and cancellation.
Authenticate OID and physical-offset directories against captured pack inventory. Reuse bounded traversal for graph and path readers; production object-index publication and reader wiring remain pending.
Publish verified physical pages before readiness; retain their binding through path completion and GC. Resolve OIDs and offset-delta bases through captured-state pages with operation admission and cancellation.

Unshipped browse record version 3 replaces version 2; maintenance rebuilds retired records under CAS. RustFS/native-Git proof passes at 100, 1000 and 10000 commits. Storage amplification and provider/lifecycle qualification remain open.
Replace unreleased descriptor v1 with authenticated pack-slot directories
and presence-aware metadata. Maintenance rebuilds retired descriptors.

Record storage savings and unresolved shared-host latency regression.
Offset lookup already authenticates the forward dictionary row. Join its
reverse slot once while retaining captured-inventory and pack-ID checks.

A re-signed valid-slot redirect regression protects offset identity.
Local join medians improve; provider and opening gates remain unresolved.
Paged object lookup resolves placements before hint paths run. Borrow
ordinal admission directly and avoid a second per-OID dictionary.
Preserve source/member and capsule-run validation for indexed reads.

Record final-source native-Git replay and remaining opening costs.
Commit OID/member and dense count page roots in run footer version 2.
Full readers verify both directories and canonical bytes before exposure.
Retire unshipped version 1 without a compatibility reader.

Keep pure codecs independent of storage features and meter admission pages.
Lazy opening remains a dependent slice.
Keep captured ref closures authoritative while deferring full OID sets.
Bulk visibility APIs become async and authenticate the captured source.
Retain deletion and type-reset markers in unreleased path-state v6.
Verify candidate changes against raw Git while skipping unrelated commits.
Require unshipped checkpoint format 6 and bind visibility page roots to the captured footer and source catalog. Keep complete catalog access explicit and async across hydration and publication consumers.
Keep Git query captures lazy. Build the GC fixture through the maintenance entry point and preserve query-view rejection, catalog retention and grace-period assertions.
Stage the duplicate through Git-clean so push still needs advisory candidates. Keep every origin-proof and no-upload assertion, and cold-hydrate the newly published duplicate repository.
Newer Clippy flags must_use emitted by async-trait 0.1.89.
Scope allowances to eight trait expansions so MSRV linting still works.
Runtime code and dependency versions remain unchanged.
Reuse unchanged catalog subtrees so fixed edits avoid full history
assembly and encoding. Verify new pages before checkpoint visibility;
retain complete query closure, physical GC roots and accounting.

Checkpoint format 9 rejects unshipped predecessors through 8. Audited
published tags contain no capsule codec; no compatibility fallback.

Proof: fixed edits through 100k bindings, corruption and amplification
regressions, publication/GC consumers, CLI build and 63 real RustFS
checks with independent current and historical hydration.

Full maintenance streaming and final-format 10GiB qualification remain
open; older format-7 large-file receipts do not prove this format.
Format9 is admitted by both root validation and positive history tests.
Reject format8 and future10 instead of listing9 as unsupported.

All metadata index features: 623 passed, one existing stress case ignored.
Production source is identical to the qualified COW build and RustFS run.
Scan authenticated pages once and reduce bounded relation batches in
private local spills. Preserve complete dependency and canonical reverse
placement validation without full recipes or random origin joins.

The rejected point-join design read 2.70 GB for a 15.8 MB catalog. This path
reads 15.8 MB, with bounded row windows and admitted live disk bytes.
Blocking workers retain workspace ownership through cancellation and
close drains them before cleanup. No dependency or config changes.

Proof: 629 metadata tests, strict component Clippy, publication/checkpoint
and GC/history/fsck checks, CLI build and 63 real RustFS checks. The
resource profile includes fixture/full-oracle work, not query-only RSS.

Full logical-catalog consumer conversion and final-source 10 GiB gates
remain open.
Drain active inspectors after the first error so spill workers finish
before history verification returns. Preserve historical page integrity
checks after the current catalog is replaced.
Replace capsule hint database initialization with authenticated copy-on-write pages. Preserve exact staged assertions and current-source/origin proof. Keep global GC admission through root publication and drain protected receive before fence release.
Check scoped cancellation after immutable preparation and before ref visibility. Drain visibility resolution and retain acknowledged commits across late cancellation and cleanup failure.
@forhappy
forhappy marked this pull request as ready for review October 16, 2026 06:43
Capsule pack selection uses captured remote refs. Rewriting unchanged push-state could report failure after a committed ref; keep that advisory contract in its released journal helper only.

Extend the RustFS ingestion smoke with an unwritable advisory path and verify the canonical SQLite payload cache instead of requiring initialization of the retired receipt warm index.
Move platform temporary-root selection to storage, retain the spill byte ceiling and cleanup ownership, and keep metadata tests free of output policy. Use the supported fixed-array slice API without changing extent validation.
Retain the normalized inspection run through replica body probes instead
of rebuilding a joined catalog. GC shares the same explicit spill owner.

Advance cursor blocks only after verified reads finish: cancelling and
resuming a pending read previously lost the unread block. Preserve
cleanup ownership and primary errors through every exit.
Verify captured catalog descriptors through the spill owner and resolve
reachable file bindings in bounded batches. Share the Git scan and
whole-file proof with recovery-owned catalogs; reuse proof cardinalities
in metadata diagnosis and rebuild summaries.

Admit complete catalog authority before source I/O so fetch-only views
retain their early incomplete-view error and perform no provider reads.
Union durable catalog roots with shared admission and reusable recipe digests. Prove winning recipes before restoring refs; an old binding proof cannot certify a current replacement.

Authenticate complete stored shards before stripping optional bloom trailers for the native Xet compaction loader.
@forhappy
forhappy merged commit d78b010 into crab-v2 Oct 16, 2026
34 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant