Skip to content

Discard unreadable books when the host starts a draft over #573

Closed

Description

@imnasnainaec

Part of Phase 4 (#427). Needs 4a (#453). Blocks 4b (#454).

Background

A draft book whose stored analysis can't be read (a torn write, or outside damage) is kept as stored and never written over (#475).

On the WebView write path:

  • An edit that reaches the book stays on screen, but writes leave that book out.
  • Save to an existing project is refused. Save As leaves the book out.
  • New and Open discard the book. This is how the user recovers.

That discard lives in whole-draft saveDraft, through replaceAll's discardUnreadable option. 4c deletes both.

On the host path:

So on the host path nothing gets the user out yet.

Scope

  • Host New and Open discard each unreadable book, so later writes treat it like any other book.
    • In DraftRepository today, this is clearing unreadableShards before the write.
  • Do it in whatever path 4a gives New and Open, not through replaceAll.
  • Opening a session stays load-only.

Why it blocks 4b

4b ships the host path by default. Without this issue, a user with an unreadable book has no way out on the default path, short of the rollback release.

Done when

  • With the flag on, New or Open on a draft with an unreadable book leaves no book unreadable, and edits that reach the book apply.
  • Tests cover this on the flag-on path.

Then

  • Remove "Books whose stored analysis can't be read" from 4c's body.

Activity

  1. imnasnainaec commented on Nov 2, 2026

    @imnasnainaec
    ContributorAuthor

    #585 already discards unreadable books in startDraftOver (discardUnreadable: true), through replaceAll. If #585 moves that write into a DraftRepository-only reset (see the review there), this issue may come down to checking that the reset covers it, plus the flag-on tests in "Done when."

    Either way, the discard belongs in DraftRepository, not AnalysisRepository. Unreadable books come from today's one-shard-per-book storage and shouldn't reach the seam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions