Skip to content

upstream fixes C: storage, LTX and background budget (0079–0136 part C) - #72

Merged
ryuzdev merged 8 commits into
ryuzcorp/v0.6.3from
p13/C-storage
Nov 18, 2026
Merged

ryuzdev merged 8 commits into
ryuzcorp/v0.6.3from
p13/C-storage

Conversation

@ryuzdev

@ryuzdev ryuzdev commented Nov 18, 2026

Copy link
Copy Markdown
Member

Part C of 6 for v0.6.3-ryuzcorp.13: upstream denoland/celld issue fixes, family C (storage, LTX and background budget). Stacked: merge bottom-up; after each merge the next layer is rebased onto ryuzcorp/v0.6.3 (rebase merge keeps one commit per patch).

Patches

Review

Review C (reviewer agent, celld --lib 454 green): ship it. Lows fixed: #275 background_since re-arms after expiry (one warn per budget window, test); #259 GC skips the live-lease-without-log case and collects only terminal absences (test).

Every fix has a fail-before test (fix reverted → test fails). .github/ and Dockerfile are untouched across the whole stack (git diff 00df62d p13/F-misc -- .github Dockerfile is empty). The independent security review of the full stack is recorded as a comment before merge.

Verification (full stack tip 12cbf4e, toolchain 1.98.1, CI profile release)

  • cargo clippy --profile release --all-targets --locked -- -D warnings: clean.
  • cargo test --profile release --locked: every suite ok (52 result lines, 0 failed).
  • cargo check --all-targets passes at every family boundary and at every patch a fixup touched.

FORK.md patch entries (0079–0136, shas filled after merge) and release notes follow in a separate PR, as for .11/.12.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f59e2d31-9f07-43a5-b107-b45f84bff350
Commits

Reviewing files that changed from the base of the PR and between 3a4a474 and e795fcb.

Files selected for processing: 28

  • crates/celld/actor.rs
  • crates/celld/cell_runtime.rs
  • crates/celld/engine_api.rs
  • crates/celld/facet_streams.rs
  • crates/celld/host_channels.rs
  • crates/celld/js.rs
  • crates/celld/js/bootstrap.rs
  • crates/celld/local_store.rs
  • crates/celld/ltx_repl.rs
  • crates/celld/ltx_replication.rs
  • crates/celld/main.rs
  • crates/celld/main/cli.rs
  • crates/celld/node_log.rs
  • crates/celld/runtime.rs
  • crates/celld/storage.rs
  • crates/celld/tests/disk_full_conformance.rs
  • crates/celld/tests/fixtures/disk-full/index.js
  • crates/celld/tests/fixtures/disk-full/wrangler.json
  • crates/celld/tests/fixtures/retire-leftover/index.js
  • crates/celld/tests/fixtures/retire-leftover/wrangler.json
  • crates/celld/tests/retire_leftover_conformance.rs
  • crates/celld/tests/retired_event_attribution.rs
  • crates/logic/lib.rs
  • crates/logic/tests/regressions.rs
  • crates/logic/types.rs
  • crates/ltx/src/db.rs
  • crates/ltx/src/paged_vfs.rs
  • docs/README.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ryuzdev

ryuzdev commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

Security review in progress: the full-stack review (SecFinal13) found no High or Medium. Two Low hardening items on #280's /tmp cap (entry metadata isn't charged; an oversize write is copied before it's refused) are being fixed in D (#73) before merge. The independent security review record will be posted on every layer once the final heads are pushed.

@ryuzdev

ryuzdev commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ryuzdev

ryuzdev commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

Independent security review record (merge gate), head a41fef0.

@ryuzdev

ryuzdev commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

Security review record, round 3, head 2dc0ecc. Layer A merged as #70. The stack is rebased onto ryuzcorp/v0.6.3, and this round folds in these fixes:

  • CodeRabbit on upstream fixes B: fleet, lease and node log durability (0079–0136 part B) #71 (6 threads, all valid): durable node-id pin; recovery-claim heartbeat during tail transfer; a loss-record 409 conflict is no longer taken as proof; the degraded resume checks the folded record; doc fixes.
  • A second-opinion review of C–F: the dev-store writer thread exits; --state refuses to adopt a non-empty foreign dir (otherwise --clean could delete it); /tmp stream ranges are refused loudly; pathToFileURL keeps the trailing slash; _b64urlEncode is chunked; Symbol.dispose docs; one shared deadline for an SQL cursor and its prefix.

SecFinal13 round 3: OK, no findings. It checked that the #245 GET fallback fails closed and its caller retries, that heartbeats can't starve the tail or outlive it, and that the --state refusal holds through symlinks. git diff origin/ryuzcorp/v0.6.3 b9b70bb -- .github Dockerfile is empty.

Local run at the stack tip b9b70bb (1.98.1, release profile): cargo check --all-targets passes at every touched patch; clippy clean; full cargo test gives 54 suites ok, 0 failed; fmt is clean apart from 3 pre-existing base files.

@ryuzdev

ryuzdev commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

Security review record, round 4. CodeRabbit raised two more issues on #71, both fixed:

SecFinal13: OK. The ephemeral boot doesn't write under the old identity or assume lease authority, and the address guard fails safe. Stack tip f2ef771; .github/Dockerfile are unchanged.

Base automatically changed from p13/B-fleet to ryuzcorp/v0.6.3 November 18, 2026 04:57
) (0098)

After a successful L1 fold, delete local L0 files whose max TXID the
fold covered, keeping the newest file that pos() and verify read back.
Each activation and each node startup also drops live-named epoch dirs
a newer local epoch supersedes, skipping resident replicas; the
clean-reload path already pruned to its exact resident set, so the
startup sweep is a no-op there and every other boot restores from the
bucket.
Concurrent PUTs used to pile onto objects.sqlite3 with one connection
and Immediate transaction each, losing the SQLite lock lottery into
busy_timeout sleeps: aggregate write throughput collapsed toward one
fsync per write and unlucky uploads stalled seconds past the durability
budget (DurabilityUnproven under fan-out, plus renewal starvation that
can self-fence the node).

Every put now funnels through one writer thread, one connection, and
one queued batch per transaction. Draining whatever is already queued
costs nothing when idle (a batch of one is today's single PUT) and
shares one commit fsync under load; each row keeps its own savepoint so
Create/Update conflicts still fail alone. A panicked writer falls back
to a direct PUT rather than failing every write.
The 0.6.0-0.6.2 import tested page_count == 0, but under replication the
replica opens the facet file first and its control tables already push the
count past zero, so the import never ran: silent upgrade data loss. The
check is now no-user-data, which also repairs the files those versions
left behind. The image replays through ordinary SQL writes, which commit
beside a live replica read lock (a Backup would take EXCLUSIVE and fail),
and the decision is stamped in user_version so a later wipe never
resurrects. Live file content always wins over the legacy image, which is
safe because 0.5.1 never wrote facet files; the legacy row stays for
manual recovery. One corner remains: an all-content wipe made on
0.6.0-0.6.2 followed by this upgrade replays the image once; delete again
on the fixed version.
A handler that answers but leaves timers or waitUntil pending holds its
drive's affiliation until the event finishes, so a retiring generation's
isolates never drain: each deploy leaks a heap until shedding latches
CapacityExhausted forever. Past the background budget (30 s, Cloudflare's
waitUntil limit) the driver ends the background work without failing the
answered request, and the abort pass releases the isolate. An event that
still holds the cell's input gate or runs another event's critical
section keeps its ops by design, and stays loud about it.
A full walk of the cut per faulted read made a whale's fill quadratic
in its size (111 min for 8.9 GB) and stalled foreground reads behind
the walk's mutex hold. The hydration set now carries an exact
cut-relative count, maintained on every insert and truncation, so
hydration() is constant time. Live file content still always wins over
fault data, and the count never covers the lock page or past-cut
holes.
…0103)

A follower dropped a sealed fragment only when its record said so, but
a restarted leader moves its lease to the new generation and a dead
session never opens a new epoch: the old generation's record reads back
absent, and the sweep skipped it forever. An absent record now counts
as closed — the fragments are garbage no new epoch will ever adopt —
while a read error still retries next pass. The seal mark extends as
before, so a straggling append is refused rather than resurrected.
#291) (0104)

A write that fails with SQLITE_FULL, IOERR, NOMEM, or INTERRUPT destroys
its transaction, and every later event on the cell — reads included —
failed until something reopened the database. Only an eviction recovered
the cell. The actor now restarts the runtime when a finished activity
leaves its scope broken; the swap pump carries the restart on the current
generation, and the placement opens the database on a fresh isolate,
which clears the poison. Downgrade-safe: the mark lives only in memory
and a reopen clears it.
) (0105)

A node that lost its DO to another node kept the dead live-named files
forever after a crash or a handoff=preserve stop, rotting outside the
local-cache budget. At boot after predecessor recovery — unless the boot
is a clean reload — the node now deletes every live-named epoch, since
only a clean reload resumes one and a restart claims each cell at a new
epoch from the bucket. The deleted cells stay in a take-once boot list
that the local reload replays, so ownership confirmation still finds
the cells that were resident when the predecessor died.
@ryuzdev
ryuzdev merged commit e391da1 into ryuzcorp/v0.6.3 Nov 18, 2026
3 of 5 checks passed
@ryuzdev
ryuzdev deleted the p13/C-storage branch November 18, 2026 05:18
@ryuzdev

ryuzdev commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

Security review record, rounds 5–7, head 2dc0ecc. Layers A–C are merged (#70–#72).

This round's fixes, all folded into their patches:

SecFinal13:

  • Round 5 found two Mediums: a cross-tenant handoff eviction, and the lost __proto__/constructor guard on the loader-env → process.env copy. Both are fixed.
  • Round 6 found the global-refusal blockade. Fixed with share-aware displacement and a 60 s expiry.
  • An 0118 regression (the cancellation guard swallowed post-dispatch aborts) was caught locally and fixed.
  • Round 7: OK, no open findings.

git diff origin/ryuzcorp/v0.6.3 01b6b14 -- .github Dockerfile is empty.

Local run, 1.98.1, release profile: cargo check --all-targets passes at every touched patch; clippy clean; full cargo test 54 suites ok, 0 failed (round 6). After the final 0107 fixup: lib 499 passed, and the ws/loader/env conformance suites are green.

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.

A cell's background work pins every superseded generation's isolate, so a single node sheds and never recovers

1 participant