Skip to content

feat: Complete exclude_newer policy#4344

Draft
jjerphan wants to merge 27 commits into
mamba-org:mainfrom
jjerphan:feat/exclude-newer-policy
Draft

feat: Complete exclude_newer policy#4344
jjerphan wants to merge 27 commits into
mamba-org:mainfrom
jjerphan:feat/exclude-newer-policy

Conversation

@jjerphan

@jjerphan jjerphan commented Jul 1, 2026

Copy link
Copy Markdown
Member

Description

Continues #4228.

Type of Change

  • Bugfix
  • Feature / enhancement
  • CI / Documentation
  • Maintenance

Checklist

  • My code follows the general style and conventions of the codebase, ensuring consistency
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run pre-commit run --all locally in the source folder and confirmed that there are no linter errors.
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes

jezdez and others added 25 commits June 30, 2026 15:37
When set, packages with a timestamp newer than the cutoff are excluded
during repodata loading. This covers both ingestion paths:

- JSON (mamba_read_json -> set_repo_solvables_impl): after parsing a
  solvable, check its timestamp and remove it if newer than the cutoff
- PackageInfo (add_repo_from_packages_impl_loop): skip the package
  before adding a solvable

The .solv cache path is not filtered; callers (e.g. conda-libmamba-solver)
are expected to invalidate the cache when exclude_newer changes.

Also moves MAX_CONDA_TIMESTAMP to helpers.hpp so both helpers.cpp and
database.cpp can use it without duplication.

Python bindings expose the new parameter as an optional
exclude_newer_timestamp keyword argument on Database.__init__().

This enables conda's --exclude-newer feature to work with the libmamba
solver backend. See conda/conda#15759 for full tracking.
- C++ tests (test_database.cpp): verify add_repo_from_packages filters
  packages by timestamp, normalizes millisecond timestamps, and filters
  packages loaded from repodata JSON
- Python tests (test_solver_libsolv.py): verify the libmambapy binding
  accepts exclude_newer_timestamp, filters packages from both the
  packages API and repodata JSON, and that None keeps all packages
The repodata JSON filter was reading solv.timestamp() to check
against the cutoff, but libsolv attributes require internalize()
before they can be read back. Since internalize() runs after all
packages are loaded, the timestamp was always 0 at filter time.

Fix by passing the parsed timestamp out of set_solvable via an
out parameter and using that directly in the filter comparison.

Also fix the millisecond normalization test to use a timestamp
that actually triggers the normalization path (> MAX_CONDA_TIMESTAMP),
and add subdir/depends fields to the Python repodata test fixture
to match real repodata structure.
Apply clang-format to ternary expression in database.cpp and
a pre-existing line-break issue in helpers.cpp.
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>

Co-authored-by: Hind Montassif <hind.montassif@gmail.com>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>

Co-authored-by: Hind Montassif <hind.montassif@gmail.com>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>

Co-authored-by: Hind Montassif <hind.montassif@gmail.com>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>

Co-authored-by: Hind Montassif <hind.montassif@gmail.com>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>

Co-authored-by: Hind Montassif <hind.montassif@gmail.com>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>

Co-authored-by: Hind Montassif <hind.montassif@gmail.com>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>

Co-authored-by: Johan Mabille <johan.mabille@gmail.com>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
@github-actions github-actions Bot added the release::enhancements For enhancements PRs or implementing features label Jul 1, 2026
jjerphan added 2 commits July 1, 2026 13:02
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release::enhancements For enhancements PRs or implementing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants