Extract updatecheck and improve sq version -v styling - #1235
Open
drluckyspin wants to merge 2 commits into
Open
drluckyspin wants to merge 2 commits into
drluckyspin wants to merge 2 commits into
Conversation
Move Homebrew formula fetch and cache into cli/updatecheck for sq version only. Highlight a newer release in verbose output with UpdateAvailable styling. No background fetch or interactive footer yet.
✅ Deploy Preview for sq-web canceled.
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved cache correctness issues and incomplete styling coverage remain.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
This PR extracts Homebrew version checking into cli/updatecheck and highlights newer releases in verbose sq version output.
Changes:
- Adds version fetching, parsing, caching, and normalization.
- Adds
UpdateAvailablestyling and related tests. - Updates command integration and changelog documentation.
Review findings:
cli/updatecheck/updatecheck.go— critical, 1 vote: use unique temporary cache files to avoid concurrent refresh conflicts.cli/updatecheck/updatecheck.go— moderate, 1 vote: enforce cache TTL when using offline fallback.cli/updatecheck/updatecheck.go— moderate, 1 vote: avoid reading a relative cache file when caching is disabled.cli/output/tablew/versionwriter_test.go— moderate, 1 vote: assert the latest-version value usesUpdateAvailablestyling.CHANGELOG.md— nit, 3 votes: correct the broken documentation link.
| File | Description |
|---|---|
cli/updatecheck/updatecheck.go |
Implements version fetching and caching. |
cli/updatecheck/updatecheck_test.go |
Tests parsing, normalization, and cache behavior. |
cli/output/tablew/versionwriter.go |
Applies styling to newer versions. |
cli/output/tablew/versionwriter_test.go |
Tests version styling. |
cli/output/printing.go |
Adds update-available styling. |
cli/internal_test.go |
Removes obsolete test exports. |
cli/cmd_version.go |
Uses the new update-check package. |
cli/cmd_version_test.go |
Retains version command tests. |
CHANGELOG.md |
Documents the update. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Use CreateTemp for atomic cache writes, skip cache reads when cacheDir is empty, honor TTL on offline fallback, fix CHANGELOG sq version URL, and assert UpdateAvailable styling in the version writer test.
Collaborator
Author
|
Addressed Copilot review in e36218d:
Tests and |
14 tasks
Collaborator
Author
|
Design for the footer half of this work is tracked in #1237. This PR is the agreed first step (extraction + |
This branch has not been deployed
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
Improve the visibility of availability of a new version for the user.
cli/updatecheck(used only bysq version).UpdateAvailablestyling for newer releases in verbosesq version -voutput.wip/update-footer-noticesafter design).Follows maintainer feedback on #864: land the small extraction first, then rework the footer against an agreed state/control model.
Test plan
go test ./cli/updatecheck/... ./cli/output/tablew/...go test ./cli/... -shortmake lintsq version -von a machine with network (shows latest version styling when newer release exists)