Skip to content

fix: detect relocated uv and pipx tool installations - #5103

Open
Shubham-Padkonde wants to merge 1 commit into
github:mainfrom
Shubham-Padkonde:fix/5095-detect-relocated-tool-installs
Open

Shubham-Padkonde wants to merge 1 commit into
github:mainfrom
Shubham-Padkonde:fix/5095-detect-relocated-tool-installs

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Description

Fixes #5095. specify self upgrade currently classifies existing uv/pipx installations outside the legacy hard-coded directories as unsupported. Since an existing entrypoint intentionally cannot fall back to another installer's registry, a valid relocated installation never reaches the upgrade path.

Extend path detection to UV_TOOL_DIR, PIPX_HOME, XDG data locations, and current Windows/macOS/Linux defaults while retaining legacy paths. These layouts follow the uv storage reference and pipx environment reference. Ignore unset or empty environment variables so they cannot turn into root-level prefixes. Existing path-component boundaries, registry fallback restrictions, and installer command construction are unchanged.

The upgrade guide notes that the same relocation variables must remain set when upgrading, so the invoked installer also uses that directory. Ephemeral uvx cache detection is outside this fix.

Testing

  • Tested CLI help and a real self upgrade --dry-run --tag v1.2.3 invocation.
  • Ran existing upgrade tests using the checkout's own virtualenv after uv sync --extra test.
  • Installed the patched CLI with uv tool install --from . specify-cli into isolated UV_TOOL_DIR and UV_TOOL_BIN_DIR directories. Its real executable reports Detected install method: uv tool and previews the correct installer command; no upgrade was executed.

Windows / Python 3.14.6:

  • 18 new cases cover nine directory layouts, sibling-environment rejection, and unset/empty relocation variables. Twelve fail on the base; all pass with the fix.
  • .venv/Scripts/python -m pytest tests/specify_cli/test_version_detection.py tests/specify_cli/test_version_execution.py tests/specify_cli/test_version_guidance.py tests/specify_cli/test_version_verification.py tests/specify_cli/selfs -q: 155 passed, 4 skipped.
  • git diff --check passes. Ruff reports the same seven existing findings in the two Python files on base and head; no new findings.
  • Linux/macOS directory layouts are exercised as isolated fixtures on Windows, not as native installations. The full repository suite was not run.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance

AI disclosure: OpenAI Codex (GPT-6), operating autonomously on behalf of Shubham-Padkonde, investigated the issue, generated code/tests/documentation, ran validation, and drafted this PR. The exact model variant/reasoning setting is not exposed to the agent. No personal line-by-line human review is claimed.

Assisted-by: Codex (model: GPT-6, autonomous)
@mnriem mnriem added the triage-must-have Verdict: high-value, important work for Spec Kit — do first label Oct 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-must-have Verdict: high-value, important work for Spec Kit — do first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: specify self upgrade reports "unsupported" for uv tool installs under XDG_DATA_HOME (and likely for current pipx installs)

2 participants