You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: tolerate SQLite sidecars unlinked during permission checks - #693
Concurrent SQLite commits can unlink a journal, WAL or SHM file after pathname lookup resolves its inode. The inventory permission guard then sees a legitimate zero-link inode and rejects the saved-data file, interrupting guest cleanup.
Re-resolve zero-link sidecars until the current pathname is present or absent. Any replacement must still pass the existing regular-file, ownership and single-link checks. The main database is never skipped, and the repair opens or closes no database descriptors.
Validation
Three deterministic integration cases reproduce native SQLite unlink during permission checks for journal, WAL and SHM: all fail before the fix and pass after it; committed data survives.
All 90 inventory/storage tests pass, including symlink and hardlink rejection for the main database and every sidecar.
Full suite: 3,029 passed, 17 skipped, 77 deselected. A final test typing correction was followed by rerunning all 90 owning tests and mypy.
Native Linux XFS probe: 106,629 checks, 2,676 writes and 17 actual zero-link observations over 30 seconds, with zero errors.
Ruff, formatting and commit hooks pass.
Review
Independent local adversarial review found no actionable issues. Optional external review was unavailable because automatic approval review rejected disclosure of private source.
This PR repairs the SDK race. Fleet dependency updates and live rollout qualification are separate.
Summary by CodeRabbit
Bug Fixes
Improved reliability when SQLite sidecar files are removed during inventory checks, allowing inventory reads to complete while preserving existing safety checks.
Strengthened checks for unsafe database and sidecar locations, including links and writable parent directories.
Tests
Added coverage for SQLite sidecar changes during active commits and for unsafe database and sidecar paths.
No actionable comments were generated in the recent review.
Recent review info
Automatic approval policy
Commit: 3955f21ea082.
Setting
Effective value
Source
Automatic approvals
Enabled
Global configuration
Merge risk
Moderate
Global configuration
Security risk
Not set
Global configuration
Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: QUIET
Plan: Advanced
Run ID: bbf1ead0-3ae4-40ad-921b-48ae268f290a
Commits
Reviewing files that changed from the base of the PR and between 1caa254 and 3955f21.
Files selected for processing: 3
src/celesto/cli/_sqlite.py
tests/integration/test_private_runtime_state.py
tests/storage/test_storage.py
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
Walkthrough
The SQLite inventory guard now rechecks sidecars with zero links and skips further checks if a sidecar disappears during the recheck. Tests cover concurrent commits during inventory reads and unsafe links at database and sidecar paths.
Changes: SQLite sidecar inventory guard
Layer / File(s)
Summary
Sidecar recheck and validation src/celesto/cli/_sqlite.py, tests/integration/test_private_runtime_state.py, tests/storage/test_storage.py
The inventory guard repeats lstat() for a sidecar with zero links and skips it if it disappears during the lookup. Integration tests coordinate a commit with an inventory read. Storage tests cover symlink and hardlink cases for the database and SQLite sidecars.
CelestoAI/celesto#692: Enables SQLite WAL and uses WAL/SHM sidecars; it also addresses sidecars disappearing during permission checks.
CelestoAI/celesto#687: Adds the SQLite inventory permission guard for database and sidecar paths that this change extends.
Suggested reviewers:yanurag-dev
Merge Risk: Minimal · up to 3955f
The change tolerates disappearing SQLite sidecars without weakening existing file validation. No actionable merge-blocking risk was identified; merge after normal checks pass.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the primary change: tolerating SQLite sidecars that are unlinked during permission checks.
Description check
The description provides a clear summary, rationale, implementation constraints, validation results, and review context. It omits the required Related Issues and Checklist sections and uses Validation…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description provides a clear summary, rationale, implementation constraints, validation results, and review context. It omits the required Related Issues and Checklist sections and uses Validation instead of Testing, but the available information is mostly complete and directly relevant.
Full details: Docstring Coverage
Explanation
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 3 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Concurrent SQLite commits can unlink a journal, WAL or SHM file after pathname lookup resolves its inode. The inventory permission guard then sees a legitimate zero-link inode and rejects the saved-data file, interrupting guest cleanup.
Re-resolve zero-link sidecars until the current pathname is present or absent. Any replacement must still pass the existing regular-file, ownership and single-link checks. The main database is never skipped, and the repair opens or closes no database descriptors.
Validation
Review
Independent local adversarial review found no actionable issues. Optional external review was unavailable because automatic approval review rejected disclosure of private source.
This PR repairs the SDK race. Fleet dependency updates and live rollout qualification are separate.
Summary by CodeRabbit
Bug Fixes
Tests