Add exclude_newer_timestamp to Database::Settings#4228
Open
jezdez wants to merge 4 commits intomamba-org:mainfrom
Open
Add exclude_newer_timestamp to Database::Settings#4228jezdez wants to merge 4 commits intomamba-org:mainfrom
exclude_newer_timestamp to Database::Settings#4228jezdez wants to merge 4 commits intomamba-org:mainfrom
Conversation
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.
7 tasks
- 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.
jezdez
added a commit
to jezdez/conda-libmamba-solver
that referenced
this pull request
Apr 10, 2026
Convert the exclude_newer duration/timestamp from conda's config into a Unix timestamp cutoff and pass it to libmambapy's Database constructor as exclude_newer_timestamp. This enables native --exclude-newer filtering in the libmamba solver backend. Depends on: - conda/conda#15761 (exclude_newer config + parse_duration_to_seconds) - mamba-org/mamba#4228 (exclude_newer_timestamp in Database::Settings)
3 tasks
jezdez
added a commit
to jezdez/conda-libmamba-solver
that referenced
this pull request
Apr 10, 2026
Convert the exclude_newer duration/timestamp from conda's config into a Unix timestamp cutoff and pass it to libmambapy's Database constructor as exclude_newer_timestamp. This enables native --exclude-newer filtering in the libmamba solver backend. Depends on: - conda/conda#15761 (exclude_newer config + parse_duration_to_seconds) - mamba-org/mamba#4228 (exclude_newer_timestamp in Database::Settings)
jezdez
added a commit
to jezdez/conda-libmamba-solver
that referenced
this pull request
Apr 10, 2026
Convert the exclude_newer duration/timestamp from conda's config into a Unix timestamp cutoff and pass it to libmambapy's Database constructor as exclude_newer_timestamp. This enables native --exclude-newer filtering in the libmamba solver backend. Depends on: - conda/conda#15761 (exclude_newer config + parse_duration_to_seconds) - mamba-org/mamba#4228 (exclude_newer_timestamp in Database::Settings)
jezdez
added a commit
to jezdez/conda-libmamba-solver
that referenced
this pull request
Apr 10, 2026
Convert the exclude_newer duration/timestamp from conda's config into a Unix timestamp cutoff and pass it to libmambapy's Database constructor as exclude_newer_timestamp. This enables native --exclude-newer filtering in the libmamba solver backend. Depends on: - conda/conda#15761 (exclude_newer config + parse_duration_to_seconds) - mamba-org/mamba#4228 (exclude_newer_timestamp in Database::Settings)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4228 +/- ##
==========================================
+ Coverage 52.73% 53.52% +0.79%
==========================================
Files 240 240
Lines 29526 29538 +12
Branches 3154 3157 +3
==========================================
+ Hits 15570 15811 +241
+ Misses 13953 13724 -229
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
exclude_newer_timestamp to Database::Settings
jezdez
added a commit
to jezdez/conda-libmamba-solver
that referenced
this pull request
Apr 10, 2026
The kwarg doesn't exist in released libmambapy yet (pending mamba-org/mamba#4228), so passing None causes a TypeError. Only include the kwarg when there's an actual timestamp value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an optional
exclude_newer_timestampfield toDatabase::Settings, allowing callers to exclude packages with a timestamp newer than the given Unix epoch cutoff during repodata loading.This enables conda's
--exclude-newerfeature to work with the libmamba solver backend, matching what rattler already supports natively. See conda/conda#15759 for the full tracking and conda/ceps#154 for the CEP proposingindexed_timestampin repodata.How it works
The cutoff is applied at load time in both ingestion paths:
mamba_read_json->set_repo_solvables_impl): after a solvable is parsed and its timestamp set, the timestamp is compared to the cutoff. If newer, the solvable is removed viarepo.remove_solvable(id, true)-- the same pattern used for parse failures.add_repo_from_packages_impl_loop): the package timestamp (normalized from ms to seconds) is checked before adding a solvable. If newer, the package is skipped entirely.The
.solvcache path is not filtered. Callers (e.g.conda-libmamba-solver) are expected to invalidate the cache whenexclude_newer_timestampchanges, the same way they handlerepodata_filters.Other changes
MAX_CONDA_TIMESTAMPfrom the anonymous namespace inhelpers.cpptohelpers.hppsodatabase.cppcan also use it.Database.__init__()accepts an optionalexclude_newer_timestampkeyword argument.Context
--exclude-neweris a supply chain security feature that excludes recently published packages, giving security vendors time to flag malicious uploads. It's already supported by uv, pip, pixi, and rattler.indexed_timestamp: conda/ceps#154