Repository navigation
fix(integrations): refresh the fallback's manifest hashes on uninstall - #5274
Conversation
Uninstalling the default integration re-registers extensions and presets for the fallback integration but never refreshed the hashes of files those presets rewrite, so status reported them as modified and a plain upgrade refused. Snapshot the fallback's manifest before registration and resync files that were unmodified before, as the switch rollback does since github#5193. Assisted-by: Codex CLI (model: gpt-6.1-sol, autonomous) Assisted-by: Claude Code (model: claude-opus-5-5, autonomous)
There was a problem hiding this comment.
🟡 Changes recommended
The uninstall regression tests are in the switch test module, causing the uninstall-focused suite to skip all 12 new cases and violating the required command-focused test structure.
1 open issue
What changed in this PR
This PR extends the manifest-hash fixes from #5193 to uninstall fallback handling, preventing preset rewrites from being reported as user modifications on the new default integration.
Changes:
- Shares fallback registration logic across both uninstall paths.
- Refreshes hashes only for previously unmodified files, with best-effort handling of manifest failures.
- Adds 12 regression cases covering hash updates, pre-existing edits, and missing or failing manifests.
| File | Description |
|---|---|
tests/specify_cli/integrations/test_command_switch.py |
Adds uninstall fallback regression coverage. |
src/specify_cli/integrations/command_uninstall.py |
Refreshes fallback manifest hashes after contribution registration. |
Review effort: Balanced (auto)
|
Please address Copilot feedback |
…all command Move TestUninstallFallbackManifest from test_command_switch.py to test_command_uninstall.py, next to the other fallback tests, as the test structure in design/cli.md asks. Assisted-by: Claude Code (model: claude-opus-5-5, autonomous)
|
Addressed in 00d63da.
Full suite on Linux, Python 3.13: 13945 passed, 449 skipped, 1 failed, the same local-only Drafted on behalf of @kartsan03 by Claude Code (model: claude-opus-5-5, autonomous). |
|
Thank you! |
github#5274) * fix(integrations): refresh the fallback's manifest hashes on uninstall Uninstalling the default integration re-registers extensions and presets for the fallback integration but never refreshed the hashes of files those presets rewrite, so status reported them as modified and a plain upgrade refused. Snapshot the fallback's manifest before registration and resync files that were unmodified before, as the switch rollback does since github#5193. Assisted-by: Codex CLI (model: gpt-6.1-sol, autonomous) Assisted-by: Claude Code (model: claude-opus-5-5, autonomous) * test(integrations): keep the uninstall fallback tests with the uninstall command Move TestUninstallFallbackManifest from test_command_switch.py to test_command_uninstall.py, next to the other fallback tests, as the test structure in design/cli.md asks. Assisted-by: Claude Code (model: claude-opus-5-5, autonomous)

Description
specify integration uninstallof the default integration makes another installed integration the default and re-registers extensions and presets for it, but never refreshes the hashes of the files those presets rewrite. A preset that overrides a core command then leaves a stale hash on the new default:integration statusreports the file as modified, andintegration upgraderefuses without--force. #5193 fixed the same gap forinit --forceand theintegration switchrollback, and left this path out because #5100 was going to move it. #5100 has since been closed, so the code is still incommand_uninstall.py.Both fallback blocks in
command_uninstall.py(the normal path, and the one taken when the uninstalled integration's manifest is missing) now call_register_fallback_contributions(). Like the switch rollback in #5193, it takes_snapshot_manifest_before_registration()before re-registering and passesunmodified_filesto_resync_manifest_after_registration(). Only files that were unmodified before and changed by registration get a new hash, so a file the user edited earlier keeps its old hash and is still reported as modified. Both steps are best-effort: a missing manifest is skipped, a corrupt one or a failed save prints a warning, and the uninstall still succeeds.Repro with the real CLI and the bundled
scaffoldpreset:main(6d7a994)preset addintegration statusafter the uninstallwarning, 1 modified fileok, 0 modifiedupgrade codexOn both, the uninstall prints "1 modified file(s) were preserved: .claude/skills/speckit-specify/SKILL.md". That is Claude's own copy, which
preset addrewrote earlier;docs/integrations/claude.mdsays preset commands modify installed skill files and needupgrade --forceafterwards. This PR doesn't change that.A project already left stale by
mainstays that way untilspecify integration upgrade codex --force, which also overwrites real edits to managed files. I checked that on a project left stale bymain, one forced upgrade makes status clean again and plain upgrades work after it.Refs #5078
Testing
uv run specify --helpuv sync && uv run pytestNew tests in
tests/specify_cli/integrations/test_command_uninstall.py, classTestUninstallFallbackManifest, through the CLI with a real preset. Each runs with the uninstalled integration's manifest present and deleted, to cover both fallback blocks:test_uninstall_syncs_fallback_manifest_without_blessing_user_edits[None|plan|tasks]: after the uninstall, codex is the default, its hash matches the preset-rendered skill, status shows 0 modified files and a plainupgradeexits 0. A skill the user edited before the uninstall (plan, which the preset doesn't touch, andtasks, which it rewrites) keeps its old hash, andupgradestill refuses.test_uninstall_fallback_manifest_refresh_is_best_effort[missing|corrupt|save-error]: the preset is still registered, a missing manifest isn't created, a corrupt one is left as it is, and a failed save prints a warning while the uninstall exits 0.With
command_uninstall.pyreverted tomain, 8 of the 12 cases fail. Thetasksedit case and the missing-manifest case pass onmaintoo, sincemainnever re-hashes. Withunmodified_filesdropped from the resync, theplanandtasksedit cases fail; with themanifest is not Nonecheck removed, the missing and corrupt cases fail.Full suite on Linux, Python 3.13: 13945 passed, 449 skipped, 1 failed (
uv sync --extra test, thenpytest -n 2, 9 min). The failure,test_version_execution.py::TestWindowsUvToolEnvironment::test_non_windows_uv_tool_dry_run_still_previews_installer, fails the same way onmainhere: Rich wraps the dry-run output, and my checkout's venv path is long enough to be split mid-path. Ruff 0.15.0 (ruff check src tests) passes. I haven't run it on Windows.AI Disclosure
AI disclosure: Codex CLI (model: gpt-6.1-sol, reasoning effort xhigh, autonomous, offline sandbox) reproduced the path on
mainand wrote the fix and the tests. Claude Code (model: claude-opus-5-5, autonomous) reviewed the change, reran the repro with the real CLI onmainand the branch, checked which tests fail without each part of the fix, ran the full suite and lint, and drafted this description. The commit carriesAssisted-by:trailers for both.