Skip to content

fix(selfupdate): add HTTP timeouts and replace fragile JSON parser#133

Merged
larkly merged 1 commit intomainfrom
fix/selfupdate-timeouts-and-quality
Apr 2, 2026
Merged

fix(selfupdate): add HTTP timeouts and replace fragile JSON parser#133
larkly merged 1 commit intomainfrom
fix/selfupdate-timeouts-and-quality

Conversation

@larkly
Copy link
Copy Markdown
Owner

@larkly larkly commented Apr 2, 2026

Summary

  • Add HTTP timeouts and context.Context propagation to all self-update requests — 30s for API metadata, 5min for binary downloads. Previously the app would hang indefinitely if GitHub was unreachable.
  • Replace hand-rolled jsonString/jsonArray helpers (naive strings.Index matching that could return wrong results) with encoding/json struct unmarshaling.
  • Deduplicate styles.go — colors and styles are now defined once via init() + RebuildStyles() instead of being duplicated in var init blocks and RebuildStyles().
  • Document modal overlay mutual-exclusion invariant in render.go.

Test plan

  • go test ./... — all 15 suites pass
  • go vet ./... — clean
  • go build ./cmd/lazystack — builds successfully
  • Manual: lazystack --update with network disconnected should fail quickly with timeout error instead of hanging
  • Manual: verify UI colors render correctly (styles init change)

Self-update HTTP requests had no timeouts — if GitHub was unreachable
the app would hang indefinitely. Add context.Context propagation with
30s timeout for API requests and 5min timeout for binary downloads.

Replace hand-rolled jsonString/jsonArray helpers (naive strings.Index
matching) with encoding/json struct unmarshaling. Deduplicate styles.go
by using init() + RebuildStyles() as single source of truth.
@larkly larkly merged commit cdb0235 into main Apr 2, 2026
0 of 2 checks passed
@larkly larkly deleted the fix/selfupdate-timeouts-and-quality branch April 2, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant