Repository navigation
fix(cli): stop reporting success for updates that never ran - #5555
Closed
bettercalln1ck wants to merge 1 commit into
Closed
bettercalln1ck wants to merge 1 commit into
bettercalln1ck wants to merge 1 commit into
Conversation
Two ways cmd_update claimed an update it did not perform. Exit codes (Osmantic#4179): _check_version_compat returns non-zero for three different reasons — the operator declining a downgrade, the operator declining a major jump, and the tool hard-blocking an install below min_compatible_ods_version — and cmd_update mapped all three to `exit 0`. Automation calling `ods update` was told the update succeeded when the tool had refused it outright. Those are not the same event, so they no longer share an exit code. The function now returns 2 when a person answers "no" and 1 when it refuses; cmd_update exits 0 for the former and 1 for the latter. Declining stays a success, matching how ods-restore treats a cancelled restore. Pre-update backup (Osmantic#4175): the fallback ran `ods-backup.sh "$_snap_label"`, but that parser has no positional argument — the label lands in its `*)` catch-all, prints "Unknown option" and exits 1. The failure was downgraded to "proceeding without safety net", so on every host without ods-update.sh the pre-update backup has never once been taken. It now passes --description, which is the flag that exists.
Collaborator
|
Thanks for this contribution. We're closing outside-contributor pull requests that have had no activity for 14 days or more, so the queue reflects work that can still land. This isn't a judgment on the change itself. If it's still needed, please rebase onto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4179.
Fixes #4175.
Closes #4179 and #4175 — both are
cmd_updatetelling the caller an update happened when it did not.Exit codes (#4179).
_check_version_compatreturns non-zero for three different reasons:min_compatible_ods_version(UPGRADE BLOCKED … use 'ods update --force' to override).cmd_updatecollapsed all three intoexit 0. Case 3 is the damaging one: the tool refused to run, and every caller — CI, a wrapper script, an operator reading$?— was told the update succeeded.Cases 1-2 and case 3 are not the same event, so they no longer share an exit code. The function returns 2 when a person answers "no" and 1 when the tool refuses;
cmd_updatemaps 2 toexit 0and anything else non-zero toexit 1. Declining stays a success on purpose — that matches howods-restore.shtreats a cancelled restore, which its own test asserts ("Cancel is not an error (returns 0)").Pre-update backup (#4175). The fallback path ran:
ods-backup.shhas no positional argument. The label falls through to its*)catch-all, which printsUnknown option: pre-update-…and exits 1 — so this branch has never once produced a backup, on any host that lacksods-update.sh. And because the failure is downgraded to a warning, the update proceeds regardless. It now passes--description, which is the flag that actually exists.The primary path (
ods-update.sh backup "$label") is fine —cmd_backupthere does take a positional name — which is why this went unnoticed.AI Assistance
AI-assisted: an AI coding assistant drafted the patch and the regression test and ran the validation recorded below. I reviewed the diff, chose the validation, and am accountable for the change.
Release Lane
release/2.6.xmainStable hotfix reason:
Changed Surface
Risk And Validation
git diff --checkrelease/2.6.xCommands/results:
Operational Change Check
Notes For Reviewers
ods-backup.shwith the exact argvcmd_updateused to pass, and confirms it is rejected withUnknown option. That is the evidence the fallback never worked, rather than an inference from reading the parser.ods-restore.sh's existing convention rather than inventing a new one. If you would rather every abort be non-zero, that is a one-line change to the mapping — but it would make interactiveods update+ "n" look like a failure to any wrapper.ods/Makefileand theintegration-smokejob intest-linux.yml; the workflow entry is the one that gates, since no workflow invokesmake test.