Repository navigation
Conversation
Django 6.1 deprecates the discrete EMAIL_* connection settings (RemovedInDjango70Warning at django.setup()), and defining MAILERS makes reading the old names an AttributeError. - Replace the eight deprecated settings with an EMAIL_CONNECTION_OPTIONS dict (TOML/env layer, keyed by EmailBackend constructor kwarg) plus a MAILERS declaration pointing at the DB-aware DBEmailBackend. - get_email_connection_kwargs / get_email_from_address coalesce the EmailSettings DB row over EMAIL_CONNECTION_OPTIONS instead of the removed settings. - DBEmailBackend defaults its mailer alias so direct construction never hits the SMTP parent's pre-MAILERS settings fallback. - The admin test-send view builds the backend directly and calls send_messages(), dropping deprecated get_connection() and EmailMessage(connection=...). - Tests override MAILERS + EMAIL_CONNECTION_OPTIONS instead of EMAIL_BACKEND/EMAIL_HOST. Claude-Session: https://claude.ai/code/session_01Bqa2ULBSaSVDwDSMEni1hf Co-authored-by: Claude <noreply@anthropic.com>
#817) The build >= 952 floor was built on a wrong premise: Panels build numbers interleave across platforms. Real iOS builds run lower than the macOS build - 942 (reported in the field) and 950 (issue #810's reporter) both render facets natively, while macOS 951 does not - so no floor can separate them, and 952 shut real iOS users out of facets, handing them the fake nav folder sort instead. Replace FACET_SUPPORT_MIN_BUILD with FACET_BLIND_BUILDS, a per-client frozenset of known facet-blind builds (Panels: {951}). use_facets now refuses only those builds; every other build - unknown and unparseable ones included - gets facets, which is the pre-gate behavior that worked on iOS. A future facet-blind macOS build must be added to the set as discovered; until then it receives facets it ignores, the pre-gate status quo. The iOS test constant moves to the field-reported build 942, an unparseable-build UA joins the facet-capable cases to pin the facets-by-default behavior, and the macOS 951 test still asserts the nav folder fallback. The 942 and unparseable cases fail under the old floor gate and pass under the denylist. Claude-Session: https://claude.ai/code/session_01MAYYLr3w4xZJA1StYH2WwN Co-authored-by: Claude <noreply@anthropic.com>
Writing tags to a CBR converts it to CBZ (comicbox repacks unwritable archives) and, with delete_original, removes the .cbr. The rename pass then opened the dead .cbr path and failed with 'does not exist', and the comic's row stayed pointed at the removed file. The converted CBZ is a new inode, so neither the watcher's nor the poller's inode move detection could ever pair old to new: the row was deleted and recreated as a fresh comic, losing bookmarks. Consume comicbox 4.8.5's WriteResult.final_path so the writer knows where each archive ended up. The rename pass now chases the written file to its post-conversion path, and a new conversion-aware DB sync replaces the split rename/unwatched-reimport enqueues: a delete_original conversion is recorded as a targeted move — for watched libraries too, since the watcher cannot pair it; its later add/delete events reconcile against the already-moved row. Conversions that keep the original leave the row alone and report the new CBZ as a created file. Pure renames and in-place writes keep their existing watcher-aware behavior. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
#822) * update deps * fix(tagging): follow CBR->CBZ conversion through rename and DB sync Writing tags to a CBR converts it to CBZ (comicbox repacks unwritable archives) and, with delete_original, removes the .cbr. The rename pass then opened the dead .cbr path and failed with 'does not exist', and the comic's row stayed pointed at the removed file. The converted CBZ is a new inode, so neither the watcher's nor the poller's inode move detection could ever pair old to new: the row was deleted and recreated as a fresh comic, losing bookmarks. Consume comicbox 4.8.5's WriteResult.final_path so the writer knows where each archive ended up. The rename pass now chases the written file to its post-conversion path, and a new conversion-aware DB sync replaces the split rename/unwatched-reimport enqueues: a delete_original conversion is recorded as a targeted move — for watched libraries too, since the watcher cannot pair it; its later add/delete events reconcile against the already-moved row. Conversions that keep the original leave the row alone and report the new CBZ as a created file. Pure renames and in-place writes keep their existing watcher-aware behavior. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(tagging): record watched-library renames instead of inferring them A rename in a watched library enqueued nothing, on the premise that the watcher's inode pairing would detect the move on its own. That premise does not hold for PDFs. pdffile's save() writes a temp file and replace()s it over the original, so an "in-place" PDF tag write leaves a new inode at the same path. The following rename then reaches the watcher as an unpairable delete+add — detect_moves compares the row's stale stored inode against the renamed file's fresh one — and the Comic row is deleted and recreated, losing bookmarks and read state. Even a same-inode archive goes unpaired when its delete and add land in different watcher batches. Enqueue the targeted move for watched libraries too. Codex performed the rename; it should state the move rather than leave the watcher to re-derive it from inodes. Scoping this to PDFs by file_type would freeze a snapshot of comicbox's per-format write strategy from another repo: its CBZ path patches the zip in place today, but is non-atomic, and an obvious future move to tmp+replace would silently reintroduce this bug. Duplicating a move the watcher does pair is safe: whichever copy lands second is dropped by _remove_file_move_collisions for an occupied destination, or matches no source row in _bulk_comics_move_prepare. As with a conversion, a watcher delete that lands first degrades to the old delete+recreate — never worse. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…batch (#823) A tag write that converts archives (CBR->CBZ with delete_original) records the conversion as one targeted move ImportTask enqueued when the whole batch finishes. A batch long enough to force a mid-batch watcher flush (60s of continuous activity) or to catch a poll gets that scan's task enqueued first, and ScribeThread's PriorityQueue breaks ties between equal priority ImportTasks by enqueue time. The scan ran first, deleted the comic rows by their now-dead paths -- cascading bookmarks away -- and left the move with no source row. Short writes were safe; only long ones lost data, which the conversion fix documented as best-effort. Register every path a pending move passes through (the DB source, the interim converted archive, the destination) in a process-local registry, and drop registered paths from a task's created/modified/deleted sets in init_apply, the importer's first phase. A task that carries the registered move reconciles it, so it releases the guard and is exempt from it; the exemption is computed from the task rather than from the release so an unappliable move cannot cost a task its own paths. Ordering stops mattering: the scan becomes a no-op for those paths whenever it runs, and this covers the poller as well as the watcher. Guarding creates matters as much as guarding deletes. Without a rename, the move's destination is the interim CBZ, and a scan that imported it first would leave the move to be dropped as a destination collision -- stranding the original row, bookmarks and all, on the dead path. Port the poller's _is_move_compatible file-type and size check into the watcher's inode move detection. A bulk conversion mass-frees CBR inodes while mass-creating CBZ files, so on an inode-reusing filesystem a new CBZ can be handed the inode a different comic's CBR just released, re-pathing one comic's row onto another comic's file. The size check is waived when the same batch also reports the source as written, which is the in-place write-then-rename flow whose stored size is legitimately stale. Since #822 codex states its own renames rather than leaving them to be paired, so the check now only gates moves inferred for third-party changes. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The online tagging status table showed a single Status and a single
Source per comic, which could not answer the question the admin actually
has during a two-source scan: which source is in which state. A comic
matched by Metron while Comic Vine sat out a rate limit read as one
"Matched" row with one source chip, and a source's rate-limit wait was
only visible in the strip above the table.
Replace both columns with one column per source the session selected, in
priority order, so each row reads across as that comic's per-source
state: Matched, Looking up, Waiting (rate limited), No match, Needs
review, User matched/skipped, or Error. A source the session did not
select gets no column at all; the columns are driven by batch.sources,
which the snapshot already carried and the frontend had never read.
comicbox already emits per-source events carrying both a path and a
source (SearchStarted, AutoWritten, NoMatch, Skipped, PromptDeferred);
OnlineTagOutcomeStats dropped all but two of them in its catch-all arm.
Fold them into source_status_by_path and ship it per row as
source_statuses, retiring won_sources, which only ever populated for
matched rows. FileFinished/FileError clear a still-searching cell, since
a search that raises is swallowed upstream without an event.
Waiting is projected rather than folded: it comes from the scan's
per-source retry deadlines, now sharing one predicate with the sources
strip so a source can never read as throttled in one place and free in
the other. User resolutions had to ride on the resolution record instead
— the prompt-apply path builds its session without an event hook — so
that record becomes {pk: {status, sources}}, merged per source because
merge-all-sources can raise a prompt from each source for one comic, and
the old last-write-wins shape dropped the first. Records written before
this change still overlay, without a source to attribute them to.
Cells with no recorded state describe themselves rather than showing a
bare em-dash: a first-wins source the scan never needed reads "Skipped"
(only when the row has real cells and merge-all is off, so it cannot
claim a source ran when that is unknowable), an unreached source on the
in-flight comic reads "Queued", and every status carries a tooltip. The
dash remains only where the state is genuinely unknown, and says so.
The status vocabulary moves to its own dependency-free module: both the
event fold and the snapshot builder need it, and importing one from the
other closed a cycle. The three duplicated Metron Cloud / Comic Vine
label maps collapse into one shared module.
The same table made a pre-existing rate-limit bug user-visible, fixed
here too. Per-source retry deadlines were cleared wholesale whenever any
comic finished, on the theory that a result proves the wait is over --
but the deadlines belong to a source, not to a comic. Worse, nothing
cleared them at scan end: comicbox aborts its retry sleep on cancel, so
pausing mid-wait strands a deadline that is still in the future, and
run_session then freezes it into the snapshot the admin keeps looking
at. The paused table counted down and stuck on "retrying...", against a
scan running nothing.
Leave per-source deadlines alone on a per-comic result (they expire on
their own epoch, which readers already filter) and clear them in the
pass runner's finally, which runs before the frozen snapshot is
published. A source that reports an outcome releases its own deadline
early; SearchStarted deliberately does not, since it fires before the
request that hits the limit. An exhausted retry budget drops the
countdown instead of advertising a retry that will never come, and
deactivate_snapshot disarms the strip for the crash path that skips
every finally. The frontend renders no countdown on an inactive snapshot
regardless, covering snapshots cached by older versions.
Also fix an adjacent estimate bug in the same function: the stalled eta
omitted merge_all_sources, so under merge-all the time remaining shrank
the moment a rate limit fired and jumped back on the next result.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
# Conflicts: # NEWS.md # codex/librarian/scribe/tag_writer.py # tests/test_tag_writer_rename.py
The tag editor had no inputs for four fields codex already stores on Comic and shows read-only. All four were missing from _CANONICAL_TO_EDITOR, the map FORMAT_FIELD_SUPPORT derives from and every input gates on: - date (year/month/day), offered by both write formats - country (ComicInfo), collection_title and alternative_issue (MetronInfo) Also drops a dead reading_direction entry that no transform offers a canonical key for; ComicInfo reaches it through manga. Composite keys follow the contract issue and community_rating already use: comicbox update mode replaces a top-level key wholesale, so every surviving part rides along whenever any part changes, a cleared part drops out of the replacement, and only a fully empty value emits a delete key. buildPatch bounds the date parts because nothing gates Save on the field rules and comicbox writes any year it is handed into a positive small int column. Fixes country and language seeding while here: their serializers map alpha-2 to the long English name, but the choice lists are keyed by the code comicbox writes, so the current value matched no item and re-picking it flipped the panel dirty for a no-op edit. Known, and shared with the other composite keys: a MetronInfo StoreDate does not survive a date edit (comicbox rederives cover_date but never store_date, and codex keeps no column to resend it), and a multi-comic date edit erases parts that differ across the selection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Comic column carries width 100% so the filename fills every spare pixel before truncating, which squeezed the per-source status columns down to their narrowest word and stacked "Metron" over "Cloud" in the header even on a viewport with room to spare. Mark those columns nowrap so their full header text counts toward their intrinsic width. Comic yields the space back and truncates its filename instead, which is what its max-width:0 ellipsis already exists to do. Use Vuetify's own column property rather than a custom rule: it styles the header and body cells consistently and needs no :deep() selector competing with the vuetify-components cascade layer. Its rule pairs nowrap with an ellipsis, so a viewport too narrow for the full name clips it rather than ever stacking it again. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The tagging cache these tests exercise is the running install's, not a fixture of their own: pytest sets no CODEX_CONFIG_DIR, so caches["tagging"] resolves to config/cache/tagging. The autouse fixture cleared the prompt, resolution and resume keys but never the snapshot, so the deactivate test left its fixture behind — and the admin Tagging tab rendered it as a phantom paused session with two queued comics that Resume answered 400, because the fixture had cleared the resume descriptor it needed. Clear the snapshot on both sides of the fixture with the rest. A full test run now leaves every tagging key empty.
Resume needs the stored descriptor naming the comics a scan never reached and the settings to re-run them with, but the status table offered its button on the snapshot's own resumable flag, which reports only that comics were left unprocessed. The two are independent keys and can disagree: run_session cleared the descriptor as its first act and left the next publish to rewrite it, yet the first publish is throttled four seconds, so a daemon killed in that window left a snapshot full of queued comics with nothing to resume from. The button then answered 400. Record the batch's remainder up front instead of merely clearing the prior one, which overwriting does anyway; each publish narrows it as comics finish, and a normal finish empties it. Derive resumable at read time from the descriptor actually being there, so a session that cannot resume reads as finished rather than advertising a button that fails. The failure was also silent -- the click reset a flag and swallowed the error, so nothing reached the admin. Report pause and resume failures through the common store's snackbar, as the tag launcher already does. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ng (#824) * fix(tagging): rename archives with their own file extension ``ext`` is a metadata field, not the file's suffix, and codex's read config deletes it — so comicfn2dict fell back to its "cbz" default and every PDF/CBR/CBT/CB7 was renamed to a name claiming to be a zip. The admin preview showed the same wrong name. Codex now performs the rename itself. Comicbox's ``rename_file`` derives its own destination and cannot be handed a corrected target, so owning the move is what makes the suffix correctable. A rendered name that is nothing but an extension would create a hidden file, so it is treated as no name at all. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(watcher): match path prefixes on directory boundaries Both the deleted-directory expansion and the library attributor compared bare string prefixes, so any two paths where one name merely began with the other were treated as parent and child. Deleting a watched folder therefore expanded into every sibling tree sharing its leading name — "Batman" collecting all of "Batman Beyond" — and those comics were deleted, with no paired add to rescue them and their bookmarks cascading away while the files were still on disk. The same bug filed a sibling library's events under whichever library happened to be a string prefix of it. Terminating each prefix with a separator restores the boundary. The library root itself still matches its own events. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(librarian): keep the scribe priority queue totally ordered Two ways a scribe task could raise TypeError inside the queue: ``SHUTDOWN_MSG`` was a bare int where every real item is a ``(priority, timestamp)`` tuple, so stopping the thread with any task still queued raised comparing int to tuple — aborting the daemon's shutdown loop before the remaining threads were ever told to stop. Equal priorities fell through to comparing the ScribeTask dataclasses, which define no ordering. Timestamps tie more readily than they look (they are truncated, and a clock can step backwards), and the loser was a task dropped in the routing thread. A monotonic counter now closes the tuple so two entries can never compare equal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(tagging): dedupe a merged online tag scan by path ``_merge_task`` tested each candidate path against ``path_to_pk``'s *values*, which are pks — a Path never equals an int, so the guard never excluded anything. Starting a second scan whose selection overlapped the running one (re-picking a folder to catch additions) queued every shared comic again: an inflated total, duplicate lookups against rate-limited sources, and a second write of the same file. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(importer): say what the filesystem settle timeout actually does The warning told the admin to poll again once copying finished, implying the task had been abandoned, but only ``init_apply`` returned early — the import ran on regardless, and skipped starting its statuses on the way out. Keep importing (abandoning the task would drop the events entirely on a watched library that isn't also polled) and describe that instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(news): rename, watcher prefix and queue fixes in v2.2.11 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(tagging): let comicbox rename, with the extension stated Supersedes the previous commit's approach. Taking the rename away from comicbox fixed the name but duplicated comicbox's job, broke the invariant that codex's collision pre-check targets the exact path ``rename_file`` will use, and would have been dead weight the moment comicbox renders the extension itself. The real defect is the input, not the renamer: ``ext`` is a metadata field, and the read config deletes it, so comicfn2dict fell back to its "cbz" default. Neither half of the fix works alone — un-deleting the key leaves it unset, and stating it under the read config gets it deleted after the merge — so renaming uses a config that keeps ``ext`` and states the archive's real suffix as metadata. That outranks any extension a third-party tagger embedded in the archive too. The admin preview derives its name the same way, so it can no longer promise a name the rename won't produce. Covered against a real archive (a CBT repacked from the example CBZ), since whether the rendered extension is right now depends on what codex hands comicbox — something the test double cannot exercise. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…cade (#825) * fix(watcher): re-read a file replaced in place instead of deleting it A tool that swaps a file by ``rm`` + ``mv``, and any watcher backend that reports an atomic replace as a delete plus an add, leaves both events in one batch. The recreated file carries a new inode, so move detection can never pair them, and dedup let the delete win: the row died, cascading its bookmarks and read progress, while a file sat at that very path. The comic then reappeared on the next scan as a new, unread one. It is the same path with new content, which is a modification. The poller already reached that conclusion by diffing snapshots; this makes the watcher agree. Custom covers are treated the same way. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(importer): never delete a comic whose file is still on disk Deleting a comic row cascades its bookmarks and read progress away, and nothing brings them back — the next scan re-imports the file as a fresh, unread comic. Yet both scanners *infer* deletes, and every inference has failure modes that name a path still sitting on disk: a watch batch that carries a delete whose paired add lands in the next batch, a directory expansion that overmatched, an inode pair the compatibility checks refused. So the delete phase now confirms each path against the filesystem and leaves anything still there for the next scan to reconcile. A stale row costs a re-read; a wrongly deleted one costs the user their place in the book. Comics, folders and custom covers all check. This cannot save a library whose whole mount vanished, where every path reads as missing, so a delete large enough to look like that logs where to go looking instead. Also fixes a browser staleness bug in the same phase: comics under a deleted folder die by cascade rather than by path, so they never reached the collection capture, and the series or publisher a folder delete emptied was never re-stamped — browsers kept listing comics that were gone. They were also counted as folders rather than comics. The move-guard test that asserted an unrelated comic still deletes left its file on disk, so its fixture now removes it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(news): delete backstop and replaced-file fixes in v2.2.11 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
) * feat(tagging): rename before writing, and sync the database inline Renaming used to happen after the write, and the database was told about it afterwards by an ``ImportTask`` queued behind whatever else the scribe was doing. Between those two moments the row pointed at a path that no longer existed, and any scan processed in the gap saw an unexplained delete plus create: it deleted the row and cascaded the comic's bookmarks and read progress away. Three rounds of fixes narrowed that gap without closing it, because the gap was the design. So the order is inverted. Each archive is renamed to the name comicbox predicts for it — with the pending patch overlaid, so the name reflects the tags about to be written — and every resulting move is applied to the database before ``write_tags`` returns, on the scribe's own thread. No scan can be processed while the two disagree. A stale delete then finds no row, and a stale create converges onto the row already at that path. A conversion still moves the file after the write, so it is synced the same way the moment the batch finishes. What stays queued is only the metadata re-read, which is safe precisely because it names a path the database already holds. Consequences: - Renaming is planned for the whole batch first, so two comics predicting one name, or a name already taken on disk or in the database, are reported instead of colliding. Both the interim and the post-conversion destination are checked, since comicbox refuses to convert onto an existing file and that refusal would land after the rename. - A move the database refuses puts the file back, so disk and database cannot diverge. - A second edit of the same comics now resolves the renamed paths, where before every write in it failed with "no such file". - Whether a library is watched no longer changes any of this. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(news): rename-first tag writes in v2.2.11 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor(importer): drop the tag-write move deferral The other half of the guard: the importer no longer holds back paths an in-flight tag write is moving through, because there is no longer a window in which to hold them. Moves are applied before ``write_tags`` returns, so any scan the importer processes is reconciling against a database that already agrees with the disk. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(watcher): don't delete a library that is only unmounted A dropped network share, an ejected volume, or a docker bind mount that didn't come up presents as an empty or missing directory rather than an error, so every comic in the library looks deleted at once. Acting on that removes every row and cascades away every bookmark and reading position in the library — for files that are perfectly fine and will be back as soon as the mount is. The poller has refused to scan a library in that state for a long time, by three separate checks. The watcher had none: it already holds the events, so it deleted. The delete phase's existence check can't help either, because while the mount is gone the files genuinely are unreachable. The watcher now consults the same checks before acting on any task that carries deletes. Adds and modifies are left alone; they can't destroy anything. Those checks move to ``codex.librarian.fs.mounted`` so both scanners share one definition of what a vanished library looks like, rather than one of them growing a defense the other never hears about. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(news): unmounted library guard in v2.2.11 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The rename work landed in stages, and each stage added its own entry, so three of them described the same guarantee from different distances: comics keeping their bookmarks through a rename. They are now one item that describes the behavior that actually shipped rather than the route taken to it. The two path-prefix fixes, which are the same mistake in two places, become one; so do the two ways codex could delete a comic whose file was still there. Two user-visible fixes were missing entirely: the online-tag Resume button no longer offers itself when it cannot work (and reports a failed pause or resume instead of silently doing nothing), and two comics that would take the same filename no longer overwrite each other. Thirteen items to eleven, each shorter. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Comics jumped Queued -> Matched in the admin tagging status table and never showed "Looking up", though the right rail did. A regression from 7716fc5, which replaced the single Status column -- whose template rendered the row-level in_flight with a spinner -- with per-source columns. A per-source in_flight cell could never be published: the fold set it on SearchStarted and cleared it on FileFinished, and comicbox emits the whole per-file sequence before tag_many yields, which was the only moment codex published. Every publish sampled the one instant when no lookup was recorded. Liveness is now a marker on the scan (SessionState.live) rather than a residue in the event history: set from comicbox's SourceStarted (4.8.7, which unlike SearchStarted also covers the explicit-id, stored-id and series-cache fast paths) and from codex's own stored-id prepass, cleared path-matched on FileFinished so a late event for a prior comic can't wipe the current one. build_snapshot elects the in-flight row by identity and projects one live cell onto it. The row is no longer guessed from path_to_pk position. tag_many re-sorts the batch by series fingerprint (series_batching defaults on), so that position never meant processing order -- harmless while the row rendered as "Queued" anyway, but not under a spinner claiming the comic is being looked up right now. No marker means no in-flight row, which is honest between comics and is exactly what Resume re-runs. The live publish rides its own clock and its own dedupe. It must not stamp _last_publish: that would throttle out the unforced result-boundary publish carrying the terminal status and the resume descriptor. It needs a time floor because comicbox answers a search from its on-disk HTTP cache when it can, so a re-scan fires events at CPU speed with nothing pacing them. And it is wholly guarded -- comicbox's _emit forwards unguarded and SourceStarted fires before the lookup's own try, so an escaping exception would land as a FileError and paint the comic ERROR in every column. A status display must not be able to corrupt an outcome. Snapshot changes now announce themselves on their own tag-session.snapshot message instead of riding task.progress, which fires for every librarian job and cost two other fetches per frame. The announcement lives in _publish_snapshot so every write is followed by exactly one notification, after the write rather than before it. Also fixes two stale-state bugs this made reachable: deactivate_snapshot could never repair a snapshot frozen inactive by a raised scan (its guard required active), and the snapshot view now demotes a snapshot whose scan is no longer the active one, closing the hard-kill window. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* update comicbox * fix(reader): 404 a page past the end instead of caching an empty 200 comicbox 5.2.2 made get_page_by_index() return None for an index past the last page; before, it raised StopIteration, which surfaced as a 500. The page view turned that None into b"" and served it as a 200 image/jpeg, and both page routes (v4 reader and OPDS) mark 2xx responses public for a week, so clients kept the empty image. Raise NotFound on None instead. cache_control_2xx leaves 404s uncached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
"!docker/debian.sources" names a file that isn't there: the Dockerfile copies debian.sources from the context root, and there is no docker/ dir. It also sat before "docker*", which re-excluded it, since Docker lets the last matching line win. No pattern excludes dist, so "!dist" had nothing to re-include. buildx gives the same build context, 1261 files, with or without them. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…kaging (#965) * fix(deps): declare packaging, which codex.version imports codex/version.py has imported packaging.version since 446cab8 (v2.2.10), but packaging was never a dependency and nothing in the runtime closure pulls it in. Installs only worked where something else had dragged it in: the Docker image got it from the builder's pip/poetry tooling. A fresh `uv pip install codex==2.5.1` crashes on import with ModuleNotFoundError: No module named 'packaging'. An AST scan of every import under codex/ against a runtime-only venv finds nothing else missing (icecream and schema_graph are dev-guarded). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(docker): ship a uv.lock-pinned venv; drop builder and apt leftovers The final image was python-debian plus `COPY --from=wheel-installer /usr/local /usr/local`, which shipped the whole nikolaik builder: node, npm, uv, poetry and pipenv (~330 MB), and replaced python-debian's own interpreter and stdlib. - Runtime deps now install into /opt/codex, a venv on python-debian's interpreter, pinned from uv.lock via `uv export` instead of re-resolved from pyproject ranges. Only that venv is copied into final. PATH gets /opt/codex/bin so `docker exec codex python` still works. - The apt install of `ruamel.yaml.clib` was parsed as a regex and installed python3-ruamel.yaml.clib plus Debian's entire python3.13. The image codec libraries were dead weight too (the Pillow and PyYAML wheels bundle their own). final installs only curl, libstdc++6 and unrar. - Bytecode is compiled at install time instead of purged. The app runs as abc, which can't write .pyc files, so every process recompiled on import: `import codex.asgi` as abc drops from 3.3 s to 1.1 s. - pycountry's gettext locales and every non-English Django/allauth/DRF locale are removed: LANGUAGE_CODE is en-us and there is no LocaleMiddleware. - A build-time smoke import fails the build, not container start, on a broken venv. arm64 image: 1,380 MB -> 889 MB. Covers and first pages of a CBR, CBZ and PDF are byte-identical to the old image's. Both platforms build. tests/test_dockerfile.py pins the apt list, the no-regex-names rule, the venv-only copy and kept bytecode. .dockerignore now admits the Dockerfile so the test runs in the CI image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(covers): stop the cover pool on Python 3.12/3.13
`CoverCreateThread.stop()` called `ProcessPoolExecutor.terminate_workers()`,
which only exists on 3.14. On the declared 3.12 floor (and 3.13) stopping
the librarian raised AttributeError; a type-ignore hid it. Probe for the
method, and cancel pending futures in `shutdown()` so the older Pythons
still drop the queued tail.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(user_data): sqlite autocommit=True + explicit transaction()
The sidecar connection used legacy `isolation_level=None` autocommit, where
`with conn:` never issues BEGIN, so the schema + version stamp and
`_clear_sidecar`'s "single transaction" truncate were never transactions:
a failure part-way left a half-cleared sidecar. Switch to 3.12's
`autocommit=True` and run multi-statement writes through an explicit
BEGIN/COMMIT/ROLLBACK `transaction()`. Single-statement upsert/delete drop
their no-op `with conn:`. The backup's `VACUUM INTO` connection gets the
same kwarg swap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(importer): failed-import existence check compared a full path to basenames
`_query_failed_import_deletes` casefolded the whole path and compared it to
each sibling's casefolded basename, so it never matched: every untouched
failed import was marked missing and deleted after any import. Compare
basenames, case sensitively as the comment intends (`exists()` is case
insensitive on macOS).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(search): size suffixes and >=/<= operators were unreachable
Both lookup tables were matched in insertion order by the first
`endswith`/`startswith` hit. `b` came before `kb`, so `size:10kb` parsed
`10k` as a number and raised; `>` came before `>=`, so `>=5` became `>`
with the value `=5`. The search filter swallows the error and silently
drops the term. Put the longer keys first and strip the operator with
`removeprefix`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(opds): parse ISO dates with datetime.fromisoformat; drop undeclared dateutil
`dateutil` reached the OPDS v1 entry only transitively (via `dateparser`).
`datetime.fromisoformat` (3.11+) reads the ISO 8601 forms Django and SQLite
emit. A string input now takes the same UTC isoformat path as a datetime
instead of returning a bare datetime, so `updated`/`published` are honestly
`str | None`; naive values are read as UTC, as Django stores them. The
`types-python-dateutil` stubs go with the import.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(workers): asyncio.timeout in WorkerPool.stop
One `asyncio.timeout` around the drain loop replaces the hand-kept deadline
and per-iteration `wait_for`. A timeout mid-`get()` drops only the getter,
never a queued worker, as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: itertools.batched for manual slice-chunk loops
The 17 `for start in range(0, len(seq), N): batch = seq[start:start + N]`
loops become `for batch in batched(seq, N):`; abort-event guards stay first
in the body. `tuple(...)` wrappers that existed only to allow slicing go,
except where the snapshot or a type-ignore still earns its keep. Batches are
tuples, which every consumer (`__in` lookups, `in_bulk`, cursor params,
`len()`) already accepts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: Path.walk, is_relative_to, datetime.UTC, removeprefix, cache, frozen dataclasses
- watcher `expand_dir_added` walks with `Path.walk()` (3.12). Unfollowed
directory symlinks now land in `filenames` instead of `dirnames`; they
still yield no event unless named like a comic archive.
- `is_relative_to` replaces two try/`relative_to`/except ValueError probes.
- `datetime.UTC` replaces `ZoneInfo("UTC")`.
- `str.removeprefix` strips the ASGI root path.
- `functools.cache` for the zero-arg OPDS schema loaders.
- `BookmarkKey` is `frozen` (it already wrote through `object.__setattr__`
and keeps its explicit hash/eq); `_LastRouteKey` gains `slots`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(typing): PEP 695 generics, type statement, Self, enum containment
- `_coalesce[T]` and `timed_step[T]` replace `Any` round-trips.
- `cache_control_2xx` gains a `[**P, R: HttpResponseBase]` signature, the
codebase's first ParamSpec.
- `type Resolution = ...` for the online-tag answer tuple.
- `-> Self` on `ComicACL.for_user` and `SidecarStore.in_memory`.
- 3.12's `value in EnumClass` replaces three frozensets of member values.
Two of them gate telemetry buckets: the vocabularies are the same closed
Codex enums as before, so nothing new is collected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: dict union, monotonic clocks, f-strings
- `a | b` replaces `{**a, **b}` where both sides are plain dicts. The admin
URL action maps and the reader settings lookups keep the unpack literal:
DRF's invariant `dict[str, str | ViewSetAction]` parameter and the
base view's `FILTER_ARGS: Mapping` need the literal's inferred type.
- Durations time with `perf_counter()` and the import write-wait deadline
and mock-comic progress interval with `monotonic()`, so a wall-clock
step can't skew them. The importer keeps its wall-clock `start_time`
(stamped into the DB) and gains a `started` counter for the finish log.
- f-strings replace `+ str(...)` concatenation in model reprs and
`get_sort_name`, the last a PEP 701 nested-quote f-string.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: Notifications StrEnum; cached_property memo properties
`Notifications` becomes a `StrEnum` like `ChannelGroups` and
`WebsocketMessages`, dropping `.value` at all 28 sites. Members hash, compare,
pickle and `json.dumps` as their string values, so the notifier dedup, the
typed-payload lookup and the websocket wire format are unchanged.
27 hand-rolled `if self._x is None:` memo properties become
`functools.cached_property`, dropping their backing attributes and the
`__init__` lines (and four whole `__init__`s) that only seeded them:
- `params` on the browser view and its three load-only overrides;
`set_params` assigns the cached value directly.
- `model_collection` and its `BrowserView` override.
- `is_admin`, losing `init_is_admin` (only ever run from `__init__`).
- `user_agent_name`, `admin_flags` (the publications preview still shares
it by assignment), and the OPDS facet, validation, ordering, breadcrumb
and stats memos.
`OPDS2LinksView.num_pages` stays a plain property, reading the memoized
`collection_and_books`, because it overrides a property.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore: drop 59 vestigial from __future__ import annotations
12 codex and 47 test modules have no annotation that needs deferring: no
`TYPE_CHECKING`-only name and no forward reference in a runtime-evaluated
annotation. Each was checked by removing the import, running ruff
(TC004/F821) and importing the module on Python 3.12, where annotations are
still evaluated eagerly; the three perf scripts, which need the debug-only
silk stack to import, were checked statically. The other 42 modules keep the
import because ruff moved their annotation-only imports under
`TYPE_CHECKING`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore: pyproject deps/classifiers, reportImplicitOverride=error, docs state the floor
- Drop `tomli` (its `< 3.11` marker is always false on the 3.12 floor;
every TOML reader uses `tomllib`) and `typing-extensions` (no direct
imports) from the runtime dependencies.
- Classifiers name Python 3.12, 3.13 and 3.14, and Django 6.0 instead of 5.1.
- basedpyright fails on a missing `@override` (already zero violations).
- The README and the Windows guide state the Python 3.12 minimum.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ode (#968) * Adapt to comicbox 5.3.0: doctor report, scan every suffix, probe() credentials 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> * Doctor on the Stats tab, with codex's own checks 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> * Give the doctor its own admin tab 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> * Require comicbox 5.3.1 and offer its Ask match mode 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> * Doctor tab: comicbox's rows and codex's own under their own headings 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> * update deps * Clear ty's diagnostics `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> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…og (#970) * Online tagging: toolbar Review button instead of an auto-opening dialog Every tag-prompt socket message ran loadPrompts() with auto-open on, so a large tagging run reopened the Match Review dialog in every admin tab each time the daemon deferred a match. The passive cues were weak: an uncounted amber dot on the hamburger and a drawer item. - loadPrompts() only ever closes the dialog now; it opens from a click. - New OnlineTagReviewButton (tonal warning, "Review N", icon + count on phones) in the browser top toolbar and the admin title bar. - app.vue head() prefixes the document title with "(N) " for admins, so a background tab shows the count. - pendingComicCount moves into the store so the drawer label, the button and the title agree; the hamburger prompts dot is removed. The button is a plain v-btn, not ScaleButton: compact density on xs stacks with size="small" and measured 16px tall in the browser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add the online-tag Review button to the reader toolbar With the hamburger prompts dot gone, the reader had no passive cue for matches waiting; only the drawer item and the (tab-only) title prefix. Mount OnlineTagReviewButton after the reader toolbar's spacer, as in the browser toolbar. Nothing else in the reader top toolbar can shrink, so below 360px the button pushed the settings button off-screen (a three-digit reading order needs 360px with it, 302px without). Hide it under 360px; the drawer item still offers the review there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Pressing Escape to close the metadata or Match Review dialog also closed
the book, and arrow keys, space, j/k and the other shortcuts paged or
changed settings underneath an open dialog.
The reader's three document keyup listeners only bailed out on the auth
store's isAuthDialogOpen flag. That misses Escape for every dialog, auth
dialogs included: Vuetify closes an overlay on Escape keydown and moves
focus back to its activator, so by keyup the dialog flag is already
false and the keyup target is the toolbar button, outside any overlay.
Checked in a real browser: event.target.closest(".v-overlay") at keyup
misses whenever the dialog was opened from a visible activator.
useReaderKeyUp decides on keydown instead. A capture-phase keydown
listener records each key pressed inside a .v-overlay (capture so a
dialog that stops keydown still counts; repeats are ignored so a held
Escape stays with the dialog), and the keyup listener skips those keys
and any keyup whose own target is inside an overlay. All three reader
listeners use it. This covers the auth dialogs too, so the
isAuthDialogOpen getter, which had no other users, is gone.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…972) make expanded $(brew --prefix) to an empty string, each export ran in its own shell, and a double-colon install:: recipe cannot pass environment to python.mk's uv sync anyway. cryptography and granian install from macOS arm64 wheels, and the one cp314 sdist build (watchdog) links CoreServices, not OpenSSL. Co-authored-by: Claude Opus 5.5 <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.
tab-title count instead of popping up a dialog.
dialog no longer turn pages.