swipe-rows: Pin / Delete / Trash Restore fail ~1 in 10 on webkit-390 #587
Closed
opened 2026-10-18 17:44:01 +00:00 by kayg
·
157 comments
No Branch/Tag specified
main
port/tasks-float-2
fix/train-1116-2
fix/train-1116-3
fix/train-1116-1
fix/flake-1134
fix/server-1182
dev
port/notes-float-3c
docs/auto-update-ig
feat/dav-transport
port/tasks-float-1
wip/mail1011-sv-order-1116
fix/flake-1179
fix/flake-1178
fix/guards-1153-fsio-split
fix/guards-1153-notes-split-we
fix/guards-1153-notes-lib
fix/guards-1153-notes-home
fix/guards-1153-ui-primitives
fix/guards-1153-primitives-e2e
fix/guards-1153-visibility-doc
feat/paper-grey-1116
fix/flake-1165
fix/flake-1119
docs/imap-766-plan-v2
fix/e2e-unique-ports
t3/paged-search-reconcile-final
wip/mail1011-final-1115
docs/tasks-float-port
perf/editor-first-paint-1c
feat/imap-notes-fetch
feat/imap-notes-projection
feat/imap-notes-readonly
feat/imap-notes-auth
feat/imap-notes-server-foundation
wip/mail1011-txn-ownvocab-1115
wip/mail1011-txn-novocab-1115
perf/p1117-final-harness
perf/single-shot-repeats
port/tasks-matrix
wip/mail1011-txn-1115
fix/static-gates-1155
feat/files-s1-identity-r7
fix/files-r7-idle-loop
fix/daily-train-1152
port/notes-float
fix/editor-tables-test-types
port/notes-float-listscript
feat/tasks-actions
port/notes-float-phone-preload
perf/sound-comparator
port/notes-float-listscroll
port/notes-float-budgets
port/notes-float-suite-fix-b
port/notes-float-sidebar-fix
port/notes-float-trim
port/notes-float-3-lists
fix/attachments-meta-capability
docs/carddav-writes-v2-plan
feat/contacts-companion-pure
issue/carddav-read-perf-fix-r2
issue/carddav-read-r2
port/notes-float-devsync2
review/calendar-2
review/switcher-a-pills
port/notes-float-switcher-a
port/port-tables-2
review/switcher-ends
wip/whiteboard-s1-1114
port/port-tables
wip/mail1011-perfneutral
review/photo-tint
port/notes-float-shell
wip/local/collections-db
wip/local/mail-p1
wip/local/cold-growth-on-tiering
wip/local/tiering-v3-s1
wip/local/wal1051-cap
wip/local/tiering-v3-s1-resume
wip/local/index-position-startup-scan
port/notes-float-flat
port/notes-float-promote
wip/handover/mail1011-candidate
wip/handover/files-s1-candidate
port/notes-float-shell-only
port/notes-float-perf
feat/whiteboard-s1
feat/tiering-v5
fix/app-switch-hitch
wip/local/files-s1-dev-v4-final
feat/files-s1-dev-v4
fix/c2-glass-shared
feat/flat-lists
wip/handover/whiteboard-s1-resume
wip/att-lazy-861
feat/switcher-browse
wip/att-lazy-860
feat/tasks-float
recovered/flat-backup-candidate
perf/stalls-1054-kc
land/ai-toolbar
feat/collections-db
feat/collections-db-fixes
codex/mail-1011-redesign-20261111
fix/ai-toolbar
backup/macos-vm/st3-head
perf/trim-candidate-phonestack
feat/switcher-three
fix/1051-index-idle-checkpoint
perf/stalls-1054-kb
perf/stalls-1054-k
perf/stalls-1054-r3
fix/c2-contrast-tail
perf/stalls-1054-r3-preview
feat/collections-before
feat/tiering-v4
fix/timelog-caret
wip/local/tasks-actions
docs/tasks-writes-v2-plan
st3-r3
feat/pass8
review/calendar-2-before-1111
wip/tiering-v3-cold4
perf/stalls-1054-r2
fix/suite-A4
fix/suite-A5-probe
fix/suite-A6
fix/suite-A3
fix/suite-A2
fix/suite-A5
fix/suite-A1
wip/local/attachments-861-fix
feat/contrast
wip/local/ports-861
storage/wal-checkpoint-off-save-1051
wip/local/mail-1011-reconcile-20261110
feat/style-sheet-fixes
feat/money-round
perf/stalls-1054
wip/tiering-v3-cold5
t3/mail-1011-liveness
feat/iphone-fixes
feat/notes-approve
wip/local/shrow-work
feat/files-s1-identity
feat/quickfix
wip/tiering-v3-cold
wip/local/shared-row-swipes
backup/macos-vm/pfx-B
backup/macos-vm/pfx-C
backup/macos-vm/pfx-D
feat/contrast-r1
feat/tiering-v3-s2-tags
feat/folder-drop
t3/photos-s1
feat/tiering-v3-s1-namespace
wip/local/photos-s1
t3/photos-plan-slice-one
recovered/backup/p1b-61505
t3/paged-search-reconcile
t3/smooth-pane-transitions
t3/index-position-startup-scan
fix/private-staging-759b-r2
backup/macos-vm/hk/hk1009/pr877
backup/macos-vm/hk/hk1009/pr878
docs/undo-block-ids-plan
fix/undo-768
backup/macos-vm/hk/hk1009/pr875
backup/macos-vm/hk/hk1009/pr904
proto/block-identity-v7d
backup/macos-vm/hk/hk1009/pr846
backup/macos-vm/hk/hk1009/pr860
backup/macos-vm/hk/hk1009/pr861
backup/macos-vm/hk/hk1009/pr849
backup/macos-vm/hk/hk1009/pr848
backup/macos-vm/hk/hk1009/pr853
backup/macos-vm/hk/hk1009/pr957
backup/macos-vm/hk/hk1009/pr893
backup/macos-vm/hk/hk1009/pr889
backup/macos-vm/hk/hk1009/pr902
docs/imap-notes-plan
docs/quota-plan-2
fix/parallel-test-flakes
docs/calendar-backend-v2-plan
feat/calendar-ical-converter
backup/macos-vm/hk/hk1009/pr808
docs/contacts-import-v2-plan
issue/610-pm-midnight
feat/calendar-v2-s1-containment
backup/macos-vm/hk/hk1009/pr854
backup/macos-vm/hk/hk1009/pr845
backup/macos-vm/hk/hk1009/pr917
docs/dav-recorder-v2-plan
plan/previews-865
plan/save-log-durable-entry
backup/macos-vm/hk/hk1009/pr934
fix/e2e-data-on-ram
backup/macos-vm/hk/hk1009/pr888
feat/appwindow3
feat/appwindow2
feat/appwindow
feat/money-p1
feat/keys-sheet
review/calendar-2-themes
feat/smooth-cursor
fix/float-style
review/calendar-2-float
release/2026-11-06-hotfix
archive/port/rows-drop-code
archive/port/rows-actions
archive/port/rows
scratch/tasks-894-ui-gates
review/calendar-2-night-wip
recovered/flaky/toast-reduced
release/2026-11-05
archive/flaky/rows-drop-fixed
archive/flaky/rows-actions
archive/flaky/rows
sim/bm15-final
sim/bm15-bis-932
sim/bm15-bis-909
sim/bm15
sim/bm15-bis-887
perf/tiering-option-b
fix/sw-lazy-precache
archive/plan/save-log-durable-entry
mock/money-fix2
archive/fix/e2e-data-on-ram
mock/appearance-all
mock/pill-press
mock/pill-press-mac
backup/macos-vm/appearance-after
mock/auto-swipes
mock/mail-actions
backup/macos-vm/mock/mail-actions
mock/money-static
archive/review/standards-917
perf/tiering-761-fix
mock/type-audit
mock/third-pane
feat/contacts-import-v2-s1
perf/executor-hot-path
archive/port/hidden-blocks
archive/port/devices
scratch/executor-on-894
scratch/executor-spans2
scratch/executor-spans
archive/port/rows-drop
feat/tiering-761-d-scale
feat/tiering-761-c-index
feat/tiering-761-b-reader
archive/review/sharing-pr3-review-9fec3d1f
perf/ports-lazy-budgets
feat/tiering-761-a-migration
archive/review/sharing-pr3-review
archive/review/sharing-pr3-review-code
archive/plan/previews-865
archive/port/port-attachments-3
archive/port/contacts-merge
fix/motion-audit-859
fix/motion-audit-859-mac
archive/port/port-pickers
archive/port/port-tables-2
archive/port/port-tables
recovered/local/sharing-s1-pr2-room-snapshot-candidate
archive/fix/parallel-test-flakes-code-minipc01
docs/imap-766-readonly-slice
feat/dav-recorder-v3
research/788-diagnosis
archive/fix/parallel-test-flakes
archive/perf/pr792-cold-index-edit
docs/sharing-slice-1
recovered/feat/dav-recorder-v2
recovered/feat/dav-recorder-v2-edd7bbb
spike/imap-766-s0-cases
archive/fix/undo-768
recovered/feat/dav-recorder
recovered/feat/dav-recorder-901acd4
feat/contacts-import
perf/cold-growth-on-764
perf/cold-growth-on-tiering
recovered/feat/tasks-set-status
feat/tasks-move-reorder
feat/tasks-delete-promote-duplicate
feat/carddav-writes
perf/quota-on-tiering
perf/quota-simple
perf/cold-growth-on-quota-stack
recovered/perf/cold-growth-on-tiering
feat/calendar-identity
feat/calendar-event-parser
feat/calendar-props-maps
port/glass-when-ring
recovered/feat/tiering-761-s1-wip-8132a84
recovered/feat/tiering-761-s1-wip-9da4094
recovered/feat/tiering-761-s1-wip-724512c
recovered/feat/tiering-761-s1-wip-66e667e
recovered/feat/tiering-761-s1
wip/6by32-01-tier-761-s1-pause-20261030
spike/imap-766-s0
wip/6by32-02-calternal-pause-20261030
wip/8by64-01-review-688-pause-20261030
wip/6by32-01-verify-744-pause-20261030
wip/6by32-01-verify-742-pause-20261030
fix/private-staging-759b
wip/6by32-01-review-748-pause-20261030
wip/6by32-01-review-733c-pause-20261030
wip/6by32-01-review-733b-pause-20261030
review/calendar-month
wip/local/bm15-trash
plan/759b-staging
review/767b-tests
review/preview-2026-10-29
docs/tiering-731-plan
wip/c6b02-review-733d
wip/c6b02-bm1-full-a
docs/deploy-plan
fix/storage-owner-liveness-642
fix/storage-fix-7
feat/tiering-731
wip/tiering-731-first-attempt
perf/idle-honest-2
fix/storage-private-tmp-642-dev
fix/storage-exact-file-quarantine-642
perf/one-flush-save
review/calendar-static
review/indexing-ring
review/when-field-2
proto/block-identity-2-review
proto/block-identity-review
review/when-field
issue/tasks-create-ids
issue/tasks-create
review/combined
review/task-polish
review/top-buttons
review/q1-q5
archive/integ325-293
archive/integ325-ci
issue/calendar-adr
archive/old/train/2026-10-23bk2
archive/old/train/2026-10-23bk
issue/469-mockup-9a
issue/smart-tasks-mockup
issue/469-menus
issue/652-signout-flake
issue/652-history-fix7
issue/652-history-fix6
archive/old/issue/spring-check-perf
issue/spring-check-perf
issue/659-rename-fast
archive/old/train/2026-10-21ar
issue/search-hardening-3
issue/652-history-fix5
issue/660-port-sheets-glass
issue/652-history-fix4
issue/652-history-fix3
issue/652-history-fix2
issue/652-history-flake
train/2026-10-21an
issue/settings-admin-port
issue/search-port
train/2026-10-20am
issue/storage-split-fix2
issue/storage-split
archive/old/issue/folder-ids-fix
train/2026-10-20al
archive/old/issue/folder-ids
train/2026-10-20ak
issue/tables-mockup
train/2026-10-19aj
train/2026-10-19ai
issue/469-merge-fixes
issue/sidebar-band
archive/old/issue/608-settings-spec
train/2026-10-19ah
issue/swipe-offscreen
train/2026-10-19ag
archive/old/issue/590-nlp-adr
archive/old/issue/587-event-after-write-2
train/2026-10-19af
archive/old/issue/587-event-after-write
issue/469-pill-room-c
issue/469-pill-room
train/2026-10-19ae
issue/469-narrow-handle
issue/397-ios-swipe-2
issue/469-desk-fixes
archive/old/issue/auto-update-adr
issue/469-filter-gap
issue/469-port-1b
issue/442-opacity-flake
issue/327-web-fast-3
archive/old/issue/469-port-1
issue/469-port-1
issue/327-web-fast-2
archive/old/issue/327-web-fast
archive/old/issue/425-stt-bench-vq1
archive/old/issue/445-no-bleed
archive/old/issue/400-swipe-mockup-2
issue/426-client-review
issue/426-client-2
issue/426-client
archive/old/issue/476-safe-area-lab
archive/old/issue/445-top-light
issue/471-blocks-mockup
archive/old/issue/448-links-app-2
archive/old/issue/448-links-app
archive/old/issue/398-cold-links
issue/434-442-small-2
issue/434-442-small
archive/old/issue/398-unload
archive/old/issue/445-bottom-band
issue/445-bottom-band
issue/351-rem-3
issue/351-rem-2
issue/351-rem
archive/old/issue/327-first-note
issue/395-width-phone
archive/old/issue/327-typing
issue/396-ios-edges
issue/397-ios-swipe
archive/old/issue/327-notes-index
issue/345-347-contrast-empty-2
archive/old/issue/44-arenas
issue/44-arenas
archive/integ325
archive/old/issue/327-perf-harness
archive/old/issue/44-thp
issue/44-thp
archive/old/issue/285-sticky-pills
archive/old/issue/44-trim-3
issue/44-trim-3
archive/old/issue/165-cards
archive/old/issue/165-picker-2
archive/old/issue/212-multi-select
No results found.
Labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
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
kayg/calternal#587
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Intermittent failure (about 1 in 10) of
apps/web/e2e/swipe-rows.spec.tson webkit-390, seen on plain origin/dev (1d2d8ce) with--repeat-each 5.:140Pin works from the swipe and the row says so; Unpin comes back:toHaveCount(0)received 1 at line 153.:177Delete moves the note to the Trash with Undo:toHaveCount(1)received 2 at line 187.:197the Trash: Restore ...: a click timed out at line 217.To decide: real bug in the swipe rows (kayg swipes on a real iPhone) or a test race. Root cause and repeat results will be posted here.
Root cause and results. PR: #591.
Real bug and a test race, plus a WebKit crash that is not the app. Traces from plain
dev(webkit-390,--repeat-each 8, 4 failures) show three causes.notes.pinanswered, the file saidcalternal-pinned: true, and the nextnotes.liststill said"pinned": false. The pin icon went away, the row said "Pin" again, and the tap on "Unpin" sent{"pinned": true}. Nothing corrects it afterwards.notes.listafternotes.deletestill listed the note and the row came back. #448 guards reads that began before the delete event; this one began after it.apps/web/src/lib/notes.svelte.ts: a pin this device asked for wins over a list read until the list agrees (or 15 s); a deletion wins for 15 s (anotes.createdfor the note, which Undo and Restore send, lets it back at once). Two new tests make every list read stale; they fail without the fix on chromium-390 and webkit-390.crashevent fires and the trace stops, right after anotes.deletedornotes.createdentry with the toast on screen. 0 in 280 on chromium; it also happens with tracing off (11 in 100 runs of the Delete test), withbackdrop-filteroff, and on unchangeddev. I could not find the trigger. One lead, not shipped because it changes how a tap feels: a tapped Delete that shuts its row without the spring (so the row is not animating when removed) took it from 11 in 100 to 3 in 90.Results (final branch):
swipe-rows--repeat-each 20: 280 passed, 0 failed.swipe-rows--repeat-each 20: 254 passed, 6 failed. All six are "Target crashed" / "Page crashed" (3 Delete, 3 Trash); no assertion failed. So the gate of 0 failures on webkit-390 is not met, because of the crashes.E2E_MATRIX=sample, four projects): 193 passed, 1 failed (list-chrome "Filter is equidistant ... pinned, 390 wide" on webkit-390, 7.7 px off once; 25 of 25 on a re-run; that test pins on the server and never reaches this code).Starting #587 on branch issue/587-event-after-write, base
9b4835e931. Tracing journal broadcasts, note writes, watcher updates and list index visibility. CLAUDE.md is absent from this worktree; proceeding with the approved job instructions.Root cause traced: crates/notes/src/home.rs:273 calls meta_touched, which queues IDs; crates/notes/src/meta.rs:880 sleeps 50 ms before refreshing SQLite meta.db. Home::record immediately calls the recorder, and the store commits and broadcasts the journal independently. notes.list reads meta.db through a separate reader connection (not the file or ids.jsonl). Pin uses API edit, which emits notes.changed while dirty text is still in its room (room/edit.rs:57), so just waiting for a file refresh would also be wrong. Create has a second path: lib.rs queues metadata, then actions.rs returns notes.created for the engine to commit. Watcher debounce is 150 ms before reconciliation; it too goes through Home::record. Startup scans batch events before sync_meta. Plan: commit metadata before journal publication, describe room events from their live text, and serialize scan refreshes so older file descriptions cannot overwrite live rows. No new fsync is needed; the rebuildable list stays synchronous=NORMAL. The requested CLAUDE.md is absent in this checkout and no copy was found under /home/kayg (depth 5). Read the PR #591 client holdback; no client changes planned.
Regression coverage is written for create (empty and with text), pin, unpin, delete, restore, rename, move, append, save, external create/edit/rename/delete. Each subscribes to the actual engine journal, immediately reads the paged list on the target event without waiting for the action response, and runs 20 rounds with 16 other writes in flight. Baseline execution is temporarily blocked on the prescribed local build-slot wrapper: /tmp/calternal-train.active names the live train PID 240806, so non-train jobs wait. No slot bypass or process cleanup will be attempted.
Implementation now waits for the metadata commit before publishing a journal event. Room events describe live text; watcher events request a row refresh from an open room; scan refreshes skip open rooms and share a per-Home lock with other metadata updates, covering description through commit. The old 50 ms metadata worker is removed. Metadata failures suppress publication; API edits propagate them. Added tests for startup scan notifications, a scan trying to overwrite an unsaved live pin, and a failed SQLite list commit. File persistence and SQLite synchronous=NORMAL are unchanged: no new fsync. Local validation is still queued behind train PID 240806.
The trace also covers the non-note journal events: daily.created/logged/log.closed wait for Notes::create/edit, so the same server barrier covers them. notes.forgotten and job progress do not add or change a live-list row. Binary room typing remains immediate collaboration traffic; it is separate from the journal events that trigger list reads. The client 250 ms refresh at apps/web/src/lib/notes.svelte.ts:232 is therefore no longer needed to hide index lag after these events; it can remain as request coalescing or be shortened/removed by the UI owner. No client file is changed. The perf VM has only 291 MB free on its root disk, so the optional baseline test source was placed on /mnt/z4-nvme (57 GB free), with its run queued under flock -o /root/perf-vm.lock.
Before-fix evidence on the perf VM, holding flock -o /root/perf-vm.lock. Source: untouched base
9b4835eplus the regression tests. Command: CARGO_TARGET_DIR=/mnt/z4-nvme/issue587/target cargo test -j4 -p calternal-notes event_visibility -- --test-threads=2. All 18 tests failed, including every action and external-edit case; the failure occurred in the first round. Full test output follows verbatim:First fixed-server regression run on the perf VM, holding flock -o /root/perf-vm.lock: 19 passed, 0 failed, in 5.17 s. All 16 action/external cases completed 20 rounds with 16 other writes per round (320 target changes and 5,120 competing writes), plus startup-scan, scan-overwrite and SQLite-failure tests. Output verbatim:
Local gates remain queued behind the test train. Checking title precedence on the first changed event of a rename before the final run.
Additional first-event finding: the shared search descriptor prefers frontmatter title over H1. After an API H1 rename, before the deferred save reconciles title fields, that would still describe the old title. The first implementation therefore needed one more change: room list rows now use the existing ADR 0025 title precedence (the field changed since the saved base wins; H1 wins a tie), without editing the document or adding a history/file write. The new H1 regression failed against the first implementation, while the explicit frontmatter-title case already passed. Output verbatim:
Expanded fixed-server regression result on the perf VM under flock -o /root/perf-vm.lock: 21 passed, 0 failed, in 5.87 s. The 18 action/external cases each completed 20 rounds with 16 competing writes (360 target actions, 5,760 competing writes), plus three scan/failure tests. Title edits now pass at the first notes.changed event too. Output verbatim:
The required local fmt, clippy, workspace and browser gates are still waiting behind the active test train through build-slot.sh. No bypass is being used.
Independent code review found two transient-error recovery gaps in the first fix. room/save.rs clears file dirtiness before publishing saved; if the new metadata commit failed there, a later clean flush returned without retrying the row. room/rename.rs moves the file before its metadata commit; actor and public no-op rename shortcuts could likewise return success with an old list path. Added regressions for explicit flush retry, background publication retry, actor rename retry, and the public rename shortcut. Room publication is now retained separately from file dirtiness, retried before later actor requests and on a timer, and coalesced by event kind during prolonged errors. These retries only commit metadata and journal events; they do not rewrite the note file. Existing saved-base title precedence is also covered.
Recovery regressions confirmed both review findings. Before recovery handling, the first fix passed 21 tests but failed all four new retry tests: both renames retained Before.md instead of Original.md; flush retained the old tags; background publication timed out. With pending publication handled independently of file dirtiness, all 25 passed in 6.10 s. Retries assert unchanged note-file modification time. Output verbatim:
Before recovery fix:
After recovery fix:
One further review finding is covered next: Cmd::Outside must still ingest an external edit during a pending metadata failure, because a watcher notification has no caller to retry it. It now bypasses the pending-publication refusal while retaining its own failed event for later publication.
Remote validation under the perf VM lock: cargo clippy -q -j4 --workspace --all-targets -- -D warnings exited 0. Three complete regression runs passed all 26 tests (6.94 s, 9.57 s, 8.80 s); another passed with the watcher-outage case looping 20 fresh homes (5.42 s). One earlier full run after the watcher guard change still failed that new recovery case, while its isolated run passed. I added failure-only diagnostics for the live text and row and am rerunning the 20-loop case without any extra successful-path read, rather than assuming that earlier failure is explained. Remote workspace tests are running. Required local gates remain queued behind train PID 240806 through build-slot.sh.
Remote workspace verification completed with exit 0 (cargo test -q -j4 --workspace), after workspace/all-target Clippy with -D warnings exited 0. The final targeted run also exited 0: 26 passed, including 20 fresh-home repetitions of the watcher-outage case. Successful-path diagnostics were removed, so that fault test makes no extra read before its assertion. The earlier intermittent failure remains documented above and has not reproduced in these subsequent full/repeated runs. All remote runs held flock -o /root/perf-vm.lock. Required local gates are still queued behind the live train.
Targeted output verbatim:
Remote workspace output verbatim:
Completed path trace: the action notes.list calls Notes::page and MetaDb::page, which uses a separate SQLite reader for notes/meta.db. Notes::list, used internally, reads the in-memory id index instead. The journal writer itself is ordered correctly: store/writer.rs commits its transaction before broadcasting entries. The missing ordering was between the notes projection and that journal.
Pin/unpin and append/patch/replace commit history in Room::api_edit, then announce changed while the file is still dirty. They now describe the live document before journaling. Empty create first commits a provisional row; create with text also goes through api_edit. The create action returns its extra created event to Engine::Owned only after these barriers. Existing-id create refreshes the room row before returning.
Save prepares history, atomically places the file, promotes history, and then commits the live row before saved. Rename and folder move save first, rename the file, update the id index, then commit the row before renamed. Bulk edit, block move, undo and tag operations use those same room/create/delete paths. Trash delete/restore move the file and update/remove the id mapping before Home::event commits the list removal/restoration. The id log may still flush lazily where it did before; lists do not read that log.
The watcher debounces 150 ms before reconciling paths. Closed-note edits describe the file before Home::record; open-note edits are merged into durable history by Cmd::Outside and describe the room. New and renamed files flush their identity mapping before their metadata/event work; external deletions remove the mapping and row. Startup discovery still reads heads and fills metadata in large batches, but commits that metadata before publishing its event chunks. The final scan refresh shares the metadata lock and skips open rooms.
Daily actions delegate to Notes::create/edit, so their outcome events get the same barrier. Forgotten notes have already left the active list; job progress and not_saved do not announce a new live-list row. Binary room updates remain immediate collaboration traffic, separate from the journal notifications used for list rereads. No client code was changed.
Additional bounded investigation of the earlier intermittent watcher-outage failure: 100 separate unit-test process runs completed, each with 20 fresh-home outage cases, with no failures. Summary verbatim:
The failure-only row/live-text diagnostic is retained in the test, and the earlier failed development run remains documented. The local train has now finished. Required local gates are running through build-slot.sh with the host compiler environment: fmt and Clippy passed; workspace tests are compiling; the server build and 10-repeat Chromium/WebKit swipe run are queued next.
Completed local gate output verbatim:
The first local workspace gate hit the process soft descriptor limit (1024; hard limit 524288). It produced EMFILE and database-open errors in several groups. Investigation found a test-harness ownership cycle: Engine registry handlers own Notes, while Notes/Home held the same Engine strongly as EventRecorder. Each completed test retained SQLite connections, and the fresh-home outage loop amplified that retention. The recorder in these tests now forwards through Weak; each fresh-home fault case closes its room and verifies its Home is released. The rerun keeps the original 1024 descriptor limit. Both host and perf VM have that same soft limit. Resource pressure is also consistent with the earlier isolated watcher-outage development failure, whose notification cannot return a file-read error to a caller; that connection is an inference, not a separately captured trace.
First local gate output verbatim:
Exact final regression test file (including the weak test recorder and cleanup assertions) was run against untouched base
9b4835eplus only the test module/dev dependency. All 26 failed as expected; no EMFILE errors occurred. The fixed local workspace suite passed with the original 1024 descriptor limit. Final before output verbatim:First requested browser gate completed against the ordering fix: 229 passed, 50 skipped, one WebKit process crash, and no assertion failures. The crash occurred during the Trash test while clicking Undo. Output excerpt verbatim:
Trace remains at /tmp/issue-587/pw-results/swipe-rows-the-Trash-Resto-d6cfa-rever-asks-Confirm-in-place-webkit-390/trace.zip. This is reported separately from assertion failures as requested. A final cache-performance guard is being added: clean saved room rows should keep reusable file stamps, while unsaved/live rows must remain conservatively stale. The initial always-live stamp would cause unnecessary warm-scan rereads. After that change I will rerun the gates on the final server binary.
Warm-scan guard reproduced a performance regression in the first implementation: saved_rows_keep_file_stamps_for_warm_scans failed because a completed save still had stamp live instead of the file stamp. The final implementation now reuses the file stamp for a clean room only after confirming its saved path and hash match the current file. Dirty/live rows and external bytes not yet ingested remain conservatively stale. A no-op save also restores a clean stamp. This preserves warm-scan reuse without labelling old room text as a newer external file. The verification reads bytes without writing/flushing the file; no forced fsync is added. Two cache guards are included, and final gates are rerunning on that server version. Red test output verbatim:
First browser run: WebKit Target crashed trace. It records the crash while clicking Undo in the Trash test. The full run had 229 passed, 50 skipped, one browser crash and no assertion failures. Final repeat-each-10 validation is now running against the warm-cache fix.
Final requested browser gate on the final server binary completed: 227 passed, 50 skipped, 3 WebKit interruptions; exit 1. Chromium completed all 10 repetitions without failures. WebKit had one explicit Page crashed and two Target page, context or browser has been closed errors around Undo. One expect-toHaveCount report was interrupted by Page crashed before it could finish; it is classified separately as a browser crash, not a completed ordering assertion failure. The two closure errors are reported literally rather than assumed to be explicit renderer crashes.
Attached traces:
Finished the server fix. PR: #594
Head SHA:
87959539a3b8f611fe7617a72c91d75419e0479fThe browser gate exits 1 with three WebKit interruptions, documented separately from completed assertions below. No merge or deployment was performed.
The server could publish a note change while
notes.liststill served its old row.Home::recordqueued the metadata refresh, and its worker waited 50 ms before updatingmeta.db; room edits could also announce a change before their deferred file save. Under load, the web app’s 250 ms reread still saw the old pin or a deleted note.This change commits the list row before recording the event. Rooms describe their current text, including saved-base title precedence, while watcher and trash operations wait for their row refresh. Scans share the refresh lock, skip open rooms, and keep cold fills batched. Clean saved rows retain reusable file stamps after checking the saved path and file hash. Failed room publications are retained and retried separately from file dirtiness, without rewriting the note file. File persistence and SQLite
synchronous=NORMALremain as before; no forced fsync was added.Server projection lag no longer requires the client’s 250 ms reread delay. The UI owner can shorten or remove it, or keep it to coalesce requests. Existing guards for reads that began before an event still apply. No client code changed.
Related to #587.
Before and after evidence:
9b4835e931f6015af966a617db06457778277b18plus the regression tests: 26 failed, 0 passed.Head:
87959539a3b8f611fe7617a72c91d75419e0479f.Final browser gate: 227 passed, 50 skipped, 3 WebKit interruptions (exit 1). Chromium completed all 10 repetitions without failures. WebKit reported one
Page crashedand twoTarget page, context or browser has been closederrors during Undo. The count expectation was interrupted by the page crash. These are reported separately from completed ordering assertions.Delete Undo repeat 4 trace
Delete Undo repeat 7 trace
Trash Undo repeat 8 trace
An earlier browser run had 229 passed, 50 skipped and one explicit
Target crashed; its trace and the development diagnostics are on #587. The test recorder uses a weak engine reference and releases each fresh Home, so final workspace tests passed with the unchanged 1,024 descriptor limit.All local heavy commands ran through the supplied
build-slot.sh, with Cargo-j4and Playwright--workers=1. Playwright used this branch’s freshly built server binary. Gate output follows verbatim.Formatting
Clippy
Workspace tests
Named ordering, recovery and cache tests
Server binary
Browser repetitions
Independent review of PR #594 started. Review checkout is detached at
87959539a3, base origin/dev9b4835e931. No commits or pushes will be made. I am reviewing event visibility, write ordering, locks, error paths and crash replay, then running the requested notes tests, repeated event tests and clippy. CLAUDE.md is absent at the worktree root; checking surrounding guidance.Review finding under verification: crates/notes/src/home.rs:273-275 drops non-room events when the list commit fails, while delete/restore callers still report success. There is no pending-event retry here (unlike Room). In particular, trash.rs restore moves the file and updates its id before home.event; a retry takes its already-restored early return and cannot republish. A later sync_meta repairs rows without publishing the lost event. Also checking room/load.rs:29 with room/merge.rs:103-104: an external merge is already durable before metadata publication fails, but load returns Err and drops the Room holding pending_events. I am running isolated fault probes against an archive of this exact head, with all added probe code outside the review worktree. Test command correction: Cargo package is calternal-notes, not notes. Initial missing cc was resolved by adding the installed Nix gcc wrapper to PATH. CLAUDE.md is absent from both supplied revisions and checkout ancestors.
Required gate evidence: full notes suite passed:
test result: ok. 254 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 14.75s. However repetition 4 of event_visibility failed:test result: FAILED. 27 passed; 1 failed; 0 ignored; 0 measured; 227 filtered out; finished in 4.52s. Failure was tests::event_visibility::outside_rename: two background creates panic at clients.rs:141 afterInternal: history write failed; event_visibility.rs:270 then unwraps their failed JoinHandle. Cause is not established; I am finishing all 20 repetitions and clippy. Separately, the isolated room-load probe confirmed that a durable external merge loses its notes.changed notification when metadata fails during room opening; successful reopen and a watcher echo do not recover it.Confirmed P1 data-loss finding at crates/notes/src/lib.rs:322-330 (retry at :271-275). A create reserves/persists the id, then the new fallible meta_touched().await? can return before applying the supplied text. Retrying the identical notes.create action takes the existing-id branch and reports success with empty text. Isolated probe used a real Engine action with one idempotency key and explicit id, set the list writer to query_only for the first attempt, then restored it and retried exactly. Output:
CONFIRMED: create with initial text fails its provisional metadata write; exact action retry succeeds with empty text and permanently omits the requested body. This fails the no-lost-writes contract. Persist/apply initial text before treating the reserved id as a completed create, and add an error-and-retry regression test.Both notification findings are now reproduced too: (P2) home.rs:273-275 drops a restore event while restore reports success; retry and a later row repair do not republish. (P2) room/merge.rs:103-104 propagates metadata failure through room/load.rs:29, destroying the pending notification after the outside edit and base hash were persisted; a later open/watch echo sees matching bytes and never emits the event. Isolated probes:
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 255 filtered out; finished in 0.02s. These probes assert the buggy outcomes; they are outside the repo and are not product regression tests.All 20 required visibility repetitions completed: 19 passed with 28/28; repetition 4 failed with 27/28 as reported above. Clippy passed:
Finisheddevprofile [unoptimized + debuginfo] target(s) in 17.61s. Release save benchmark is building. No worktree edits, commits or pushes.Independent review finished. Verdict: FIX FIRST.
Head:
87959539a3Base:
9b4835e931P1: Initial text is lost on create retry. crates/notes/src/lib.rs:322-330, retry branch :271-275. The id is already persisted when the provisional metadata write fails. The initial Append has not run. The identical Engine action retried after recovery takes the existing-id branch and succeeds with an empty note. Reproduced using one explicit id and one idempotency key. Apply or persist the initial text before considering the reserved id a completed create; add a regression test for failure before the first edit.
P2: Successful restore loses its notification after metadata failure. crates/notes/src/home.rs:273-275, called from trash.rs:528-533. The restored file exists and the restore reports success, but the event is discarded and its list row remains missing. Public retry reports not in Trash; the internal already-restored retry at trash.rs:427-432 also cannot republish. A later sync_meta repairs the row without an event. Delete and scan discovery have the same lack of retained publication work (scan.rs:262-267 discards the discovery batch). Keep retryable publication work outside rooms too, or propagate an error with a retry path that actually repairs and announces the committed action.
P2: Failed room loading destroys an outside edit's pending event. crates/notes/src/room/merge.rs:103-104 and room/load.rs:29. append_outside has already persisted both the edit and base hash. A metadata failure bubbles out through load, destroying the Room and its pending_events. On recovery the file matches the persisted base hash, so reopening and the next watcher echo never announce notes.changed. Reproduced with a closed note changed externally, failing metadata during get, recovering, reopening and reconciling. Preserve the pending publication across unsuccessful load, or retain the loaded actor and retry before returning successful reads.
Contract decisions:
Gates used the actual package name calternal-notes; literal -p notes fails with: error: package ID specification
notesdid not match any packages. Every local build/test/benchmark ran through the required build-slot.sh, cargo -j4. The Nix gcc wrapper was added to PATH after the initial missing-cc error.Full cargo test summary, verbatim:
20 event_visibility repetitions, verbatim summary lines under each repetition label:
Run 1:
Run 2:
Run 3:
Run 4:
Run 5:
Run 6:
Run 7:
Run 8:
Run 9:
Run 10:
Run 11:
Run 12:
Run 13:
Run 14:
Run 15:
Run 16:
Run 17:
Run 18:
Run 19:
Run 20:
Run 4 failure, verbatim:
Thus 19 runs passed 28/28, and one failed 27/28 (559/560 individual cases). The failing outside_rename test panicked in its background creates with history write failed; the cause was not established. This gate is not clean.
Clippy (
cargo clippy -p calternal-notes -j4 --all-targets -- -D warnings), exit 0, verbatim summary:Isolated fault probes from a git archive of this exact head, with probe code only under /tmp, verbatim:
These probe tests assert the buggy outcomes to demonstrate them. They are not passing product regressions.
Existing save_bench, release with repository fat LTO, 50 timed saves per size, four runtime workers, new temporary data directory per run; each append occurs outside the save timer. Both versions verify every appended line occurs exactly once. Host is shared, so differences this small are not strong performance evidence.
head-1:
base-1:
head-2:
base-2:
The temporary base worktree has been removed. Review worktree remains detached at the stated head and git status --porcelain is empty. No repository edits, commits, pushes, merges or deployments. Evidence and probe source remain under /tmp/calternal-review-594; nothing was committed. CLAUDE.md was absent from the supplied revisions, worktree root and checkout ancestors.
Starting the review fixes on branch
issue/587-event-after-write-2, from base87959539a3b8f611fe7617a72c91d75419e0479f. I will address all four findings, run the required gates and save-latency comparison, and open a new PR into dev superseding #594.Code tracing confirms the three recovery gaps in the review. In lib.rs, the reserved id is durable before meta_touched and the initial Append, while the existing-id return skips that Append. In home.rs, record returns immediately on a metadata error. In room/load.rs, settle propagates ingest's metadata error after append_outside has persisted the edit and base hash, dropping the local pending_events with the Room. scan.rs also drops the entire discovery event batch after a metadata error.
The replacement branch now retains the initial create edit in history until completion, and keeps failed publications in a durable history table, coalesced by note and event kind. A background retry reads current list rows before publication and acknowledges specific queue sequences. The successful save path adds no history write. Fault regression runs and the baseline flake investigation are queued behind the active shared test train; no gate results yet.
Local validation is temporarily waiting for the shared build-slot scheduler. The active /tmp/calternal-train.active PID is 568514 (trainpar.sh af). All baseline fault probes, instrumented visibility repetitions, baseline save benchmark and fixed-code checks are running through build-slot.sh and have not yet entered a slot. I am preserving the scheduler and the other job's processes. Implementation and additional restart/discovery regression coverage are prepared; no passing gates are claimed.
Baseline reproduction results from
8795953:All seven new metadata-fault regressions failed for their intended reasons: explicit-id, key-derived-id and no-key creates returned empty text on retry; restore, restore across a Home restart, closed-room external edit, and scan discovery never recovered their notifications. Verbatim summary:
The replacement implementation passed the first visibility run:
The history flake reproduced on the baseline immediately in edit_title_property, and again on run 3 in outside_edit_closed. Instrumenting the history writer, rather than the test unwrap, exposed the actual error:
History starts grouped transactions with deferred BEGIN. Jobs such as create first SELECT the note row, then try to write. SQLite can refuse that read-to-write upgrade with SQLITE_BUSY without waiting through busy_timeout. commit then rolls back the entire group and drops every reply, turning this into unrelated background creates failing with “history write failed”.
A deterministic regression coordinates a second WAL writer between a history job's read and write, without sleeps. It fails on the baseline:
The fix acquires the history writer lock with BEGIN IMMEDIATE before running any grouped job. This makes contention wait at lock acquisition instead of failing a later upgrade and discarding unrelated writes. Its regression and the final required gates are running next. No retries, sleeps, or serialization were added to the visibility tests to hide the flake.
The new lock regression and all 36 visibility tests passed with BEGIN IMMEDIATE. The first full workspace run then caught a test-fixture interaction: tests::fanout::a_crash_before_the_seed_is_durable_never_doubles_text failed because History::stall blocks inside the transaction and deliberately leaves its old thread asleep forever across a simulated restart. An immediate transaction now holds a writer lock there, unlike the old empty deferred transaction. A real process crash would release that lock.
I moved the test-only stall point before transaction acquisition, preserving its old lock-free behavior and the ordered writer queue. No production pause or retry was added. The complete fanout suite and the deterministic writer regression now pass:
The final gates are being rerun from formatting onward. The workspace build uses the host's shared env.sh so the Nix OpenSSL headers and libraries are available. An initial environment-only clippy attempt lacked those paths; the subsequent full workspace clippy passed.
Finished the review fixes in PR #597: #597. It targets dev and supersedes #594. Nothing was merged or deployed; this issue remains open.
Head:
24d0c5204db3dccc50866b889978a30de6c5b1ffonissue/587-event-after-write-2, based on87959539a3b8f611fe7617a72c91d75419e0479f.lib.rs:301,lib.rs:351,history/publication.rs:70).home.rs:273,home.rs:304,scan.rs:262).room/mod.rs:334).history.rs:537, regression athistory.rs:770).All seven metadata-fault regressions and the writer regression fail on the original revision. Final validation: fmt and workspace clippy passed; workspace tests passed 543 tests, 2 ignored; all 30 visibility runs passed 36/36, or 1,080 cases. The paired save comparison uses clean release builds, two alternating runs per revision, and 50 timed saves per size. At 3,500 lines, p50 was 3.88/3.99 ms before and 4.28/3.98 ms after; the raw output below retains the shared-host variation.
Every heavy local command used build-slot.sh and Cargo -j4. Gate output and the save comparison below are verbatim; the combined command exited 0. The PR contains the same full output. No evidence or artifacts were committed.
Final gate output and save comparison, verbatim
Independent re-review of PR #597 started. Review only; no commits or pushes. Worktree is detached at
24d0c5204d, base9b4835e, previous reviewed head8795953. I will review the delta and affected full code paths, verify earlier findings, and run the requested test, repeated visibility, and clippy gates.Independent re-review finding 1, P1: Pending create survives permanent deletion and replaces a later create's requested text.
At crates/notes/src/history/publication.rs:76, begin_create uses INSERT OR IGNORE, while history.rs:358-368 purge only removes updates and notes, never note_creates. finish_create in lib.rs:352-375 later consumes that old body.
Reproduced against an isolated git archive of
24d0c52: fail a create with explicit id purged-create and initial text "secret old body" by setting the list connection query_only=ON; recover the connection; get the reserved note and append different text; delete it and permanently forget it. history.note is now None, but history.pending_create still contains the original body. Create the same explicit id with "new requested body". The call succeeds, but the resulting document contains "secret old body" and omits "new requested body". This both loses the new write and restores text from a permanently deleted note. Clean pending intent as part of purge and make a new note life unable to consume an earlier life's create.Probe output, verbatim:
The probe asserts the defective outcome to demonstrate it; it is not a passing product regression. Source and logs are under /tmp/calternal-review-597, outside the repository.
Independent re-review finding 2, P2: Older deferred delete lands after permanent forget and rewrites the final state.
At crates/notes/src/home.rs:317, retry_events discards a deferred notes.deleted only when the id has a live path. A permanently forgotten note also has no live path, so the old delete is replayed after the newer notes.forgotten. record_listed at home.rs:295 calls missing::remember, which calls History::depart for this old delete; history/departed.rs:53-54 INSERT OR REPLACE resets gone_ms to NULL.
Reproduced on isolated
24d0c52: create and save a note, set metadata query_only=ON, delete it successfully, restore metadata writes, permanently forget it successfully, and wait for the history barrier. departed.gone_ms is Some. Run retry_events and another barrier: departed.gone_ms is now None, even though there is no Trash entry. The older state landed last. Normalize or supersede deferred events against the final lifecycle, including permanent deletion, rather than only testing live path presence.Probe output, verbatim:
This asserts the bug for demonstration. No worktree edits.
Independent re-review finding 3, P2: One failed room event is replayed twice without any crash.
At crates/notes/src/room/mod.rs:349-350, a successful room retry clears only the in-memory pending_events. It does not acknowledge the row previously inserted into publications by room/mod.rs:336-337. home.rs:333-336 then publishes that row again before removing it.
Reproduced on isolated
24d0c52: create and save; subscribe to the journal; set metadata query_only=ON; append with an idempotency key (returns error and persists one pending event); restore writes; get the note. The room publishes notes.changed, but history.pending_events still has one row. Run retry_events: a second journal event has identical kind, item and data. No second edit and no crash are needed. The normal background retry calls meta_touched, which sends RefreshMeta to the same actor and can produce the same double publication. Also, recording and acknowledging are separate durable operations, so kill -9 between home.rs:334 and :336 can duplicate replay again. Coordinate the room and durable worker and use a durable event identity if exactly-once delivery is required.Probe output, verbatim:
This asserts the bug for demonstration. No worktree edits.
Independent re-review finding 4, P2: A kill before the fallback persistence still permanently loses an outside edit notification.
At crates/notes/src/room/mod.rs:334-337 and home.rs:280-287, publication intent is persisted only after publication fails. The outside edit and its new base were already committed together by history.rs:279-296, called from room/merge.rs:77-89. There is no pending intent in that transaction.
Real SIGKILL reproduction on an isolated archive of
24d0c52, with the only product instrumentation an await pause at entry to Home::defer_events: child opens a saved note, writes an outside edit, fails metadata with query_only=ON, and gets the note. After the edit/base commit and failed metadata, the child reports reaching defer_events before its history write. Parent kills only that recorded child PID using Child::kill, waits, then starts fresh Notes and Engine on the same directory. Text contains the outside edit, publications is empty, and reopening, watcher reconcile and retry_events never emit notes.changed. The persisted base equals the file, so ingest takes the no-change return. A 1.2-second journal receive also times out after all explicit recovery steps.Persist notification intent with the durable mutation or retain a replayable durable marker before advancing its base. The new home-restart test kills only after fallback persistence has completed, so it does not cover this gap.
Probe output, verbatim:
This probe asserts the missing-event outcome to demonstrate it. Existing byte/history crash replay is not lost in this scenario. All instrumentation and evidence are under /tmp/calternal-review-597, not committed.
Independent re-review of PR #597 finished. Verdict: FIX FIRST.
Head:
24d0c5204dBase:
9b4835e931Previous reviewed head:
87959539a3Ranked findings, reproduced in an isolated archive of this head:
Earlier findings and contract assessment for
24d0c52.The earlier exact-action create retry defect is fixed for its original scenario: lib.rs persists Create before durable index reservation; the existing-id branch calls finish_create; the stored key makes the first append idempotent. The explicit-id, key-derived-id, and explicit-id-without-key regression tests all passed. A different lifecycle defect remains: purge retains this intent, allowing old text to replace a later new create (finding 1).
The earlier restore notification loss is fixed for completed fallback persistence: Home::record retains failed metadata/journal publications and start_publications retries them. Restore, restart, discovery and delete/restore regression tests passed. Scan discovery now defers each failed chunk instead of throwing it away. The restart test does not kill in the write-to-outbox gap (finding 4).
The earlier failed-room-load event loss is fixed if the fallback history write completes: Room::event defers pending_events before returning the metadata error to load; the new load regression passes. The outside-edit update and base still commit before this later fallback persistence, so SIGKILL in between loses the notification (finding 4).
The earlier outside_rename flake is addressed by BEGIN IMMEDIATE: history commit obtains the write lock before jobs read, avoiding WAL read-snapshot upgrade failure that bypassed the busy handler. The new competing-writer regression passes. Writer tune retains busy_timeout=5000 and synchronous=FULL; readers retain 5-second busy timeout. A writer holding the lock over five seconds can still fail the grouped write, as expected from that timeout; no infinite retry or executor blocking was introduced. Production waiting remains on the dedicated history thread, and publication reads use spawn_blocking. The test stall was moved outside transactions, so artificial crashes do not leave a competing write lock behind.
Store: /users//notes/history.db, migration 6 tables publications and note_creates. publications stores one row per (kind,item), replacing with a fresh AUTOINCREMENT seq; pending_events reads at most 1000 rows ordered by seq. Successful retry deletes precisely those seqs; the acknowledgement regression ensures newer failed work survives an older ack. This is a batch limit, not a storage limit. Outstanding distinct notes can grow without a hard bound during an outage; a failed batch prevents its rows being acknowledged. note_creates stores whole initial bodies and has no TTL or background draining; only finish_create deletes entries, and permanent purge misses them (finding 1). Room retry does not remove persisted publication rows (finding 3). Publication and ack are separate commits, so replay is not exactly once. Filtering saved paths does not serialize replay with live events or account for forgotten notes (finding 2).
Contract 1: List rows are committed before events in the examined paths; immediate-read visibility tests passed in all 20 repetitions. Contract 2: fails for wrong initial text and older delete overwriting permanent forget. Contract 3: no new lock cycle or blocking wait on async executors found; storage has the cleanup/bound limitations above; save benchmark interpretation and measurements follow. Contract 4: existing file/history kill-9 tests passed; external notification replay has the confirmed gap in finding 4.
Every local heavy command ran through the required build-slot.sh, with cargo -j4. The gcc-wrapper bin directory was added to PATH. All requested gates exited 0. No tests were added to the worktree. The fault probes below assert buggy outcomes, not passing product requirements.
cargo test -p calternal-notes -j4, verbatim summary:
cargo test -p calternal-notes -j4 event_visibility, 20 repetitions. All 720 cases passed. Verbatim summary lines in run order:
Run 1:
Run 2:
Run 3:
Run 4:
Run 5:
Run 6:
Run 7:
Run 8:
Run 9:
Run 10:
Run 11:
Run 12:
Run 13:
Run 14:
Run 15:
Run 16:
Run 17:
Run 18:
Run 19:
Run 20:
cargo clippy -p calternal-notes -j4 --all-targets -- -D warnings, exit 0, verbatim summary:
Isolated probes, verbatim evidence:
Save latency: release save_bench, 50 timed saves per size, four runtime workers, automatic saves and watching off, separate fresh data directory for each run. Append work is outside the save timer, and each run asserts every appended line occurs exactly once. Built
24d0c52with repository release settings; comparison uses the retained save-head release binary for the previously reviewed8795953. Runs were interleaved head, previous, head, previous inside a build slot. No extra successful-save history flush was added by this delta: BEGIN IMMEDIATE changes writer-lock acquisition, not the pending/prepare/place/promote sequence.The shared host was noisy: no consistent p50 or p95 regression across sizes/runs, but one head save took 350.31 ms. These measurements cannot certify unchanged tail latency under load, and do not measure a large cold scan or a writer holding a competing transaction for the full busy timeout.
head-1:
prev-1:
head-2:
prev-2:
All review probes and benchmark evidence remain outside the repository under /tmp/calternal-review-597 (reused build caches under /tmp/calternal-review-594). The only added product instrumentation was in the isolated archive: an await pause before fallback notification persistence for the real SIGKILL test. No commits, pushes, merges, deployments, or issue closures. The supplied worktree remains detached at the reviewed head; git status --porcelain is empty.
Starting third round on issue/587-event-after-write-3 from origin/dev
1200114c32. Supersedes #594 and #597. I read both reviews and will remove durable event/create state, recover the list from files and journal, and test all seven findings. CLAUDE.md is absent in this checkout and searched ancestors/nearby checkouts; using repository docs and the approved job instructions.Fault-injection results against
24d0c52: four regressions fail as intended: regression_failed_create_cannot_resurrect_forgotten_id (the create succeeds), regression_create_retry_conflicts_with_different_file_text (the retry ignores changed bytes), regression_delete_failure_then_forget_keeps_gone (gone_ms becomes NULL), and regression_one_reconcile_path_after_failed_edit (a second notification is received). These use the real list connection with PRAGMA query_only=ON, then restore writes. The existing create/restore/load regression probes also fail on9b4835e; full logs are outside the repo.Design choice: recovery retains only a set of note ids and repairs current rows, then emits notes.changed with reconciled=true. It does not replay old event kinds or lifecycle data. Events are at-least-once hints. Initial text is written and flushed before list metadata; empty UI placeholders retain ADR 0021 first-keystroke behavior. Permanent id identity is preserved in the existing departed deletion history, without a new table or stored event/body. This marker must survive another note reusing the old path.
Read-only code review found four related edge cases; targeted tests cover them: an initial write failure left an index reservation, concurrent reads could open an empty room before the initial write, server-key normalization could reject identical retries, and notification failure could skip automatic title renaming. File and authored history now precede index publication; discovery shares the lifecycle lock. Permanent deletion now commits both identity and path gone_ms in its history transaction before unlink, independently of notification delivery. Backup discovery assigns a fresh identity rather than reusing a forgotten id. No notification/create-intent tables remain.
The corrected baseline runs explicitly recompile the archive source (Cargo can otherwise reuse newer checkout artifacts):
8795953fails all seven original review_* regression variants, and24d0c52fails all four re-review scenarios plus the conflicting-content check. The SIGKILL regression requires startup to announce the repaired row and immediately checks the list before opening the note; this fails on24d0c52. The latest notes run passed 279 tests with one existing ignored test. Final workspace gates and the 30 repetitions are underway. The first workspace clippy attempt stopped because pkg-config/OpenSSL discovery was absent from PATH; the installed Nix tools and OpenSSL pc directory have been supplied, and the gate is rerunning.Save latency measured on this shared host with two interleaved runs per revision, release fat LTO, 50 timed saves per size, four runtime workers, automatic saves and watching disabled. Before is a fresh build of
24d0c52; after is the current implementation. Each benchmark verifies every appended line occurs exactly once. All builds and runs held the required local build slot.Medians are close across both pairs; p95 for 3,500 lines is somewhat higher after the change (7.86–8.65 ms versus 7.48–7.68 ms). These shared-host runs do not establish unchanged tail latency or cold-scan performance. No extra successful-save history flush was added.
Verbatim benchmark output:
One additional regression was found after the first clean 30-run visibility pass: a pin/edit can commit to history, fail list metadata, then restart before its deferred file save. A file-only startup scan sees unchanged old bytes and leaves the list stale. regression_failed_unsaved_edit_restart_reconciles_from_journal reproduced this with PRAGMA query_only and failed with: startup trusted the old file over the durable journal.
The fix reads the existing note bases and journal changes during startup, opens only identities with changes not yet in their file base, and commits their current list rows before hinting. The same reconciliation helper reloads a closed room with existing history after load failure. This uses no persisted event, create request or new dirty marker. It adds startup history-reading work; save hot-path durability is unchanged. Final gates and latency runs are being repeated after this change.
The strengthened restore read-barrier regression also fails on
9b4835ewith: a restore hint must wait for its list row. Together with the earlier baseline failures, every reviewed scenario has a failing prior-revision regression.Final paired save-path measurements after journal-aware startup recovery are below. At 3,500 lines p95 is higher after the change in both pairs (7.47 and 10.66 ms versus 5.23 and 8.79 ms); the host also changed substantially between pairs. I am reporting this as a tail-latency limitation, not claiming performance equivalence. Large cold-scan costs of reading existing histories remain unmeasured.
Deletion regression coverage now also replays an older permanent-deletion timestamp. That exposed an UPDATE which could replace an existing gone_ms; both permanent updates now use COALESCE to preserve the first committed deletion state. The final workspace gates passed again, and the clean 54-test visibility loop is underway. No event or create request state was added.
Finished third round. New PR: #599
Head:
e174661153Refs #587. Supersedes #594 and #597. Base:
1200114c32. Head:e174661153.Note notifications previously ran ahead of list commits. The later durable outbox and create intents introduced stale text, deletion replay and duplicate recovery paths. This change removes those tables and request/event replay code.
Both discovery paths share the lifecycle lock, assign new identities to reintroduced backup copies of forgotten notes, and avoid exposing an empty room during create. No event, initial body, notification acknowledgement or extra dirty marker is persisted. The existing departed table retains permanent identities independently of path reuse. History BEGIN IMMEDIATE from #597 remains to prevent grouped writes failing a read-snapshot upgrade.
9b4835eand87959539b4835e(restore barrier) and87959539b4835eand879595324d0c5224d0c5224d0c5224d0c52The SIGKILL test pauses immediately after the outside edit/base commit, kills only its recorded child PID, verifies signal 9, and checks the repaired list before opening the note. Startup also publishes the repaired-row hint.
Additional regressions cover an initial I/O failure and retry, concurrent reads before the initial file, conflicting existing bytes, restart without a create intent, CRLF/BOM preservation, server-key normalization, automatic title renaming after failed publication, deletion state before unlink/event, path reuse, backup discovery, and a journal edit whose list write fails before its file save.
The save differential oracle now opens fresh stores without starting a competing actor for the Room it owns directly. Its file-byte, CRDT-state, history-update, version and restart assertions are unchanged; normal startup recovery is tested separately.
Compared with #597, notes runtime files change +463/-392 lines (net +71); tests change +750/-17 (net +733); ADR 0021 adds four lines. The 131-line publication module and its two-table migration are removed. The remaining runtime growth covers durable file-first creation, permanent deletion and recovery from existing journal data. The full diff against current dev is:
Save measurements use release fat LTO, 50 timed saves at each size, four runtime workers, automatic saves and watching off, fresh data per run, and two interleaved runs each of
24d0c52and this save path. Every appended line is verified exactly once. All local builds, tests and measurements use the required build-slot.sh; cargo uses -j4.The final paired measurements show higher p95 at 3,500 lines after the change: 7.47–10.66 ms versus 5.23–8.79 ms. The shared host varied substantially across pairs, so these runs do not establish unchanged tail latency. Startup now reads existing histories to detect edits newer than file bases; large cold-scan cost was not measured. No extra successful-save history flush was added. The final deletion-only SQL hardening does not affect the measured save path.
Final gates: fmt passed with no output; workspace clippy with -D warnings passed; workspace tests passed (560 tests, 2 existing ignored tests); event_visibility passed 30/30 runs, 54 tests each (1,620 cases). Installed Nix gcc, pkg-config and OpenSSL pkg-config paths were supplied for this host. No frontend changes are included.
Verbatim gate output follows. The fmt command exited 0 and produced no stdout or stderr.
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -j4 -- -D warnings (exit 0)
cargo test --workspace -j4 (exit 0)
for run in $(seq 1 30); do cargo test -p calternal-notes -j4 event_visibility; done (exit 0)
Independent review of PR #599 started. Worktree is detached at
e174661153; review base is merge-base with origin/dev,1200114c32. Review only: no branch changes, commits, or pushes. I will trace the seven earlier defects, run gates through the build slot, and measure base versus head on the locked perf VM.PR #599 independent review finding,
e174661: P2, one unreadable note prevents healthy notes in its repair batch from recovering.Code: crates/notes/src/meta.rs:844-850 collects a whole 128-file chunk as Result<Vec<_>>. One describe failure throws away every healthy description in that chunk. home.rs:322-325 then requeues all up to 1000 selected IDs on any reconcile_ids failure. No hint is published because meta_ids returns early at home.rs:348. Repair retries every 1.1 seconds, even when the other files are healthy.
Reproduced in an isolated archive of this exact head, without modifying the review worktree. Discover two external files (neither has a room/history), remove their cached rows, replace one file with a directory to force an unreadable-file error, and mark both IDs stale. After 2.5 seconds of the real background repair loop, the healthy row remains missing and both IDs remain pending:
An unreadable file during recovery from a metadata outage can therefore block unrelated list repairs and notifications indefinitely. With a fixed 1000-ID selection, persistent failures can also monopolize the selected set as more IDs arrive. This does not trigger a full folder scan, but it repeats healthy reads and retains successfully repairable IDs.
Change the read chunks to keep successful descriptions and return the failed identities separately. Acknowledge and publish healthy IDs independently, and requeue only IDs whose list commit or publication actually failed. Probe source and output are under /tmp/calternal-review-599, outside the repo. The probe asserts the buggy outcome; it is evidence, not a passing product requirement.
PR #599 independent review: code-path re-check of the seven findings in comments 57978 and 58065.
The original scenarios are addressed in
e174661:The earlier outside_rename flake was an additional gate observation, outside those seven findings. History writes now begin IMMEDIATE (history.rs:619), so a competing writer cannot invalidate a deferred transaction's read snapshot. The competing-writer regression and all 20 event_visibility repetitions passed in this review. Full suite: 281 passed, 0 failed, 1 ignored. Repeated visibility gate: 54 passed per run, 20/20. Clippy with -D warnings passed. Full verbatim summaries and performance results will follow in the final review comment.
PR #599 independent review finding,
e174661: P2, one transient startup history read error lets older file state replace newer journal state and leaves no live retry.Code: crates/notes/src/scan.rs:157-165 logs an error from history.unflushed and continues. The later file-only sync_meta at scan.rs:200 trusts file stamps and can replace a live row; no stale identity or global retry is retained for the failed history discovery. meta.rs:761-766 has the same log-and-return problem if reading cached stamps fails: the scan can finish without retaining the missing repair.
Reproduced in an isolated archive with a one-shot fault injection at the beginning of History::unflushed, returning an ordinary Error::internal once. The production error-handling code is unchanged. Create and save a note, successfully pin it without saving its file, then reopen. Inject the read error only on the new Home's startup scan. After scan completion and another 1.5 seconds, its list says pinned=false, the stale set is empty, and a now-successful call to history.unflushed still finds the durable unsaved pin:
The note bytes are recoverable by opening the note or restarting again. The defect is silently abandoned cache recovery and older state landing last, not permanent loss of journal bytes. It violates contract points 1, 4 and the ordering part of 5 under a transient storage read failure.
Do not continue a file-only refresh when the journal comparison failed. Retain a bounded global recovery-needed flag and retry history discovery after backoff; keep affected/live rows from being replaced until their journal state has been checked. Likewise, keep scan/list repair pending if db.stamps fails. Mark scan completion only when the required repair is complete, or expose incomplete state while it is retried. Probe source and log are outside the repo under /tmp/calternal-review-599/probe-src and probe-startup.log. The probe asserts the buggy outcome to demonstrate it.
PR #599 independent review status: correctness gates are complete and clean. Two new recovery defects are posted above. The base and head release benchmark binaries have been rebuilt with source timestamps refreshed and checked for the correct old-worker versus new-reconciliation symbols; earlier stale-cache binaries were discarded before accepting measurements.
The performance part is temporarily waiting for /root/perf-vm.lock on root@10.69.69.63, held by another benchmark train. My base and head runs are queued with flock -o. I am leaving the other job and its processes untouched. Every accepted run will report load plus average and peak one-second CPU steal, and runs exceeding 5% steal will be repeated. I will continue through the measurements and remove everything created on the VM before finishing. No worktree changes, commits, pushes, merges or deployments.
PR #599 independent review finding,
e174661: P2, the in-memory stale set has no bound and can grow with deleted identities during a recorder outage.Code: home.rs:291-296 extends the HashSet without any cardinality limit; :313 takes only 1000 IDs per retry, and :322-325 restores the whole batch when the recorder still fails. Removal from the note index or permanent deletion does not discard the retained ID because its hint still needs delivery.
An isolated head probe supplies a failing EventRecorder and feeds six batches of 1000 distinct completed deletion hints through the production Home::record path. Every list removal succeeds; no notes remain in the index. After another 1.5 seconds of the real retry worker:
Repeating completed deletions continues to add identities. Deduplication bounds repeated failures for one ID, but does not bound a stream of different IDs. This violates contract point 6 and can consume memory during a prolonged journal outage even if the current corpus is small.
Cap retained identity work and switch to a bounded global reconciliation-needed flag after the cap, with recovery that scans current truth once after the outage rather than retaining every historical deletion. Keep the per-ID path for small failures and fix per-ID acknowledgement/draining as described in comment 58124. The probe asserts the bad outcome for evidence; code and logs remain under /tmp/calternal-review-599, outside the repository.
PR #599 independent review finding,
e174661: P1, create retry can self-deadlock while holding lifecycle. The non-daily variant can also stall the startup scan for its 60-second timeout.Code: lib.rs:263 holds lifecycle across the existing-ID path's home.ask calls at :289 and :298. Home::ask calls ensure_known at home.rs:262. If a concurrent deletion removes the ID, ensure_known's daily-note branch at scan.rs:105-108 can call watch::identify, which unconditionally takes lifecycle again at watch.rs:341. Tokio's mutex is not reentrant. This path never reaches SCAN_WAIT and cannot recover by finishing the scan.
Reproduced in an isolated head archive with no new production failpoint. Start with day-2026-10-19, mark startup scanning active, and use the existing meta_update lock to pause its create retry after lifecycle was acquired. Perform a real Notes::delete and wait for its index removal. Write an external replacement 2026-10-19.md, then release meta_update. Deletion completes, but the create retry enters ensure_known -> identify and waits on its own lifecycle guard. Explicitly marking the scan complete does not unblock the retry. The probe cancels only its own task for cleanup.
A separate probe covers ordinary IDs with another unknown file waiting for startup discovery. After real deletion removes the retry's ID, create waits for scan completion at scan.rs:114 while holding lifecycle, and scan::identify_many waits for lifecycle at scan.rs:227. That cycle resolves only at SCAN_WAIT=60s. Cancelling the probe's create task lets the real scan finish immediately:
This violates contract point 6. The daily self-deadlock also blocks any later create, discovery, restore or permanent forget that needs the Home's lifecycle lock.
Do not call scan-waiting or discovering ask/ensure_known while holding lifecycle. Revalidate identity under lifecycle, then use a direct actor request that does not discover or wait for the scan, or release the guard before the wait and revalidate afterward. Cover concurrent deletion and a reappearing daily file. Probe source and logs are outside the repository under /tmp/calternal-review-599/probe-src, probe-daily-cycle.log and probe-cycle.log.
The lock finding in comment 58171 is now P1. A second, stronger probe demonstrates an actual self-deadlock for a reappearing daily-note file: create holds lifecycle, ask calls ensure_known, and its daily-file path calls watch::identify, which takes the same lifecycle mutex. Explicit scan completion does not release it. The original comment now contains both reproductions, exact source references and the fix direction. This is separate from the ordinary-ID scan wait cycle, which is bounded by 60 seconds.
Starting fourth-round fixes for #599 on issue/587-event-after-write-4, from
e174661153. Reading every review comment after 58065 and reusing the isolated probes. I will preserve durable write, list commit, then hint; add bounded recovery and lock regressions; compare origin/dev and the new head on the perf VM; and open a new PR into dev without merging. Initial VM check: / has 11 GB free (89% used), so tmpfs is not required unless space falls below 2 GB.58124: the unreadable-batch finding is reproduced and fixed. round4_unreadable_note_does_not_block_healthy_repair_or_ack fails on
e174661with "timed out waiting for: healthy repair beside unreadable note" and passes on the fourth-round tree. File-read chunks retain successful descriptions; reconciliation handles each identity independently, acknowledges successful list commits and hints, and requeues only failures. The test replaces poison.md with a directory, verifies healthy is listed and acknowledged, restores poison.md, then verifies the queue drains.All seven new regression tests fail on an isolated
e174661archive and pass on the working tree. Full logs remain outside the repository under /tmp/calternal-fix-587-r4. Final workspace gates and locked VM performance measurements are underway.58134: both abandoned startup comparisons are reproduced and fixed. The two tests round4_startup_retries_journal_discovery_before_file_rows and round4_startup_retries_failed_list_stamp_read fail on
e174661because a failed comparison incorrectly ends scanning. Both pass on the fourth-round tree. Startup now returns an error before any file-only refresh when journal discovery fails; the watcher keeps scan incomplete and retries after one second. Stamp-read errors also propagate for retry. The journal test checks the announced pin stays true before retry and after completion. Baseline receives only the same Home-scoped one-shot fault hooks used by the new tests.All seven new regression tests fail on an isolated
e174661archive and pass on the working tree. Full logs remain outside the repository under /tmp/calternal-fix-587-r4. Final workspace gates and locked VM performance measurements are underway.58158: the deleted-identity retention finding is reproduced and fixed. round4_recorder_outage_bounds_deleted_ids_and_drains_overflow feeds 6000 distinct completed deletions through Home::record; it fails the 1000-identity bound on
e174661and passes on the fourth-round tree. Past 1000 identities, recovery clears per-ID work and keeps one global reconciliation flag. An empty recorder request checks availability without emitting a hint or scanning repeatedly during recorder outage. Once available, recovery scans current files and journal, removes orphan cache rows, and publishes one global refresh hint. The test verifies empty-corpus recovery and that successful work stays drained.All seven new regression tests fail on an isolated
e174661archive and pass on the working tree. Full logs remain outside the repository under /tmp/calternal-fix-587-r4. Final workspace gates and locked VM performance measurements are underway.58171/58174: both lock cycles are reproduced and fixed. round4_create_retry_does_not_wait_for_scan_under_lifecycle and round4_daily_create_retry_does_not_reenter_lifecycle time out on
e174661and pass on the fourth-round tree. They pause retry with meta_update, perform real deletion, and run startup discovery; the daily case writes an external replacement. Create now uses ask_known, a direct actor request with no discovery/scan wait, while lifecycle is held. Every create call under that guard uses it, including new creates. A debug-build task-owner check rejects lifecycle reentry; round4_lifecycle_reentry_panics_before_waiting also fails one174661and passes after. Lock-order comments are beside Home/Notes locks, SQLite connections and actor handles.All seven new regression tests fail on an isolated
e174661archive and pass on the working tree. Full logs remain outside the repository under /tmp/calternal-fix-587-r4. Final workspace gates and locked VM performance measurements are underway.Performance work is temporarily waiting for /root/perf-vm.lock on root@10.69.69.63. The seed command is queued through flock -o; a nonblocking lock probe returned 1. No other job or process was stopped. The VM now has 16 GB free on /, so the benchmark will use its own /root/fix-587-r4-20261019 directory rather than tmpfs. Baseline release binaries are built from freshly fetched origin/dev
1200114c32. Correctness work continues while the VM is occupied.Lock audit for issue #587 fourth round:
Waiting order: jobs -> lifecycle -> direct room requests -> meta_update -> list reader -> index -> room map -> unwritten set. The list write connection is a leaf after meta_update. Only one SQLite connection guard is taken at a time. meta_update and all std mutex guards are dropped before requesting a room. The room actor may acquire meta_update and the short Home locks; it never takes lifecycle, discovers, waits for scanning, or waits for another room. History writer, index writer, outbound client queues and recorder are leaves. homes/lists registry locks, unresolved cache, stale IDs, watcher handle, running reports, rename tickets, debug lifecycle owner and test hooks are independent short locks. busy uses jobs.try_lock without waiting.
Checked: create's three guarded requests all use ask_known; ordinary ask discovers only before entering its direct request. restore discovers before lifecycle; forget does not discover. Both discovery paths take lifecycle once; identify_many releases it before calling watch::identify. Discovery/meta_touched may reach rooms only after meta_update is dropped. Reconcile never uses discovering ask. Room load/edit/save/merge/rename/trash use direct live metadata updates and leaf journal/recorder requests. Registry initialization drops map locks before OnceCell initialization. Missing-target lookup nests list reader -> index; no code holds index while taking a SQLite connection. Index persistence receivers are awaited after releasing the index guard. Debug task ownership catches nested lifecycle acquisition before it can wait.
The overflow fix now also reaches the browser: a global notes.changed hint with reconciled=true and an empty item triggers a full list read. Refreshing only the newest page cannot remove deleted identities that were intentionally discarded at the retention cap. This adds four lines to notes.svelte.ts.
The browser regression drops the real deletion notification on the live socket, confirms the stale row remains, sends the global hint, then expects the row to disappear. It fails against the origin/dev app (the same list consumer as
e174661), where the stale row remains, and passes with the fix. Both list-catch-up browser tests passed in Chromium at 1440 px with --workers=1. Builds and Playwright ran inside build-slot.sh with the required environment; artifacts are outside the repository. The final Rust gates also passed: fmt, workspace clippy with -D warnings, 567 workspace tests (2 existing ignored), and 30 visibility runs of 61 tests each. Latency measurements are still running on the VM; high-steal attempts are discarded and repeated.The initial unpaired baseline probes showed 30-56 ms save medians at 100 lines and large I/O tails; four attempts exceeded the 5% CPU-steal limit and were rejected before the first accepted baseline. I changed the final comparison to one locked matrix of three alternating baseline/head pairs, so no other VM benchmark can run between revisions. Every timed run and retry still holds flock -o /root/perf-vm.lock; each reports mean and peak one-second steal plus load. Initial probes are diagnostic only and excluded from the final paired table. The old driver stops itself with exit 75 at its next helper invocation; no process was killed.
The first locked matrix confirms a 3,500-line p95 regression, so profiling and a performance fix are required before opening the new PR. All three accepted pairs have mean and peak one-second CPU steal below 5%:
Median run quantiles are 30.06 / 45.82 / 47.47 before versus 29.32 / 49.85 / 51.02 after: p95 +4.03 ms (+8.80%). The instrumented build separates server keys, preparing the file and pending journal row, placement, promotion, and metadata description/hash/links/list commit. A candidate avoids constructing the search document's entire body when only list fields are used; it remains isolated outside the worktree until profiling confirms the cost. No durability step will be removed. The 100-line median p95 is 40.11 versus 40.24 ms (+0.13 ms, +0.32%), within both limits.
The first complete locked matrix has 18 accepted runs (three alternating pairs per size) and three rejected high-steal attempts. Median run quantiles:
These exceed the requested limit at 3,500 and 20,000 lines. The profiler and the isolated candidate are built and uploaded. Profiling is temporarily waiting for the shared VM lock again; the other job is untouched. I will address the measured cost and run a new complete paired matrix against origin/dev before opening the PR. This table is diagnostic, not a performance acceptance claim. Local gates and both desktop browser regressions are clean.
A stronger outage test found an edge case in the first fourth-round implementation: record([]) may succeed while event writes still fail. Its readiness-only probe then rescanned current truth every retry. The extended round4_recorder_outage_bounds_deleted_ids_and_drains_overflow test failed with "a recorder outage must not repeatedly scan current truth" before this fix and now passes.
The pending work now tracks whether the global row repair completed. A recorder-only failure retries a fresh hint without another scan. A new row failure invalidates that completed repair. Small counters keep a failure arriving during a scan or publication from being acknowledged by older work. Unreadable current identities remain in the bounded per-ID set so healthy repairs can finish independently. Generic failures require repair; only paths that already committed rows use the hint-only path. This also covers failures before metadata was attempted, such as an initial file or history failure. No events, create bodies or new durable markers are stored.
The same test now introduces a real query_only metadata failure after the first global repair and verifies that the new file is listed before publication recovers. All seven latest round4 regressions were rerun against an isolated
e174661archive and failed; final gates passed on2cc5b3c7de: fmt, workspace clippy with -D warnings, 569 tests (2 existing ignored), and 30 runs of 63 visibility tests.The block benchmark had a 3,500-line pair with p95 37.55 ms before versus 199.83 ms after despite low steal. That variation is not explained by the measured metadata cost. The final measurement keeps both revisions warm and alternates individual saves, reversing order each sample, to reduce time drift in I/O. Each revision gets 50 samples per size in each of three paired runs. Both benchmark harnesses wait for actual scan completion and separately report warm-up time. The binaries match the pinned baseline and this committed head, with only an archive-only scan-wait helper. All measurements still hold the VM lock and reject/repeat steal over 5%.
The final benchmark alternates individual saves after both revisions have fully opened the same fixture. It reverses save order on every sample, uses 50 saves for each revision in a run, and runs three accepted pairs at each size. The final table will compute p50/p95/p99 over all 150 timed saves for each revision and size, rather than take the median of three separate run percentiles. All individual run percentiles and raw timing values remain available for review. Both revisions share each pair's load and CPU-steal window; the entire pair is repeated if mean or peak one-second steal exceeds 5%.
The first 20,000-line attempt spent about 159 seconds scanning and 71 seconds opening the baseline room, and about 157 seconds scanning and 74 seconds opening the head room. Those times were outside the save timer. The timed attempt exceeded 5% steal and was rejected. The original generated fixtures retain the complete journal and the same fragmented CRDT state; no history was removed to accelerate warming. No local heavy commands are running while the final matrix proceeds.
The completed interleaved diagnostic run exposed a benchmark isolation problem: origin/dev returns from save before its deferred list worker finishes, so that work can overlap the next revision’s timed save. I am rerunning with an archive-only FIFO completion barrier after each operation, outside the save timer. The baseline worker and its 50 ms delay are unchanged; the barrier waits for its prior queued metadata and backlink work. The head uses a no-op barrier because its list work completes synchronously. Percentiles will still pool all 150 samples per revision and size, with three accepted pairs and retries above 5% CPU steal. No product code changed; the tested head remains
2cc5b3c7de. The VM root has 16 GB free, so no tmpfs is needed.The isolated paired matrix completed: 9 accepted pairs, 4 attempts rejected for >5% steal, 150 saves per revision and size. Pooled p50/p95/p99 in ms: 100 lines dev 27.397/45.909/49.604, head 28.236/47.331/61.910 (p95 +1.422 ms, +3.097%); 3,500 lines dev 27.039/41.934/60.445, head 26.220/44.242/50.043 (+2.308 ms, +5.503%); 20,000 lines dev 51.598/72.903/80.281, head 52.003/70.426/74.187 (-2.477 ms, -3.398%). The smaller sizes exceed the requested threshold. I built a profiler from this exact head to separate durable save phases, cached hash work, list commit and publication; it is queued behind the shared VM lock. No acceptance claim or PR yet.
Final-head profiling completed under the VM lock: six accepted profiling pairs, three high-steal attempts repeated. The 100-line cached hash work is p50/p95 0.070/0.103 ms, row upsert 0.138/0.206 ms, and total publication 0.342/0.831 ms. At 3,500 lines those are 0.148/0.200, 0.129/0.184 and 0.531/0.712 ms. The durable save phases dominate the tail, and the profiling repeats did not reproduce the earlier p95 regressions (100 lines +0.145 ms; 3,500 lines -0.450 ms), but the full upsert still needlessly rewrites tags and backlinks. Commit
c5bc206235changes cached saves to commit just the file stamp. Scans skip open rooms, so the room owns those already committed fields; a missing/moved row falls back to the full upsert. The extended test checks tags, backlinks, pin changes and eviction. Workspace tests and clippy pass; 30 visibility repeats are running. The final uninstrumented matrix is now six accepted pairs per size (300 samples per revision), declared before results, with the same isolation and steal rules.All final gates pass at
c5bc206235: fmt, workspace clippy with -D warnings, workspace tests 569 passed / 2 existing ignored, and event_visibility 30/30 runs of 63 tests. The six-pair final matrix is still running under the VM lock. Its first 20,000-line pair has rejected three attempts for peak one-second steal of 6.475%, 5.742% and 5.340% (whole-window means 3.155%, 2.875% and 0.629%). Each is being repeated with a fresh fixture. No samples have been accepted at 20,000 lines yet; no performance acceptance claim. This external measurement delay is the only outstanding step before the new PR.The final six-pair matrix remains delayed by VM steal spikes. Five of 18 pairs are accepted: two at 100 lines, two at 3,500 lines and one at 20,000 lines. Nine attempts have been rejected and repeated. The accepted 20,000-line pair is dev p50/p95/p99 49.048/61.832/65.932 ms versus head 47.795/58.914/60.162 ms; mean/peak steal 0.176%/2.723%. The smaller-size partial pools still exceed the absolute p95 limit, so they are not an acceptance claim. All six pairs per size are still required by the declared method. The full-history fixtures and final binaries are unchanged. Code and all required local gates are complete at
c5bc206235; no PR has been opened while this check is pending.The locked final matrix reached its one-hour command limit (exit 124). The timeout ended both recorded child processes; ps confirms neither benchmark executable remains running. Five accepted pairs and twelve rejected high-steal attempts are preserved, with one unfinished attempt excluded. I am resuming only the missing size/pair combinations under a new flock acquisition, preserving the final head, full-history fixture, six pairs / 300 samples per size, baseline completion barrier and both mean/peak steal cutoffs. Root still has 16 GB free. This is a measurement delay; the code and all required gates are already complete.
Additional recovery finding while checking consumers: an ID-specific notes.changed hint with reconciled=true refreshes only the newest 50 rows. That cannot remove a cached identity whose notes.deleted hint was missed, and can miss an older restored row. The newly added global-only handler does not cover the ordinary per-ID path. A real-browser probe at
c5bc206drops a real deletion entry, then delivers the producer’s per-ID reconciled hint followed by an ordinary hint. Chromium fails with expected row count 0, received 1 after 5 seconds. This is the same consumer behavior ase174661for nonempty IDs. The fix treats every reconciled hint as a full list reread, coalesces the burst, and preserves that pending full reread across ordinary hints. Both global and identity variants now share the regression; desktop Chromium and WebKit validation is running. This changes only the browser consumer and test. The native benchmark source remains exactlyc5bc206, so its accepted samples remain valid for the final Rust tree.Benchmark protocol correction before the final report: the FIFO barrier drains origin/dev’s deferred list worker for about 50 ms after each edit/save, but the head’s synchronous path had a no-op barrier. Alternating first position does not remove that unequal pause between operations; it can skew I/O tails. I am padding the completion barrier to the same minimum 100 ms on both revisions, outside the Notes.save timer, while keeping the baseline FIFO drain. Full-history fixtures, sample count (six pairs / 300 per revision per size), percentiles and mean/peak steal rules remain unchanged. The existing 14 accepted pairs remain diagnostic evidence, not discarded or relabelled. A fresh matrix with symmetric pacing will be the final comparison. Phase-instrumented builds of the same native source are also prepared for the 20,000-line case. No product Rust changed. Browser follow-up
d2c1026ec4fixes per-ID recovery, passes six Chromium/WebKit tests, and has the identical crates tree3fab3283a6as native benchmark commitc5bc206235. Required gates are rerunning on this final UI commit.Build verification correction: the earlier paired-isolated-final diagnostic used a stale Cargo example for its purported head. SHA256 d94e1da63a94c0424275d66091b758a6d47322d33bf88fbb0997b742aa8bbed4 contains the baseline FIFO marker bench_meta_idle and lacks the head’s global-repair error string. Those nine accepted diagnostic pairs are invalid and excluded. I should have checked the binary identity before reporting those diagnostic comparisons. The later stamp binary 7a3f86e0f319657badd446f7c36cc812c73fab5f613a1afbf7e92cf5eafaa86a is the actual head: it has global repair and the final stamp-only UPDATE, with no baseline worker marker. That later run is still diagnostic because of the unequal pacing described above.
I forced every archive source and manifest fresh before rebuilding each new variant, and verified distinct baseline/head strings plus the final SQL. The new uninstrumented binaries are baseline e4e7b21ff518e143dfee8c8367ba1bdab9f1fdbb5ec781eb413cc7bad0ecae91 and head 66f3523b6d4ce0e4d320ce6be4e954e4c4eb7b6c62555aa2fbc5e915997d6dbc. The corrected controller also asserts at least 90 ms of measured completion time outside every save timer, as a runtime check that both 100 ms barriers actually linked. A fresh six-pair matrix is now running with symmetric completion intervals. Only that verified matrix will supply the final table. All previous outputs remain outside the repo as diagnostic evidence. The product head remains
d2c1026ec4; all required gates pass there.The expanded browser regression found a second stale consumer at
d2c1026: after dropping a real delete hint and delivering the generic per-ID reconciled hint, the sidebar row correctly disappears but the open editor’s link stays a live note (cm-link-note), instead of changing to cm-link-trash. Link target answers are cached separately; they re-read when notesState.paths changes, but generic notes.changed recovery only bumped rev. This also affects a cached Trash answer after a missed permanent-delete hint. The fix invalidates path answers for every reconciled hint, using the same recovery flag as the coalesced full list read. The regression now includes a real linked note, missed delete, and missed permanent deletion, checking both Trash and Gone states. It fails on the current pre-fix UI; Chromium and WebKit are now validating the fix. No native source or benchmark binary changed.The same consumer regression confirms one final loaded-list gap: when the Trash view is open, dropping a real notes.forgotten entry and sending the generic reconciled hint leaves the permanently deleted row visible. At
49facd4, Chromium expects count 0 but receives 1 after 5 seconds. applyTrashEntry only reacts to original lifecycle event kinds. It now also coalesces notes recovery hints into the existing Trash reload. The shared global/per-ID browser cases cover the main list, an active Trash list, and link transitions live -> Trash -> Gone. This is a small consumer-only fix; native source and benchmark binaries are unchanged. Full browser validation is running.All six independent consumer regression variants fail against the
e174661app build: global and per-ID main-list recovery leave the deleted row; global and per-ID cached-link recovery leave cm-link-trash instead of cm-link-gone after a missed forget hint; global and per-ID loaded-Trash recovery leave the permanently deleted row visible. The link scenario first waits for the original delete’s own HTTP lookups to settle, so only the recovery hint can repair the later state. These are assertion failures at the intended states, not setup timeouts. The current app previously passed all 14 browser cases, and is rerunning after that test-barrier refinement. All native source remains at the exactc5bc206crates tree.The isolated profiles show list publication at 3,500 lines costs p50 0.580 ms / p95 0.917 ms / p99 0.935 ms. Cached fields hit on 49/50 saves. Hash checking costs p95 0.246 ms and the stamp-only database update 0.121 ms; the remainder includes executor handoff. Commit
a34bb18removes the extra blocking-pool handoff on multithreaded runtimes, retaining the hash check and the single-thread fallback. Both cached-field correctness tests pass; the eviction/pin/tag/backlink oracle now exercises the multithreaded path.The final comparison uses independent revision processes: scan and room warmup complete first, 50 saves per run, symmetric 100 ms completion intervals outside Notes.save, Notes.shutdown/checkpoint and process exit, then filesystem sync before the next revision. This avoids one revision carrying the other revision's deferred filesystem writes. Earlier paired runs are diagnostic only. Three alternating-order repetitions per size will provide 150 samples per revision. Mean and peak one-second steal must both be <=5%; rejected runs repeat. Root disk has remained above 2 GiB free, so no tmpfs was needed. Native candidate binaries now return their source SHA as a startup marker, in addition to recorded binary hashes.
Head
a34bb182b4: all required gates pass through build-slot.sh. Full output follows verbatim. The final save matrix is queued under the shared perf-VM lock; the profiling controller and all its recorded children exited cleanly. No PR has been opened yet.All required local gates ran through build-slot.sh, with cargo -j4. The fmt command exited 0 with no output. Workspace tests: 569 passed, 2 existing ignored. Visibility: 30/30 runs, 63 tests each (1,890 cases).
cargo clippy --workspace --all-targets -j4 -- -D warnings (exit 0)
cargo test --workspace -j4 (exit 0)
cargo test -p calternal-notes -j4 event_visibility, 30 runs (all exit 0)
Additional browser validation (exit 0)
bun run checkexited 0: svelte-check found 0 errors and 13 warnings in 8 files.Final performance verification at
a34bb182b4is delayed by VM steal spikes. The fixed three-repetition serial matrix currently has two accepted runs and 14 rejected attempts. The latest 3,500-line attempts had mean / peak one-second steal 2.489% / 5.489% and 3.170% / 8.726%; they are discarded and repeated. All accepted data, including a higher 100-line head tail in the first pair, remains in the report. No latency-based filtering is used. The VM lock is held, root has 16 GB free, and no unrelated processes or files have been touched. Required gates are all green with verbatim output in comment 58494. Continuing the matrix before opening the replacement PR.Warmup observation from the final matrix, separate from timed Notes.save: the first accepted 20,000-line run had dev scan 47.313 ms / room open 29,303.627 ms, and head scan 101,500.672 ms / room open 24,911.232 ms. The full retained history exposes a large startup cost in the journal comparison introduced in #599. This round preserves that correctness requirement; the benchmark waits for it rather than timing saves while scanning or pruning history to hide it. The final report will include warmup ranges and make clear that the save table does not establish fast startup. The second head repetition exceeded peak steal (6.024%) and is being repeated; no rejected save samples enter the final quantiles.
The fixed three-repetition matrix has 17/18 accepted runs at
a34bb182b4. All three 100-line pairs are complete: pooled dev p50/p95/p99 21.226/43.672/48.462 ms; head 26.231/50.427/91.809 ms, so this does not pass the p95 budget. At 3,500 lines: dev 29.847/50.532/57.033 ms; head 29.196/46.360/131.688 ms. All accepted data is retained, including head p99 outliers. The third 20,000-line head run is still warming. Twenty high-steal attempts have been rejected and repeated so far.A source-marker-verified profiling binary for the current head is built and queued under the same VM lock to separate 100-line journal preparation, file placement, promotion and list publication. Its binary SHA256 is c4baf831bc5ab35bd3f008a2074a60cb9c08680f1dbe5a6f940222b1d341dc4d. No further code change is justified until this decomposition is available. All required correctness gates remain green.
The fixed final matrix completed with 18 accepted runs and 22 rejected high-steal attempts, all repeated. The observed p95 budget FAILS at 100 and 20,000 lines. No latency-based filtering was performed. Current-head stage profiling at those sizes is queued behind another perf-VM job; continuing the investigation.
Performance: origin/dev
1200114c32versus heada34bb182b4. All runs used root@10.69.69.63 underflock -o /root/perf-vm.lock. Root had over 2 GiB free (16 GB reported before upload), so no tmpfs was needed. No unrelated files or processes were changed.Each size has three accepted runs of 50 saves per revision. Exactly one revision process is alive at a time. It finishes startup scanning and room loading before timing, then preserves the full generated CRDT history through all saves. Both revisions start from identical fixtures. Each finishes with an exactly-once content check, Notes.shutdown/checkpoint and process exit;
sync -fdrains filesystem writes before the next revision starts. Revision order alternates by repetition. Sizes are nominal list-line counts at the midpoint: N minus 25 initially, 50 appends, with constant title/frontmatter overhead. Append setup is outside the timer, which surrounds Notes.save. A baseline-only FIFO barrier drains deferred list/backlink work outside the timer; both revisions then enforce the same minimum 100 ms completion interval. Quantiles pool 150 save samples per revision and size.22 attempts exceeded the 5% steal limit and were discarded and repeated. Accepted run context follows; load is the 1/5/15-minute average, steal is whole-window mean / peak one-second sample.
Warmup is excluded from the save timer and remains a limitation of the full retained history. The journal comparison introduced in #599 adds substantial startup work. Observed scan and room-open ranges follow; no history was pruned to hide them.
Profiling found full search-body construction and repeated tag/backlink upserts during list publication. Saves now reuse committed fields for the same room change count and path, verify the saved file hash, and commit the fresh stamp before the hint. Missing rows rebuild fully; file-date fallback is never cached. A final profile found a blocking-pool handoff in that short cached-row commit, removed on multithreaded runtimes while keeping the single-thread fallback. Earlier diagnostic matrices, the invalid stale-example comparison and measurement corrections are disclosed on #587 and excluded here. Final binaries have recorded hashes; the head also returns its source SHA at startup, checked by the controller.
Current-head 100-line stage profiling completed: six accepted revision runs, no high-steal rejections. Across the three head runs, list publication p95 is 0.282 / 0.310 / 0.314 ms; cached hash p95 is 0.107 / 0.100 / 0.122 ms, SQLite stamp update p95 0.109 / 0.116 / 0.107 ms. This verifies the handoff fix keeps the added 100-line publication work under 0.5 ms. The durable prepare/place/promote phases account for almost all save time. The profiling comparison reverses the earlier total-latency result (pooled dev p95 54.598 ms, head 46.317 ms), showing substantial I/O variation across time windows; these instrumented diagnostic samples are kept separate from the final uninstrumented matrix, which still reports its failed budget. The current-head 20,000-line profile is running and repeating high-steal attempts.
The final browser rerun is waiting inside build-slot.sh. That wrapper gives active test trains exclusive priority; I am respecting that wait and not bypassing it. The existing 14-browser-test result is from
59be006, which has the same browser source; all required native gates pass at finala34bb18. This rerun will validate the final native build too.The accepted current-head 20,000-line profile isolates an avoidable cost: cached file verification p95 0.741 ms, SQLite stamp update 0.139 ms, total publication 1.875 ms. The profile total itself reverses the earlier disk-window result (dev p95 97.553 ms, head 84.558 ms), confirming large storage variation; both datasets remain separate and disclosed.
Commit
de5664c320, pushed on the same unopened branch, removes the reread for actual saves. Prepared captures metadata from the flushed temporary image. After placement and journal promotion, list publication commits that image’s stamp rather than reading metadata from a destination another app may already have changed. Ordinary refreshes still hash current bytes, including writes that preserve size and mtime. Missing or ineligible cached fields still take the full description path. No new lock, task, retained event or persisted marker is added.The race regression pauses after placement, writes an outside version, checks that its stamp is not attributed to our fields, then waits for the watcher actor and checks recovery. The ordinary-refresh regression now preserves both size and mtime. The first run passed the stamp assertion but exposed a missing actor barrier in the test’s final watcher check; that barrier is added and checks are rerunning. The full required local gates and final browser rerun are queued through build-slot.sh behind the active train.
Both dev and this new head are being rebuilt on the perf VM with the same Rust 1.98.1 toolchain, release profile and harness. Both binaries will return their source SHA at startup. Before results are available, the new fixed matrix is declared as six alternating-order runs per revision and size, 50 saves per run, 300 samples per revision. The earlier
a34bb18matrix remains a failed comparison and is not mixed into the changed-code result. Root still has 15 GB free; all remote work holds the VM lock and uses only this job’s directory. No PR has been opened or merged.Head
de5664c320: all required gates and the final browser rerun pass. The new after-placement outside-write race and preserved-size/mtime refresh check pass. Full verbatim output follows. Release-pair building is queued on both available resource paths; the first completed matched pair will be used, and duplicate queued work will skip after readiness is recorded. No performance samples exist yet for this changed source, and no PR has been opened.All required local gates ran through build-slot.sh, with cargo -j4. The fmt command exited 0 with no output. Workspace tests: 570 passed, 2 existing ignored. Visibility: 30/30 runs, 64 tests each (1,920 cases).
cargo clippy --workspace --all-targets -j4 -- -D warnings (exit 0)
cargo test --workspace -j4 (exit 0)
cargo test -p calternal-notes -j4 event_visibility, 30 runs (all exit 0)
Additional browser validation (exit 0)
bun run checkexited 0: svelte-check found 0 errors and 13 warnings in 8 files.Benchmark setup finding: production disables transparent huge pages at crates/calternal/src/main.rs:56, but the direct-library benchmark example omitted that initialization. The perf VM kernel reports [always] madvise never; our active head process975493 had THP_enabled=1 and AnonHugePages=10,240 kB of25,316 kB RSS. This establishes a setup mismatch; it does not by itself prove the cause of the latency differences.
The declared six-repetition serial matrix will finish and its entire result will remain reported. A corrected comparison is declared before any new data: six accepted paired runs per size, 50 saves per revision, 300 samples per revision/size, same Rust1.99 release build, full retained histories, both source markers/hashes checked, production no_huge_pages initialization asserted at Ready. Both rooms will remain warm. Each sample completes one revision’s edit and save before switching, drains its deferred metadata, then syncs the filesystem outside the Notes.save timer. This prevents a revision’s list WAL from being carried by the other revision’s flush, while bringing the measurements close enough to reduce drift between long startup windows. Version order alternates by sample and repetition. Both mean and peak one-second steal still must be <=5%; high pairs repeat.
This is a harness correction and controlled replication; product source remains
de5664c320, with all required gates and14browser checks green. No global kernel setting, unrelated process or production machine will be changed.Default-memory serial diagnostic at
de5664c320: 34 accepted revision runs, 23 high-steal attempts rejected and repeated. One subsequent warmup was stopped after confirming the harness omitted production memory initialization. Every completed accepted latency sample is retained. The server calls calternal_memory::no_huge_pages at main.rs:56; this example omitted it. The VM uses THP always, and the checked head process had10MB of anonymous huge pages. This is a configuration mismatch, not evidence of causality. These diagnostic data will remain separate from the production-initialized replication.The stop used pidfd SIGINT only on the previously recorded controller973651 after exact command/start-time checks and verification of its recorded private benchmark child. Its finally block stopped that child; the command exited130. No unrelated process was signaled. The audit is kept outside the repository. No product code changed; all source de566 gates remain green. The corrected paired replication is fixed at six accepted pairs per size,300samples/revision/size, with production memory initialization, alternating complete operations, FIFO metadata acknowledgements, and sync-f barriers outside Notes.save before switching revisions.
The production-initialized replication is running under /root/perf-vm.lock. Both binaries were built on the perf VM with the same Rust 1.98.1 release toolchain (fat LTO, one codegen unit), after waiting for a shared local slot and selecting the first completed matched build. This corrects the compiler detail in comment58682: no Rust1.99 artifact is mixed into this comparison. Both runtime source markers and THP_enabled=0 checks passed. Product source is unchanged at
de5664c320. The common harness SHA256 is2a53b83b96ec2e8c8bdd5bc9d98bd1341fce247dd67de1d3e6412461afe47b21.The fixed matrix remains six accepted paired repetitions at each size,50saves/revision/pair,300samples/revision/size. It alternates complete edit/save operations, acknowledges baseline deferred metadata with equal completion padding, syncs outside the save timer, and verifies live and persisted exactly-once contents. Root has14GB free; no tmpfs is needed. Mean and peak one-second steal must both stay at or below5%; whole high-steal pairs repeat. All raw results and prior failed diagnostics remain outside the repository.
Production-initialized paired replication is continuing: 4 of 18 fixed pairs accepted; 13 whole pairs rejected and repeated because mean or peak one-second CPU steal exceeded 5%. No latency-based exclusion is used. Source remains
de5664c320; all required gates and 14 browser checks remain green.The first accepted 20,000-line pair had 0.072% mean and 0.251% peak steal. Its startup scan took 97.71 seconds on head versus 0.05 seconds on dev; room opening took 25.02 versus 20.77 seconds. Startup is excluded from Notes.save timing and will be reported as a material limitation, with the complete retained history kept in every fixture. Earlier high-steal warmups were slower.
The fixed save matrix is not complete, so no final performance claim or new PR is published yet. The current comparison will finish or report its concrete execution limit; all completed data stay recorded outside the repository. No unrelated VM process or file has been changed.
Dev advanced during the fixed benchmark: current origin/dev is
b6136b1457, a merge of PR #609. Compared with the frozen job-start baseline1200114c32, only four swipe-row UI/test files changed. The complete crates tree, Cargo.toml and Cargo.lock have identical Git object IDs; rust-toolchain.toml and .cargo also have no diff. The native Notes.save sources used by the frozen baseline are therefore unchanged. The final performance report will name both SHAs and retain the exact measured source marker, without silently relabelling the binary. The product branch remains based one174661as requested. No rebase, merge or deployment was performed.Performance verification is delayed by CPU steal on the shared perf VM. The fixed matrix has 11/18 accepted pairs ({'100': 4, '3500': 4, '20000': 3}) and 27 whole-pair rejections. The latest 20,000-line attempt averaged 3.336% steal and peaked at 9.535%, so it is being repeated from fresh fixtures. There are no runtime or exactly-once content-check errors. No latency-based exclusion is used.
The controller continues under /root/perf-vm.lock within its declared three-hour execution limit. Source remains
de5664c320; all final required gates and 14 browser checks remain green. Current-source diagnostic archives and a matching paired profile controller are prepared outside the repository for use if the completed p95 matrix exceeds either budget. The new PR has not been opened. Dev advanced only through swipe-row UI changes; native-source equivalence to the frozen benchmark baseline is recorded in comment58764.The completed 100-line group exceeds the absolute p95 budget at
de5664c320. All six accepted pairs are included, 300 saves per revision. The 3,500-line group also has all six pairs and passes. The final 20,000-line pair is still running; no completed result is being dropped.A current-source stage profile is queued under /root/perf-vm.lock. It builds both frozen dev and head with the same VM Rust 1.98.1 release toolchain, uses production memory initialization and the same alternating complete operations and filesystem drains, records preparation, placement, journal promotion and list-publication timings, and repeats high-steal attempts. Trace output stays in memory during measurement. This profile is diagnostic and will remain separate from the uninstrumented matrix. No product source has changed yet; all gates remain green.
Completed production-initialized matrix at
de5664c320: all 18 fixed pairs accepted after 29 high-steal rejections. The command exited 0; all live and persisted content checks passed. The 100-line group exceeds the 0.5 ms absolute p95 budget by 0.306 ms. Both larger sizes pass. Current-source profiling is queued under the shared VM lock before any further product change. All required correctness gates and 14 browser checks remain green; no new PR has been opened.Performance: origin/dev
1200114c32versus headde5664c320. All runs in this completed matrix used root@10.69.69.63 underflock -o /root/perf-vm.lock. Root had more than 2 GiB free before every attempt; no tmpfs was needed. No unrelated files or processes were changed.The baseline SHA was frozen at job start. During measurement dev advanced to
b6136b1457; its complete crates tree, Cargo.toml and Cargo.lock have the same Git object IDs as the measured baseline. Only swipe-row UI/test files changed (PR #609), so native Notes.save sources are unchanged. The measured artifact retains its exact1200114c32source marker. The product branch remains based one174661as requested.Matched build: perf VM; rustc 1.98.1 (48a229cea 2026-09-01); fat LTO, one codegen unit. The common harness hash is 2a53b83b96ec2e8c8bdd5bc9d98bd1341fce247dd67de1d3e6412461afe47b21. Both artifacts return their source SHA and verify THP_enabled=0 before timing, matching production main's calternal_memory::no_huge_pages initialization.
The fixed matrix contains six accepted pairs at each size, 50 saves per revision in each pair: 300 samples per revision and size. Both rooms finish startup scanning and loading before timing, and retain the complete generated CRDT history. Each revision starts from the same fixture. Only one revision edits and saves at a time; operation order alternates by pair and sample. Append setup is outside the timer; the timer surrounds Notes.save. After each edit and save, a baseline-only FIFO barrier acknowledges its deferred list work, with the same minimum 100 ms completion padding on both revisions. After each complete save operation, sync -f drains filesystem work outside the save timer before the other revision edits. Both processes have watch, automatic rename and automatic flushing disabled during measurement. Each pair checks exactly-once live and persisted file contents, then shuts both stores down and exits.
Sizes are nominal line counts at the midpoint: N minus 25 initial list lines and 50 appends, with constant title/frontmatter overhead. Quantiles use the sorted pooled samples at floor((n-1)*p). Whole-workload process CPU includes edit, save and deferred metadata, and is not a save-only CPU measurement.
Performance limit: FAIL. Every size must have a p95 increase no greater than 0.5 ms and no greater than 5%.
29 whole-pair attempts exceeded 5% CPU steal and were repeated. No latency-based exclusions were made. Accepted-run free disk ranged from 13.79 to 13.79 GiB. CPU steal below is whole-window mean / peak one-second sample; load is the 1/5/15-minute average.
Warmup is excluded from save timing and remains a material limitation. The journal comparison introduced in #599 adds startup work with the full retained history. No history was pruned.
Profiling found full search-body construction, repeated tag/backlink upserts and a blocking-pool handoff during list publication. Saves now reuse committed list fields for the same change count and path and update the stamp through the short cached-row commit. Prepared captures the flushed write image stamp; it commits after placement and journal promotion and before the hint. Ordinary refreshes still hash current bytes, including changes preserving size and mtime. Missing rows rebuild fully; file-date fallback is never cached. The after-placement outside-write regression verifies that another writer cannot lend its later metadata to our fields and that the watcher subsequently recovers.
Earlier results and measurement corrections remain on #587. The previous
a34bb18matrix failed the budget (comment 58541). The firstde5664cserial matrix omitted production memory initialization and failed at 100 and 20,000 lines (comment 58698). The omission was verified with THP_enabled=1 and 10 MiB of huge pages in the old harness; this establishes a setup difference, not causation. Earlier unequal pacing, cross-revision dirty-WAL carry and a stale diagnostic example were also disclosed. None of those datasets is mixed with the fixed final matrix above.Binary hashes:
All accepted raw measurements
All rejected attempt CPU and load context
Head
aa03e1edcais committed and pushed on issue/587-event-after-write-4. The new change reuses one current text snapshot across server key comparisons and title synchronization, refreshing it after every actual key edit before later checks or H1 positions. Normal saves avoid repeated full CRDT text reconstruction. No lock or durable-write ordering changed. The independent save oracle keeps its original key preparation and all of its assertions.All required gates pass: fmt; workspace clippy with -D warnings; 570 workspace tests with two existing ignores; 30 visibility runs of 64 tests. All 14 Chromium/WebKit checks pass with one worker. Full verbatim output follows. An initial private-signature mismatch in nested test helpers was fixed before these final runs.
Performance is still pending for this changed source. The completed
de5664cmatrix remains in comment58829, including its 100-line p95 increase of0.806ms. A current-source diagnostic profile ofde5664cis running; earlier stage traces used exactly the same server key/title function, verified byte-for-byte. A fresh fixed comparison for this new head is queued under the VM lock: six accepted pairs per size,50saves per revision per pair,300samples per revision and size, unchanged harness/fixtures/pacing/production memory setup, same VM Rust1.98.1 compiler, and both mean and peak one-second CPU steal at most5%. No latency-based exclusion will be used. No new PR has been opened yet.All required local gates ran through build-slot.sh, with cargo -j4. The fmt command exited 0 with no output. Workspace tests: 570 passed, 2 existing ignored. Visibility: 30/30 runs, 64 tests each (1,920 cases).
cargo clippy --workspace --all-targets -j4 -- -D warnings (exit 0)
cargo test --workspace -j4 (exit 0)
cargo test -p calternal-notes -j4 event_visibility, 30 runs (all exit 0)
Additional browser validation (exit 0)
bun run checkexited 0: svelte-check found 0 errors and 13 warnings in 8 files.Current-source stage profiling completed at
de5664cwith three accepted pairs and one high-steal rejection, all content checks passing. The complete uninstrumented matrix in comment 58829 remains the performance result for that source. Instrumented API p95 was lower on head in all three accepted pairs; the stage data show the physical-write and journal stages dominate the save time. Cached SQL commit p95 is about 0.12 ms at 100 lines and 0.15 ms at 20,000 lines. Server key/title work at 20,000 lines has p50 3.20 ms and p95 4.73 ms.The tested and pushed
aa03e1echange removes repeated text reconstruction in that same key/title function by maintaining one current snapshot. The old function was identical in the earlier trace andde5664c. No latency improvement is claimed for the new source until its fixed uninstrumented matrix completes. It is queued under the same VM lock, with unchanged compiler, harness and sampling plan.Stage profile of
de5664c320against the frozen native dev baseline1200114c32. These instrumented results are diagnostic; the uninstrumented completed matrix remains in comment 58829. Both builds used VM Rust 1.98.1, the production memory initialization, identical fixtures and complete alternating operations with filesystem drains. Every accepted pair passed live and persisted exactly-once content checks.Each stage statistic uses the last 50 completed timed save groups, delimited by the begin/total trace markers. Startup calls outside those groups are excluded. Directory sync is part of placement; cached lock/commit are part of publication. Quantiles describe separate stage distributions and must not be added. The API p95 uses Notes.save; the internal total surrounds Room.save.
Nominal lines: 100; attempt 1; load before 1.06 1.03 1.01, after 0.96 1.01 1.00; steal mean 0.439%, peak 1.985%. API p95: dev 31.081 ms, head 28.222 ms.
Nominal lines: 3,500; attempt 1; load before 0.96 1.01 1.00, after 0.74 0.96 0.98; steal mean 0.101%, peak 0.754%. API p95: dev 35.628 ms, head 31.230 ms.
Nominal lines: 20,000; attempt 2; load before 1.03 0.95 0.99, after 0.90 0.94 0.98; steal mean 0.543%, peak 3.865%. API p95: dev 101.538 ms, head 90.011 ms.
Build metadata:
Raw profile log SHA256: a8b6acd18ac8ab7665a049ede6027c92354a36a875e29f52af09afa7893e4dd4.
Diagnostic stage profile evidence for
de5664c, nominal 100 lines, attempt 1, accepted=True. These instrumented samples are separate from the uninstrumented matrix.Raw timing, CPU, load and stage trace
Diagnostic stage profile evidence for
de5664c, nominal 3,500 lines, attempt 1, accepted=True. These instrumented samples are separate from the uninstrumented matrix.Raw timing, CPU, load and stage trace
Diagnostic stage profile evidence for
de5664c, nominal 20,000 lines, attempt 1, accepted=False. These instrumented samples are separate from the uninstrumented matrix.Raw timing, CPU, load and stage trace
Diagnostic stage profile evidence for
de5664c, nominal 20,000 lines, attempt 2, accepted=True. These instrumented samples are separate from the uninstrumented matrix.Raw timing, CPU, load and stage trace
The final comparison for
aa03e1edcais temporarily blocked on the shared perf VM lock. The queued flock reports a waiting write lock blocked by the existing writer PID 986086. There is no build output or new latency sample yet. The queue remains active; no other process is being signaled or changed.The old-source diagnostic profile is complete and posted in comments 58853 through 58857. All required gates and 14 browser checks for the new source pass, with full verbatim output in comment 58847. The fixed new comparison retains the same six pairs per size, 50 saves per revision per pair, compiler, harness, baseline binary and CPU-steal limits. The PR remains unopened while performance verification is pending.
Dev advanced to
236fa2ffcdthrough PR #616. The new daily-log parser and UI changes are outside the direct Notes benchmark dependency closure. I checked the union of the baseline and head benchmark package graphs, including their root dev dependencies, and verified identical Git object IDs for core, engine, fsio, memory, notes, store and testkit, plus root manifests, lockfile and compiler configuration. The frozen1200114baseline binary therefore still represents the current dev inputs for this benchmark. No rebase or merge was performed; the fixed running matrix is unchanged.The comment API repeats all comments when pagination is requested; the refresh now deduplicates IDs. All 104 unique comments were read, with no new review findings beyond the recorded work.
The final comparison is running for head
aa03e1edca: 11 of 18 pairs accepted and 2 high-steal attempts rejected and repeated so far. The run uses the same VM Rust 1.98.1 compiler, common harness, fixtures and pacing as the completedde5664cmatrix. Runtime source markers and production memory checks passed.Baseline binary SHA256: 13ad67bb5900d9e02ee8c24dbc51b1e15af09d3b7d1e007c1ac1b796d97483a1.
Head binary SHA256: f85035b66bf7603c5500358ce722ba9bfd14ba5d9dc191cea00dd7ea76e2c76e.
The harness calls Notes.save directly with no event recorder; file and change-journal writes are enabled. This is unchanged from the original reviewer probe and both declared matrices. Watching, automatic saves and automatic renaming are disabled during measurement. Each pair verifies every append in both the live document and persisted file. All accepted samples will be included; no latency-based exclusion is used. The fixed target remains six accepted pairs per size, 300 save samples per revision and size.
All source gates remain green at this head (full output in comment 58847). The PR is still unopened pending the complete performance result.
Completed matrix for
aa03e1edca: 18 accepted pairs, eight high-steal rejections, all content checks passing, command exit 0. Both larger sizes pass. The 100-line p95 increases by 1.471 ms, exceeding the absolute budget. All accepted samples are included below. No PR has been opened.The current profile also measures an early read/hash of the current file (p95 about 0.23 ms at 100 lines). The guarded placement later reads and checks the same file against the base or intended image hash, returning conflicting bytes for merge and retry. I am removing the earlier duplicate read while retaining that placement guard and retry path. Normal saves avoid one blocking-pool handoff and file read/hash; an outside conflict may prepare a discarded image before merging. File and journal durability, list commit and hint order remain in place. Existing save differential, outside-write, crash and restart checks will be rerun before any performance claim.
Performance: origin/dev
1200114c32versus headaa03e1edca. All final runs used root@10.69.69.63 underflock -o /root/perf-vm.lock. Root had more than 2 GiB free before every attempt; no tmpfs was needed. No unrelated files or processes were changed.The baseline SHA was frozen at job start. During measurement dev advanced to
236fa2ffcd. The Notes benchmark dependency closure has identical Git object IDs to the measured baseline: core, engine, fsio, memory, notes, store and testkit, plus root manifests, lockfile and compiler configuration. Later UI and daily-log parser changes are outside that closure. The measured artifact retains its exact1200114c32source marker. The product branch remains based one174661as requested.Matched build: perf VM; rustc 1.98.1 (48a229cea 2026-09-01); fat LTO, one codegen unit. The common harness hash is 2a53b83b96ec2e8c8bdd5bc9d98bd1341fce247dd67de1d3e6412461afe47b21. Both artifacts return their source SHA and verify THP_enabled=0 before timing, matching production main's calternal_memory::no_huge_pages initialization.
The fixed matrix contains six accepted pairs at each size, 50 saves per revision in each pair: 300 samples per revision and size. Both rooms finish startup scanning and loading before timing, and retain the complete generated CRDT history. Each revision starts from the same fixture. Only one revision edits and saves at a time; operation order alternates by pair and sample. Append setup is outside the timer; the timer surrounds Notes.save. After each edit and save, a baseline-only FIFO barrier acknowledges its deferred list work, with the same minimum 100 ms completion padding on both revisions. After each complete save operation, sync -f drains filesystem work outside the save timer before the other revision edits. Both processes have watch, automatic rename and automatic flushing disabled during measurement. Each pair checks exactly-once live and persisted file contents, then shuts both stores down and exits.
The benchmark calls the Notes API directly with no event recorder; file and change-journal writes are enabled. Sizes are nominal line counts at the midpoint: N minus 25 initial list lines and 50 appends, with constant title/frontmatter overhead. Quantiles use the sorted pooled samples at floor((n-1)*p). Whole-workload process CPU includes edit, save and deferred metadata, and is not a save-only CPU measurement.
Performance limit: FAIL. Every size must have a p95 increase no greater than 0.5 ms and no greater than 5%.
8 whole-pair attempts exceeded 5% CPU steal and were repeated. No latency-based exclusions were made. Accepted-run free disk ranged from 13.73 to 13.73 GiB. CPU steal below is whole-window mean / peak one-second sample; load is the 1/5/15-minute average.
Warmup is excluded from save timing and remains a material limitation. The journal comparison introduced in #599 adds startup work with the full retained history. No history was pruned.
Profiling found full search-body construction, repeated tag/backlink upserts and a blocking-pool handoff during list publication. Saves now reuse committed list fields for the same change count and path and update the stamp through the short cached-row commit. Prepared captures the flushed write image stamp; it commits after placement and journal promotion and before the hint. Ordinary refreshes still hash current bytes, including changes preserving size and mtime. Missing rows rebuild fully; file-date fallback is never cached. The after-placement outside-write regression verifies that another writer cannot lend its later metadata to our fields and that the watcher subsequently recovers.
Earlier results and measurement corrections remain on #587. The previous
a34bb18matrix failed the budget (comment 58541). The firstde5664cserial matrix omitted production memory initialization and failed at 100 and 20,000 lines (comment 58698). The omission was verified with THP_enabled=1 and 10 MiB of huge pages in the old harness; this establishes a setup difference, not causation. Earlier unequal pacing, cross-revision dirty-WAL carry and a stale diagnostic example were also disclosed. None of those datasets is mixed with the fixed final matrix above.The complete production-initialized
de5664cmatrix is retained in comment 58829, with every accepted raw sample and rejected CPU/load context. It passed both larger sizes, but the 100-line p95 increased by 0.806 ms, exceeding the absolute limit by 0.306 ms. The following source profile accepted all three sizes after one high-steal repeat (summary 58853, raw evidence 58854–58857). At 100 lines cached SQL commit p95 was about 0.12 ms and publication p95 about 0.21 ms; preparation, directory sync and journal promotion dominated. At 20,000 lines server key/title work took p50 3.20 ms and p95 4.73 ms. The current head shares one current text snapshot across those key/title comparisons and refreshes it after each actual key edit before subsequent checks or H1 positions. Normal saves avoid repeated full-document reconstruction. The independent save oracle keeps its original key preparation and all of its assertions. This new matrix uses the same compiler, unchanged baseline binary, harness, fixtures and pacing; only head source changes. Earlier source measurements are not pooled with this matrix.Binary hashes:
Every accepted raw measurement
Every rejected attempt CPU and load context
Head
61c4a755a4is committed and pushed on issue/587-event-after-write-4. Normal saves now use the current-file check in guarded placement instead of reading and hashing the file once earlier and again during placement. The guard accepts only the saved base hash or the exact intended bytes; otherwise it returns outside bytes for merge and retry. A conflicting outside write can cause a prepared image to be discarded before merging. No successful-save durability step, list commit or hint ordering was removed. No state, lock or schema was added.All final checks pass at this head: fmt; workspace clippy with -D warnings; 570 workspace tests with two existing ignores; 30 visibility runs of 64 tests; all 14 Chromium/WebKit checks with one worker. This includes the existing save differential oracle, save-time outside retry, uncertain-write, crash and restart coverage. Full verbatim output follows.
The complete
aa03e1ematrix remains in comment 59044, including its 100-line p95 increase of 1.471 ms. A fresh fixed comparison for the new head is queued under the perf VM lock. The compiler, unchanged baseline binary, harness, fixtures, pacing, sample counts and steal filters are unchanged: six accepted pairs at each size, 300 saves per revision and size. No new performance result or PR is claimed before that matrix completes.All required local gates ran through build-slot.sh, with cargo -j4. The fmt command exited 0 with no output. Workspace tests: 570 passed, 2 existing ignored. Visibility: 30/30 runs, 64 tests each (1,920 cases).
cargo clippy --workspace --all-targets -j4 -- -D warnings (exit 0)
cargo test --workspace -j4 (exit 0)
cargo test -p calternal-notes -j4 event_visibility, 30 runs (all exit 0)
Additional browser validation (exit 0)
bun run checkexited 0: svelte-check found 0 errors and 13 warnings in 8 files.Performance: origin/dev
1200114c32versus head61c4a755a4. All final runs used root@10.69.69.63 underflock -o /root/perf-vm.lock. Root had more than 2 GiB free before every attempt; no tmpfs was needed. No unrelated files or processes were changed.The baseline SHA was frozen at job start. During measurement dev advanced to
236fa2ffcd. The Notes benchmark dependency closure has identical Git object IDs to the measured baseline: core, engine, fsio, memory, notes, store and testkit, plus root manifests, lockfile and compiler configuration. Later UI and daily-log parser changes are outside that closure. The measured artifact retains its exact1200114c32source marker. The product branch remains based one174661as requested.Matched build: perf VM; rustc 1.98.1 (48a229cea 2026-09-01); fat LTO, one codegen unit. The common harness hash is 2a53b83b96ec2e8c8bdd5bc9d98bd1341fce247dd67de1d3e6412461afe47b21. Both artifacts return their source SHA and verify THP_enabled=0 before timing, matching production main's calternal_memory::no_huge_pages initialization.
The fixed matrix contains six accepted pairs at each size, 50 saves per revision in each pair: 300 samples per revision and size. Both rooms finish startup scanning and loading before timing, and retain the complete generated CRDT history. Each revision starts from the same fixture. Only one revision edits and saves at a time; operation order alternates by pair and sample. Append setup is outside the timer; the timer surrounds Notes.save. After each edit and save, a baseline-only FIFO barrier acknowledges its deferred list work, with the same minimum 100 ms completion padding on both revisions. After each complete save operation, sync -f drains filesystem work outside the save timer before the other revision edits. Both processes have watch, automatic rename and automatic flushing disabled during measurement. Each pair checks exactly-once live and persisted file contents, then shuts both stores down and exits.
The benchmark calls the Notes API directly with no event recorder; file and change-journal writes are enabled. Sizes are nominal line counts at the midpoint: N minus 25 initial list lines and 50 appends, with constant title/frontmatter overhead. Quantiles use the sorted pooled samples at floor((n-1)*p). Whole-workload process CPU includes edit, save and deferred metadata, and is not a save-only CPU measurement.
Performance limit: FAIL. Every size must have a p95 increase no greater than 0.5 ms and no greater than 5%.
8 whole-pair attempts exceeded 5% CPU steal and were repeated. No latency-based exclusions were made. Accepted-run free disk ranged from 13.71 to 13.71 GiB. CPU steal below is whole-window mean / peak one-second sample; load is the 1/5/15-minute average.
Warmup is excluded from save timing and remains a material limitation. The journal comparison introduced in #599 adds startup work with the full retained history. No history was pruned.
Profiling found full search-body construction, repeated tag/backlink upserts and a blocking-pool handoff during list publication. Saves now reuse committed list fields for the same change count and path and update the stamp through the short cached-row commit. Prepared captures the flushed write image stamp; it commits after placement and journal promotion and before the hint. Ordinary refreshes still hash current bytes, including changes preserving size and mtime. Missing rows rebuild fully; file-date fallback is never cached. The after-placement outside-write regression verifies that another writer cannot lend its later metadata to our fields and that the watcher subsequently recovers.
Earlier results and measurement corrections remain on #587. The previous
a34bb18matrix failed the budget (comment 58541). The firstde5664cserial matrix omitted production memory initialization and failed at 100 and 20,000 lines (comment 58698). The omission was verified with THP_enabled=1 and 10 MiB of huge pages in the old harness; this establishes a setup difference, not causation. Earlier unequal pacing, cross-revision dirty-WAL carry and a stale diagnostic example were also disclosed. None of those datasets is mixed with the fixed final matrix above.The complete production-initialized
de5664cmatrix is retained in comment 58829, with every accepted raw sample and rejected CPU/load context. It passed both larger sizes, but the 100-line p95 increased by 0.806 ms, exceeding the absolute limit by 0.306 ms. The following source profile accepted all three sizes after one high-steal repeat (summary 58853, raw evidence 58854–58857). At 100 lines cached SQL commit p95 was about 0.12 ms and publication p95 about 0.21 ms; preparation, directory sync and journal promotion dominated. At 20,000 lines server key/title work took p50 3.20 ms and p95 4.73 ms. The current head shares one current text snapshot across those key/title comparisons and refreshes it after each actual key edit before subsequent checks or H1 positions. Normal saves avoid repeated full-document reconstruction. The independent save oracle keeps its original key preparation and all of its assertions. This new matrix uses the same compiler, unchanged baseline binary, harness, fixtures and pacing; only head source changes. Earlier source measurements are not pooled with this matrix.The
aa03e1ematrix is retained in comment 59044: all 18 accepted pairs and eight high-steal rejections. Both larger sizes passed; the 100-line p95 increased by 1.471 ms. The profile also measured the earlier current-file read/hash at about 0.23 ms p95 at 100 lines. Saves now use the current-file comparison already performed by guarded placement, avoiding that duplicate read/hash and worker handoff. A mismatch returns outside bytes to the existing merge/retry path. An outside conflict may prepare a discarded image before merging; successful-save durability, list commit and hint ordering remain unchanged. Existing save differential, outside-write, uncertain-write, crash and restart checks pass. The current matrix keeps the same fixed method and does not pool earlier source data.Binary hashes:
All accepted runs and samples:
Rejected attempts and CPU/load context:
A further case of 58158 was reproduced on
61c4a75: an unsaved journal edit makes scan::run call reconcile_ids. Its list row commits, but recorder-only failure returned an error to scan and forced another full journal scan instead of retrying only the hint. The existing overflow regression now includes a live, unflushed pinned note. It fails before the fix at the first-global-publication assertion and passes after. Only metadata repair failures now fail reconcile_ids; hint failures remain queued independently. No save path changes.Before fix:
After fix:
All required local gates ran through build-slot.sh, with cargo -j4. The fmt command exited 0 with no output. Workspace tests: 570 passed, 2 existing ignored. Visibility: 30/30 runs, 64 tests each (1,920 cases).
cargo clippy --workspace --all-targets -j4 -- -D warnings (exit 0)
cargo test --workspace -j4 (exit 0)
cargo test -p calternal-notes -j4 event_visibility, 30 runs (all exit 0)
Additional browser validation (exit 0)
bun run checkexited 0: svelte-check found 0 errors and 13 warnings in 8 files.The new fixed uninstrumented matrix for
7854fdcbfais declared before collecting any of its timing results: 60 accepted pairs of 50 saves per revision at 100 lines (3,000 samples/revision), and six pairs of 50 at each larger size (300 samples/revision). It uses exactly the prior compiler, baseline binary, harness, fixtures, operation ordering, completion barriers and filesystem drains. All previous matrices remain separate. Only pairs exceeding 5% mean or peak CPU steal are rejected and repeated; no latency exclusions. The additional fixed 100-line sampling addresses the much larger observed I/O tail variation than the measured cached-list publication cost (the first current-source profile pair has cached commit p95 0.131 ms, publication 0.279 ms, while preparation, directory sync and promotion each have p95 in the tens of milliseconds). Three profile pairs are being completed separately; these instrumented samples will not be mixed into the gate.Independent round 4 review started. Read-only detached head
7854fdcbfa(origin/issue/587-event-after-write-4); base1200114. I will audit lock ordering and event visibility, exercise suspicious cases in a scratch worktree, run the notes tests, and compare release save latency locally. No commits or pushes planned.Review validation hit an environment blocker after waiting for build slots: cargo could not link because cc is absent from the default PATH; one scratch invocation also lacked cargo. Installed Nix compiler is available. I am rerunning inside the same required slot wrapper with explicit cargo/compiler paths. This is a validation environment failure, not yet a product finding. Lock inventory and ongoing notes are in /home/kayg/Developer/calternal-research/review-587-v4.md.
P1 data loss reproduced in the new file-first create path (lib.rs:373 -> fsio/src/swap.rs:132-163). write_unless_changed checks File::open(path); when it sees NotFound it later calls ordinary std::fs::rename(tmp, path). That rename replaces a file which appeared after the check, without preserving or journaling its bytes.
Concrete reproduction in a scratch copy: pause fsio::put after the absent-path check, place Race target.md containing "outside note that must survive\n", then resume notes.create(id=create-race-target, title=Race target, text="app initial text\n"). Result was Ok(Created { id: "create-race-target", path: "Race target.md", version: 1 }); the surviving file contained the app frontmatter and "app initial text\n". The outside text was gone. The hook only widens the real scheduling window; it does not change placement behavior. Underlying fsio absent-file fallback predates this branch; the redesign newly uses it as the no-overwrite initial-create operation. This is a contract gap, not a claim that the helper bug originated in round 4.
Gate output verbatim:
test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 293 filtered out; finished in 0.42s
The passing scratch checks cover real SIGKILL after write/before list and after list/before event, twenty same-id concurrent edit/rename/create-retry/delete rounds, and 110,000 retained failures staying bounded. Fix the absent destination placement with an atomic no-replace operation, handling a newly present file as conflict. A lifecycle mutex cannot serialize an outside editor. Review and remaining validation continue.
P2 wrong state reproduced: scan::identify_many silently swallows deletion-history read errors at scan.rs:226-228 and again at :253-255. Its caller scan::run receives no failure, continues sync_meta/save_state, and the startup watcher can mark the scan complete. Unknown files have not been indexed, and no stale id/global flag schedules another attempt.
Concrete scratch reproduction: settle an empty Home, place Undiscovered.md with calternal-id undiscovered-note, inject one read error from history.gone_ids (after unflushed succeeds), and run the scan. After 500 ms:
REVIEW587 gone_ids failure result=Ok(()) indexed=false listed=0 pending=0 global=false
The file remains intact, but lookup/list omit it until another discovery/rescan/restart. A one-shot transient query error is enough; a running filesystem watcher does not synthesize a new event for an unchanged file that existed before startup. Propagate this error from identify_many through run so the startup loop keeps incomplete=true and retries. Apply this to both gone_ids calls. The existing unflushed/stamp-read retry tests do not cover this stage.
P3 debug-only false panic reproduced in home.rs:533-545. lifecycle_owner uses tokio task id to detect recursion, but independent sibling futures in tokio::join! have the same task id. They should serialize through the mutex.
Concrete scratch reproduction: inside one tokio::spawn, join two Notes::create futures for independent ids and titles, with the Home already settled. The second future panics while the first awaits history:
assertion
left != rightfailed: lifecycle acquired twice by one taskThis guard is compiled out in release builds; this is a debug/library composability defect, not another release deadlock. Use a re-entry check that distinguishes logical call ownership from sibling futures, or rely on focused lock-order tests without this false-positive guard.
Final scratch checks so far, verbatim:
test result: FAILED. 4 passed; 3 failed; 0 ignored; 0 measured; 293 filtered out; finished in 0.90s
The three failures are the P1 outside-file overwrite, P2 swallowed scan read failure, and this P3 guard panic.
Performance measurement complete on the shared local host, release profile (fat LTO), CARGO_TARGET_DIR=/home/kayg/Developer/calternal-target-587, all builds/runs through build-slot. Identical harnesses perform 20 warmups then 1,000 saves with 100 input lines and 100 saves with 10,000 input lines; each save follows an append without adding a line. Watch, auto-rename and automatic flush are disabled; no engine recorder/network is installed. Plain text input lines, plus server frontmatter. Percentiles are nearest rank, milliseconds.
To check an initial combined-latency regression under changing load, ran the two built binaries back-to-back in one slot:
100 lines, base save p50/p95/p99 = 0.794557 / 2.772317 / 4.904510
100 lines, head save p50/p95/p99 = 0.648305 / 1.533901 / 4.277332
10,000 lines, base save p50/p95/p99 = 7.318890 / 12.758775 / 13.929189
10,000 lines, head save p50/p95/p99 = 7.363635 / 12.964031 / 14.738526
Save p95 deltas: -1.238416 ms and +0.205256 ms. No save-only p95 regression exceeds the requested 1 ms threshold.
Performance flag: 10,000-line edit-plus-save p95 increased from 14.075266 to 17.245558 ms (+3.170292 ms). This also increased in the first run (11.437546 -> 14.886955 ms, +3.449409 ms). Synchronous list work is now paid before the append returns, so save-only timing does not show the whole interaction cost. Paired 100-line edit-plus-save p95 improved from 3.435401 to 2.988653 ms.
Paired uptime output:
15:05:30 up 6 days 5:35, load average: 30.45, 20.84, 19.16
15:05:33 up 6 days 5:35, load average: 30.90, 21.09, 19.25
This is a quick shared-host measurement, not isolated performance proof. Raw output is kept outside the repository in calternal-research/r587v4-perf-paired.log. The original notes suite has passed; workspace validation continues after resolving missing compiler/pkg-config/OpenSSL paths.
Independent round 4 review finished: FIX FIRST.
Head:
7854fdcbfa(origin/issue/587-event-after-write-4). Base:1200114. Review worktree unchanged; no commits, pushes, merges, deployments or VM runs. The issue remains open.Findings, with reproductions posted separately above:
P1 data loss: initial create can overwrite an outside file appearing after the absent-path check and before rename. The underlying fsio fallback predates the branch; the new initial-create path uses it as its no-overwrite operation.
P2 wrong state: identify_many swallows gone_ids read errors, allowing a successful scan with unknown notes omitted and no pending repair.
P3 minor, debug only: task-id lifecycle ownership mistakes independent sibling futures in tokio::join! for recursive acquisition and panics.
The round-3 discovery/scan lock cycle is removed. No further release lock cycle was found. Lock inventory and nested acquisition paths are documented in /home/kayg/Developer/calternal-research/review-587-v4.md. The bounded stale-set checks and both real SIGKILL save-publication recovery checks passed.
Paired release save latency, milliseconds (p50 / p95 / p99):
100 input lines, 1,000 saves: base 0.794557 / 2.772317 / 4.904510; head 0.648305 / 1.533901 / 4.277332.
10,000 input lines, 100 saves: base 7.318890 / 12.758775 / 13.929189; head 7.363635 / 12.964031 / 14.738526.
No save-only p95 regression exceeds 1 ms. Performance flag: 10,000-line edit-plus-save p95 14.075266 -> 17.245558 ms, +3.170292 ms, repeating the initial run's +3.449409 ms. These are quick shared-host measurements. Paired load averages were 30.45/20.84/19.16 before base and 30.90/21.09/19.25 after head.
Unmodified head notes gate, exit 0, output verbatim:
Scratch review checks, exit 101, output verbatim (the three failures reproduce the findings):
Workspace gate, exit 0: 570 passed, 0 failed, 2 ignored across 57 result groups. Command: cargo test --workspace -j4 -- --test-threads=4. Output result lines verbatim:
All heavy local commands used the required build-slot wrapper and cargo -j4. Compiler/pkg-config/OpenSSL PATH setup and stale shared-target artifacts were resolved; final notes and workspace gates passed. Raw logs, measurements, report and scratch-only reproductions remain outside the repository. Browser E2E was not run.
Starting round-4 fixes on issue/587-event-after-write-4 at
7854fdcbfa(comparison base1200114). I will preserve outside creates, propagate deletion-history scan failures, fix lifecycle diagnostics, and profile/re-measure edit plus save locally. No VM use, merge, deployment, or pushes to main/dev.Source findings confirmed and fixes prepared: absent destinations now use hard_link of the flushed temporary image, which atomically refuses an arriving outside file; both gone_ids reads propagate errors through scan::run so startup stays incomplete and retries after its existing one-second backoff; the debug lifecycle owner includes the note identity so independent creates can share one task. Permanent tests cover the absent-check placement window, initial and reacquired deletion-history failures, startup retry, and joined independent creates. Local targeted tests and release tracing-span profiling are queued behind the required shared build slots.
Validation and local release profiling are waiting for all three required build slots, currently held by other jobs. No slot bypass or other-process termination was attempted. The implementation and permanent regression tests are ready; this is a scheduling delay, not a source blocker.
The local release profile at the reviewed head used tracing spans around live list metadata, tag scanning, backlink parsing, and CRDT text extraction. For 10,000-line edits, the instrumented metadata closure measured p50/p95 1.850/2.342 ms. Tag scanning measured 0.625/0.799 ms and backlink parsing 0.963/1.318 ms; text extraction measured 0.120/0.261 ms. These are instrumented costs, not the final latency comparison. This identifies the newly synchronous full-text scanners as the main additional work. The fix skips backlink parsing when no opening bracket exists and skips tag parsing after the last hash's complete line, preserving fence and target context before that point. Uninstrumented base/head release binaries are being prepared for repeated alternating local measurements.
Formatting passed. The first clippy attempt caught a deprecated atomic fetch_update in the new test-only failure countdown on Rust 1.99; it is now try_update. This did not affect product behavior. The check will be rerun and final gate output will identify successful results.
Finished the round-4 review fixes on issue/587-event-after-write-4.
Head:
80e94699a6Start:
7854fdcbfaPerformance comparison base:
1200114P1: an absent destination is now placed with an exclusive hard link from the flushed temporary image, followed by removal of the temporary name. An outside file arriving after the absence check is preserved and its bytes are returned to the create caller as IdempotencyConflict. Unsupported placement fails safely instead of using a replacing rename. Permanent tests: create_preserves_outside_file_appearing_after_absence_check in fsio, and create_reports_conflict_when_an_outside_file_arrives_before_placement in notes. The first writes the outside file at the actual absence-check boundary; the second checks the API conflict, preserved bytes and absent index entry.
P2: identify_many returns Result and propagates both gone_ids read failures through scan::run. The existing startup loop keeps incomplete=true and retries one scan at a time with a one-second backoff; it cannot save completion state after these failures. Permanent tests: scan_propagates_deletion_history_read_failure_and_retries, scan_propagates_deletion_history_failure_after_reacquiring_lifecycle, startup_keeps_unknown_notes_incomplete_until_deletion_history_retry. They cover both read sites and automatic recovery without another filesystem event.
P3: debug lifecycle ownership includes the note identity alongside the Tokio task. Different notes can wait in sibling futures in the same task. Permanent test: independent_creates_joined_in_one_task_do_not_reenter. The existing round4_lifecycle_reentry_panics_before_waiting test still covers direct reentry for the same identity.
Performance: local release tracing spans at the reviewed head identified synchronous full-text list scanners as the main extra edit cost. Instrumented metadata closure p50/p95 was 1.850/2.342 ms; tag scanning was 0.625/0.799 ms, backlink parsing 0.963/1.318 ms, and CRDT text extraction 0.120/0.261 ms. The fix skips backlink parsing without an opening bracket and stops tag parsing after the final hash's complete line. Earlier fence/target context is still processed.
The uninstrumented release comparison used the reviewer's identical harness: 20 warmups, 1,000 saves at 100 lines, 100 saves at 10,000 lines, nearest-rank percentiles, watch/auto-rename/automatic flush disabled. Base and head ran in base/head/head/base order three times inside one required local build slot. The table reports medians of the six per-run quantiles for each revision, not pooled percentiles. The product code in the measured head matches this commit; the scratch benchmark has the older spelling of an unused test-only atomic hook, which was renamed for the final clippy gate. These are shared-host quick measurements. No perf VM was used.
10,000-line edit-plus-save p95: 14.957097 -> 13.493467 ms, a change of -1.463630 ms. The <=1 ms regression target is met. Save p95 changes are -0.992532 ms at 100 lines and -3.024462 ms at 10,000 lines. The 100-line edit-plus-save p95 change is -0.302366 ms.
All six 10,000-line edit-plus-save p95 values, in execution order within each revision:
Base: 16.714290, 14.401248, 14.170713, 15.512947, 19.654453, 14.106123 ms.
Head: 13.615645, 14.356108, 10.696476, 14.621671, 13.371289, 12.361902 ms.
Final validation: 576 passed, 0 failed, 2 ignored across 57 workspace result groups. Formatting and clippy exited 0. The first clippy attempt's test-hook deprecation was fixed before the successful final check. No evidence files or benchmark artifacts were committed. Only product code, test hooks and permanent tests were committed. The supplied preamble specified no trailer values; the commit uses Refs: #587 without invented attribution. The issue remains open. No merge or deployment occurred.
Gate output, verbatim:
All paired benchmark output, including uptime, verbatim:
Starting the read-only delta review of 7854fdc..80e9469 for round 4. Review checkout is detached at
80e94699a6; no branch will be pushed. Base SHA is7854fdcbfa. I will audit exclusive placement, scan recovery, lifecycle and metadata fast paths, rerun scratch reproductions, and run the notes gate.Delta audit finding: scan::identify_many now propagates both deletion-history read errors, but watch.rs:182-186 retries scan::run in an unbounded while loop with one-second sleeps. scan.finish is reachable only on success. ScanState has only a boolean, and Notes::incomplete exposes that boolean; no terminal error is published to callers. Thus permanent deletion-history failure leaves startup incomplete forever and blocks subsequent watcher path processing, although a warning is logged each second. I am reproducing permanent failure and checking the other fixes; the unmodified notes gate is queued behind occupied build slots.
Delta review evidence at
80e94699a6:P1 create placement is fixed: the original scheduling reproduction now returns IdempotencyConflict and preserves
outside note that must survive\n. Missing destinations use hard_link of the flushed adjacent image, which atomically refuses an occupied destination. Unsupported hard links return an error; an LD_PRELOAD fault returning EOPNOTSUPP producedErr(Error { code: Internal, detail: "Operation not supported (os error 95)" }), with no destination file or index entry. There is no ordinary-rename fallback on that path.P1 residual overwrite path found by the requested write/rename audit: Room::rename at crates/notes/src/room/rename.rs:39 still calls rename_safely. That helper checks to.exists and then calls ordinary rename in crates/fsio/src/lib.rs:90-102. The scratch hook pauses after the actual absence check, writes
outside rename destination must survive\n, then resumes the real rename. Result wasOk("Delta rename.md"), and the destination instead contained the app note's frontmatter andapp body\n. The outside bytes were lost. Trash restore and moves to Trash use the same helper. This helper is unchanged by this delta; the original create finding is closed, but the broader no-overwrite audit cannot pass. Existing-file save also retains its documented check-then-rename fallback when atomic exchange fails; that fallback was not changed by this delta.P2 permanent failure is reproduced: renaming only the scratch history's departed table lets journal discovery succeed but makes gone_ids fail on every scan. After 3.3 seconds, exact output was
DELTA587 permanent history failure after 3.3s: scanning=true indexed=false error=Error { code: Internal, detail: "no such table: departed" }. Restoring the table allowed the scan to finish. Source confirms watch.rs:182 has no retry limit, and only logs a warning; clients receive an incomplete boolean with no terminal error. Both gone_ids error returns now propagate correctly, but bounded startup recovery remains unfinished.P3 is narrowed, not eliminated: the original joined different-id creates now pass, but two independent idempotent creates for the same id joined in a single spawned task panic at home.rs:540 with
lifecycle acquired twice for one note in one task. Same task plus same identity still does not prove recursion. This guard is debug-only.The new save transition tests both pass: tags go empty -> delta -> empty -> second (with a fenced hidden tag) -> empty; backlinks go empty -> Target.md -> empty -> Target.md (with a fenced decoy) -> empty. Each step uses the real edit and explicit save, checks the list or backlink rows, and confirms saved body bytes.
Original scratch checks all pass, including both SIGKILL publication gaps, 20 concurrent operation rounds and 110,000 stale reports. Combined scratch gate:
test result: FAILED. 10 passed; 3 failed; 1 ignored; 0 measured; 297 filtered out; finished in 5.07s. The three failures are the residual rename race, permanent scan failure, and same-id lifecycle false positive above. Fsio gate:test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s.The unmodified notes gate passed with 296 passed, 0 failed and 1 ignored. A clean verification and paired release measurements will be included in the final comment. No product files were changed; all hooks and new review tests are confined to the updated scratch worktree, and evidence is outside the product repository.
Delta perf evidence: rebuilt
80e9469release harness and ran the preserved1200114base binary and head in base/head/head/base order, back-to-back in one build slot. The unchanged harness uses 20 warmups, 1,000 measured saves at 100 lines and 100 at 10,000 lines, explicit dirty saves and nearest-rank percentiles.10,000-line edit-plus-save p95: pair 1 base 26.817357 ms, head 11.492663 ms (-15.324694 ms); reverse-order pair 2 base 21.131680 ms, head 12.797350 ms (-8.334330 ms). The previous +3.17 ms regression is not reproduced. Save-only p95 improves at both note sizes in both pairs. The 100-line edit-plus-save p95 is mixed: 3.926206 -> 5.188823 ms in pair 1, 3.942408 -> 3.462161 ms in pair 2. Host load was about 44-46; these are shared-host measurements, not a latency guarantee. All four harness runs exit 0.
The final clean notes gate is queued after clearing only notes/fsio development artifacts, to exclude the shared target's demonstrated stale-binary reuse. The correctness verdict remains fix first for the reproduced rename overwrite path, permanent scan failure, and same-id debug guard false positive.
Review status: correctness checks, original reproductions, new transition tests and paired release measurements are complete. The final clean head notes gate has been waiting several minutes for the required shared build-slot scheduler, so completion is currently blocked on slot availability. The earlier unmodified-head run passed (296 passed, 0 failed, 1 ignored); the clean rerun excludes the target-cache reuse seen during scratch setup. I am leaving the queued command in place and will post its exact result when it completes. No build-slot override or process termination is being used.
Finished the round-4 delta review. Verdict: fix first. Head SHA:
80e94699a6. No product files were changed, and the issue remains open.Delta review (
80e9469)Verdict: fix first. The original create overwrite reproduction, one-shot scan error reproduction and different-id sibling-create reproduction now pass. The requested broader audit found an unchanged rename overwrite race, unbounded startup recovery for permanent deletion-history errors, and a remaining debug guard false positive for independent same-id creates. Tag and backlink fast-path transition checks pass.
Reviewed the 15-file delta
git diff 7854fdc 80e9469at detached HEAD80e94699a6. The review checkout stayed read only. The previous scratch worktree was updated to this head after preserving its old tracked instrumentation outside the product repository; only scratch scheduling hooks and review tests were added there. No commits, pushes, merges, deployments, issue closure or VM access occurred. Findings and reproduction evidence were posted to issue 587.P1 create fixed; unchanged rename overwrite path remains
crates/fsio/src/swap.rs:157-169now links the already-flushed adjacent temporary image to the absent destination withstd::fs::hard_link. On Linux this is an exclusive directory-entry creation primitive: an occupied destination fails rather than being replaced. It does not requirerenameat2(RENAME_NOREPLACE)or atomic exchange support. A successful link is followed by unlinking the temporary name and syncing the directory.AlreadyExistsreads and returns the competing bytes; every other error propagates. There is no replacing-rename fallback for a missing destination. Filesystems without hard links therefore reject this create safely, at the cost of availability. This was verified by injecting EOPNOTSUPP into link/linkat: create returnedErr(Error { code: Internal, detail: "Operation not supported (os error 95)" }); neither a destination file nor an index entry appeared. This is fault injection on Linux, not a claim to have mounted every filesystem.The original scratch hook was moved to immediately after the real absence check and before the new hard link. Its exact output is:
An already-existing file cannot reach the replacing branch during initial create, because its expectation predicate is always false. A dangling symlink or unreadable racing destination can instead produce an error; neither is replaced by this path. Cleanup/fsync can still report an error after our own image has become visible, which is distinct from overwriting competing bytes.
Remaining P1 audit finding, predating this delta:
crates/notes/src/room/rename.rs:39callsrename_safely;crates/fsio/src/lib.rs:91-102checksto.exists()and then performs an ordinary replacing rename. Pausing after that actual check, creatingDelta rename.mdwithoutside rename destination must survive\n, and resuming the real room rename returnedOk("Delta rename.md"). The destination instead held the source note's frontmatter andapp body\n. The outside bytes were lost without being read or journaled. The same helper serves restore and both Trash move paths. The case-only path also uses ordinary renames. Replace destination placement with an exclusive operation and preserve a conflict; handle case-only renames explicitly. This is not a claim that80e9469introduced the helper, but the requested assertion that no note path still overwrites is false.The complete production write/rename call-site audit in crates/notes found:
Other direct filesystem write/rename hits are test code. No additional production note placement primitive was found. The audit distinguishes intentional cache/metadata replacement from note-content destinations; it does not certify the unchanged exchange fallback or Trash recovery write as exclusive.
P2 error propagation fixed; permanent failure never finishes startup
Both deletion-history reads in identify_many now use
?, and run propagates the result. The original one-shot reproduction now reports the injected error. The head's new tests cover a later successful scan and failure after lifecycle reacquisition. The old silent successful scan is fixed.However,
crates/notes/src/watch.rs:182-186retries run in an unbounded while loop, sleeps one second, and reaches scan.finish only after success. This loop also holds up processing subsequent watcher paths. ScanState has only a scanning boolean and completion notification; Notes::incomplete at scan.rs:405 returns that boolean. A tracing warning is emitted each attempt, so this is not silent in server logs, but callers receive no terminal scan error.The new scratch reproduction opens a real Home and renames only the scratch database's departed table before starting it. Journal discovery still succeeds; every gone_ids query fails. After 3.3 seconds:
Restoring the table makes startup finish on its next retry. The observation plus the unconditional source loop establishes that leaving the failure permanent leaves startup incomplete indefinitely. Bound the startup retry phase and expose a persistent failed/degraded scan state; do not falsely report successful discovery or discard tombstone safety when history is unreadable.
P3 different-id sibling creates fixed; same-id siblings still panic
The debug guard now keys ownership by
(Tokio task id, note identity). This fixes the original different-id tokio::join! reproduction. Independent idempotent creates for the same identity also legitimately serialize, however, and the guard still mistakes those sibling futures for recursion.A new scratch test joins two independent create calls with identical id, title and body inside one spawned task. It panics at
crates/notes/src/home.rs:540:Use logical acquisition ownership or remove the false-positive diagnostic in favor of focused lock-order checks. This remains debug-only; no additional release deadlock is claimed.
Fast-path correctness and scratch checks
links::findcan return early only when there is no opening bracket anywhere in its current input; every link accepted by the existing parser requires that bracket.tags::scan::spansreturns early only with no hash, or truncates after the whole line containing the final hash. Tag parsing is line-local apart from forward fence state, so later hash-free lines cannot change spans already recognized. The optimizations do not reuse a previous text's empty result. The existing metadata cache also requires the current applied version/path and a clean room; edits rederive live fields before save can reuse them.Two new scratch integration tests exercise real edits and explicit saves, checking the persisted body each time:
delta_save_adds_and_removes_tags_across_plain_text_fast_path: empty -> delta -> empty -> second with a fenced hidden tag and a plain tail -> empty. List tags follow every transition.delta_save_adds_and_removes_backlinks_across_plain_text_fast_path: empty -> Target.md -> empty -> Target.md with a fenced decoy -> empty. Backlink rows and source ids follow every transition.Both pass. All seven original scratch checks now pass, including the three original failures, both real subprocess SIGKILL gaps, twenty concurrent same-id operation rounds and 110,000 bounded stale reports. The child entrypoint without its child environment is included in that count. Only recorded subprocess children were killed.
The updated scratch suite adds the two transition tests, unsupported-hard-link test, and the three remaining-finding reproductions. Command, inside the build-slot wrapper with CARGO_TARGET_DIR=/home/kayg/Developer/calternal-target-587:
Exit 101. Failures are exactly the rename race, permanent history failure, and same-id guard false positive described above; the ignored test is the separately run perf harness. Fsio suite exit 0:
The first scratch invocation reused the unmodified-head binary and selected zero scratch tests; it is excluded. Clearing only notes/fsio development artifacts before rebuilding produced the verified 311-test scratch binary above. Final unmodified-head verification below also starts by clearing those two packages' development artifacts.
Performance delta
Rebuilt the head release test binary with fat LTO and one codegen unit, after clearing only notes/fsio release artifacts. Reused the preserved original base binary (
1200114c32; executable calternal_notes-2ba11291d7edadd6, also identified in the original build log). The harness is unchanged: 20 warmups, 1,000 measured saves at 100 lines and 100 at 10,000 lines; append x, explicitly save, nearest-rank percentiles. Watch, automatic rename and automatic flush are disabled. Both pairs ran back-to-back in one build slot, in base/head/head/base order. No VM was used. Every local build and harness execution used the required slot wrapper and cargo -j4.The previous 10,000-line edit-plus-save regression is not reproduced: head minus base p95 is -15.324694 ms and -8.334330 ms in these two pairs. Save-only p95 also improves at both sizes in both pairs. Small-note edit-plus-save p95 is mixed: +1.262617 ms then -0.480247 ms. Do not turn these shared-host results into a universal latency guarantee; load averages were about 44–46 during measurement. The 10,000-line result supports the intended benefit of avoiding full per-line tag/link scans on plain text, while the integration tests above verify transitions to and from tagged/linked text.
All four perf invocations exit 0, with these verbatim result lines in execution order:
Final unmodified-head gate and evidence
The final gate ran after clearing notes/fsio development artifacts, from the unmodified review checkout, inside the required build-slot wrapper. Command:
CARGO_TARGET_DIR=/home/kayg/Developer/calternal-target-587 cargo test -q -p calternal-notes -j4. Exit status 0. Gate output, verbatim:Final HEAD remains
80e94699a6. Bothgit status --porcelain=v1andgit diff --check 7854fdc 80e9469produce no output. All scheduled commands are complete. The final clean gate waited for shared build-slot availability; that blocker was posted to the issue and resolved without overriding the scheduler or terminating any other job.Evidence remains outside the product repository under /home/kayg/Developer/calternal-research: r587v4-delta-head-clean-tests.log, r587v4-delta-scratch-tests.log, r587v4-delta-fsio-tests.log, r587v4-delta-perf.log, and r587v4-delta-release-build.log. Scratch reproductions, transition tests and scheduling hooks remain uncommitted in the updated r587v4-tests worktree named above. The link/linkat fault injector and runner scripts are also outside the product repository. No evidence or artifacts were committed.
Starting the remaining delta-review fixes on branch issue/587-event-after-write-5, based on
80e94699a6. I will first port and reproduce the three failing review tests, then audit every note placement path, bound startup recovery with a visible failure state, and remove the same-id sibling-future guard false positive. Required workspace gates and paired local save-latency checks will follow. No VM, merge, deployment, or issue closure.Reproduced all three delta findings before changing behavior, on
80e94699a6plus permanent tests and a scheduling seam.P1: delta_rename_must_preserve_file_arriving_after_absence_check injects the outside destination at the shared helper used by room renames, folder moves, Trash moves and restores. The old helper replaces its bytes with app body.
P2 and P3: the reviewer tests are ported into notes::tests::delta_review. Full failure evidence follows.
Audit findings: guarded save still falls back to replacing rename when exchange is unsupported; keep_outside uses a replacing write after a separate existence check; migration uses replacing writes after preflight; Trash deletion removes an already occupied content destination before moving. These paths also need preservation. Safest choices: exclusive moves and new-image placement; fail safely if an existing-file exchange is unsupported; suffix conflicting note paths where the documented name rule applies; preserve occupied Trash content and return a conflict. Startup will get three attempts with exponential backoff, then retain an actionable failed scan state, wake waiting requests, and leave lists marked incomplete.
The three initial red tests are recorded. Implementation and the placement audit are in progress. The baseline
80e9469release build is running under the required local slot wrapper; the targeted test suite is waiting for a free build slot. I am keeping the scheduler intact and doing source review and test additions while it waits. No VM is in use.The
80e9469baseline release binary is built and preserved. The remaining local test/build work is blocked on the priority test train: /tmp/calternal-train.active points to the live trainpar.sh ai job. The required wrapper correctly keeps this job waiting. I will not override the scheduler or terminate shared processes. Source review, permanent tests and lasting ADR updates are ready for compilation as soon as slots become available.Validation is still blocked by the priority train, which has been active for about 28 minutes and still has seven shard jobs. The targeted suite remains queued in the required wrapper. The three original red reproductions are posted above; product changes, permanent tests, and ADR updates are staged on issue/587-event-after-write-5. Formatting and whitespace checks pass. Baseline
80e9469release binary and the matching head benchmark worktree are prepared. I will continue waiting without bypassing the scheduler, killing shared processes, or claiming gates/performance have passed.Validation remains blocked by the priority train after about 56 minutes. It has progressed to three remaining shard jobs; the required build-slot wrapper still keeps this job queued. No workspace gate or head latency result is claimed yet, and nothing has been committed or pushed. The staged implementation and permanent tests are ready. I am continuing until the scheduler permits the authorized validation, then will commit, push the new branch, and open the new PR.
The independent read-only correctness review found two further paths within the required P1 audit. I checked the source and added permanent regressions before changing their behavior.
Rename jobs plan backlink edits in rename.rs before the room chooses its actual destination. The staged room fix can choose Destination 2.md for an unindexed Destination.md, while stored backlink edits still target Destination.md. The same problem affects undo when the original path becomes occupied. Evidence: rename.rs target/link_steps and bulk/steps.rs Step::Rename only store the returned path; bulk::drive currently executes rename and dependent edits in one parallel batch. New tests cover an unindexed destination, a collision after a plan is stored, and an undo collision.
bulk/steps.rs Step::Create still passes the folded candidate from unique_md_name to a case-sensitive filesystem lookup. A requested Destination.md probes destination.md, misses the outside file, publishes a new identity, then room/load.rs seeds the new room from the competing file and appends the planned body. A regression now requires a conflict with both the outside image and dependent source edit preserved. A further replay regression protects later typing during undo.
The old debug test that deliberately reacquired lifecycle and expected the removed panic is obsolete; it has been removed. The permanent independent-sibling API tests cover the supported behavior.
Safest choice: choose numbered destinations before storing dependent edits, then keep stored destinations fixed. Exclusive placement collisions stop the job before dependent edits run; a fresh action can replan. Job creates will use the same file-first helper as API creates, and identity retries will retain their original creation version for undo. The five new red tests are queued in the required wrapper. The priority train still has one job, so no runtime result is claimed yet.
The five extra placement/replay regressions from the independent code review were added before the corresponding fixes. All five failed, demonstrating outside-file adoption, stale backlinks after suffix allocation, dependent edits before a failed rename/create, and duplicate text/version ownership on create replay. Raw red output follows.
The fixes now pass all targeted suites: fsio 18, migration 37, notes 305 (one ignored). Full workspace gates have also passed:
Workspace notes result verbatim:
A final independent correctness pass and local release save-latency comparison against
80e9469are running. No evidence files or benchmark harnesses are in the product worktree.All product gates passed, but the first local release save-latency pass showed shared-host noise at 10,000 lines: baseline/head/head/baseline save p95 was 11.202570 / 10.998661 / 12.514920 / 10.091325 ms. The second pair is +2.423595 ms, beyond the requested 1 ms threshold. The 100-line p95s were 1.918248 / 1.345545 / 1.437153 / 1.594072 ms.
I am repeating the unchanged binaries with five balanced baseline/head/head/baseline groups (ten runs per revision) to distinguish repeatable save cost from shared-host variance. Every initial and repeated run will be reported. No perf VM is being used.
Finished the three delta findings on branch issue/587-event-after-write-5.
Base:
80e94699a6Head:
5b4e4ea47bNew PR: #627 (base dev). Remote branch SHA verified against HEAD. No merge, deployment, or issue closure. Commit trailers: Refs: #587; Base-commit:
80e94699a6.P1: every production note placement is exclusive. Native no-replace moves cover normal/case-only renames, folder moves, Trash and restore; a blocked rollback preserves the original at the reported temporary path. Missing note writes use exclusive links; existing file saves and migration use checked exchange with no replacing fallback. Stored jobs retain planned destinations, and collision stops dependent edits. Bulk creates now use the same file-first placement as API creates; replay does not append initial text twice and returns the original seed version for undo.
Permanent tests: delta_rename_must_preserve_file_arriving_after_absence_check (the reviewer regression, verified red before fix), case_only_rename_preserves_a_different_destination, rename_preserves_a_dangling_destination_symlink, case_only_collision_rolls_back_or_keeps_the_staged_original, unsupported_exchange_never_replaces_an_existing_file, migration_preserves_files_changed_after_preflight, deleting_preserves_an_occupied_trash_destination, rename_uses_a_suffix_for_an_unindexed_destination, placement_review_rename_retargets_links_to_the_actual_suffix, placement_review_bulk_create_cannot_adopt_an_outside_file, placement_review_planned_rename_conflict_keeps_links_unchanged, placement_review_undo_rename_conflict_keeps_links_at_the_live_note, and placement_review_bulk_create_retry_keeps_original_version_for_undo. The five additional regressions were also verified red before their fixes; raw evidence is in comment 59469.
P2: discovery stops after three failed attempts with 500 ms and 1 s backoff. A persistent health error records the library identity, cause, and repair/restart/rescan instructions in server logs; scan_error also exposes the health state. Startup waiters are released and known notes remain usable. Lists stay incomplete and whole-library edits reject the failed scan. Only successful rescan clears the health error. Test delta_permanent_deletion_history_failure_must_terminate_scan was verified red on the base, and checks bounded completion, visible error/incomplete state, known-note availability, and repair recovery.
P3: lifecycle serialization no longer treats independent futures sharing a Tokio task id as recursive acquisition. The mutex serializes same-id siblings. Same initial text succeeds idempotently; differing text conflicts. Tests delta_independent_same_id_create_retries_joined_must_not_panic (verified red on base) and same_id_sibling_creates_with_different_text_conflict pass in debug builds.
Conservative recovery choice: an old running bulk-create job that published its identity but never recorded its authored seed may return an explicit conflict after upgrade. Identity alone is insufficient to establish ownership. The stored job payload and any competing file remain intact; resolve the conflict and start a freshly planned change. It is not silently completed or blindly appended. Unsupported exclusive moves/exchanges fail visibly rather than replacing note files.
Placement audit for issue 587, round 5
Production note-content paths:
Other file writes audited:
Required gates, all exit 0. Commands run under the local build-slot wrapper with four Cargo jobs:
Gate status output verbatim:
Formatting stdout/stderr was empty. Clippy stdout/stderr was empty. Full workspace test stdout/stderr verbatim:
Totals across the workspace result lines: 591 passed, zero failed, two ignored.
Local release save latency, all runs and method:
Save latency in milliseconds. Medians of the run p50 and p95 across all twelve runs per revision (initial ABBA plus five repeated ABBA groups). Each run measures 1,000 saves at 100 lines and 100 saves at 10,000 lines after 20 warmups. No runs discarded.
The median run save-p95 deltas are below 1 ms for both sizes. Individual run deltas exceed 1 ms under shared-host load, including +2.423595 ms for the initial second 10,000-line pair; this check does not establish a hard latency bound. All raw runs below include host load. The scratch harness sometimes logs a Tokio shutdown panic from a detached background task on both revisions after measurements; all 24 benchmark test processes exit successfully. The workspace gates have no failures.
Initial pass:
Balanced repeat:
All logs, benchmark harnesses, measurement tables and scratch worktrees are outside the repository. The committed changes contain only product code, permanent tests and lasting ADR updates. The product worktree is clean after committing.
Starting second delta review at detached HEAD
5b4e4ea47b, comparison base80e9469. The review checkout stays read only; scratch reproductions and new fast-path checks will run outside it. I will verify placement audit comment 59478, bounded startup failure, same-id creates, and the head notes test gate.Second delta source audit: the original create race is guarded by exclusive hard-link placement; moves use rustix RenameFlags::NOREPLACE, including case-only staging and rollback; existing-file writes now propagate failed exchange instead of falling back to replacing rename. Startup retries are capped at three with 500 ms and 1 s backoff; failure wakes waiters, retains an actionable health error, and keeps lists incomplete. The debug task-id ownership guard is removed. I am rerunning the fault and concurrency checks. Local test execution is currently queued behind the required shared build-slot scheduler; no slot override is being used.
Second delta finding, P2: a planned rename collision still applies its dependent title edit. rename.rs:51-52 appends the H1 edit before Step::Rename at :77. The new batching at bulk/mod.rs:218-222 commits edits preceding a placement before attempting that placement. Reproduction uses the real Notes::rename API: hold home.jobs, wait until its plan is durable, place an outside Destination.md, release jobs. Rename returns Internal with the planned-destination conflict; the note stays at Alpha.md but H1 is Destination, and the job is failed with done=1, steps=2. Outside Destination.md survives. This contradicts comment 59478’s claim that collision precedes dependent title edits. Scratch regression delta2_rename_collision_must_not_apply_dependent_title_edit fails: test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 320 filtered out; finished in 0.03s. Resolve placement before committing its dependent title change, preserving correct inverse/undo order. This is a remaining partial-mutation problem, not a repeat of the fixed outside-file overwrite. The previous P1/P2/P3 reproductions and both fast-path transition tests pass.
Finished second delta review. Branch: detached review checkout. Base
80e94699a6; head5b4e4ea47b. Verdict: fix first. Full review appended to /home/kayg/Developer/calternal-research/review-587-v4.md under Delta review 2 (5b4e4ea). Final head gate exit: 0. The full gate stdout/stderr is quoted verbatim below.Delta review 2 (
5b4e4ea)Verdict: fix first. The three previous delta findings are closed by the checked fixes. One P2 remains in collision handling: the real rename API changes the note's H1 before discovering that the planned move is blocked. The placement audit is correct about exclusive primitives, but its title-edit ordering claim is false. Head notes tests and the prior scratch checks pass; the added title-collision regression fails.
Reviewed detached head
5b4e4ea47bagainst80e94699a6, and the placement audit in issue comment 59478. The review checkout remained read only. Scratch worktree r587v4-tests was advanced to this head after saving its previous tracked diff outside the repository. No commits, pushes, merges, deployments, issue closure or VM access occurred.P2: a failed planned rename commits its dependent title change
Locations: crates/notes/src/rename.rs:51-52 and :77-81; crates/notes/src/bulk/mod.rs:211-222.
The public rename API builds an H1 edit before its move. The new batching commits every edit preceding a Create/Rename before attempting that placement. If an outside file occupies the planned destination after planning, the move correctly refuses it, but the title edit has already succeeded. The operation returns an error with the new title at the old path. This violates comment 59478's specific claim that occupied planned destinations stop before dependent backlink/title edits. Backlink edits after the move are correctly stopped; the head's existing planned-rename regression begins with a move and therefore misses the normal API's leading H1 edit.
New scratch reproduction
delta2_rename_collision_must_not_apply_dependent_title_editcalls the real Notes::rename API, holding home.jobs only until its plan is stored. It then writes an outside Destination.md and releases the job. This controls timing without changing product code or placement behavior. Exact observed fields:The outside file is intact, but the live note text changes from
# Alphato# Destination; its deferred journal edit remains part of the note despite the failed rename. The assertion that the note text stays unchanged fails. This is a partial-mutation problem, not another outside-file overwrite, and is not claimed to have originated with the old H1 planning code. The current delta's ordering does not provide the guarantee claimed by its audit.Required direction: resolve the planned placement before committing its dependent H1 edit, or provide equivalent conflict recovery, and keep the corresponding inverse/undo ordering correct. Retain a public-API collision regression, rather than testing only hand-written move-first plans.
Command through build-slot, same target and four Cargo jobs:
cargo test --lib -p calternal-notes -j4 delta2_rename_collision -- --nocapture --test-threads=1. Exit 101:Verification of the previous findings
P1: the racing destination is preserved. fsio/src/lib.rs:157-170 calls rustix renameat_with with RenameFlags::NOREPLACE. The installed rustix 1.1.5 Linux backend sends __NR_renameat2 with those flags; its flag definition maps to RENAME_NOREPLACE. There is no exists-check/plain-rename or link/unlink fallback for note moves. Unsupported operations propagate the native error; unsupported target operating systems return Unsupported. The source stays in place when the native operation refuses a move. Case-only staging, placement, and rollback all use the same exclusive operation. If a second outside file blocks rollback, the original remains under the reported temporary name and the error is not retried as an ordinary destination collision. Permanent fsio tests cover a racing destination, a dangling destination symlink, case-only different-file collisions, and both rollback outcomes.
Missing-file writes exclusively hard-link a flushed create_new temporary image to the destination. AlreadyExists returns the competing bytes (or a read error for an unreadable/dangling destination); other errors propagate. There is no copying or replacing fallback on a filesystem without hard links. Existing-file writes require atomic EXCHANGE; failure now propagates rather than falling back to ordinary rename. Successful exchange keeps the displaced inode for verification and rollback. The unsupported-exchange regression passes; the scratch EOPNOTSUPP link fault also returns an error without creating or indexing a note.
The original create race reproduction returns IdempotencyConflict and preserves the outside bytes. The rename race now returns Delta rename 2.md and preserves the original destination bytes.
P2: both deletion-history reads propagate failures. watch.rs:182-199 tries at most three times with 500 ms and 1 s sleeps between attempts. ScanState::fail retains a repair/restart/rescan error, sets scanning=false, and wakes completion waiters. Notes::scan_error exposes the persistent error; a tracing error includes the user identity and cause. Lists and tag pages remain incomplete. Rewrite and tag-rename reject the health failure. Only scan.finish after a successful rescan clears it. The old permanent-history scratch reproduction now observes scanning=false after 3.3 s with the departed-table error, a persistent health error, incomplete state, and a released settled waiter. The head regression additionally checks known-note reads and successful repair/rescan. The one-shot error reproduction still returns the injected error rather than success.
P3: the Tokio task-id ownership diagnostic has been removed; lifecycle is the ordinary Tokio mutex. Both original different-id and same-id sibling reproductions pass without panic. Same-id/same-text creates return the same path and version 1. The permanent different-text sibling test requires exactly one success and an IdempotencyConflict, with the winning bytes retained.
Placement table cross-check
A fresh grep covered fs::rename, rename(, std::fs::write, File::create, OpenOptions, write/write_all, write_atomic, Prepared, write_unless_changed, and persist across crates/notes and other workspace writers. Every production markdown placement found is listed below. Existing-file saves intentionally exchange a checked file; they do not refuse all existing files.
Fast paths
The retained scratch integration tests exercise real edits and explicit saves and assert both the saved body and derived rows after every transition. Tag checks run plain -> #delta -> plain -> a fenced hidden tag plus #second and plain tail -> plain. Backlink checks run plain -> Target.md link -> plain -> fenced decoy plus real link -> plain. Both pass at this head. These are current-input scans: no-bracket text cannot contain a link accepted by links::find; no-hash text cannot contain a body tag. Truncation retains the complete last hash line and all preceding fence state. Room cache reuse requires the same applied version/path and a clean room, so edit transitions do not reuse old empty results. No new latency measurement was requested or made in this second delta; the earlier delta's measured performance conclusions are unchanged.
Tests and evidence
All local builds and tests used build-slot.sh, cargo -j4, and CARGO_TARGET_DIR=/home/kayg/Developer/calternal-target-587. The first slot wait resolved normally. Scratch hooks only widen real scheduling windows; only recorded child processes were killed by the hard-kill tests. Package-specific development artifacts were cleared before scratch and clean-head builds to prevent reuse of the wrong worktree's binary.
Scratch command: LD_PRELOAD=/home/kayg/Developer/calternal-research/r587v4-delta-link-failure.so REVIEW587_UNSUPPORTED_LINK=1 cargo test --lib -p calternal-notes -j4 review587_ -- --nocapture --test-threads=1. Exit 0:
This includes the seven original checks, same-id retries, permanent history failure, rename race, two tag/backlink transition tests, and unsupported hard links. The ignored test is the separately used perf harness. Both real SIGKILL publication gaps, twenty concurrent edit/rename/create/delete rounds, and 110,000 bounded stale reports pass again.
Support command: cargo test -q -p calternal-fsio -p calternal-migrate-v0 -j4. Exit 0:
The clean-head gate was repeated after the additional scratch build, again clearing notes/fsio development artifacts. Both runs passed (first 16.92 s, final 30.90 s). Final unmodified review-head command: CARGO_TARGET_DIR=/home/kayg/Developer/calternal-target-587 cargo test -q -p calternal-notes -j4. Exit 0. Output verbatim:
Evidence remains outside the repository in /home/kayg/Developer/calternal-research/r587v4-delta2-{scratch-tests,support-tests,head-tests,head-final-tests,title-tests}.log and r587v4-delta2-write-audit.txt. No evidence was committed. Final checkout status and diff whitespace checks are clean.
Starting the last rename collision fix on branch issue/587-event-after-write-5, base
5b4e4ea47b. The worktree is clean and already on this new branch. I will port the public API regression first, verify it fails, then cover recovery and run fmt, clippy and workspace tests. The new branch follows the forge rule that pushes to an open PR branch are ignored.Confirmed on base
5b4e4eawith only the ported test added: delta2_rename_collision_must_not_apply_dependent_title_edit fails. The API returned Internal, old path Alpha.md, new H1 Destination, failed job done=1 of 2. The competing Destination.md bytes survived.The first attempt lacked cc in PATH; using the prior review GCC wrapper resolved linking. Evidence is outside the repository in /home/kayg/Developer/calternal-research/r587v5-red.log. The fix will put the exclusive move before the H1 edit and preserve the conflict code. Recovery tests will kill only their own child at the durable move/title boundaries.
The ported public API regression now passes: IdempotencyConflict, Alpha.md, H1 Alpha, failed job done=0 of 2; both original and competing file bytes are unchanged. Both real SIGKILL tests pass after the move and after the title edit before progress. Recovery reaches the complete new state and undo restores the complete old state.
Branch correction: API inspection found that issue/587-event-after-write-5 already has open PR #627. I therefore created issue/587-event-after-write-6 from the same
5b4e4eabase, following the hard rule to use a new branch and new PR. I will verify origin/issue/587-event-after-write-6 after pushing; I will not update the existing PR branches. Added assertions also cover restart after collision and an undo collision preserving the title.Gate environment blocker: fmt passed (fmt exit: 0), but the first workspace clippy invocation exited 101 because pkg-config was absent from PATH when building OpenSSL. I restored the existing review environment from fix587v5-env.sh, including pkg-config and PKG_CONFIG_PATH, and restarted the gates under build-slot. No product change was needed for this environment issue.
Finished the last collision finding on #587.
Branch: issue/587-event-after-write-6
Base:
5b4e4ea47bHead:
0104c0fe1dPR: #629
Rename jobs now claim the exact destination with the exclusive move before applying their H1 or backlink edits. A collision leaves the original file bytes, title and path unchanged and returns IdempotencyConflict. The failed job has zero completed steps. Replay completes the move before the title edit; undo retains destination-first ordering.
The reviewer's public API regression was ported first and failed on the unchanged product code at the base SHA (0 passed, 1 failed). It now also checks the conflict code, zero progress, original disk bytes and unchanged state after restart. Tests:
Both process-death tests killed only their recorded child and verified signal 9. Restart completed the new path and title exactly once; undo restored the full old state.
Commands: cargo fmt --all -- --check; cargo clippy --workspace --all-targets -j4 -- -D warnings; cargo test --workspace -j4 -- --test-threads=4. All heavy commands used build-slot. Workspace totals: 595 passed, 0 failed, 2 ignored across 57 result groups.
Gate status and clippy completion, verbatim:
Workspace result lines, verbatim:
Push verified by git log origin/issue/587-event-after-write-6 -1 and a live ls-remote, both showing
0104c0fe1d. The existing -4 and -5 PR branches were not updated; the hard rule requires a new branch and PR. Worktree status and git diff --check are clean. No merges, deployments or issue closure.Evidence remains outside the repository: r587v5-red.log, r587v5-renames.log and r587v6-{fmt,clippy,workspace,gates}.log under /home/kayg/Developer/calternal-research. No artifacts were committed.
Started the train AJ note format regression fix on branch issue/587-create-format-7, based on
0104c0fe1d. I will trace create seed and title handling, audit the branch for other vault format changes, and run the requested gates and fresh-note e2e spec.Cause found:
e174661153added unconditional title generation in the initial-text create path (now place_create in crates/notes/src/lib.rs). It calls room::title_of and inserts title after calternal-id/date/last edited, even for a body with no H1. same_initial_text also normalizes title from the current file, hiding the extra field. The fix removes title from both create normalization paths; user-supplied frontmatter remains request content and must match exactly. Added an exact-byte Rust regression for plain text and H1 bodies, same-text no-op retries after reopen, and conflicts for changed bodies or added title keys. Existing deletion guards remain unchanged. ADR 0025 describes H1/title synchronization on later saves; that pre-existing behavior remains unchanged.Branch format audit against origin/dev: the only added note frontmatter key is the unconditional create title field, now removed along with its overwrite of an authored title value. Create still sets calternal-id, date, last edited in that order for plain bodies. Existing request frontmatter is retained. No additional note keys, changed server-key ordering, vault sidecar files, serialized Trash detail fields, migration marker fields, or database schema changes were found. Two intentional persistence changes remain: create stores its seed under the caller author in existing history rows, and permanent deletion stores an identity marker (fold = NUL + gone:) in the existing departed table so path reuse cannot resurrect a deleted id. Neither adds files or schemas, and both are required for the existing idempotency/deletion guarantees. Exclusive placement uses the existing temporary-file naming and preserves competing files. ADR 0025 title synchronization on later saves is pre-existing on origin/dev.
The first local Rust test attempt could not link because cc was absent from PATH. Using the installed Nix GCC wrapper resolved it. Focused create tests now report:
Gate environment finding: the first clippy attempt stopped before checking product code because pkg-config was not on PATH and openssl-sys could not discover OpenSSL. The installed Nix pkg-config wrapper and OpenSSL development path are available; I have configured those in the external gate runner and restarted the gates under the build-slot wrapper. No repository changes were needed for the environment fixes.
Workspace gate exposed a test fixture dependency on the unwanted field: tests::event_visibility::edit_title_property timed out at event_visibility.rs:269 because replacing the literal title: Original now changes nothing when create correctly omits that key. The gate reported: test result: FAILED. 309 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out; finished in 31.03s. Updated that mutation to set the title property using frontmatter::set and apply its edit, so it actually changes the property and still verifies immediate list visibility. Restarting all gates after this test-only correction.
Finished and pushed
0a66200147on issue/587-create-format-7. Verified git ls-remote reports the identical full SHA. Worktree is clean. New PR: #632 (replaces #629; no merge or deployment).Cause:
e174661added unconditional title generation to the durable create path and title normalization to same_initial_text. Removed both. Create now adds only calternal-id/date/last edited; retries compare the remaining request content exactly. Added exact-byte regression coverage for plain and H1 bodies, reopen/no-op retries and changed body/title conflicts. Existing permanent-deletion tests pass.Other persistence changes audited: authored seed rows in the existing updates table and permanent identity markers in the existing departed table are retained for the required guarantees. No other new note keys, changed managed-key order, vault files or serialization/schema changes were found. ADR 0025 save-time H1/title sync predates this branch and remains. No evidence or artifacts are committed.
Gate output verbatim:
Relevant test output verbatim:
All local heavy commands ran through the required build-slot wrapper, cargo used -j4, and Playwright used one worker. Nix compiler/pkg-config/OpenSSL paths resolved the initial environment failures; the title-property test correction resolved the first workspace failure. Final gates all passed.
Landed in train AJ, #633.
Train AJ ran the full suite: fmt, clippy, workspace tests, the build, svelte-check, and every Playwright project in parallel shards.
Failures, each checked:
swipe-rows:274(webkit-390): 7 of 8 alone; the one failure was a WebKit page crash (Target crashed), the known Playwright-WebKit host crash, not an assertion.Contents:
title:was removed). Reviewed independently three times; 310 notes tests.Closing during the 26 Oct handover cleanup: Landed in train AJ (#633).