Skip to content

fix(conda): preserve cross-platform lock data - #11946

Merged
jdx merged 4 commits into
mainfrom
codex/fix-conda-cross-platform-lock
Aug 13, 2026
Merged

jdx merged 4 commits into
mainfrom
codex/fix-conda-cross-platform-lock

Conversation

@jdx

@jdx jdx commented Aug 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • update the coordinated rattler dependency set to use cross-platform virtual package defaults
  • honor CONDA_OVERRIDE_* variables when resolving conda lock metadata
  • preserve existing lock entries when a backend returns no metadata
  • return a failure from explicit mise lock when conda parsing or solving fails

Root cause

rattler_virtual_packages 4.1.0 seeded foreign Linux solves with __glibc=0, which made packages such as ffmpeg unsolvable. The conda backend then converted that solve failure into an empty successful PlatformInfo. Applying the empty result preserved the artifact URL and checksum but cleared conda_deps, after which lockfile cleanup removed all now-unreferenced conda package records.

This updates to the coordinated rattler releases containing conda/rattler#2646, propagates genuine conda resolution errors, and makes the shared lock-result application path skip empty metadata rather than merging it into an existing entry.

Fixes the behavior reported in discussion #11944.

Validation

  • mise run lint-fix
  • cargo test --locked --bin mise backend::conda::tests
  • cargo test --locked --bin mise lockfile::tests::empty_resolution_preserves_existing_conda_dependencies
  • cargo test --locked --bin mise cli::lock::tests
  • mise run test:e2e e2e/lockfile/test_lockfile_conda_cross_platform
  • manually confirmed ffmpeg 7.1.1 locks for both linux-x64 and macos-arm64
  • manually confirmed a forced CONDA_OVERRIDE_GLIBC=0 solve failure exits 1 and leaves the lockfile byte-for-byte unchanged

AI-assisted — Tool: Codex; model: openai/unavailable; version: unavailable.


Note

Medium Risk
Changes lockfile merge semantics and conda solve/error handling across platforms; mitigated by targeted rattler fix, regression tests, and preserving data on partial failure.

Overview
Fixes cross-platform conda lockfiles losing conda_deps and package records when a foreign-platform solve fails or returns empty metadata.

Dependency bump: Coordinated rattler upgrades (rattler_virtual_packages 5, rattler_repodata_gateway 0.32, rattler_package_streaming 0.27) so foreign Linux solves get sane virtual-package defaults instead of __glibc=0.

Conda backend: Virtual-package detection now uses VirtualPackageOverrides::from_env() (e.g. CONDA_OVERRIDE_*), a cache path, and propagates errors; lock resolution no longer turns parse/solve/missing-main-package failures into silent empty PlatformInfo.

Lock pipeline: Resolution tuples carry error_is_fatal (true for conda); mise lock classifies those as Failed and surfaces them after writing the lockfile. apply_lock_result skips merging empty PlatformInfo into existing platform entries so prior URLs, checksums, and conda_deps stay intact; conda package resolution errors are returned fatally instead of logged and ignored.

Adds unit tests and an e2e regression (CONDA_OVERRIDE_GLIBC=0 must exit non-zero without mutating the lockfile).

Reviewed by Cursor Bugbot for commit b477e68. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Bug Fixes

    • Improved cross-platform Conda lockfile generation.
    • Resolution failures, invalid specifications, and missing package information are now reported clearly.
    • Existing lockfile platform and dependency data is preserved when no updates are available.
    • Unsupported platforms continue to be skipped without being treated as failures.
    • Virtual-package detection respects environment settings and reports detection errors.
  • Tests

    • Added regression coverage for cross-platform Conda lockfiles, failed re-locking, resolution outcomes, and preserving existing lockfile data.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: fa960079-e781-4b0e-9198-60db5e6c6d1e

📥 Commits

Reviewing files that changed from the base of the PR and between 4b9ff1c and b477e68.

📒 Files selected for processing (2)
  • src/cli/lock.rs
  • src/lockfile.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/lockfile.rs
  • src/cli/lock.rs

📝 Walkthrough

Walkthrough

Conda resolution failures now propagate as lock errors. Lock processing distinguishes fatal failures from unresolved skips. Empty resolutions preserve existing platform and dependency data. Dependency versions and regression tests were updated.

Changes

Conda lock resolution

Layer / File(s) Summary
Propagate Conda resolution errors
Cargo.toml, src/backend/conda.rs
Rattler dependency versions were updated. Virtual-package detection and lock-info resolution now return contextual errors.
Extend and apply lock results
src/lockfile.rs
Lock results now include fatal-error state. Empty platform information does not overwrite existing lockfile entries.
Classify, report, and test lock results
src/cli/lock.rs, e2e/lockfile/test_lockfile_conda_cross_platform
Lock processing applies all results before reporting resolution errors. Tests cover fatal, nonfatal, empty, and failed re-lock outcomes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Mergeability Score: ⚪ Minimal · up to b477e

The conda lockfile behavior change is supported by targeted tests and manual validation, and no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant LockCLI
  participant CondaBackend
  participant Lockfile
  LockCLI->>CondaBackend: resolve lock information
  CondaBackend-->>LockCLI: platform data or fatal resolution error
  LockCLI->>Lockfile: apply lock result
  Lockfile-->>LockCLI: preserve existing platform data
  LockCLI-->>LockCLI: classify results and report deferred errors
Loading

Possibly related PRs

  • jdx/mise#11664: Both PRs modify lock-task result classification and handling.

Poem

A rabbit checks each lock with care,
Conda errors now appear there.
Empty results leave data whole,
Failed relocks keep control.
Tests guard every platform pair.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving cross-platform Conda lock data.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR updates the coordinated rattler dependency set and adjusts conda lock resolution so failures are propagated while empty metadata cannot erase existing cross-platform lock data.

  • Uses environment-aware virtual-package overrides during conda solving.
  • Distinguishes fatal conda resolution failures from ordinary unresolved metadata.
  • Preserves existing platform metadata and conda package references on empty results.
  • Adds unit and end-to-end regression coverage for successful foreign-platform locking and failed re-lock preservation.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains in the provided follow-up-review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
src/backend/conda.rs Propagates virtual-package detection, match-spec parsing, solving, and missing-main-package failures instead of returning empty lock metadata.
src/cli/lock.rs Classifies backend-designated resolution errors as failures, preserves successful updates, writes non-regressing results, and returns the collected errors.
src/lockfile.rs Prevents empty platform metadata from replacing existing lock information while retaining creation of new tool stubs.
Cargo.toml Updates the coordinated rattler repodata, package-streaming, and virtual-package dependency versions.
Cargo.lock Records the coordinated rattler dependency graph update and associated transitive lockfile changes.
e2e/lockfile/test_lockfile_conda_cross_platform Verifies a Linux conda lock contains dependency metadata and remains byte-for-byte unchanged after a forced solve failure.

Reviews (5): Last reviewed commit: "fix(lock): reject unresolved platform up..." | Re-trigger Greptile

Comment thread src/cli/lock.rs Resolved
@jdx
jdx force-pushed the codex/fix-conda-cross-platform-lock branch from 56e733f to 4f147c2 Compare August 12, 2026 23:42
@socket-security

socket-security Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/lockfile.rs`:
- Around line 2629-2631: Update the Conda error path in the lock-resolution flow
around resolve_conda_packages and LockResolutionResult so Err(e) preserves and
returns the package-resolution error instead of replacing it with an empty
BTreeMap; keep error_is_fatal true for BackendType::Conda. Add a regression test
verifying explicit lock reports Failed and does not persist incomplete package
data when Conda parsing or solving fails.
🪄 Autofix

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: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: d893feb7-7e2e-46ac-b3cb-248cf2161bbe

📥 Commits

Reviewing files that changed from the base of the PR and between 4f147c2 and bd04503.

📒 Files selected for processing (2)
  • src/cli/lock.rs
  • src/lockfile.rs

Comment thread src/lockfile.rs Resolved
@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Instruction counts

benchmark trend instructions Δ wall (min) Δ
env ▄▁▃▃▃▃▄▄▄▃▂▁▁▂▁▃▅██ 80,907,790 → 80,898,760 -0.01% 18.68 → 18.51ms -0.91%
hook-env ▃▁▂▃▂▂▂▃▂▃▁▁▂▂▁▅█▇▇ 82,405,617 → 82,401,613 -0.00% 21.43 → 18.96ms -11.50%
ls █▇▇▇▃▃▃▃▂▁▁▁▁▁▁▂▅▄▄ 73,423,991 → 73,408,149 -0.02% 16.65 → 16.87ms +1.36%
registry ████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ 43,177,615 → 43,327,091 +0.35% 11.62 → 11.69ms +0.59%
startup ▄▁▄▅▆█▇█▆█▂▂▃▃▃▇▆▆▆ 15,573,715 → 15,580,592 +0.04% 9.72 → 9.24ms -4.93%

No instruction-count regression above 1%.

Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.

Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.

b477e687d5ba vs abf5621098d4 · measured on the runner, not pushed to the history.

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4b9ff1c. Configure here.

Comment thread src/lockfile.rs Resolved
@jdx
jdx merged commit 054b39c into main Aug 13, 2026
39 of 42 checks passed
@jdx
jdx deleted the codex/fix-conda-cross-platform-lock branch August 13, 2026 13:12
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.

1 participant