Skip to content

fix(id/world): let fork tolerate a crash-torn journal tail (#1523) - #2933

Merged
dezren39 merged 1 commit into
mainfrom
queue/1828-1523-fork-torn-tail
Oct 31, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/1828-1523-fork-torn-tail

Conversation

@dezren39

@dezren39 dezren39 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Fixes #1523 — queue task 1828 (triage task 1569, verified on main).

What

FileJournal::open treats an unterminated last journal line as a crash-torn append (dropped with a warning, truncated), but read_journal_entries — the strict helper fork_world reads cold source journals through — parsed every non-empty chunk and failed the whole read as corrupt. A crash-torn world opened fine but could never be forked.

  • pkgs/id/src/world_store.rs: read_journal_entries now excludes an unterminated final fragment (the split chunk after the last \n when the file does not end in one) with the same tracing::warn! "dropping torn final entry at byte N" message open uses. Newline-terminated unparseable lines stay fatal with the existing is corrupt error, in any position including the last line.
  • FileJournal::append's Define rollback compatibility for world profile journal entries #227 version-bump path also reads through this helper, but only on journals open has already truncated, so its behaviour is unchanged.
  • One pre-existing rustfmt hunk in the same file's test module (an ExecutionProfile append that rustfmt on main already wants collapsed) is included so the file is fmt-clean.

Tests

New in pkgs/id/tests/world_fork.rs:

  • a_fork_tolerates_a_crash_torn_journal_tail — torn fragment appended raw after close; fork succeeds and replays to the last complete entry (header rewritten, install copied, provenance recorded).
  • a_fork_refuses_a_corrupt_but_complete_final_line — newline-terminated garbage as the final line; fork fails with the corrupt error.

Verified on the laptop: cargo test --no-default-features --features world --test world_fork 4/4 pass; cargo test --lib world_store 21/21 pass.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner October 31, 2026 03:37
@coderabbitai

coderabbitai Bot commented Oct 31, 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 39 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: 5ea8e2a6-2b23-45a9-a5fa-6b120da02d1b
Commits

Reviewing files that changed from the base of the PR and between 9813b78 and d4758ad.

Files selected for processing: 2
  • pkgs/id/src/world_store.rs
  • pkgs/id/tests/world_fork.rs
  • 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T03:39:21.109111Z d4758ad PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant