Skip to content

lockfile: relocate to top-level avocado.lock#165

Open
mobileoverlord wants to merge 1 commit into
mainfrom
jschneck/lockfile-avocado-lock
Open

lockfile: relocate to top-level avocado.lock#165
mobileoverlord wants to merge 1 commit into
mainfrom
jschneck/lockfile-avocado-lock

Conversation

@mobileoverlord

Copy link
Copy Markdown
Contributor

Summary

Promotes 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.

Details

  • LockFile::get_path now returns <src>/avocado.lock; a new legacy_path()
    points at the old .avocado/lock.json.
  • LockFile::load migrates an existing legacy lock to the new path on first
    read (version-migrate → write avocado.lock → remove the old file), so
    existing projects upgrade transparently.
  • save merges any legacy on-disk state before writing.
  • connect upload / save / load resolve the lock via get_path with a legacy
    fallback, and the save/load bundle now carries avocado.lock.
  • init gitignores the whole .avocado/ scratch dir while keeping
    avocado.lock tracked.

Testing

  • Added a legacy → top-level migration test; updated the path assertion.
  • cargo build, cargo test, and cargo clippy are green.

Copilot AI review requested due to automatic review settings July 3, 2026 14:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.lock and add legacy-path support + migration on load.
  • Include avocado.lock in save archives and restore it during load.
  • Update init to gitignore the .avocado/ scratch directory while keeping avocado.lock tracked; 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.

Comment thread src/utils/lockfile.rs
Comment thread src/utils/lockfile.rs Outdated
Comment thread src/commands/save.rs
Comment thread src/commands/load.rs
@mobileoverlord mobileoverlord force-pushed the jschneck/lockfile-avocado-lock branch from 96715aa to 5565083 Compare July 3, 2026 15:20
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
@mobileoverlord mobileoverlord force-pushed the jschneck/lockfile-avocado-lock branch from 5565083 to e03d3a2 Compare July 4, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants