feat: a Done button that closes the day behind you #20

Merged
brian merged 1 commit from test into main 2026-08-20 20:10:48 +00:00
Owner

At the foot of every day — under the adder, past the last page — one button that
locks everything on the day and goes back to the welcome screen. Not to the
calendar the back arrow steps out to: Done means finished writing, not up.

Locking is the point rather than a tidy-up. A page left unlocked is a page a
resting hand can still write on, and the moment someone stops writing is exactly
when the tablet gets picked up, carried and put down. Pages already locked are
skipped rather than rewritten, so closing a day that was already closed doesn't
mark every page dirty and push a write for each one. The movement lock is
cleared on the way, being this lock's opposite.

Android locks through lockAllPages(), which reads the same set pagesForDay()
does — so what gets locked is exactly what was on screen, not a wider query that
could reach a page the user never saw. The web works from the feed's blocks
instead, because a block holds content the user has typed but that hasn't been
persisted yet; going back to the database there would lock a stale copy.

It appears on the empty day too, where it has nothing to lock. It is also the
way back, and a day opened by mistake is exactly a day you want to leave.

The button also closes a race it would otherwise have made easy to hit. Android
writes a typed document back on a 400ms debounce, on the composition's scope,
so leaving the screen cancels a save still sitting out its delay — type a
character, go within 400ms, and that edit is gone. True of the back button
already, but Done is pressed straight after writing, and on a one-page day it
sits just under the text. The pending saves are now held per screen rather than
per row, and finish() waits for them before it locks. Done takes up to 400ms to
act; that is the cost of not eating the last sentence. The web needs none of
this — saveDoc() writes content.doc synchronously and debounces only the
persist, so the lock already captures what is on screen.

The tests go in JournalRepositoryTest, which exists for this exact hazard: edits
made from outside the ink view that write back a snapshot and take the ink with
it. Locking a day is now one of those edits.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

At the foot of every day — under the adder, past the last page — one button that locks everything on the day and goes back to the welcome screen. Not to the calendar the back arrow steps out to: Done means finished writing, not up. Locking is the point rather than a tidy-up. A page left unlocked is a page a resting hand can still write on, and the moment someone stops writing is exactly when the tablet gets picked up, carried and put down. Pages already locked are skipped rather than rewritten, so closing a day that was already closed doesn't mark every page dirty and push a write for each one. The movement lock is cleared on the way, being this lock's opposite. Android locks through lockAllPages(), which reads the same set pagesForDay() does — so what gets locked is exactly what was on screen, not a wider query that could reach a page the user never saw. The web works from the feed's blocks instead, because a block holds content the user has typed but that hasn't been persisted yet; going back to the database there would lock a stale copy. It appears on the empty day too, where it has nothing to lock. It is also the way back, and a day opened by mistake is exactly a day you want to leave. The button also closes a race it would otherwise have made easy to hit. Android writes a typed document back on a 400ms debounce, on the composition's scope, so leaving the screen cancels a save still sitting out its delay — type a character, go within 400ms, and that edit is gone. True of the back button already, but Done is pressed straight after writing, and on a one-page day it sits just under the text. The pending saves are now held per screen rather than per row, and finish() waits for them before it locks. Done takes up to 400ms to act; that is the cost of not eating the last sentence. The web needs none of this — saveDoc() writes content.doc synchronously and debounces only the persist, so the lock already captures what is on screen. The tests go in JournalRepositoryTest, which exists for this exact hazard: edits made from outside the ink view that write back a snapshot and take the ink with it. Locking a day is now one of those edits. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
feat: a Done button that closes the day behind you
All checks were successful
Build and Deploy / test (push) Successful in 26s
Build and Deploy / build (push) Successful in 10s
Build and Deploy / deploy-main (push) Has been skipped
Build and Deploy / deploy (push) Successful in 13s
918586525e
At the foot of every day — under the adder, past the last page — one button that
locks everything on the day and goes back to the welcome screen. Not to the
calendar the back arrow steps out to: Done means finished writing, not up.

Locking is the point rather than a tidy-up. A page left unlocked is a page a
resting hand can still write on, and the moment someone stops writing is exactly
when the tablet gets picked up, carried and put down. Pages already locked are
skipped rather than rewritten, so closing a day that was already closed doesn't
mark every page dirty and push a write for each one. The movement lock is
cleared on the way, being this lock's opposite.

Android locks through lockAllPages(), which reads the same set pagesForDay()
does — so what gets locked is exactly what was on screen, not a wider query that
could reach a page the user never saw. The web works from the feed's blocks
instead, because a block holds content the user has typed but that hasn't been
persisted yet; going back to the database there would lock a stale copy.

It appears on the empty day too, where it has nothing to lock. It is also the
way back, and a day opened by mistake is exactly a day you want to leave.

The button also closes a race it would otherwise have made easy to hit. Android
writes a typed document back on a 400ms debounce, on the composition's scope,
so leaving the screen cancels a save still sitting out its delay — type a
character, go within 400ms, and that edit is gone. True of the back button
already, but Done is pressed straight after writing, and on a one-page day it
sits just under the text. The pending saves are now held per screen rather than
per row, and finish() waits for them before it locks. Done takes up to 400ms to
act; that is the cost of not eating the last sentence. The web needs none of
this — saveDoc() writes content.doc synchronously and debounces only the
persist, so the lock already captures what is on screen.

The tests go in JournalRepositoryTest, which exists for this exact hazard: edits
made from outside the ink view that write back a snapshot and take the ink with
it. Locking a day is now one of those edits.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
brian merged commit f06d17bb72 into main 2026-08-20 20:10:48 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
brian/Journal!20
No description provided.