[BR-1308] Fix: Properly add original file modification and creation time#1444
[BR-1308] Fix: Properly add original file modification and creation time#1444AlexisMora wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughChangesFile upload results now include creation timestamps derived from filesystem birth times. Create and replace sync actions forward modification and creation timestamps as ISO strings, and the replace API request includes the new creation-time field. File timestamp collection
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/backend/features/sync/actions/services/upload-file.ts (1)
23-26: 🩺 Stability & Availability | 🔵 TrivialPlatform availability of
birthtime.On Linux filesystems that don't support birth time (e.g., older ext4, tmpfs, overlayfs),
fs.stat().birthtimereturns the epoch (1970-01-01T00:00:00.000Z). This would propagate an incorrect creation timestamp to the backend. Consider whether a fallback (e.g., usingmtimewhenbirthtimeis epoch) is needed for robustness.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/backend/features/sync/actions/services/upload-file.ts` around lines 23 - 26, Handle unsupported birth times in the metadata returned by the upload-file logic: when the `birthtime` from `stat(path)` is the epoch, use `mtime` as the creation timestamp instead. Update the return path for empty files and any corresponding timestamp handling so `creationTime` never propagates an invalid epoch value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/backend/features/sync/actions/services/upload-file.ts`:
- Around line 23-26: Handle unsupported birth times in the metadata returned by
the upload-file logic: when the `birthtime` from `stat(path)` is the epoch, use
`mtime` as the creation timestamp instead. Update the return path for empty
files and any corresponding timestamp handling so `creationTime` never
propagates an invalid epoch value.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 144f00d7-e2f5-490b-bb8e-da9ef9652a5e
📒 Files selected for processing (7)
src/backend/features/sync/actions/services/create-file.test.tssrc/backend/features/sync/actions/services/create-file.tssrc/backend/features/sync/actions/services/replace-file.test.tssrc/backend/features/sync/actions/services/replace-file.tssrc/backend/features/sync/actions/services/upload-file.test.tssrc/backend/features/sync/actions/services/upload-file.tssrc/infra/drive-server-wip/services/files.service.ts
|



What is Changed / Added
Added original file creation and modification time
Summary by CodeRabbit
New Features
Bug Fixes