Skip to content

fix(id/groups): GroupLog::open drops and truncates a torn final fragment (#1522) - #2924

Merged
dezren39 merged 1 commit into
mainfrom
queue/1800-1522-grouplog-torn-tail
Oct 31, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/1800-1522-grouplog-torn-tail

Conversation

@dezren39

@dezren39 dezren39 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Fixes #1522.

GroupLog::open parsed every line with serde_json::from_str(...)?, so a crash-torn unterminated final fragment in groups.jsonl — exactly what its own single-write_all append can leave behind — bricked every group command.

Mirror the sibling stores (Outbox::open, and the world journal's FileJournal::open):

  • Iterate with split_inclusive('\n') and track the byte count of kept lines.
  • An unparseable unterminated final line is a torn append: warn (tracing::warn!, like the world journal), drop it, and truncate the file to the last complete line so the next append is not glued onto the fragment.
  • A newline-terminated unparseable line was fully written, so it stays fatal with the existing line N is not an event context — the existing test_a_line_that_is_not_an_event_is_an_error passes unchanged.
  • No change to the event format, the fold, or append behaviour.

Tests (laptop, cargo test groups::log): 6/6 pass — the 4 pre-existing tests plus:

  • test_a_torn_final_fragment_is_dropped_and_truncated — a fragment-only log opens empty and the file is truncated to empty.
  • test_a_torn_fragment_after_valid_events_keeps_them_and_folds — valid events survive, projection() folds and contains the created group, and the file is truncated back to the good bytes.

Full groups module on the laptop: cargo test --lib groups:: — 443 passed, 0 failed.

Queue task 1800 (triage pinned by task 1567).


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 02:50
@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 26 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: 5139db76-2181-4770-865d-bc8b586fedf6
Commits

Reviewing files that changed from the base of the PR and between 48f7c86 and f9ace95.

Files selected for processing: 1
  • pkgs/id/src/groups/log.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-31T02:52:02.901248Z f9ace95 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