Skip to content

Support mamba/micromamba v2.6.0 - #907

Draft
maresb wants to merge 2 commits into
conda:mainfrom
maresb:update-for-mamba-v2.6.0
Draft

Support mamba/micromamba v2.6.0#907
maresb wants to merge 2 commits into
conda:mainfrom
maresb:update-for-mamba-v2.6.0

Conversation

@maresb

@maresb maresb commented May 4, 2026

Copy link
Copy Markdown
Contributor

Description

Add support for mamba/micromamba 2.6.0's new hierarchical package cache layout. Closes #906.

claude added 2 commits May 4, 2026 23:12
Mamba/micromamba 2.6.0 reorganized the package cache hierarchically by
channel and subdir (mamba-org/mamba#4163). Packages now live at
``<pkgs_dir>/<scheme>/<host>/<channel>/<platform>/<dist_name>/...``
instead of the flat ``<pkgs_dir>/<dist_name>/...`` that conda and
pre-2.6 mamba use. ``_get_repodata_record`` only knew the flat path,
so once a package was cached the LINK-only reconstruction failed with
``FileNotFoundError`` (conda#906).

Resolution has two layers:

- Mamba 2.6.0 returns LINK actions that already include every FetchAction
  field (``url``, ``fn``, ``md5``, ``sha256``, ``depends``, ``constrains``,
  ``subdir``, ``timestamp``, ...). ``_link_action_as_fetch`` synthesizes
  FETCH directly from those fields when complete -- no disk access at
  all. The check is strict: ``depends`` must be a list (so a missing or
  null value cannot silently erase a package's runtime dependencies),
  and every identity-bearing field is required.

- For sparse LINK actions (older conda) we still need a disk lookup.
  Candidate paths are derived from LINK metadata (hierarchical from the
  package URL or ``base_url``+``platform``, plus the legacy flat path),
  not by globbing the cache. Each candidate is validated against the
  LINK on every identity field both sides expose: ``name``, ``version``,
  ``subdir``, ``fn``, ``md5``, ``sha256``, then URL-or-channel with
  libmamba precedence (URL when both sides have one, else channel).
  Channel string spelling differences are tolerated when URL matches
  (mirrored channels). A wrong-channel/wrong-hash record is rejected
  rather than silently used.

Helper structure mirrors libmamba semantics where parity matters:

- ``_libmamba_strip_url_secrets`` removes ``user:pass@`` userinfo and
  ``/t/<token>`` segments (both with and without scheme, and including
  libmamba's deliberately overbroad ``/t/<chars>`` regex). Pinned as a
  libmamba-compat helper, not a general URL sanitizer.
- ``_normalize_url_for_cache_path`` mirrors mamba's
  ``package_cache_folder_relative_path`` URL-to-path encoding.
- ``_normalize_url_for_compare`` mirrors mamba's ``compare_cleaned_url``
  (force scheme to ``https``, strip credentials, drop trailing slash).
- ``_link_action_explicit_or_derived_url`` exposes provenance in the
  name -- explicit ``url`` is gospel; one assembled from
  ``base_url``/``platform``/``fn`` is a heuristic.

Diagnostics: ``_record_matches_link`` returns ``(matched, reason)`` so
``_get_repodata_record`` can log a specific DEBUG line for each
rejection and surface the most actionable reason in the final WARNING
(found-but-rejected beats missing-fallback). Per-retry messages stay
at DEBUG so a single missing package no longer produces 11
nearly-identical warnings.

The ``LinkAction`` TypedDict is now ``total=False`` and documents both
shapes that runtime callers actually see (sparse conda LINK vs rich
mamba 2.6.0 LINK).
A focused module separate from the ~3000-line ``test_conda_lock.py``,
covering ``conda_solver`` cache-record reconstruction end-to-end.

Layered coverage:

- ``_link_action_as_fetch``: synthesis succeeds with mamba 2.6.0's full
  LINK shape; rejects sparse/null/incomplete LINKs (parametrized over
  every required identity field, plus a ``depends`` is-a-list check
  so dependency erasure can't slip past).
- libmamba-compat URL helpers: scheme-less credentials stripping,
  token-without-trailing-slash, and a pinned test for the deliberately
  overbroad ``/t/<chars>`` regex (``/not/t/pkg.conda`` ->
  ``/not.conda``) so future cleanups don't quietly diverge from mamba's
  cache path derivation. Plus ``compare_cleaned_url`` parity (http vs
  https, trailing slash, credentials).
- ``_hierarchical_cache_subpath``: URL-derived path, base_url+platform
  fallback, duplicated-platform-suffix handling, port colon escaping,
  and credential/token stripping before path encoding.
- ``_record_matches_link``: every identity field validated, mirrored
  channel acceptance via URL precedence, sparse-LINK channel fallback
  (closes the silent-accept gap), derived-URL comparison from
  base_url+fn, and reason strings checked for the diagnostic path.
- ``_candidate_record_paths``: paths come from metadata, never globs.
- ``_get_repodata_record``: legacy and hierarchical hits, cross-channel
  collision rejection, DEBUG-level reason for identity mismatches,
  WARNING-prefers-rejected-over-missing, and a single final WARNING
  invariant (no per-retry warning spam).
- ``_reconstruct_fetch_actions``: synthesis path with
  ``_get_pkgs_dirs`` patched to fail loudly (proves zero disk access
  for mamba 2.6.0); replay of a captured real ``mamba 2.6.0`` LINK-only
  dryrun JSON; disk fallback against an on-disk hierarchical cache laid
  out the way mamba 2.6.0 actually writes it, with impostor records
  triggering ``FileNotFoundError`` rather than silently-wrong lockfiles.

The fixture ``dryrun-mamba-2.6.0-linux-64-zlib.json`` was captured by
running ``mamba create --dry-run --json zlib`` against an already
populated ``CONDA_PKGS_DIRS`` so the solver returned LINK-only actions.
@netlify

netlify Bot commented May 4, 2026

Copy link
Copy Markdown

Deploy Preview for conda-lock ready!

Name Link
🔨 Latest commit f6b1e2a
🔍 Latest deploy log https://app.netlify.com/projects/conda-lock/deploys/69f92b1c13b9d600088e2ecc
😎 Deploy Preview https://deploy-preview-907--conda-lock.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

maresb added a commit to maresb/conda-lock that referenced this pull request Jun 27, 2026
conda-lock does not yet support mamba/micromamba 2.6.0 (tracked in conda#907).
The routine dependency update in conda#911 bumped the dev environment to
mamba 2.6.2, which broke CI on main (last green: 2026-05-20).

Pin the dev-environment solver to `mamba <2.6.0` and the CI
MICROMAMBA_VERSION to the last pre-2.6 release (2.5.0-2), and regenerate
pixi.toml to match. Temporary workaround, to be reverted in conda#907.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maresb added a commit that referenced this pull request Jun 27, 2026
Pin mamba/micromamba <2.6.0 until 2.6 is supported (#907)
maresb pushed a commit to maresb/conda-lock that referenced this pull request Jul 4, 2026
Remove the stopgap pins from conda#921 (see also conda#907): this branch
delivers the mamba/micromamba 2.6 support the pins were waiting
for, and CI must run micromamba >=2.6.0 to actually exercise the
hierarchical package cache layout end-to-end.

- ``MICROMAMBA_VERSION`` back to ``latest`` in ``test.yml`` and
  ``integration-test.yml``.
- ``mamba`` unpinned in ``pixi.toml`` and
  ``environments/dev-environment.yaml``.

The committed lockfiles remain valid: they resolve mamba 2.3.2,
which satisfies both the pinned and unpinned specs, and they were
generated from source files identical to the post-revert state
(conda-standalone included, no pin), so their content hashes still
match. A relock is still desirable to pull mamba >=2.6.0 into the
dev environment so the e2e ``mamba`` parametrization exercises the
new solver rather than 2.3.2.
maresb pushed a commit to maresb/conda-lock that referenced this pull request Jul 5, 2026
Remove the stopgap pins from conda#921 (see also conda#907): this branch
delivers the mamba/micromamba 2.6 support the pins were waiting
for, and CI must run micromamba >=2.6.0 to actually exercise the
hierarchical package cache layout end-to-end.

- ``MICROMAMBA_VERSION`` back to ``latest`` in ``test.yml`` and
  ``integration-test.yml``.
- ``mamba`` unpinned in ``pixi.toml`` and
  ``environments/dev-environment.yaml``.

The committed lockfiles remain valid: they resolve mamba 2.3.2,
which satisfies both the pinned and unpinned specs, and they were
generated from source files identical to the post-revert state
(conda-standalone included, no pin), so their content hashes still
match. A relock is still desirable to pull mamba >=2.6.0 into the
dev environment so the e2e ``mamba`` parametrization exercises the
new solver rather than 2.3.2.
maresb pushed a commit to maresb/conda-lock that referenced this pull request Jul 5, 2026
Remove the stopgap pins from conda#921 (see also conda#907): this branch
delivers the mamba/micromamba 2.6 support the pins were waiting
for, and CI must run micromamba >=2.6.0 to actually exercise the
hierarchical package cache layout end-to-end.

- ``MICROMAMBA_VERSION`` back to ``latest`` in ``test.yml`` and
  ``integration-test.yml``.
- ``mamba`` unpinned in ``pixi.toml`` and
  ``environments/dev-environment.yaml``.

The committed lockfiles remain valid: they resolve mamba 2.3.2,
which satisfies both the pinned and unpinned specs, and they were
generated from source files identical to the post-revert state
(conda-standalone included, no pin), so their content hashes still
match. A relock is still desirable to pull mamba >=2.6.0 into the
dev environment so the e2e ``mamba`` parametrization exercises the
new solver rather than 2.3.2.
maresb pushed a commit to maresb/conda-lock that referenced this pull request Jul 5, 2026
Remove the stopgap pins from conda#921 (see also conda#907): this branch
delivers the mamba/micromamba 2.6 support the pins were waiting
for, and CI must run micromamba >=2.6.0 to actually exercise the
hierarchical package cache layout end-to-end.

- ``MICROMAMBA_VERSION`` back to ``latest`` in ``test.yml`` and
  ``integration-test.yml``.
- ``mamba`` unpinned in ``pixi.toml`` and
  ``environments/dev-environment.yaml``.

The committed lockfiles remain valid: they resolve mamba 2.3.2,
which satisfies both the pinned and unpinned specs, and they were
generated from source files identical to the post-revert state
(conda-standalone included, no pin), so their content hashes still
match. A relock is still desirable to pull mamba >=2.6.0 into the
dev environment so the e2e ``mamba`` parametrization exercises the
new solver rather than 2.3.2.

Verification: grep confirms no mamba/micromamba version pins remain
(`git grep -n 'MICROMAMBA_VERSION\|mamba =' .github/ pixi.toml
environments/`); the pins being reverted were introduced by
conda#921 solely to dodge the 2.6.0 cache-layout break
this branch fixes.
maresb pushed a commit to maresb/conda-lock that referenced this pull request Jul 7, 2026
Remove the stopgap pins from conda#921 (see also conda#907): this branch
delivers the mamba/micromamba 2.6 support the pins were waiting
for, and CI must run micromamba >=2.6.0 to actually exercise the
hierarchical package cache layout end-to-end.

- ``MICROMAMBA_VERSION`` back to ``latest`` in ``test.yml`` and
  ``integration-test.yml``.
- ``mamba`` unpinned in ``pixi.toml`` and
  ``environments/dev-environment.yaml``.

The committed lockfiles remain valid: they resolve mamba 2.3.2,
which satisfies both the pinned and unpinned specs, and they were
generated from source files identical to the post-revert state
(conda-standalone included, no pin), so their content hashes still
match. A relock is still desirable to pull mamba >=2.6.0 into the
dev environment so the e2e ``mamba`` parametrization exercises the
new solver rather than 2.3.2.

Verification: grep confirms no mamba/micromamba version pins remain
(`git grep -n 'MICROMAMBA_VERSION\|mamba =' .github/ pixi.toml
environments/`); the pins being reverted were introduced by
conda#921 solely to dodge the 2.6.0 cache-layout break
this branch fixes.
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.

FileNotFoundError: Distribution '<pkg>' not found in pkgs_dirs after upgrading to mamba/micromamba 2.6.0

2 participants