Skip to content

fix: skip update check (not just cache write) when config dir is absent (Bugbot #397) - #414

Merged
shujaatTracebloc merged 1 commit into
developfrom
fix/bugbot-updatecheck-throttle
Jul 27, 2026
Merged

fix: skip update check (not just cache write) when config dir is absent (Bugbot #397)#414
shujaatTracebloc merged 1 commit into
developfrom
fix/bugbot-updatecheck-throttle

Conversation

@shujaatTracebloc

@shujaatTracebloc shujaatTracebloc commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Resolves a Cursor Bugbot finding on the cli promotion PR (#397, develop → main) — a follow-up to #404.

Update check unthrottled without config dir (Medium)#404 correctly stopped writeUpdateCache from recreating a wiped ~/.tracebloc, but latestReleaseVersion still called fetchLatestRelease whenever the cache couldn't be read. On a fresh install (or after offboard) the config dir is absent, so the throttle cache can never be persisted — meaning every TTY command re-hit the GitHub releases API and could burn the full updateCheckTimeout, defeating the once-a-day throttle the failed-fetch path preserves elsewhere.

Fix (reconciles both #404 and this): a single configDirExists gate answers "can the update-check throttle be persisted?" and is now used by both sides:

The distinction the finding asked for:

  • dir absent → skip the fetch (return "").
  • dir present but cache stale/unreadable → falls through to the normal throttled fetch + persist, so the everyday path is untouched.

Coverage added (reusing the existing httptest + temp-TRACEBLOC_CONFIG_DIR scaffolding), no existing tests removed:

  • TestLatestReleaseVersion_MissingConfigDirSkipsNetwork — absent dir ⇒ no fetch attempted (test server errors if hit) and the dir is not created. Fails on the pre-fix code, passes with it.
  • TestLatestReleaseVersion_DirPresentNoCacheFetchesAndPersists — dir present, no cache ⇒ still fetches and persists the throttle (guards the normal path).

(#397 (comment))

Lands on develop; the promotion PR head picks it up on the next sync and Bugbot re-reviews.

🤖 Generated with Claude Code


Note

Low Risk
Best-effort CLI update nudge only; behavior is tighter throttling and no config-dir side effects, with new httptest coverage.

Overview
Fixes unthrottled GitHub release checks when ~/.tracebloc is missing (fresh install or after offboard). After #404 stopped writeUpdateCache from recreating the config dir, latestReleaseVersion could still call fetchLatestRelease on every TTY command because the throttle could never be saved—each run could hit the full updateCheckTimeout.

A shared configDirExists gate now answers whether the throttle can be persisted: latestReleaseVersion returns "" and skips the network when the dir is absent; writeUpdateCache uses the same helper (behavior unchanged from #404). When the dir exists but the cache is stale or missing, the normal once-per-day fetch and persist path is unchanged.

Tests cover absent-dir (no HTTP, dir not created) and dir-present-with-no-cache (fetch + cache write).

Reviewed by Cursor Bugbot for commit 214ca84. Bugbot is set up for automated code reviews on this repo. Configure here.

…nt (Bugbot #397)

#404 made writeUpdateCache refuse to recreate a wiped ~/.tracebloc, but
latestReleaseVersion still fetched from GitHub whenever the cache couldn't be
read. On a fresh install / after offboard the dir is absent, so the throttle can
never be persisted and every TTY command re-hit the releases API, burning
updateCheckTimeout each time.

Reconcile both: introduce configDirExists as the single "can the throttle be
persisted?" gate, used by writeUpdateCache (skip write — #404) AND
latestReleaseVersion (skip the network check entirely — #397) when the dir is
absent. A dir-present-but-stale/unreadable cache still falls through to the
normal throttled fetch, so the everyday path is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shujaatTracebloc shujaatTracebloc self-assigned this Jul 27, 2026
@shujaatTracebloc
shujaatTracebloc merged commit 19ea73f into develop Jul 27, 2026
24 checks passed
@shujaatTracebloc
shujaatTracebloc deleted the fix/bugbot-updatecheck-throttle branch July 27, 2026 08:48
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.

3 participants