feat: Implement indexed_timestamp field for package records - #2502
Draft
pavelzw wants to merge 4 commits into
Draft
feat: Implement indexed_timestamp field for package records#2502pavelzw wants to merge 4 commits into
pavelzw wants to merge 4 commits into
Conversation
Implements the indexed_timestamp CEP (conda/ceps#154): an optional field on package records holding the Unix epoch milliseconds at which an indexing tool first added the artifact to the channel index. - Add `indexed_timestamp: Option<TimestampMs>` to `PackageRecord`. Build tools never set it (`IndexJson` is unchanged) and repodata patching cannot modify it (it is not part of the `PackageRecordPatch` whitelist). - rattler-index stamps newly indexed packages with the indexing time (one value per subdir run), preserves previously assigned values across re-indexing runs including `--force`, and rejects packages whose build timestamp is in the future of the indexing time. - New `backfill-indexed-timestamps` option (TOML config, CLI flag, and py-rattler kwarg) controlling how records in existing repodata that lack the field are seeded: `from-conda-package-timestamp` (default, clamped to the indexing time), `now`, or `off`. - `exclude-newer` filtering in both solver backends now prefers `indexed_timestamp` over the builder-provided `timestamp`, with an aggregated warning when records lack the field. - Expose an `indexed_timestamp` property on py-rattler's `PackageRecord`. https://claude.ai/code/session_01KvrZfUCxfjQzPBJKzPG5Ez
Collaborator
|
Tiny nitpick: Its not CEP 154, its just a draft CEP without a name. |
baszalmstra
requested changes
Jun 11, 2026
Comment on lines
+83
to
+115
| impl BackfillIndexedTimestamps { | ||
| const FROM_CONDA_PACKAGE_TIMESTAMP: &str = "from-conda-package-timestamp"; | ||
| const NOW: &str = "now"; | ||
| const OFF: &str = "off"; | ||
| } | ||
|
|
||
| impl FromStr for BackfillIndexedTimestamps { | ||
| type Err = String; | ||
|
|
||
| fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
| match s { | ||
| Self::FROM_CONDA_PACKAGE_TIMESTAMP => Ok(Self::FromCondaPackageTimestamp), | ||
| Self::NOW => Ok(Self::Now), | ||
| Self::OFF => Ok(Self::Off), | ||
| _ => Err(format!( | ||
| "invalid value `{s}`, expected one of `{}`, `{}`, `{}`", | ||
| Self::FROM_CONDA_PACKAGE_TIMESTAMP, | ||
| Self::NOW, | ||
| Self::OFF | ||
| )), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl std::fmt::Display for BackfillIndexedTimestamps { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| f.write_str(match self { | ||
| Self::FromCondaPackageTimestamp => Self::FROM_CONDA_PACKAGE_TIMESTAMP, | ||
| Self::Now => Self::NOW, | ||
| Self::Off => Self::OFF, | ||
| }) | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
The derive-more crates has some functionality for this.
Member
Author
|
please don't review this pr yet, i haven't even looked at the code myself 😭 |
- Derive `Display`/`FromStr` for `BackfillIndexedTimestamps` via strum (already a workspace dependency) instead of hand-rolled impls. - Clarify that the indexed_timestamp CEP is a draft proposal without an assigned number. https://claude.ai/code/session_01KvrZfUCxfjQzPBJKzPG5Ez
…e3vdnx # Conflicts: # Cargo.lock
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
This PR implements support for the
indexed_timestampfield in package records, as specified in CEP 154. Theindexed_timestampfield tracks when a package was first added to a channel index by an indexing tool, distinct from the buildtimestampset by build tools.Key changes:
Core field addition: Added
indexed_timestamp: Option<TimestampMs>toPackageRecordinrattler_conda_types, with proper serialization/deserialization support.Indexing logic:
indexed_timestampacross re-indexing runs, even withforcemodeFromCondaPackageTimestamp(default): Seeds from package build timestamp, clamped to indexing timeNow: Seeds with current indexing timeOff: Leaves records untouchedSolver integration: The
exclude_newerconstraint now prefersindexed_timestampover buildtimestampwhen filtering packages, with appropriate messaging to users.Configuration: Added
BackfillIndexedTimestampsenum torattler_configwith CLI and config file support.Python bindings: Exposed
indexed_timestampproperty inPackageRecordandPrefixRecordPython classes.Comprehensive testing: Added tests covering timestamp assignment, preservation across re-indexing, backfill modes, future timestamp rejection, and solver behavior with indexed timestamps.
How Has This Been Tested?
Added integration tests in
basic_indexing.rs:test_indexed_timestamp_assignment_and_preservation: Verifies assignment on new packages and preservation across re-indexingtest_indexed_timestamp_backfill_modes: Tests all three backfill modestest_index_rejects_future_build_timestamp: Validates rejection of future-dated packagesAdded solver tests in
min_age_tests.rs:solve_min_age_prefers_indexed_timestamp: Confirms indexed time takes precedencesolve_min_age_indexed_timestamp_overrides_new_build_timestamp: Tests override behaviorsolve_min_age_falls_back_to_build_timestamp: Validates fallback for records without indexed_timestampAdded Python tests in
test_index.pyandtest_package_record.pycovering roundtrip serialization and timestamp assignmentExisting tests updated to include the new
backfill_indexed_timestampsconfiguration fieldChecklist:
https://claude.ai/code/session_01KvrZfUCxfjQzPBJKzPG5Ez