Permissions issue when initializing checkpoints
Description
Users reported issues with checkpoints related to permissions in the workspace. It was found that this was due to permissions, as users were able to bypass this issue by either changing permissions or disabling checkpoints. This PR makes changes to check that we have the necessary permissions and add what files we can.
The legacy checkpoints implementation would ignore these errors, and end up tracking no files/creating no checkpoints. These changes will proceed with checkpoints, including files where possible.
Fixes #2322, #2239
Test Procedure
Modify a workspace such that VS Code/Cline is not able to access any files (sudo chmod 000
Modify a workspace such that some files and folders are not accessible (sudo chmod 000 <file/dir>), and perform the same test. It should proceed, and if you check the checkpoints shadow git in globalStorage it should be tracking the files it is able to access (git ls-files). Restoring from a checkpoint should only restore the tracked files.
Type of Change
- [X] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] 📚 Documentation update
Pre-flight Checklist
- [X] Changes are limited to a single feature, bugfix or chore (split larger changes into separate PRs)
- [X] Tests are passing (
npm test) and code is formatted and linted (npm run format && npm run lint) - [X] I have created a changeset using
npm run changeset(required for user-facing changes) - [X] I have reviewed contributor guidelines
Screenshots
Additional Notes
[!IMPORTANT] Adds permissions checks and error handling to checkpoint initialization and file addition, allowing partial file tracking when some files are inaccessible.
- Behavior:
- Adds permissions checks in
getWorkingDirectory()inCheckpointUtils.tsto ensure workspace accessibility.- Modifies
addCheckpointFiles()inCheckpointGitOperations.tsto continue adding accessible files despite errors.- Updates
initShadowGit()inCheckpointGitOperations.tsto handle file addition failures gracefully.- Error Handling:
- Introduces error handling in
addCheckpointFiles()andinitShadowGit()to log errors and proceed with accessible files.- Logs errors in
commit()inCheckpointTracker.tsif file addition fails.- Misc:
- Adds
--ignore-errorsoption togit.add()inCheckpointGitOperations.tsto bypass inaccessible files.- Updates
CheckpointTracker.tsto handle partial file additions without hanging.This description was created by
for 2c1642105cad724599aa4004c8820e3a360c91a9. It will automatically update as commits are pushed.
🦋 Changeset detected
Latest commit: b06959249f7bb9295bf258d8f5e11923a5f87b33
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| claude-dev | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR