fix: skip update check on local builds - #1706
Conversation
floatpanebot
left a comment
There was a problem hiding this comment.
Hi @alejodelosrios! Please fix the following issues with your PR:
- Body: Missing the
## What?or## Why?headings required by the PR template.
Benchmark report — no significant changeMetrics worse: 0 · better: 0 (threshold: ±3%). benchstat outputauto-generated by benchmarks.yml |
Formatting issues have been resolved. Thank you!
|
Verified the sandbox case manually, since it's the part worth being sure about. Same binary, same network, seconds apart — the only difference is one environment The screenshot below is the second command (my locale is The two table cases |

What?
checkForUpdatesCmdandcheckForV1RCCmdnow return early on a local development build — an unstamped binary running outside any package sandbox. Snap and Flatpak builds are explicitly left untouched.Why?
versiondefaults to"dev"(main.go:67), andmake build/go run .build without ldflags (Makefile:25-26), so a source build is unstamped.detectInstalledVersion()then reports something that is never the running binary:"dev", which never equals the latest release tag.Either way the notice fires on every source build, e.g.
Update available: 0.44.0 (installed: dev).The docs already frame source builds as contributor territory: "Building from source is not recommended for most users… Only proceed if you… want to contribute to the project or need a custom build" (docs/docs/installation.md).
Why the guard needs two conditions, not one
Testing
version == "dev"alone would regress released builds.snapcraft.yamlandcom.floatpane.matcha.yamlboth build without ldflags, so snap and flatpak binaries are also unstamped — and those are managed by the update path (trySnapRefresh,tryFlatpakUpdate). Their runtimes always injectSNAPandFLATPAK_ID, so the guard uses that to distinguish a packaged build from a local one.make build/go run .make installThis mirrors an existing pattern:
view/html.go:76-78already usesos.Getenv(...) != ""in production to detect the runtime environment.Tests
Table-driven coverage of all seven cases, including
unstamped snap buildandunstamped flatpak build. Removing the sandbox condition fails exactly those two.make lint,make testandgo test -raceare clean.Known limitation
A developer running
go run .from the terminal of a packaged editor (VS Code snap, or VS Code / GNOME Builder on Flatpak) inherits the editor'sSNAP/FLATPAK_IDand will still see the notice. This fails conservative — showing the notice, not hiding it.Not included
snapcraft.yamland the Flatpak manifest not stampingmain.versionis a real bug on its own (a released snap reportsdev), but it is a separate logical change. Happy to open it as a follow-up.