chore(cli): connect bound, audible cache writes, fetch-failure sweep - #185
Merged
Conversation
Three independent hygiene fixes ahead of the club-resolver chain (#180). #182: CLI dispatch and use-club's verify probe now provision HttpClientLayer.live instead of Client.default, inheriting the shared transport's connectionTimeout(10s). A black-holed server fails connect natively at 10s instead of parking a fiber on zio-http's unbounded 30s default. Bounding connect at the Netty layer (below ZIO interruption) sidesteps the uninterruptible-unwind problem and, unlike a blanket request timeout, leaves slow synchronous calls (a large blacklist add) and the streaming follows untouched. #181: club add / club remove repopulate the completion cache through a reported write; an unwritable cache dir is now named on stderr instead of failing silently forever. Never changes the exit code. The write is a better signal than the old invalidate here (deleting an absent file succeeds, so a failed delete can't detect an unwritable dir). #184: sweep api_fetch_failure on startup behind a new FetchFailureRetentionDays app_setting (30d), chained after the cache sweep. deleteBefore had zero callers, so the failure audit trail grew unbounded (404 bodies embed the requested slug, defeating SHA-256 dedup). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eZg53up5PrYiMgukmc65Q
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.
Three independent hygiene fixes — the cheap wins sequenced ahead of the club-resolver chain (#180). All on one PR since they're small and share
Dispatcher.scala.#182 — CLI connect bound
Dispatch and
use-club's verify probe provisioned stockClient.default, whose connect is unbounded (zio-http's 30s default), so a black-holed/misconfiguredapi_urlhung the CLI for 30s before any message. Both sites now provisionHttpClientLayer.live— the repo's shared transport, which already setsconnectionTimeout(10s). Bounding connect at the Netty layer (below ZIO interruption) sidesteps the uninterruptible-unwind problem a ZIO-level.timeouthits, and — unlike a blanket request timeout — leaves legitimately-slow synchronous calls (a largeblacklistadd) and the streaming follows (logs, job follow) untouched. This also makesHttpClientLayer's scaladoc claim ("used at every provisioning site") finally true.#181 — audible completion-cache writes
club add/club removenow repopulate the completion cache through a reported write: an unwritable cache dir is named on stderr instead of failing silently forever. Never changes the exit code (a broken completion cache is not a failed command). The write is a better signal than the oldinvalidatehere — deleting an absent file succeeds, so a failed delete can't detect an unwritable dir, which is exactly the issue's repro. A fetch failure stays silent (the preceding server call just succeeded, so a managed-set fetch blip is not a cache-dir problem).#184 — sweep
api_fetch_failureon startupApiFetchFailure.deleteBeforehad zero callers, so the failure audit trail grew unbounded — 404 bodies embed the requested slug, defeating SHA-256 dedup, and orphan bodies are pinned byON DELETE RESTRICT. Now swept on the same startup pass as the cache, behind a new DB-ownedFetchFailureRetentionDaysapp_setting (default 30d).deleteBeforealready chainsdeleteOrphansand has orphan-cleanup test coverage.Testing
AppSetting.alliterates generically, so the new key is auto-covered byTestAppSettingSql.Closes #182
Closes #181
Closes #184
🤖 Generated with Claude Code
https://claude.ai/code/session_017eZg53up5PrYiMgukmc65Q