Skip to content

Never re-append a merged Telemetry file - #26

Merged
GordonBeeming merged 1 commit into
mainfrom
gb/fix/migration-recovery-safety
Oct 13, 2026
Merged

GordonBeeming merged 1 commit into
mainfrom
gb/fix/migration-recovery-safety

Conversation

@GordonBeeming

Copy link
Copy Markdown
Owner

Summary

Review of ClaudeBar's matching change found two gaps in recovering an interrupted Telemetry Folder move, and CodexBar's code from #25 had them too.

  • Once a merge's append succeeded, a failed rename to .migrated left the file as .merging, so the next launch appended every line again. It now falls back to deleting the source. If that fails too, it parks the file as .merging-done, which later runs only delete, and hasPendingFiles() doesn't count it.
  • A directory or symlink named like a leftover (….jsonl.migrated or .merging) was already skipped, just silently. It's now reported and left alone, and nothing under it is removed.

If even the rename to .merging-done fails, the file stays .merging and a later launch can repeat its lines. Bar UI ignores repeated records, so nothing gets counted twice.

Test plan

  • swift test: 109 tests, 0 failures; swift test --parallel exits 0
  • Three new tests, each failing before the fix: a directory and a symlink named like leftovers survive untouched; a failed .migrated rename falls back to deleting the source; a source that can be neither renamed nor deleted is never appended again

Once a merge's append succeeded, a failed rename to .migrated left the
file as .merging and the next launch appended it again. It now falls
back to deleting the source, or parking it as .merging-done, which later
runs only delete. A directory or link named like a leftover is reported
and left alone rather than skipped silently.
@GordonBeeming
GordonBeeming requested a balanced review from Copilot October 13, 2026 02:13
@coderabbitai

coderabbitai Bot commented Oct 13, 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 42 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
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 353c38ec-45f5-4367-9d42-a1eba791425b
📥 Commits

Reviewing files that changed from the base of the PR and between 0160a0c and d55942b.

📒 Files selected for processing (2)
  • Sources/CodexBarCore/TelemetryFolderMigration.swift
  • Tests/CodexBarCoreTests/TelemetryFolderMigrationTests.swift
  • 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

Comment @coderabbitai help to get the list of available commands.

@GordonBeeming
GordonBeeming marked this pull request as ready for review October 13, 2026 02:14
@GordonBeeming
GordonBeeming merged commit 3960c52 into main Oct 13, 2026
4 checks passed
@GordonBeeming
GordonBeeming deleted the gb/fix/migration-recovery-safety branch October 13, 2026 02:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The migration-complete flag prevents parked .merging-done files from receiving the promised later cleanup.

1 open finding
What changed in this PR

Prevents telemetry migration retries from re-appending already merged records.

Changes:

  • Adds .merging-done recovery state and safer cleanup fallback.
  • Reports non-file leftovers and adds regression tests.
File Description
TelemetryFolderMigration.swift Adds merge completion recovery and leftover validation.
TelemetryFolderMigrationTests.swift Tests failed cleanup and non-file leftovers.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

}
return entries.contains { entry in
guard let stage = Self.stage(of: entry), stage != .migrated,
guard let stage = Self.stage(of: entry), stage == .live || stage == .merging,
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 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-13T02:17:41.976964Z d55942b Draft marked ready
🔒 Security Review ✅ Completed 2026-10-13T02:17:04.531700Z d55942b Draft marked ready
ℹ️ 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

Development

Successfully merging this pull request may close these issues.

2 participants