Skip to content

fix(web): clear a draft's save-failure alert once a save lands - #104

Merged
TusanHomichi merged 1 commit into
mainfrom
claude/83-stale-save-alert
Oct 14, 2026
Merged

TusanHomichi merged 1 commit into
mainfrom
claude/83-stale-save-alert

Conversation

@TusanHomichi

@TusanHomichi TusanHomichi commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Primary Issue

Refs #83. Not "Closes": the intermittent failure itself is not reproduced, so its root cause isn't established. Details below.

Problem And Outcome

Investigating #83 turned up a real defect. When an ordinary save failed, the draft showed "The draft did not save. Stay on this draft and save again before leaving." A later save that reached the server left that alert on screen next to Saved; received() only ever set the message.

After this PR, a successful save clears the message the save chain set, but only while that message is still the one shown, so an unrelated problem is never dismissed by a save. Playwright also keeps a trace for every failing test, so the next occurrence of #83 carries its own evidence.

Changes

  • drafts/[id]/+page.svelte:
    • the save chain's messages go through showSaveProblem(), which records the message it set;
    • on a saved result, that message is cleared if it is still displayed;
    • those messages are: failed save, refused SPA departure, saving-departure, held workflow act, and unsaved document unload;
    • the pending-recovery message is untouched, because a reload resolves it, not a save.
  • e2e/draft-recovery.spec.ts: after the retry saves, no alert remains.
  • playwright.config.ts: trace: 'retain-on-failure'.
  • CHANGELOG.md: Unreleased → Fixed.

Correction rung: 2. The e2e assertion guards the stale-alert class on the save path.

#83 investigation

The intermittent failure is a timeout: "My sessions" did not render within 5 s of clicking Home after the retry saved. The failure snapshot is consistent with a slow, in-flight SPA navigation:

  • inputs are disabled because navigating.to is set;
  • the stale alert, which is this PR's bug, is still shown.

Both recorded failures overlapped heavy concurrent work on the host: once another Playwright session, once a full cargo build in another checkout. I could not reproduce it here:

  • the single test with --repeat-each=30 --workers=2: 30/30 passed;
  • the whole draft-recovery.spec.ts with --repeat-each=2 --workers=2 while a cold cargo build -p consolebook-server ran alongside: 94/94 passed.

#83 stays open until a retained trace shows where the departure waits.

Verification

  • Negative control: with only the page fix reverted, the new assertion fails (Expected: 0, Received: 1 at draft-recovery.spec.ts:2392), and the failure trace was retained under test-results/.
  • Full local proof on 717a0ea (scripts/proof.py, euid 0 with DAC capabilities dropped): passed.
    • Receipt .proof/20261014T214644Z-717a0ea49135/receipt.json, sha256 d8ee41b8136b57e37f4919b6ebd5e80bdbb341a592b4fc91ee4c3c53b75ddd69.
    • Browser suite: 59 expected, 0 unexpected, 0 flaky.
    • An earlier attempt on the same commit failed at cargo test with No space left on device (host disk, not code). The rerun above is after freeing space.
  • Codex review: no findings.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts

The ordinary save chain's messages (failed save, refused departure,
held workflow act) stayed on screen after a later save reached the
server. A successful save now clears the message the chain set, and
only while it is still the one shown.

Playwright keeps a trace for every failing test, so an intermittent
failure carries its own evidence.

Refs #83

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T21:46:48.137922Z 717a0ea PR opened
ℹ️ About Codex in GitHub

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.

@TusanHomichi
TusanHomichi merged commit c7fe83f into main Oct 14, 2026
4 checks passed
@TusanHomichi
TusanHomichi deleted the claude/83-stale-save-alert branch October 14, 2026 21:59
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.

2 participants