Repository navigation
fix(plugin-profiles): roll back an apply's record only while it is still ours - #18249
Conversation
…ill ours Closes #18218 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RAoAtSsNvSGmqHFVRFAugW
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review (incremental, blocking only): no security issues foundI reviewed the changes since I read every hunk of both files in scope:
What was checked:
critical-findings: 0 |
|
claude-review reviewed Code review: PR #18249 (incremental, 622ecb7 → 21319dd)This was a blocking-only review. The prior-findings file says Scope: Does this push answer the earlier finding? The earlier finding (no test fails if
From this tracing, the new tests would fail on the old wiring and pass on the fix. I did not run them. The "224/224" in the owner's reply is the author's claim, not checked here. Other notes:
Verifier dropped 0 of 0 candidates. |
…write A preload loaded with node --import overwrites the record an apply just saved with another apply's record, then fails the settings rename. The tests cover commit()'s plain rollback, with and without a record before, and a finish whose record moves from the data folder to the repository. Both fail on the old deleteRecord/saveRecord wiring. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two applies racing on one folder still lost a record after #18249: apply B read no record, apply A then saved its record and wrote the settings file, and B's claim overwrote A's record. B's settings write then failed on the changed file, and its rollback, finding its own record there with nothing before it, deleted it. Clear then had no record of A's 97 entries. claimRecord now swaps the record only while the file still holds the text prepare read, and raises SettingsConflict otherwise, so apply re-plans with A's record as the previous one. saveRecord has no caller left and is removed. Found by the plugin-profiles acceptance run (item 4). Refs: #18218 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #18218
Summary
When two applies race on one settings file and the second one's settings write fails, its rollback overwrote or deleted the first apply's record, so
clearandresetcould no longer undo the first apply.Fix
lib/record.mjs: newrollbackRecord(path, ours, previous)puts the previous record back (throughswapRecord's compare-then-rename) or deletes the file, only while the file still holds the record this apply wrote; otherwise it leaves the file alone.scripts/profiles.mjscommit: both rollback branches use it.Verification
lib/record.test.mjs(3 tests): restore and delete while the record is ours, and both leave another apply's record in place.node --test scripts/profiles.test.mjs: 219 pass.Related
🤖 Generated with Claude Code
https://claude.ai/code/session_01RAoAtSsNvSGmqHFVRFAugW