detached d53fbf4

fix(changelog): strip commit/date suffix from version strings

Version strings like '0.1.12 (25b2bd4, ...)' were used as-is for GitHub API lookups and comparisons, causing changelog to never show. Now strips to semver only.
commit
d53fbf4f2d0eeba8db3a130e73630adfcc00c75d
author
patriceckhart · · 2026-04-25 15:50 UTC
parent
25b2bd4
signature
unsigned
refs
tag: v0.1.13
1 file · +16 -6
M internal/agent/changelog.go +16 -6
@@ -26,7 +26,17 @@ type ChangelogInfo struct {
2626 //
2727 // Honours $GITHUB_TOKEN for private-repo access. Times out at 4s so
2828 // startup never blocks on a flaky network.
29+// semverOnly strips commit hash and date suffixes from version strings
30+// like "0.1.12 (25b2bd4, 2026-04-25T09:25:45Z)" to get just "0.1.12".
31+func semverOnly(v string) string {
32+ if i := strings.IndexByte(v, ' '); i > 0 {
33+ return v[:i]
34+ }
35+ return v
36+}
37+
2938 func FetchChangelog(ctx context.Context, version string) (ChangelogInfo, error) {
39+ version = semverOnly(version)
3040 if version == "" || version == "dev" {
3141 return ChangelogInfo{}, nil
3242 }
@@ -153,30 +163,29 @@ func FetchChangelogAsync(version string) <-chan ChangelogInfo {
153163 // the first-ever launch (no LastChangelogShown stored — we don't
154164 // dump release notes at someone who just installed).
155165 func ShouldShowChangelog(currentVersion string, cfg Config) bool {
166+ currentVersion = semverOnly(currentVersion)
156167 if currentVersion == "" || currentVersion == "dev" {
157168 return false
158169 }
159170 if cfg.LastChangelogShown == "" {
160171 return false
161172 }
162- // For local builds (0.0.0), always proceed to the fetch step.
163- // The caller compares the fetched release version against
164- // LastChangelogShown to decide whether to actually show.
165173 if currentVersion == "0.0.0" {
166174 return true
167175 }
168- return cfg.LastChangelogShown != currentVersion
176+ return semverOnly(cfg.LastChangelogShown) != currentVersion
169177 }
170178
171179 // MarkChangelogShown persists the version whose changelog the user
172180 // just dismissed. Idempotent; safe to call when the dialog wasn't
173181 // actually shown (e.g. fetch failed) so we don't keep retrying.
174182 func MarkChangelogShown(version string) error {
183+ v := semverOnly(version)
175184 cfg, _ := LoadConfig()
176- if cfg.LastChangelogShown == version {
185+ if semverOnly(cfg.LastChangelogShown) == v {
177186 return nil
178187 }
179- cfg.LastChangelogShown = version
188+ cfg.LastChangelogShown = v
180189 return SaveConfig(cfg)
181190 }
182191
@@ -185,6 +194,7 @@ func MarkChangelogShown(version string) error {
185194 // correctly trigger the dialog while THIS launch (which is also
186195 // "first-ever") doesn't.
187196 func SeedChangelogVersion(version string) {
197+ version = semverOnly(version)
188198 if version == "" || version == "dev" {
189199 return
190200 }
@@ -26,7 +26,17 @@ type ChangelogInfo struct {
26 //26 //
27 // Honours $GITHUB_TOKEN for private-repo access. Times out at 4s so27 // Honours $GITHUB_TOKEN for private-repo access. Times out at 4s so
28 // startup never blocks on a flaky network.28 // startup never blocks on a flaky network.
29+// semverOnly strips commit hash and date suffixes from version strings
30+// like "0.1.12 (25b2bd4, 2026-04-25T09:25:45Z)" to get just "0.1.12".
31+func semverOnly(v string) string {
32+ if i := strings.IndexByte(v, ' '); i > 0 {
33+ return v[:i]
34+ }
35+ return v
36+}
37+
29 func FetchChangelog(ctx context.Context, version string) (ChangelogInfo, error) {38 func FetchChangelog(ctx context.Context, version string) (ChangelogInfo, error) {
39+ version = semverOnly(version)
30 if version == "" || version == "dev" {40 if version == "" || version == "dev" {
31 return ChangelogInfo{}, nil41 return ChangelogInfo{}, nil
32 }42 }
@@ -153,30 +163,29 @@ func FetchChangelogAsync(version string) <-chan ChangelogInfo {
153 // the first-ever launch (no LastChangelogShown stored — we don't163 // the first-ever launch (no LastChangelogShown stored — we don't
154 // dump release notes at someone who just installed).164 // dump release notes at someone who just installed).
155 func ShouldShowChangelog(currentVersion string, cfg Config) bool {165 func ShouldShowChangelog(currentVersion string, cfg Config) bool {
166+ currentVersion = semverOnly(currentVersion)
156 if currentVersion == "" || currentVersion == "dev" {167 if currentVersion == "" || currentVersion == "dev" {
157 return false168 return false
158 }169 }
159 if cfg.LastChangelogShown == "" {170 if cfg.LastChangelogShown == "" {
160 return false171 return false
161 }172 }
162- // For local builds (0.0.0), always proceed to the fetch step.
163- // The caller compares the fetched release version against
164- // LastChangelogShown to decide whether to actually show.
165 if currentVersion == "0.0.0" {173 if currentVersion == "0.0.0" {
166 return true174 return true
167 }175 }
168- return cfg.LastChangelogShown != currentVersion176+ return semverOnly(cfg.LastChangelogShown) != currentVersion
169 }177 }
170 178
171 // MarkChangelogShown persists the version whose changelog the user179 // MarkChangelogShown persists the version whose changelog the user
172 // just dismissed. Idempotent; safe to call when the dialog wasn't180 // just dismissed. Idempotent; safe to call when the dialog wasn't
173 // actually shown (e.g. fetch failed) so we don't keep retrying.181 // actually shown (e.g. fetch failed) so we don't keep retrying.
174 func MarkChangelogShown(version string) error {182 func MarkChangelogShown(version string) error {
183+ v := semverOnly(version)
175 cfg, _ := LoadConfig()184 cfg, _ := LoadConfig()
176- if cfg.LastChangelogShown == version {185+ if semverOnly(cfg.LastChangelogShown) == v {
177 return nil186 return nil
178 }187 }
179- cfg.LastChangelogShown = version188+ cfg.LastChangelogShown = v
180 return SaveConfig(cfg)189 return SaveConfig(cfg)
181 }190 }
182 191
@@ -185,6 +194,7 @@ func MarkChangelogShown(version string) error {
185 // correctly trigger the dialog while THIS launch (which is also194 // correctly trigger the dialog while THIS launch (which is also
186 // "first-ever") doesn't.195 // "first-ever") doesn't.
187 func SeedChangelogVersion(version string) {196 func SeedChangelogVersion(version string) {
197+ version = semverOnly(version)
188 if version == "" || version == "dev" {198 if version == "" || version == "dev" {
189 return199 return
190 }200 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close