Skip to content

feat(rfc-0040): implement version_info() for toolchain version indirection#746

Open
loonghao wants to merge 5 commits intomainfrom
fix/vx-check-and-lock-issues
Open

feat(rfc-0040): implement version_info() for toolchain version indirection#746
loonghao wants to merge 5 commits intomainfrom
fix/vx-check-and-lock-issues

Conversation

@loonghao
Copy link
Copy Markdown
Owner

@loonghao loonghao commented Apr 4, 2026

Summary

Implement RFC 0040: Toolchain Version Indirection — version_info() Provider Interface.

Solves the version mismatch in Rust support: users write rust = "1.93.1" (rustc) in vx.toml, but vx downloads rustup (e.g., 1.28.1). Previously this caused O(n) store scanning in vx check and complex passthrough logic in vx lock.

Changes

Core: version_info() Provider Interface

  • vx-runtime: Add VersionInfoResult struct + version_info() to Runtime trait (default None)
  • vx-starlark: Add VersionInfoResult::from_json(), execute_version_info(), bridge make_version_info_fn_owned()
  • builder: Inject version_info_fn into every ManifestDrivenRuntime

Rust Provider (vx-providers/rust/provider.star)

  • Add version_info() mapping rustc versions → store layout + install params
  • Update post_extract() to use ctx.install_params["toolchain"] instead of hardcoded "stable"

Lock Command Integration

  • resolve_tool_version() calls version_info() first; uses store_as for lock version, fetches latest installer when download_version is None

Tests (49 total)

  • vx-starlark (26 tests): from_json() parsing (null, valid, partial, edge cases) + StarlarkProvider::version_info() integration
  • vx-runtime (23 tests): constructors, builders, effective_store_version(), Rust/Python patterns, channels, Clone/Debug

RFC Document

  • Updated implementation checklist (Phase 1 ✅, Phase 2 ✅, Phase 3 partial, Phase 4 ✅)

Key Design Decisions

  1. Two independent VersionInfoResult types — avoid circular dependency between vx-runtime and vx-starlark
  2. Optional interface — returns None by default; only toolchain-manager patterns need it
  3. O(1) version detection — store under rustc version (~/.vx/store/rust/1.93.1/)
  4. Backward compatible — old passthrough logic retained

Remaining Work (Phase 3)

  • Update vx check for O(1) detection
  • Remove legacy O(n) store scanning in common.rs
  • Remove old Rust passthrough fallback in runtime/mod.rs

loonghao added 2 commits April 4, 2026 15:14
Fix #744: Upgrade SystemFallback to Installed when detected version matches. Fix #745: Add store fallback when remote resolution fails.

Closes #744, Closes #745
…ction

Add version_info() to provider.star DSL. Rust provider now stores by rustc version (O(1) check). lock.rs uses version_info() first.
@loonghao loonghao changed the title fix(cli): fix vx check system_fallback for Rust and vx lock for installed tools feat(rfc-0040): implement version_info() for toolchain version indirection Apr 4, 2026
@loonghao loonghao force-pushed the fix/vx-check-and-lock-issues branch from 3e033df to eff2474 Compare April 4, 2026 10:11
loonghao added 2 commits April 4, 2026 18:52
When stdout is not a TTY (e.g., test runner, CI), OutputRenderer
auto-upgrades to JSON format. The where command outputs JSON with
'source: not_found' instead of human-readable 'not found' text.

Updated 4 failing tests to also match 'not_found' (JSON source field):
- test_where_unknown_tool
- test_where_system_installed_tool
- test_where_multiple_tools
- test_imagemagick_where_detects_system
- Add cancelled state as acceptable in check_job function
- Introduce check_optional_job for conditional jobs (test-full, cross-build, coverage, docs)
- Only core jobs (build, test-targeted, code-quality, etc.) are strictly required
- Conditional jobs that are legitimately skipped no longer cause CI failure
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