Skip to content

fix(python): honor minimum release age for core versions#10311

Merged
jdx merged 1 commit into
mainfrom
codex/fix-python-min-release-age
Jun 11, 2026
Merged

fix(python): honor minimum release age for core versions#10311
jdx merged 1 commit into
mainfrom
codex/fix-python-min-release-age

Conversation

@jdx

@jdx jdx commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • attach release timestamps to core Python remote versions so minimum_release_age can filter them
  • use python-build-standalone dates for precompiled Python listings
  • use python-build definition commit timestamps for source-build Python listings
  • add an e2e covering precompiled Python release-age filtering without installing Python

Root cause

Core Python returned VersionInfo entries without created_at, so the shared release-age filter had no timestamp metadata to hide newly published Python versions.

Tests

  • rustfmt --edition 2024 --check src/plugins/core/python.rs
  • cargo test parses_python --quiet
  • mise run test:e2e e2e/core/test_python_precompiled_minimum_release_age

This PR was generated by an AI coding assistant.


Note

Medium Risk
Changes version listing behavior for a core tool and adds a git subprocess on the source-build path; failures degrade to missing timestamps rather than breaking installs.

Overview
Core Python remote version listings now set created_at, so shared minimum_release_age filtering can exclude versions that are too new.

For precompiled listings (python.compile=false / Windows), release dates from the python-build-standalone index (YYYYMMDD) are normalized to ISO timestamps on each VersionInfo. For source-build listings, a new git log pass over plugins/python-build/share/python-build maps each definition name to the commit time it was added; failures are logged and listing still works without timestamps.

Unit tests cover the parsers, and an e2e script asserts mise latest / mise ls-remote --json respect --minimum-release-age for precompiled Python without installing.

Reviewed by Cursor Bugbot for commit a5c1ec1. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Python plugin now populates creation timestamps for precompiled remote Python versions, enabling accurate filtering by release age.
  • Tests

    • Added end-to-end test validating --minimum-release-age filtering (verifies filtered results differ from unfiltered latest) and unit tests for parsing and interpreting precompiled release timestamps.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 90ddc5a6-022e-4ff6-a3c5-b5d4ed9b0478

📥 Commits

Reviewing files that changed from the base of the PR and between a173003 and a5c1ec1.

📒 Files selected for processing (2)
  • e2e/core/test_python_precompiled_minimum_release_age
  • src/plugins/core/python.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • e2e/core/test_python_precompiled_minimum_release_age
  • src/plugins/core/python.rs

📝 Walkthrough

Walkthrough

Parses python-build git history and precompiled date strings to populate created_at for Python versions, integrates those timestamps into remote version listings, and adds an e2e script validating --minimum-release-age filtering and JSON timestamp fields.

Changes

Python Precompiled Version Timestamps

Layer / File(s) Summary
Date parsing helpers and tests
src/plugins/core/python.rs
Adds parse_python_build_definition_created_at to map git-log output to version→timestamp and python_precompiled_created_at to convert YYYYMMDD to RFC3339 midnight; includes unit tests validating parsing and invalid-input behavior.
Git-based timestamp collection
src/plugins/core/python.rs
Adds a helper that runs git -C <pyenv> log --format=%cI --name-only scoped to plugins/python-build/share/python-build, parses the output, and returns a BTreeMap of version→created_at timestamps.
Integration into remote version listing
src/plugins/core/python.rs
Updates _list_remote_versions to set VersionInfo.created_at for precompiled and definition-discovered versions using the new converters and git-derived map, with graceful fallback.
End-to-end validation
e2e/core/test_python_precompiled_minimum_release_age
Bash e2e script that disables precompiled compilation, compares unfiltered vs --minimum-release-age 2025-01-01 latest results, asserts version formatting and difference, and checks ls-remote --json entries have non-null created_at timestamps before the cutoff.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit reads git logs by night,
Dates in YYYYMMDD now bite,
Timestamps bloom for builds once old,
Filters dance and stories told,
🐇⏳

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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 pull request title 'fix(python): honor minimum release age for core versions' directly and accurately describes the main change: enabling the --minimum-release-age filter for Python core versions by populating created_at timestamps.
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.


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

@jdx jdx marked this pull request as ready for review June 11, 2026 18:46

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9a6df21. Configure here.

Comment thread src/plugins/core/python.rs
Comment thread e2e/core/test_python_precompiled_minimum_release_age

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

Actionable comments posted: 1

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

Inline comments:
In `@src/plugins/core/python.rs`:
- Around line 191-196: The git invocation building the args for "git log" (the
array containing "--format=%cI", "--name-only", and the path
"plugins/python-build/share/python-build") should be constrained to add-only
history so created_at reflects the original add commit, not last-touch edits;
update the git log args to include "--diff-filter=A" (and keep "--format=%cI"
and "--name-only") so only file-add commits are considered, and make the same
change for the other similar git log invocation(s) in python.rs (the other
occurrence around the referenced lines).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 83f52ab3-6a1e-4b88-b15b-05e560153692

📥 Commits

Reviewing files that changed from the base of the PR and between fa0ec9d and 9a6df21.

📒 Files selected for processing (2)
  • e2e/core/test_python_precompiled_minimum_release_age
  • src/plugins/core/python.rs

Comment thread src/plugins/core/python.rs
@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes Python version listings so minimum_release_age filtering can actually apply to core Python versions, which previously had no created_at metadata. The precompiled path now converts the existing YYYYMMDD build date to an ISO 8601 string per entry, while the source-build path runs git log --diff-filter=A against the local python-build clone and maps each definition filename to its first-add commit time.

  • Precompiled path (python_precompiled_created_at): straightforward 8-digit-to-ISO conversion with early-return validation; all matched entries always have a timestamp since the regex already requires a digit-string date field.
  • Source-build path (python_build_definition_created_at): synchronous git log --format=%cI --diff-filter=A --name-only call with graceful unwrap_or_default fallback; the timestamp parser correctly handles +00:00-offset git output via jiff::Zoned, and the downstream minimum_release_age comparator also calls parse_into_timestamp so both formats resolve to the same UTC Timestamp for comparison.
  • E2e test exercises the precompiled path without installing Python via MISE_PYTHON_COMPILE=0.

Confidence Score: 5/5

Safe to merge — the change is additive, failures fall back to empty timestamp maps, and no install path is modified.

Both new code paths have graceful degradation: the source-build git log failure is caught, logged, and replaced with an empty map, so version listing continues uninterrupted without timestamps. The precompiled conversion is purely mechanical and validated by unit tests. The jiff library correctly unifies the +00:00 git timestamp format and the Z precompiled format into a single Timestamp for comparison, so the cross-format concern is resolved. No existing install or resolution logic is touched.

No files require special attention.

Important Files Changed

Filename Overview
src/plugins/core/python.rs Adds created_at to precompiled and source-build VersionInfo entries; precompiled path converts YYYYMMDD to ISO 8601, source-build path runs git log --diff-filter=A to find the first-add commit time. Fallback to empty map on git failure is clean.
e2e/core/test_python_precompiled_minimum_release_age New e2e that verifies --minimum-release-age hides the latest precompiled Python and that every returned version carries a created_at earlier than the cutoff. Uses MISE_PYTHON_COMPILE=0 so no Python install is needed.

Reviews (2): Last reviewed commit: "fix(python): honor minimum release age f..." | Re-trigger Greptile

Comment on lines +1006 to +1008
created_at
.entry(version.to_string())
.or_insert_with(|| timestamp.clone());

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.

P1 Newest-first git log + or_insert_with stores modification date, not creation date

git log outputs commits newest-first. or_insert_with keeps the first value inserted, which is the most-recent commit touching each definition file. If a definition (e.g. 3.12.0) was patched or fixed in a later commit, the map stores that modification timestamp rather than the original creation timestamp. A user running minimum_release_age on the source-build path would see Python 3.12.0 (released 2023-10-03) silently hidden because its definition was touched more recently.

Adding --diff-filter=A to the git log call restricts output to commits that first Added each file, so the map always records the true release date.

Fix in Claude Code

Comment on lines +185 to +197
let output = crate::cmd!(
"git",
"-C",
self.python_build_path(),
"-c",
format!("safe.directory={}", self.python_build_path().display()),
"log",
"--format=%cI",
"--name-only",
"--",
"plugins/python-build/share/python-build",
)
.read()?;

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.

P1 Adding --diff-filter=A restricts the log to commits that first Added each definition file, ensuring the map records the original release date rather than the date of any subsequent patch or maintenance commit.

Suggested change
let output = crate::cmd!(
"git",
"-C",
self.python_build_path(),
"-c",
format!("safe.directory={}", self.python_build_path().display()),
"log",
"--format=%cI",
"--name-only",
"--",
"plugins/python-build/share/python-build",
)
.read()?;
let output = crate::cmd!(
"git",
"-C",
self.python_build_path(),
"-c",
format!("safe.directory={}", self.python_build_path().display()),
"log",
"--format=%cI",
"--name-only",
"--diff-filter=A",
"--",
"plugins/python-build/share/python-build",
)
.read()?;

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

@jdx jdx force-pushed the codex/fix-python-min-release-age branch from 9a6df21 to a173003 Compare June 11, 2026 18:52
@jdx jdx force-pushed the codex/fix-python-min-release-age branch from a173003 to a5c1ec1 Compare June 11, 2026 18:53
@jdx jdx enabled auto-merge (squash) June 11, 2026 19:06
@github-actions

Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.2 x -- echo 20.8 ± 1.1 18.1 25.4 1.00
mise x -- echo 21.8 ± 1.7 19.2 41.3 1.05 ± 0.10

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.2 env 20.8 ± 1.2 18.1 26.1 1.00
mise env 21.4 ± 1.2 18.5 28.8 1.03 ± 0.08

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.2 hook-env 21.2 ± 1.2 18.3 25.7 1.00
mise hook-env 23.4 ± 3.4 18.6 35.4 1.10 ± 0.17

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.2 ls 18.3 ± 1.2 15.6 23.1 1.00
mise ls 19.3 ± 1.4 15.9 23.9 1.05 ± 0.11

xtasks/test/perf

Command mise-2026.6.2 mise Variance
install (cached) 146ms 145ms +0%
ls (cached) 66ms 67ms -1%
bin-paths (cached) 74ms 79ms -6%
task-ls (cached) 153ms 153ms +0%

@jdx jdx merged commit 0849610 into main Jun 11, 2026
34 checks passed
@jdx jdx deleted the codex/fix-python-min-release-age branch June 11, 2026 19:15
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.

1 participant