← Back to Pull requests

Send to device, Previously deleted, better series finder, hide finished, phone relay, exclude filters #31

Merged
Krowsingre merged 46 files (2048 lines) on Oct 22, 2026 12:44 UTC
View on GitHub
Krowsingre Krowsingre commented on Oct 22, 2026 04:18 UTC
Author

Before: there was no Send to device shelf, re-imported deleted books came back silently, the series finder only asked Hardcover and Audible, missing series books couldn't be marked read or added by hand, finished books couldn't be hidden, sending an iCloud-only book to the phone needed a permanent download, and filters could only pick books, not leave them out.

After: a pinned "Send to device" collection and Library tab; books deleted before land in "Previously deleted" (or are skipped, by a setting); the series finder also asks Wikidata, ISFDB and Google Books, shows which number each owned book is, wraps long missing lists, lets missing books be marked read or added by hand, and shows missing books greyed out on collection cards and in a new "In this series" row on book details; "Hide finished books" filter; sync relays phone books from the other place to Supabase without keeping a copy; every filter list cycles show only, hide, off.

How: migrations v16 (shelf row) and v17 (series_lists.read), new series_sources.rs, relay_for_phone at the end of run_both, LibraryExclude wrapped in NOT in browse.rs. Wikidata, ISFDB and Google Books are tested with saved replies only, since the build environment can't reach them.

---
_Generated by Claude Code_

Diff: 2048 lines (+1827 / -221) across 46 files Reviewer: Krowsingre Review duration: 505m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.91) × (1 − Review Confidence (0.83)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.91 · 2048 lines diff across 46 files
0.91
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.88 · 5 substantive comment(s)
0.88
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
82%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.400
Self Review self_review
0.140
Mass File Touch mass_file_touch
0.080
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
9 items
chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Oct 22, 2026 04:18 UTC
Bot

<!-- codex-pull-request-review-summary -->
<!-- codex-review-state:v1 {"code_review":{"commit_sha":"cb7ef2d77a341eb2c7d557e4a7ee051fe43b27a2","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

| Review | Status | Commit | Review trigger |
| --- | --- | --- | --- |
| 📝 Code Review | ✅ Completed <relative-time datetime="2026-10-22T04:22:00.888794Z">2026-10-22T04:22:00.888794Z</relative-time> | cb7ef2d | PR opened |

<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review" or "@codex security review".
  • Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    </details>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Oct 22, 2026 04:21 UTC
    Code Review
    crates/tbv-core/src/library.rs:1
    @@ -367,10 +367,24 @@ const MIGRATIONS: &[&str] = &[
             PRIMARY KEY (ebook_id, audiobook_id)
         );
         "#,
    +    // v17: books of a series the person has read elsewhere (keys of
    +    // `series_lists.books`, like `hidden`), so a missing book can be marked read.
    +    r#"
    +    ALTER TABLE series_lists ADD COLUMN read TEXT NOT NULL DEFAULT '[]';
    +    "#,

    <sub><sub>!P1 Badge</sub></sub> Keep migration 16 in its original slot

    Placing the new read migration before the block identified as v16 breaks upgrades from any build that already shipped the Send to device migration: such databases have user_version = 16, so migrate() skips this ALTER TABLE and runs only the following shelf insertion. The app then queries and installs sync triggers for series_lists.read, causing library startup to fail with a missing-column error. Append the read column as v17 after the existing v16 migration.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Oct 22, 2026 04:21 UTC
    Code Review
    src/home/bookActions.ts:1
    @@ -12,13 +12,8 @@ import { isAudio, kindOf } from "../lib/queryBooks";
     import { NO_FILTERS } from "../library/libraryView";
     import { isApp, isHome, isWeb } from "../api";
     
    -/** Whether this computer sends Supabase only the books chosen for the phone (Settings › Sync). */
    -let choosingForPhone = false;
    -export function setChoosingForPhone(on: boolean) {
    -  choosingForPhone = on;
    -}
    -/** Where choosing books for the phone shows: on a computer that chooses them, and on the phone. */
    -export const phoneChoiceShown = () => (isApp && !isHome && choosingForPhone) || isWeb;
    +/** Where choosing books for the phone shows: on a computer (the Send to device shelf), and on the phone. */
    +export const phoneChoiceShown = () => (isApp && !isHome) || isWeb;

    <sub><sub>!P1 Badge</sub></sub> Hide or honor Send to device outside chosen-only mode

    On desktop this now exposes “Send to device” for every sync configuration, including the default where phoneChosenOnly is false. In that mode files_kept() ignores phone_wanted and follows only the global bookFiles/audioFiles switches, so selecting a book can be a complete no-op when file sync is off, while deselecting it cannot stop transfer when file sync is on. Either retain the settings-based visibility gate or make the backend honor the flag independently.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Oct 22, 2026 04:21 UTC
    Code Review
    crates/tbv-core/src/sync/mod.rs:1
    @@ -1461,6 +1461,47 @@ impl Library {
             Ok(out)
         }
     
    +    /// Books chosen for the phone whose file isn't on this computer and
    +    /// hasn't reached the phone's place (`lane`): copied there from the other.
    +    pub(crate) fn phone_relays(&self, lane: Lane) -> Result<Vec<Relay>> {
    +        let rows = self
    +            .conn
    +            .prepare(
    +                "SELECT b.id, b.format, lf.cover_path FROM books b LEFT JOIN local_files lf ON lf.book_id = b.id
    +                 WHERE b.deleted_at IS NULL AND b.phone_wanted AND lf.path IS NULL",
    +            )?
    +            .query_map([], |r| Ok((r.get::<_, String>(0)?, r.get::<_, String>(1)?, r.get::<_, Option<String>>(2)?)))?
    +            .collect::<rusqlite::Result<Vec<_>>>()?;
    +        let retry_after = (Utc::now() - Duration::hours(RETRY_FILE_HOURS)).to_rfc3339_opts(SecondsFormat::Millis, true);
    +        let sql = format!("SELECT uploaded_at, failed_at FROM {} WHERE path = ?1", lane.files_table());
    +        let due = |path: &str| -> Result<bool> {
    +            let done: Option<(Option<String>, Option<String>)> = self.conn.query_row(&sql, params![path], |r| Ok((r.get(0)?, r.get(1)?))).optional()?;
    +            Ok(match done {
    +                None => true,
    +                Some((Some(_), _)) => false,
    +                Some((None, failed)) => failed.is_none_or(|f| f < retry_after),
    +            })
    +        };
    +        let mut out = Vec::new();
    +        for (book_id, format, cover) in rows {
    +            let hex = book_id_hex(&book_id);
    +            let path = format!("books/{hex}.{format}");
    +            if !due(&path)? {
    +                continue;
    +            }

    <sub><sub>!P2 Badge</sub></sub> Retry relay covers after the book upload succeeds

    When a relayed book uploads successfully but its subsequent cover upload fails, the book path is recorded as uploaded before the cover attempt. On every later sync this early continue excludes the relay because the book itself is no longer due, so the cover is never retried; the normal file pass cannot recover it because phone covers require a local book path, which this relay case lacks. Relay selection needs to account for a due cover even when the book path is already complete.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Oct 22, 2026 04:21 UTC
    Reviewer

    <!-- codex-review-receipt:v1 -->

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: cb7ef2d77a

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review".
  • If Codex has suggestions, it will comment; otherwise it will react with 👍.

    Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    </details>

    Krowsingre Krowsingre commented on code on Oct 22, 2026 04:25 UTC
    Code Review
    crates/tbv-core/src/library.rs:1
    @@ -367,10 +367,24 @@ const MIGRATIONS: &[&str] = &[
             PRIMARY KEY (ebook_id, audiobook_id)
         );
         "#,
    +    // v17: books of a series the person has read elsewhere (keys of
    +    // `series_lists.books`, like `hidden`), so a missing book can be marked read.
    +    r#"
    +    ALTER TABLE series_lists ADD COLUMN read TEXT NOT NULL DEFAULT '[]';
    +    "#,

    Fixed in 7378935: Send to device is v16 again and the read column is v17 after it.

    ---
    _Generated by Claude Code_

    Krowsingre Krowsingre commented on code on Oct 22, 2026 04:25 UTC
    Code Review
    crates/tbv-core/src/sync/mod.rs:1
    @@ -1461,6 +1461,47 @@ impl Library {
             Ok(out)
         }
     
    +    /// Books chosen for the phone whose file isn't on this computer and
    +    /// hasn't reached the phone's place (`lane`): copied there from the other.
    +    pub(crate) fn phone_relays(&self, lane: Lane) -> Result<Vec<Relay>> {
    +        let rows = self
    +            .conn
    +            .prepare(
    +                "SELECT b.id, b.format, lf.cover_path FROM books b LEFT JOIN local_files lf ON lf.book_id = b.id
    +                 WHERE b.deleted_at IS NULL AND b.phone_wanted AND lf.path IS NULL",
    +            )?
    +            .query_map([], |r| Ok((r.get::<_, String>(0)?, r.get::<_, String>(1)?, r.get::<_, Option<String>>(2)?)))?
    +            .collect::<rusqlite::Result<Vec<_>>>()?;
    +        let retry_after = (Utc::now() - Duration::hours(RETRY_FILE_HOURS)).to_rfc3339_opts(SecondsFormat::Millis, true);
    +        let sql = format!("SELECT uploaded_at, failed_at FROM {} WHERE path = ?1", lane.files_table());
    +        let due = |path: &str| -> Result<bool> {
    +            let done: Option<(Option<String>, Option<String>)> = self.conn.query_row(&sql, params![path], |r| Ok((r.get(0)?, r.get(1)?))).optional()?;
    +            Ok(match done {
    +                None => true,
    +                Some((Some(_), _)) => false,
    +                Some((None, failed)) => failed.is_none_or(|f| f < retry_after),
    +            })
    +        };
    +        let mut out = Vec::new();
    +        for (book_id, format, cover) in rows {
    +            let hex = book_id_hex(&book_id);
    +            let path = format!("books/{hex}.{format}");
    +            if !due(&path)? {
    +                continue;
    +            }

    Fixed in 7378935: a relay whose book is already there but whose cover isn't is still picked up, and sends only the cover.

    ---
    _Generated by Claude Code_

    Krowsingre Krowsingre commented on code on Oct 22, 2026 04:25 UTC
    Code Review
    src/home/bookActions.ts:1
    @@ -12,13 +12,8 @@ import { isAudio, kindOf } from "../lib/queryBooks";
     import { NO_FILTERS } from "../library/libraryView";
     import { isApp, isHome, isWeb } from "../api";
     
    -/** Whether this computer sends Supabase only the books chosen for the phone (Settings › Sync). */
    -let choosingForPhone = false;
    -export function setChoosingForPhone(on: boolean) {
    -  choosingForPhone = on;
    -}
    -/** Where choosing books for the phone shows: on a computer that chooses them, and on the phone. */
    -export const phoneChoiceShown = () => (isApp && !isHome && choosingForPhone) || isWeb;
    +/** Where choosing books for the phone shows: on a computer (the Send to device shelf), and on the phone. */
    +export const phoneChoiceShown = () => (isApp && !isHome) || isWeb;

    Fixed in 7378935: the phone's place now always takes books chosen for it, even with book file sync off. With it on, every book goes anyway, which is what that setting means.

    ---
    _Generated by Claude Code_

    Reviewers
    Assignees
    Krowsingre Krowsingre
    Labels
    risk: low confidence: 82.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 90.5% (HIGH) · Higher = larger blast radius
    90.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 82.7% · Lower = rushed or shallow review
    82.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.7% · Safe to merge
    15.7%