Repository navigation
Adapt to comicbox 5.3.x: doctor tab, probe() credentials, ask match mode - #968
Merged
Merged
Conversation
…edentials comicbox 5.3.0 ships a doctor (run_checks) that reports whether the host can read each archive format, has the image codecs cover matching needs, and whether its config and package pins are in order, with a fix per problem. Codex now runs it: problems are logged once at startup after loguru is up, GET /api/v4/admin/doctor serves the rows, and the admin Jobs tab ends with a Doctor section with a Re-check button. The Online section is left out because codex keeps credentials in its own database and checks them on the Tagging tab. The Docker final stage runs `comicbox doctor -q` as its smoke test, which proves unrar extracts, pymupdf loads and every pin is satisfied. The scanner no longer drops .cbr or .pdf when comicbox says the tool is missing. The poller's database snapshot lists every row, so an excluded suffix made every existing CBR or PDF row look deleted the day unrar broke, and 5.3.0's probe test-extracts a member, which fails on more hosts than the path check it replaced. Suffixes derive from FileTypeEnum, shared with the janitor; an unreadable archive fails its import with comicbox's reason. The credential validator uses OnlineSource.probe() instead of hand-rolled mokkari and simyan calls: Metron's goes through comicbox's rate gate and Comic Vine's counts against the real shared bucket. Adopting it exposed that _build_credentials passed an unset Metron key as "", which mokkari turns into a blank Bearer header that replaces the username and password, so legacy logins failed on every real run while the old validator passed them. Unset fields are now None. Also: the chosen-match replay passes codex's online config so it reads the cache the search filled; the reader imports pdffile lazily behind is_pdf_supported() so a broken pymupdf disables PDFs instead of failing server start, as comicbox does; str() of a StrEnum MatchMode is its value. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Move the Doctor section from the Jobs tab to the top of the Stats tab, above the Platform readout it extends: Jobs is for actions, and an admin asking what this install is goes to Stats. codex/doctor is now a package. checks.py adds a "Codex" section of rows, in comicbox's row shape so the panel and the startup log treat them alike: - database: SQLite version, FTS5 (proved with a temp virtual table, since not every build records compile options) and the journal mode in effect. - config dir: writable, with free space; warns under 1 GiB, since the database, backups, logs and cover cache all grow there. - one row per library: missing, the unmounted docker volume sentinel, unreadable, not writable unless read only, or empty. - watcher: Folder rows under event-enabled libraries against the kernel's inotify watch limit on Linux, with a sysctl to run on the host. - credentials: the stored tagging credentials read raw through Cast so the field's converter cannot hand back ciphertext, decrypted with the live key; a changed key file is otherwise invisible until a run fails. The view runs the report through channels' database_sync_to_async now that it queries the database. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The report opened the Stats tab, which is the telemetry preview; a health report deserves a page of its own. Doctor is the last tab in the bar, at /admin/doctor. The heading is the verdict, "No problems" or "N problems", coloured by it, with the host line under it and Re-check on the right, so the one thing an admin came to read is the first thing on the page. The Stats tab is as it was. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
comicbox 5.3.1 accepts MatchMode.ASK from a session that has a prompt handler or defers its prompts, which codex always supplies. Ask auto-writes nothing and prompts for every match: review everything. The match modes now derive from comicbox's enum instead of a hand-written copy, on the model (migration 0056 adds ask to the choices) and in the UI choices. The start endpoint validates the mode with a ChoiceField, so a bad one is a 400 here rather than an error inside the librarian. The launcher and the Tagging tab describe Ask in their hints. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The report carried codex's checks as one more section among comicbox's. They answer different questions, so the report now keeps them apart: DoctorReport holds comicbox's rows and codex's rows as two tuples, the API returns them as two lists, and the tab renders each under its own heading, comicbox's grouped by section and codex's flat. The table is its own component so both headings share one look. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`make ty` runs apart from `make lint`, and 25 diagnostics had collected, all in code untouched by this branch. Most sit on lines that already waive the matching pyright rule for the same django-stubs gap (implicit `<fk>_id` attributes, nullable foreign keys, reverse relations), so they gain the ty twin. Two are real fixes: the foreign-key query built its field list with filter(bool, ...), whose signature widens the elements to object, which values_list refuses; a comprehension keeps the type. The stats view's permission override cannot satisfy both checkers from a class that inherits DRF's instance-variable declaration and the admin mixin's ClassVar, so it waives ty's override rule and says why. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Summary
Adapts codex to comicbox 5.3.0 and 5.3.1 and takes up what they added.
Doctor tab
codex/doctorwraps comicbox 5.3'srun_checks()(archive tools, PDF, Pillow codecs, comicbox config, package pins) and adds a Codex section: SQLite version, FTS5 and journal mode; config dir free space; one row per library root (missing, unmounted Docker sentinel, unreadable, not writable unless read only, empty); the event watcher's folder count against the Linux inotify limit; and whether the stored tagging credentials still decrypt with the key file.GET /api/v4/admin/doctorreturns comicbox's rows and codex's apart; a new admin Doctor tab renders them under their own headings with the verdict as the page heading and a Re-check button. Problems are also logged once at startup, after loguru is configured.comicbox doctor -qas its smoke test (not exercised in an image build here; CI builds that stage only on deploy).Scanner keeps every suffix
The scan used to drop
.cbrand.pdfwhen comicbox said the tool was missing. The poller's database snapshot lists every row, so an excluded suffix made every existing CBR or PDF row look deleted the day unrar broke, and 5.3.0's probe test-extracts a member, which fails on more hosts than the path check it replaced. Suffixes now derive fromFileTypeEnum, shared with the janitor; an unreadable archive fails its import with comicbox's reason.Credentials
OnlineSource.probe()instead of hand-rolled mokkari and simyan calls; Metron's goes through comicbox's rate gate and Comic Vine's counts against the real shared bucket._build_credentialspassed an unset Metron key as"". mokkari sends a blank Bearer header for any token that is notNone, replacing the username and password, so legacy logins failed on every real run while the old validator passed them. Unset fields are nowNone.comicbox 5.3.1: Ask match mode
comicbox[pdf]~=5.3.1, whose session acceptsMatchMode.ASKwith a prompt handler (Accept MatchMode.ASK in OnlineSession when prompts can be resolved comicbox#237).ask) and in the UI choices, so Ask, which prompts for every match, is offered in the admin default, the launcher and the start endpoint. The start endpoint now validates the mode.Smaller
is_pdf_supported(), so a broken pymupdf disables PDFs instead of failing server start, as comicbox does.make tywas clean of 25 pre-existing diagnostics: ty ignore twins beside existing pyright ignores, onefilter(bool, ...)→ comprehension, one documented waiver on the stats view's permission override.Review notes
Verification
make lint,make ty: clean🤖 Generated with Claude Code