Skip to content

Make the e2e suite pass, and fix the data loss it was reporting - #106

Merged
vmillet-dev merged 3 commits into
mainfrom
fix/a-closed-editor-still-owns-its-note
Sep 14, 2026
Merged

vmillet-dev merged 3 commits into
mainfrom
fix/a-closed-editor-still-owns-its-note

Conversation

@vmillet-dev

@vmillet-dev vmillet-dev commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Two commits, one subject: the end-to-end suite fails on the Ubuntu leg, and it is
right to.

1 — A note closed right after it was written loses its body

02-note-lifecycle › reads the note back from the database on a fresh front end
Expected: "openssl req -new -key staging.key -out staging.csr"
Received: ""

Not flaky infrastructure. requestClose() fires the title, the source and the
content commits and then closes, in the same turn. Each commit suspends on
resolve() while the draft turns into a row; closeOverlay() runs before they
resume and clears _selectedNote.

By the time they do resume, find() has nothing left to answer with: the draft
is gone, the selection is gone, and the only fallback is the canvas view —
which is one round trip behind the write that created the note. The commits
resolved to null and were dropped in silence. The note kept the title its
creation payload carried and lost the body typed after it.

Windows wins that race, Linux loses it, which is what made a data-loss bug read
as an unreliable test.

NotesStore now remembers the row the draft became, until the editor is pointed
at another note. find() consults it after the selection and before the view,
and persist() keeps it current.

Reproduced, not guessed. The new test plays that sequence — commit, close in
the same turn, let it settle. With the lookup removed:

× lands the commits the close itself fired
AssertionError: expected "update" to be called with arguments: [ Any<String>, …(1) ]
Number of calls: 0

2 — The e2e profile was only half wiped

resetProfile() wiped app_data_dir() and called it clean. Since #99 that is no
longer the whole profile: tauri-plugin-window-state writes .window-state.json
under app_config_dir(), and on Linux those are two different directories.

So the window geometry survived every wipe there, and a run opened on the window
the run before it closed with. Windows cannot tell the two apart — both are
%APPDATA%\<id> — which is why the hole never showed, and CI never met it either:
its runners are new each time. Both are wiped now, de-duplicated so Windows still
does one pass, and the guard names whichever survived. docs/architecture.md says
so where it states the rule.

Checked

npm test 960 passing, npm run lint clean, the suite 15/15 in 3:52 locally.
On CI the first three attempts of the earlier commit were green on both legs;
the count restarts here because this branch moved, and five consecutive green runs
are what this merges on.

⚠️ Worth knowing while reading those runs: test-e2e is continue-on-error, so a
failing E2E leg still reports the whole run as success — which is how the defect
above sat on main across three merges. #108 tracks that.

🤖 Generated with Claude Code

Closing fires the title, the source and the content commits and closes in
the same turn, so they are still suspended on the draft's resolution when
the overlay goes. The draft was gone by then and a closed editor adopts
nothing, leaving find() with only the canvas view — a round trip behind —
so the commits resolved to nothing and were dropped. The note kept the
title its creation payload carried and lost the body typed after it.

The store now remembers the row the draft became until the editor is
pointed elsewhere.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
tauri-plugin-window-state writes .window-state.json under app_config_dir(),
which on Linux is not app_data_dir() — so the window geometry survived the
wipe and a run opened on the window the previous one closed with. Windows
cannot tell the two directories apart, which is why it passed there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vmillet-dev vmillet-dev changed the title Keep the body of a note closed right after it was written Make the e2e suite pass, and fix the data loss it was reporting Sep 14, 2026
The variables panel commits on blur and the write crosses the bridge, so the
sleep was a bet. A Windows runner lost it: the note was re-read before the
variable existed and reported the snippet's own default, and the scenario
after it then found no row to remove.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vmillet-dev
vmillet-dev merged commit 9c2898a into main Sep 14, 2026
45 checks passed
@vmillet-dev
vmillet-dev deleted the fix/a-closed-editor-still-owns-its-note branch September 14, 2026 20:02
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.

1 participant