lockfile: relocate to top-level avocado.lock#165
Conversation
There was a problem hiding this comment.
Pull request overview
Promotes the project lockfile from the scratch .avocado/lock.json location to a top-level, tracked avocado.lock, including migration logic and bundle/import support so existing projects upgrade transparently.
Changes:
- Move the canonical lockfile path to
<src_dir>/avocado.lockand add legacy-path support + migration on load. - Include
avocado.lockinsavearchives and restore it duringload. - Update
initto gitignore the.avocado/scratch directory while keepingavocado.locktracked; update connect upload to prefer the new lockfile path with legacy fallback.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/lockfile.rs | Changes lockfile path, adds legacy path, and implements legacy → top-level migration/merge behavior. |
| src/commands/save.rs | Adds avocado.lock to the saved archive when present. |
| src/commands/load.rs | Restores avocado.lock from the archive when present. |
| src/commands/init.rs | Updates .gitignore behavior to ignore .avocado/ while keeping avocado.lock tracked. |
| src/commands/connect/upload.rs | Prefers avocado.lock for uploads, falling back to legacy .avocado/lock.json. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5565083 to
e03d3a2
Compare
jetm
left a comment
There was a problem hiding this comment.
Reviewed the lockfile relocation. The migration/restore path has a few correctness issues, plus a .gitignore matching nit — details inline.
Promote the lock file from `.avocado/lock.json` to a top-level, committed `avocado.lock` (like Cargo.lock / flake.lock). This frees `.avocado/` to be a purely-scratch, gitignored directory (which upcoming overlay-preprocessing staging relies on). `LockFile::load` migrates an existing `.avocado/lock.json` to the new path on first read (version-migrate, write to avocado.lock, remove the old file), so existing projects upgrade transparently. - get_path -> <src>/avocado.lock; add legacy_path() + path migration in load() - save merges legacy on disk before writing; write temp uses .lock.tmp - connect upload: resolve lock via get_path with legacy fallback - save/load: bundle and restore avocado.lock - init: gitignore the whole .avocado/ scratch dir; keep avocado.lock tracked
e03d3a2 to
b12c843
Compare
jetm
left a comment
There was a problem hiding this comment.
All review findings addressed — the lock restore now honors !force, legacy bundles fall back and are cleaned up, the migration is read-only in load(), and .gitignore matching is line-wise. CI green. LGTM.
Summary
Promotes the lock file from
.avocado/lock.jsonto a top-level, committedavocado.lock(likeCargo.lock/flake.lock). This frees.avocado/to bea purely-scratch, gitignored directory.
Details
LockFile::get_pathnow returns<src>/avocado.lock; a newlegacy_path()points at the old
.avocado/lock.json.LockFile::loadmigrates an existing legacy lock to the new path on firstread (version-migrate → write
avocado.lock→ remove the old file), soexisting projects upgrade transparently.
savemerges any legacy on-disk state before writing.get_pathwith a legacyfallback, and the save/load bundle now carries
avocado.lock.initgitignores the whole.avocado/scratch dir while keepingavocado.locktracked.Testing
cargo build,cargo test, andcargo clippyare green.