Skip to content

comicbox doctor --online: verify each source's credentials live - #231

Merged
ajslater merged 1 commit into
developfrom
feature/doctor-online
Oct 4, 2026
Merged

ajslater merged 1 commit into
developfrom
feature/doctor-online

Conversation

@ajslater

@ajslater ajslater commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follows #230 (merged); rebased onto develop, so this is one commit.

comicbox doctor --online all (or --online metron,comicvine) sends exactly one request per configured source named, and that answer replaces the source's offline status:

  • OK: the rate-limit windows the request left (burst 19/20, daily 4999/5000 left)
  • MISCONFIGURED: rejected credentials (401/403, simyan AuthenticationError)
  • WARN: rate limited, or an answer without X-RateLimit-* headers (a proxy or bot check in front of Metron)
  • ERROR: anything else (network down, 5xx)

A configured source that isn't named keeps unverified: add --online all (1 API request). A source without credentials is never sent a request. --online keeps its required argument, so every hint says --online all.

How

  • New abstract OnlineSource.probe(), so each format package owns its cheapest call: Metron's series_type_list, and Comic Vine's one-row list_origins, whose bucket tagging never touches.
  • The probe builds a private, uncached client and closes it after. Neither a cached answer nor a shared session another caller built (codex, say) can stand in for the server's answer. This replaces the plan's "force cache off, then _close_shared_online_sessions()".
  • No with_retry: the doctor reports the first answer. Comic Vine skips the request when its local origins bucket is spent, because simyan would otherwise block for twice its timeout.
  • Probe traffic carries (cli; doctor) in the User-Agent.
  • ComicVineOnlineSource._build_session is split into _new_client(), so the probe shares client construction without the REFRESH unlink or cache maintenance.

Test plan

  • make fix, make lint, make ty
  • make test: 2390 passed, 1 skipped. The new tests fake the transport below requests, so mokkari's and simyan's own error handling runs for real: 200, 401, 403, 429/420, 5xx, connection error, header-less HTML, a spent local bucket, uncached and unshared clients, and the User-Agent.
  • Live: comicbox doctor --online all verified both real keys (one request each).

🤖 Generated with Claude Code

`comicbox doctor --online all` (or `--online metron,comicvine`) sends
exactly one request per configured source named and puts the answer on
that source's row: OK with the rate-limit windows it left, MISCONFIGURED
for rejected credentials, WARN for a rate limit, ERROR for anything else.
A configured source that isn't named keeps its offline row with
"unverified: add --online all (1 API request)"; one with no credentials
is never sent a request. --online keeps its required argument, as in a
run, so every hint says `--online all`.

Each source owns its cheapest call through a new abstract
OnlineSource.probe(): Metron's series_type_list, and Comic Vine's
one-row list_origins, whose bucket tagging never touches. The probe
builds a private client rather than the shared one, with no response
cache, so neither a cached answer nor a session another caller built
can stand in for the server's, and closes it after. It never goes
through with_retry, which can sleep for minutes on a rate limit, and
Comic Vine's skips the request when its local origins bucket is spent,
since simyan would block for twice its timeout waiting for a slot.

A response without X-RateLimit-* headers turns the row into a WARN
naming a proxy or bot check, read off the counter the existing response
hook already keeps. Probe traffic carries "(cli; doctor)" in the
User-Agent so Metron's operators can tell it from tagging.

ComicVineOnlineSource._build_session is split so the probe shares its
client construction without the REFRESH unlink or cache maintenance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ajslater
ajslater force-pushed the feature/doctor-online branch from 8f0d03e to c5ff53c Compare October 4, 2026 03:00
@ajslater
ajslater merged commit e1b1e6d into develop Oct 4, 2026
7 checks passed
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