Ensure atomic file replacement in --fix mode - #40
Conversation
Implemented an atomic replacement mechanism for files modified with `--fix`, preventing potential data loss during interrupted operations. Added tests to verify file mode preservation and symlink handling, and updated documentation and changelog to reflect the changes. (This commit message was AI-generated.) Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe ChangesAtomic
Priority: ➖ Normal — Schedule the atomic `--fix` update because it prevents interrupted writes from leaving CSS files empty while preserving modes and symlink behavior. Estimated code review effort: 2 (Simple) | ~15 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The --fix path now replaces files through a staged atomic rename while preserving modes and updating symlink destinations. No actionable merge-blocking risk remains in the supplied change context. Sequence Diagram(s)sequenceDiagram
participant computeFixPass
participant replaceFileAtomically
participant FileSystem
computeFixPass->>replaceFileAtomically: pass target label and output
replaceFileAtomically->>FileSystem: resolve target and read mode
replaceFileAtomically->>FileSystem: create staged output beside target
replaceFileAtomically->>FileSystem: apply mode and rename staged file
FileSystem-->>computeFixPass: complete atomic replacement
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes address issue ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) 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. Comment |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
Resolves #27
Summary by CodeRabbit
Bug Fixes
--fixnow atomically replaces CSS files, preventing interrupted writes from leaving files empty.Documentation
--fixatomically replaces files, while STDIN input still outputs consolidated CSS to STDOUT.Chores