Skip to content

Exit non-zero from integration upgrade when no integration is installed - #5526

Merged
mnriem merged 1 commit into
github:mainfrom
yxshee:fix/5338-integration-upgrade-no-installed-exit-code
Nov 23, 2026
Merged

mnriem merged 1 commit into
github:mainfrom
yxshee:fix/5338-integration-upgrade-no-installed-exit-code

Conversation

@yxshee

@yxshee yxshee commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #5338.

When no integration is recorded in a Spec Kit project, specify integration upgrade previously printed a yellow warning (No integration is currently installed.) and exited with code 0. This caused chained automation and editor upgrade actions (such as specify self upgrade && specify integration upgrade && ...) to report success when nothing was upgraded, and was inconsistent with specify integration upgrade <key> exiting 1 when <key> is not installed.

Changes:

  • Update integration_upgrade in src/specify_cli/integrations/command_upgrade.py to print [red]Error:[/red] No integration is currently installed., include the Install one with: specify integration install <key> guidance matching specify integration use, and raise typer.Exit(1) when no default integration is installed.
  • Preserve existing behavior for installed integrations (including the missing-manifest path covered by test_upgrade_no_manifest and external adapter upgrade tests).
  • Update test_upgrade_no_integration_installed and add regression tests in tests/specify_cli/integrations/test_command_upgrade.py covering missing .specify/integration.json, empty state payloads ({}, {"installed_integrations": []}, {"integration": null, "installed_integrations": []}), --force with no installed integration, and upgrading after uninstalling the last integration.

Testing

Set up this checkout's .venv and editable install using the local development guide. Run commands from the checkout root.

  • Tested locally with .venv/bin/specify --help (Windows PowerShell: .\.venv\Scripts\specify.exe --help)
  • Ran relevant existing tests with .venv/bin/python -m pytest tests -q (Windows PowerShell: .\.venv\Scripts\python.exe -m pytest tests -q); use affected test paths for focused checks and LC_ALL=en_US.UTF-8 on macOS
  • Tested with a sample project (if applicable)

Verification evidence (macOS, Python 3.14.6):

  • Before fix (a4d5712): LC_ALL=en_US.UTF-8 .venv/bin/python -m pytest tests/specify_cli/integrations/test_command_upgrade.py -k "no_integration or after_uninstalling_last_integration" -q failed all 6 regression cases (assert 0 == 1).
  • After fix:
    • LC_ALL=en_US.UTF-8 .venv/bin/python -m pytest tests/specify_cli/integrations/test_command_upgrade.py -q: 74 passed.
    • LC_ALL=en_US.UTF-8 .venv/bin/python -m pytest tests/specify_cli/integrations/ tests/integrations/ -n auto -q: 4887 passed, 8 skipped.
    • uvx ruff@0.15.0 check src tests: All checks passed.
    • .venv/bin/python .github/scripts/check_file_helper_migration.py --base upstream/main --head HEAD: passed (exit 0).
    • .venv/bin/specify --help and .venv/bin/specify integration upgrade --help: passed (exit 0).
    • Sample project verification:
      • Fresh .specify/ directory without integration.json: .venv/bin/specify integration upgrade exited 1 (Error: No integration is currently installed.); .venv/bin/specify integration upgrade --force exited 1.
      • After .venv/bin/specify integration install copilot --script sh: .venv/bin/specify integration upgrade exited 0 (Integration 'GitHub Copilot' upgraded successfully).
      • After .venv/bin/specify integration uninstall: .venv/bin/specify integration upgrade exited 1.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (fill in the disclosure below)

AI disclosure: Posted on behalf of @yxshee. Implemented and tested with Antigravity (model: Gemini 4 Neon (High), autonomous mode) for issue triage, code generation, regression test authoring, and validation; the commit carries an Assisted-by: trailer.

In a Spec Kit project with no integration recorded, `specify integration
upgrade` printed a yellow warning and exited 0. That broke chained
upgrade commands and editor tooling (e.g. `specify self upgrade &&
specify integration upgrade && ...`), which treated exit 0 as a
successful upgrade even though nothing was upgraded, and was inconsistent
with `specify integration upgrade <key>` exiting 1 when `<key>` is not
installed.

Fail with exit code 1, print an error message with an actionable
`specify integration install <key>` hint matching `integration use`, and
add regression tests covering missing state, empty state payloads,
`--force`, and post-uninstall upgrades.

Refs github#5338

Assisted-by: Antigravity (model: Gemini 4 Neon (High), autonomous)
@yxshee
yxshee requested a review from mnriem as a code owner November 23, 2026 02:30
Copilot AI adaptive review requested due to automatic review settings November 23, 2026 02:30

Copilot AI 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.

🟢 Approval recommended

The implementation and regression coverage address missing-integration failure handling across normal, forced, and post-uninstall paths, with no active review issues reported.

No open issues 🎉

What changed in this PR

Updates specify integration upgrade so projects without an installed integration report an error and exit with status 1, preventing automation chains from falsely reporting success.

Changes:

  • Prints installation guidance and exits non-zero when no integration is installed, including with --force.
  • Adds regression coverage for missing and empty integration state, forced upgrades, and post-uninstall behavior.
  • Preserves successful upgrades and existing missing-manifest behavior.
File Description
tests/​specify_cli/​integrations/​test_command_upgrade.py Updates expected exit-code behavior and adds regression tests for missing or empty integration state, forced upgrades, and post-uninstall scenarios.
src/​specify_cli/​integrations/​command_upgrade.py Changes the no-installed-integration path to print an error with installation guidance and exit with status 1.

Review effort: Lite (adaptive)

@mnriem mnriem added the triage-must-have Verdict: high-value, important work for Spec Kit — do first label Nov 23, 2026
@mnriem
mnriem requested a balanced review from Copilot November 23, 2026 16:43

Copilot AI 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.

🟢 Approval recommended

No active review issues are identified for the change that prevents upgrades with no installed integration from being treated as successful.

No open issues 🎉

Review effort: Balanced

@mnriem
mnriem merged commit fbafea2 into github:main Nov 23, 2026
14 checks passed
@mnriem

mnriem commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

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.

specify integration upgrade exits 0 when nothing is installed: intended?

3 participants