feat(update): smoke-test new binary and print from/to versions #40

Merged
David merged 1 commit from feat/update-verify-by-running into main 2026-05-15 13:18:42 +02:00
Owner

Summary

  • yt update previously ended with "Run yt --version to confirm." which pushed the smoke test onto the user. This PR has the command actually spawn <new-binary> --version itself; if the spawn fails, exits non-zero, or returns empty stdout, the update is reported as failed instead of silently leaving the user with a broken binary (corrupt artifact, arch mismatch, missing shared lib, etc.).
  • Output now shows both versions so the user sees what changed: from: <CARGO_PKG_VERSION> (<git-hash>, built <date>) (baked into the running binary at build time) and to: <whatever the new binary's --version prints> (clap's yt prefix is stripped so the banners line up).
  • Three new tests cover the helper: real yt binary returns its banner, missing path errors on spawn, non-zero exit (/bin/false on Unix) errors with the exit status.
  • Checksum verification was already implemented (see verify_checksum in this file). No new YouTrack issue needed.

Test plan

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --all-targets (215 passed, +3 new)
  • Smoke test against a real release: yt update --force prints both FROM/TO lines and refuses to proceed if <bin> --version fails.
## Summary - `yt update` previously ended with "Run `yt --version` to confirm." which pushed the smoke test onto the user. This PR has the command actually spawn `<new-binary> --version` itself; if the spawn fails, exits non-zero, or returns empty stdout, the update is reported as failed instead of silently leaving the user with a broken binary (corrupt artifact, arch mismatch, missing shared lib, etc.). - Output now shows both versions so the user sees what changed: `from: <CARGO_PKG_VERSION> (<git-hash>, built <date>)` (baked into the running binary at build time) and `to: <whatever the new binary's --version prints>` (clap's `yt ` prefix is stripped so the banners line up). - Three new tests cover the helper: real `yt` binary returns its banner, missing path errors on spawn, non-zero exit (`/bin/false` on Unix) errors with the exit status. - Checksum verification was already implemented (see `verify_checksum` in this file). No new YouTrack issue needed. ## Test plan - [x] `cargo fmt --check` - [x] `cargo clippy --all-targets -- -D warnings` - [x] `cargo test --all-targets` (215 passed, +3 new) - [ ] Smoke test against a real release: `yt update --force` prints both FROM/TO lines and refuses to proceed if `<bin> --version` fails.
feat(update): smoke-test new binary and print from/to versions
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 18s
Create release / Create release from merged PR (pull_request) Has been skipped
c478cbf7cb
Replace the trailing "Run \`yt --version\` to confirm." with an actual `<new-binary> --version` spawn, then surface that output. Now `yt update` prints both the previous version (baked into the running binary via build.rs) and the version the swapped-in binary reports, so a stale-cache or arch-mismatch download fails loudly instead of silently leaving the user with a broken binary they have to test by hand.

Checksum verification was already in place: `verify_checksum` fetches `<url>.sha256`, SHA-256s the download, and refuses to install on mismatch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
David merged commit fc194c8b49 into main 2026-05-15 13:18:42 +02:00
David deleted branch feat/update-verify-by-running 2026-05-15 13:18:43 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pandoras-box/youtrack-cli!40
No description provided.