Skip to content

feat(go): add created_at support to ls-remote --json#7305

Merged
jdx merged 2 commits intomainfrom
feat/go-created-at
Dec 15, 2025
Merged

feat(go): add created_at support to ls-remote --json#7305
jdx merged 2 commits intomainfrom
feat/go-created-at

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Dec 15, 2025

Summary

  • Go now provides created_at timestamps in mise ls-remote go --json output
  • When MISE_LIST_ALL_VERSIONS is set (for versions host fetching): Uses slow method that fetches tags with commit dates from GitHub (requires auth)
  • Otherwise: Uses fast tag listing without dates (versions host provides the timestamps)
  • Added list_tags_with_dates() function to github.rs that fetches tags and retrieves commit dates in parallel

Test plan

  • MISE_USE_VERSIONS_HOST=1 mise ls-remote go --json returns versions with created_at from versions host
  • MISE_USE_VERSIONS_HOST=0 MISE_LIST_ALL_VERSIONS=1 mise ls-remote go --json returns versions with real commit dates (requires valid GitHub token)

🤖 Generated with Claude Code


Note

Go ls-remote now returns versions with optional created_at by fetching GitHub tag commit dates (slow path) or plain tags (fast path).

  • Go plugin (src/plugins/core/go.rs):
    • Replace git ls-remote logic with _list_remote_versions_with_info returning VersionInfo { version, created_at }.
    • When MISE_LIST_ALL_VERSIONS is set: use github::list_tags_with_dates to include commit dates; otherwise use github::list_tags (no dates).
    • Parse go tag names, filter/sort versions, and de-duplicate.
  • GitHub client (src/github.rs):
    • Add types: GithubTag { name, commit }, GithubTagCommit, GithubCommit{ commit }, GithubCommitInfo, GithubCommitPerson, and GithubTagWithDate.
    • Add list_tags_with_dates() with pagination; fetch each tag’s commit info in parallel to extract committer date.
    • Keep list_tags() with optional pagination controlled by MISE_LIST_ALL_VERSIONS.

Written by Cursor Bugbot for commit e160f20. This will update automatically on new commits. Configure here.

Go now provides created_at timestamps in ls-remote --json output.

- When MISE_LIST_ALL_VERSIONS is set (for versions host fetching):
  Fetches tags with commit dates from GitHub (slower, requires auth)
- Otherwise: Uses fast tag listing without dates (versions host provides them)

Added list_tags_with_dates() function to github.rs that fetches tags
and retrieves commit dates in parallel.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings December 15, 2025 04:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for created_at timestamps in mise ls-remote go --json output by implementing a dual-path approach: when MISE_LIST_ALL_VERSIONS is set, it fetches tags with commit dates from GitHub (slower but provides dates), otherwise it uses fast tag listing where the versions host provides timestamps later.

Key Changes

  • Modified GoPlugin to implement _list_remote_versions_with_info() instead of _list_remote_versions() to return VersionInfo with timestamps
  • Added conditional logic to use slow GitHub commit date fetching when MISE_LIST_ALL_VERSIONS is set, fast tag-only listing otherwise
  • Implemented list_tags_with_dates() function in github.rs with parallel commit date fetching

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/plugins/core/go.rs Replaced version list method to return VersionInfo with conditional date fetching based on MISE_LIST_ALL_VERSIONS
src/github.rs Added structs for GitHub commit data and list_tags_with_dates() function with parallel date fetching

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/github.rs
Comment on lines +220 to +222
response_headers = get_headers(&next);
let (more, h) = crate::http::HTTP_FETCH
.json_headers_with_headers::<Vec<GithubTag>, _>(next, &response_headers)
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

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

The variable assignment is incorrect. The get_headers() function returns HeaderMap, but it's being reassigned to response_headers which should contain the response headers from the HTTP request. This should be removed as the headers are already obtained from the next request on line 222.

Suggested change
response_headers = get_headers(&next);
let (more, h) = crate::http::HTTP_FETCH
.json_headers_with_headers::<Vec<GithubTag>, _>(next, &response_headers)
let (more, h) = crate::http::HTTP_FETCH
.json_headers_with_headers::<Vec<GithubTag>, _>(next, &get_headers(&next))

Copilot uses AI. Check for mistakes.
Comment thread src/github.rs Outdated

Ok(results
.into_iter()
.filter_map(|(name, date)| date.map(|d| GithubTagWithDate { name, date: d }))
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

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

Tags without commit dates are silently filtered out. If fetching commit data fails for any tag, that tag will be excluded from results entirely. Consider returning tags with None dates or logging a warning when tags are dropped due to missing commit information.

Copilot uses AI. Check for mistakes.
Comment thread src/plugins/core/go.rs Outdated
Comment thread src/github.rs
@jdx
Copy link
Copy Markdown
Owner Author

jdx commented Dec 15, 2025

@copilot address these issues:

Bug: Hardcoded repository ignores configurable go_repo setting

The old code used Settings::get().go_repo which allows users to configure a custom Go repository via the MISE_GO_REPO environment variable or config. The new code hardcodes "golang/go" in both the slow path (list_tags_with_dates) and fast path (list_tags), completely ignoring the configurable setting. Users who have set a custom repository (e.g., an internal mirror or fork) will now have that setting ignored.

Additional Locations (1)
src/plugins/core/go.rs#L232-L233

Bug: Failed date fetches silently drop versions from results

When list_tags_with_dates fetches commit dates in parallel, any tag where the date fetch fails (due to rate limiting, network issues, or missing commit info) gets silently dropped via filter_map. Since this function is used for versions host fetching when MISE_LIST_ALL_VERSIONS is set, this could result in incomplete version data without any indication to the user or caller that entries are missing.

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 15, 2025

@jdx I've opened a new pull request, #7306, to work on those changes. Once the pull request is ready, I'll request review from you.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 15, 2025

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.7 x -- echo 20.4 ± 0.4 19.9 24.4 1.00
mise x -- echo 20.7 ± 0.4 20.1 23.5 1.01 ± 0.03

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.7 env 20.2 ± 0.8 19.3 28.2 1.00
mise env 20.3 ± 0.5 19.5 25.9 1.01 ± 0.05

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.7 hook-env 20.1 ± 0.4 19.4 23.7 1.00
mise hook-env 20.3 ± 0.5 19.5 27.8 1.01 ± 0.03

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.7 ls 16.9 ± 0.3 16.3 18.5 1.00
mise ls 17.2 ± 0.5 16.5 23.6 1.02 ± 0.04

xtasks/test/perf

Command mise-2025.12.7 mise Variance
install (cached) 108ms 108ms +0%
ls (cached) 65ms 66ms -1%
bin-paths (cached) 71ms 72ms -1%
task-ls (cached) 436ms 428ms +1%

…tches (#7306)

The Go plugin hardcoded "golang/go" instead of using the `MISE_GO_REPO`
setting, and silently dropped versions when commit date fetching failed.

## Changes

- **Respect go_repo configuration**: Extract repo from
`Settings.go_repo` URL instead of hardcoding "golang/go" in both slow
and fast paths
- **Retain all tags**: Change `GithubTagWithDate.date` to
`Option<String>` and return tags even when date fetch fails
- **Surface failures**: Upgrade log level from `debug!` to `warn!` when
commit date fetching fails

```rust
// Before: hardcoded repo, tags dropped on fetch failure
github::list_tags_with_dates("golang/go")
  .filter_map(|(name, date)| date.map(|d| GithubTagWithDate { name, date: d }))

// After: configurable repo, all tags retained
let repo = settings.go_repo.trim_start_matches("https://").trim_start_matches("github.com/");
github::list_tags_with_dates(repo)
  .map(|(name, date)| GithubTagWithDate { name, date })  // date is Option<String>
```

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jdx <216188+jdx@users.noreply.github.com>
Comment thread src/plugins/core/go.rs
.trim_start_matches("http://")
.trim_start_matches("github.com/")
.trim_end_matches(".git")
.trim_end_matches('/');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: URL parsing fails for SSH and non-standard URLs

The URL parsing logic for extracting the repo path from go_repo only handles HTTPS github.com URLs correctly. For SSH URLs like git@github.com:golang/go.git, the trim operations leave the result as git@github.com:golang/go instead of the expected golang/go, because the colon : isn't handled. Similarly, GitHub Enterprise URLs like https://github.enterprise.com/org/go result in github.enterprise.com/org/go. These malformed repo paths will cause the GitHub API calls to fail. The old code using git ls-remote worked with any git URL format, so this is a regression for users with SSH or non-standard URL configurations.

Fix in Cursor Fix in Web

@jdx jdx merged commit ce26457 into main Dec 15, 2025
28 checks passed
@jdx jdx deleted the feat/go-created-at branch December 15, 2025 12:38
jdx pushed a commit that referenced this pull request Dec 15, 2025
### 🚀 Features

- **(conda)** add dependency resolution for conda packages by @jdx in
[#7280](#7280)
- **(go)** add created_at support to ls-remote --json by @jdx in
[#7305](#7305)
- **(hook-env)** add hook_env.cache_ttl and hook_env.chpwd_only settings
for NFS optimization by @jdx in
[#7312](#7312)
- **(hooks)** add MISE_TOOL_NAME and MISE_TOOL_VERSION to
preinstall/postinstall hooks by @jdx in
[#7311](#7311)
- **(shell_alias)** add shell_alias support for cross-shell aliases by
@jdx in [#7316](#7316)
- **(tool)** add security field to mise tool --json by @jdx in
[#7303](#7303)
- add --before flag for date-based version filtering by @jdx in
[#7298](#7298)

### 🐛 Bug Fixes

- **(aqua)** support cosign v3 bundle verification by @jdx in
[#7314](#7314)
- **(config)** use correct config_root in tera context for hooks by @jdx
in [#7309](#7309)
- **(nu)** fix nushell deactivation script on Windows by @fu050409 in
[#7213](#7213)
- **(python)** apply uv_venv_create_args in auto-venv code path by @jdx
in [#7310](#7310)
- **(shell)** escape exe path in activation scripts for paths with
spaces by @jdx in [#7315](#7315)
- **(task)** parallelize exec_env loading to fix parallel task execution
by @jdx in [#7313](#7313)
- track downloads for python and java by @jdx in
[#7304](#7304)
- include full tool ID in download track by @jdx in
[#7320](#7320)

### 📚 Documentation

- Switch `postinstall` code to be shell-agnostic by @thejcannon in
[#7317](#7317)

### 🧪 Testing

- **(e2e)** disable debug mode by default for windows-e2e by @jdx in
[#7318](#7318)

### New Contributors

- @fu050409 made their first contribution in
[#7213](#7213)
jdx added a commit that referenced this pull request Dec 15, 2025
## Summary

- Restores `git ls-remote --tags` for Go version listing instead of
`github::list_tags`
- Fixes issue where Go returned no versions because golang/go has 500+
tags and the "go1.x" version tags aren't on the first page of GitHub API
results

## Background

The recent change in #7305 switched Go from `git ls-remote` to
`github::list_tags()`. However, this broke Go version listing because:

1. The golang/go repo has 500+ tags
2. GitHub API returns tags in alphabetical order, so older tags like
"weekly.*" come first
3. `github::list_tags()` only fetches the first page by default (when
`MISE_LIST_ALL_VERSIONS` is not set)
4. The actual version tags (go1.x) are on later pages

The original `git ls-remote --tags` approach fetches all tags
efficiently in a single call, filtered server-side to only "go*" tags.

## Test plan

- [x] `mise run lint-fix` passes
- [x] `MISE_USE_VERSIONS_HOST=0 mise ls-remote go` now returns Go
versions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Switches Go version listing fast path to `git ls-remote` to
efficiently retrieve all `go*` tags and avoid GitHub API pagination
issues.
> 
> - **Go plugin (`src/plugins/core/go.rs`)**:
> - **Version listing (fast path)**: Replace `github::list_tags` with
`git ls-remote --tags --refs go*` executed via
`plugins::core::run_fetch_task_with_timeout`.
> - Parse refs to extract versions, filter invalid patterns,
de-duplicate, sort, and map to `VersionInfo` (no dates).
> - **Version listing (slow path)**: Keep `github::list_tags_with_dates`
for detailed info when `MISE_LIST_ALL_VERSIONS` is set.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b573a79. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
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.

3 participants