Defines new path manager#32
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds declarative store template materialization, rewrites local store initialization to build in a temporary directory before renaming into place, and adds store-root resolution with a new exception type and upward ChangesStore template, initialization, and root resolution
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant init_local_store as init_local_store
participant materialize as materialize
participant filesystem as filesystem
init_local_store->>filesystem: create temp dir under invocation path
init_local_store->>materialize: materialize(STORE_TEMPLATE, tmp_dir)
materialize->>filesystem: create directories and files
alt materialize fails
materialize-->>init_local_store: raise exception
init_local_store-->>init_local_store: raise StoreInitError
else success
materialize-->>init_local_store: return built_path
init_local_store->>filesystem: rename built_path to .dstrack
end
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Test Results 48 files ± 0 48 suites ±0 35s ⏱️ +2s Results for commit 215729e. ± Comparison against base commit 383e2e3. This pull request removes 3 and adds 13 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/dstrack/_store_template.py`:
- Around line 46-57: materialize() currently only enforces exclusive creation
for directories, while TemplateFile entries are still written with write_text()
and can silently overwrite existing content, which contradicts the docstring and
promised FileExistsError behavior. Update materialize() so it checks whether
each file path already exists before writing (and raises FileExistsError
consistently for both files and directories), using the existing path/template
handling in materialize(), TemplateDir, and the per-entry write logic to
preserve exclusive-create semantics for all entries.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4edef2ad-1514-4d89-8235-683c3da5e409
📒 Files selected for processing (7)
src/dstrack/_cli.pysrc/dstrack/_store_template.pysrc/dstrack/errors.pysrc/dstrack/paths.pytests/test_cli.pytests/test_paths.pytests/test_store_template.py
Summary
This PR defines a new path manager functionality to resolve the root directory of the local store. This also introduces a new local store directory creation, which creates the directory based on a template.
Changes
Test plan
uv run pytestpasses.dstrack initmultiple times and check the created directory.Summary by CodeRabbit
New Features
.gitignorecontents.Bug Fixes
Tests