Skip to content

fix(conda): include channel in lock identity#9984

Merged
jdx merged 1 commit into
jdx:mainfrom
risu729:fix/conda-channel-lock-options
May 31, 2026
Merged

fix(conda): include channel in lock identity#9984
jdx merged 1 commit into
jdx:mainfrom
risu729:fix/conda-channel-lock-options

Conversation

@risu729

@risu729 risu729 commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • include Conda channel values in lockfile option identity
  • reuse typed channel parsing for lock options
  • add regression coverage for custom channel lock options

Why this belongs in lock identity

The Conda channel is part of the package universe being solved. The same tool name and version can resolve to different package builds, dependency URLs, and checksums on conda-forge, bioconda, or a private channel. If the channel is not part of the lock identity, mise lock can reuse solve metadata from one channel while the config asks for another, which breaks reproducibility and can install the wrong artifact set.

Verification

  • cargo fmt --check
  • cargo test conda_lockfile_options_include_channel

Summary by CodeRabbit

  • Bug Fixes
    • Improved conda channel handling: Channel configurations specified in tool requests are now properly resolved and included in lockfile options during generation.

@greptile-apps

greptile-apps Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a lockfile identity gap for the Conda backend: the effective channel (e.g. conda-forge, bioconda) was not included in the lock options, so packages resolved from different channels could collide in the lockfile. The fix mirrors the exact pattern used by the npm, go, ubi, pipx, and other backends.

  • Adds CondaOptions::lockfile_options() returning {"channel": <effective channel name>}, which delegates to the existing channel_name() helper that falls back to the global conda.channel setting when no per-tool channel is configured.
  • Implements CondaBackend::resolve_lockfile_options() using request.options(), consistent with every other backend that overrides this method.
  • Adds a unit test asserting that an explicitly configured channel appears in the lock options.

Confidence Score: 5/5

Safe to merge — the change is additive, follows an established pattern, and is covered by a unit test.

The new code is a straightforward addition of a method that already existed implicitly (channel was resolved at install time but not captured in lock identity). The implementation is consistent with every other backend that overrides resolve_lockfile_options, and the fallback to the global setting via channel_name() is the same logic already used during install. No existing behavior is altered.

No files require special attention.

Important Files Changed

Filename Overview
src/backend/conda.rs Adds lockfile_options() to CondaOptions and resolve_lockfile_options() to CondaBackend, embedding the effective channel name in the lockfile identity. Follows the same pattern as npm, go, ubi, and other backends. A unit test covers the explicit-channel path.

Reviews (3): Last reviewed commit: "fix(conda): include channel in lock iden..." | Re-trigger Greptile

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces the InstallManifest tool option source, allowing options to be persisted and used from installation manifests. It updates BackendArg to track the source of options, implements lockfile option resolution for the Conda backend, and ensures proper precedence where configuration overrides manifest options. I have no feedback to provide.

@risu729

risu729 commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

CI note: lint/test-ci are failing because cargo deny check now detects RUSTSEC-2026-0145 for astral-tokio-tar 0.6.1 via rattler_package_streaming. This appears unrelated to this PR: the current main branch is failing the same cargo-deny advisory in the test workflow, and test-ci only failed because lint failed.

This comment was generated by an AI coding assistant.

@risu729 risu729 force-pushed the fix/conda-channel-lock-options branch from 00b0e59 to 15425d2 Compare May 31, 2026 08:14
@risu729 risu729 marked this pull request as ready for review May 31, 2026 16:07
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds lockfile options support to the Conda backend. CondaOptions introduces a lockfile_options() helper that emits conda channel configuration as key/value pairs. CondaBackend implements the resolve_lockfile_options trait method to populate lockfile metadata from incoming tool request options. Test coverage is added to verify channel values are included correctly.

Changes

Conda Lockfile Options

Layer / File(s) Summary
Lockfile options helper and backend implementation
src/backend/conda.rs
CondaOptions::lockfile_options() returns a map containing the resolved conda channel, and CondaBackend::resolve_lockfile_options() implements the trait method to extract options from tool request configuration.
Test coverage for lockfile options
src/backend/conda.rs
Test module imports BTreeMap and adds a unit test asserting that lockfile_options() correctly includes the provided channel value (e.g., bioconda) in the returned map.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 The conda channel now flows with grace,
Into lockfile options, keeping pace,
With tests that verify the way,
Configuration saved for another day! 🌾

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 identifies the main change: including Conda channel information in the lockfile identity to ensure proper reproducibility.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

🧹 Nitpick comments (1)
src/backend/conda.rs (1)

78-81: ⚡ Quick win

Conda lockfile channel identity currently uses the raw string (not canonicalized)

src/backend/conda.rs builds lockfile_options() with ("channel", self.channel_name()), i.e. the raw channel option value, not the parsed/typed Channel canonical name. This is also enforced by tests (conda_lockfile_options_include_channel) expecting exact string passthrough (e.g. "bioconda" stays "bioconda").

Normalizing via channel() would change lock-option behavior (and test expectations) and requires defining the canonical serialization plus parse-error handling. If stable identity across equivalent spellings is the goal, wire channel() into lockfile_options() and update tests; otherwise leaving it as-is is consistent with other backends that generally emit raw identity-affecting option values.

🤖 Prompt for 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.

In `@src/backend/conda.rs` around lines 78 - 81, The lockfile_options currently
emits the raw channel string via lockfile_options() -> ("channel",
self.channel_name()); change this to use the canonicalized channel identity from
self.channel() instead: call self.channel(), map the resulting Channel to its
canonical string form (e.g. Channel::to_string() or canonical_name()) and put
that value into the BTreeMap; if parsing fails, fall back to self.channel_name()
(and optionally log or warn) so we don't panic. Update the test
conda_lockfile_options_include_channel (and any expectations) to expect the
canonicalized form instead of the raw input.
🤖 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.

Nitpick comments:
In `@src/backend/conda.rs`:
- Around line 78-81: The lockfile_options currently emits the raw channel string
via lockfile_options() -> ("channel", self.channel_name()); change this to use
the canonicalized channel identity from self.channel() instead: call
self.channel(), map the resulting Channel to its canonical string form (e.g.
Channel::to_string() or canonical_name()) and put that value into the BTreeMap;
if parsing fails, fall back to self.channel_name() (and optionally log or warn)
so we don't panic. Update the test conda_lockfile_options_include_channel (and
any expectations) to expect the canonicalized form instead of the raw input.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 35430447-b8c8-44b4-a67e-6909ef833dad

📥 Commits

Reviewing files that changed from the base of the PR and between a0dd654 and 15425d2.

📒 Files selected for processing (1)
  • src/backend/conda.rs

@jdx jdx merged commit 5cdba15 into jdx:main May 31, 2026
33 checks passed
@risu729 risu729 deleted the fix/conda-channel-lock-options branch May 31, 2026 16:13
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