Skip to content

chore(lock): make --check read-only - #7085

Merged
lucascolley merged 7 commits into
prefix-dev:mainfrom
00200200:fix/lock-check-readonly
Oct 5, 2026
Merged

lucascolley merged 7 commits into
prefix-dev:mainfrom
00200200:fix/lock-check-readonly

Conversation

@00200200

Copy link
Copy Markdown
Contributor

Problem

Closes #7081. pixi lock --check currently updates/creates pixi.lock when missing or outdated, so a second --check can spuriously succeed after the first wrote the file.

Fix

Treat --check like a dry-run for lockfile persistence: always use LockFileUsage::DryRun so the check reports drift without writing pixi.lock.

How tested

Integration test: missing lockfile, --check fails twice, pixi.lock is never created.

00200200 and others added 2 commits September 22, 2026 23:05
--check now uses dry-run lockfile semantics so a missing or outdated
pixi.lock fails the check without creating or rewriting the file.
--check stays read-only, but it now prints what would change before failing,
as it did before, instead of exiting silently. The Python CLI test encoded
the old write-on-check behaviour; it now asserts --check fails twice without
creating pixi.lock, then a plain `pixi lock` recreates it. Also applies
rustfmt to the new Rust test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@00200200 00200200 changed the title Make pixi lock --check read-only (never create pixi.lock) fix: make pixi lock --check read-only (never create pixi.lock) Sep 23, 2026

@lucascolley lucascolley left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks @00200200, this looks good to me. Please could we also update the docs to mention that --check implies --dry-run?

@lucascolley lucascolley changed the title fix: make pixi lock --check read-only (never create pixi.lock) fix(lock): make --check read-only Oct 1, 2026
@lucascolley lucascolley changed the title fix(lock): make --check read-only chore(lock): make --check read-only Oct 1, 2026
Document that --check leaves pixi.lock and environments unchanged. Use Subdir in the added integration test to match the upstream migration and fix E0433 in the PR merge build.
@00200200

00200200 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the documentation request in 7dad5ef: the CLI documentation extender now explicitly states that --check implies --dry-run and does not create or modify pixi.lock. Also merged current upstream and updated the regression test for the Platform-to-Subdir migration. The focused missing-lock-file integration test and formatting checks pass.

Comment thread docs/reference/cli/pixi/lock_extender

@lucascolley lucascolley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you!

Comment thread crates/pixi_cli/src/lock.rs Outdated
Comment thread crates/pixi_cli/src/lock.rs Outdated
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
@lucascolley
lucascolley enabled auto-merge (squash) October 5, 2026 07:41
@lucascolley
lucascolley merged commit 0acd9bb into prefix-dev:main Oct 5, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(lock): --check should imply --dry-run

2 participants