Mail P1b: search save-log token and paged reconcile #1011
Open
kayg
wants to merge 54 commits from
t3/paged-search-reconcile-final into dev
pull from: t3/paged-search-reconcile-final
merge into: kayg:dev
kayg:main
kayg:port/tasks-float-2
kayg:fix/train-1116-2
kayg:fix/train-1116-3
kayg:fix/train-1116-1
kayg:fix/flake-1134
kayg:fix/server-1182
kayg:dev
kayg:port/notes-float-3c
kayg:docs/auto-update-ig
kayg:feat/dav-transport
kayg:port/tasks-float-1
kayg:wip/mail1011-sv-order-1116
kayg:fix/flake-1179
kayg:fix/flake-1178
kayg:fix/guards-1153-fsio-split
kayg:fix/guards-1153-notes-split-we
kayg:fix/guards-1153-notes-lib
kayg:fix/guards-1153-notes-home
kayg:fix/guards-1153-ui-primitives
kayg:fix/guards-1153-primitives-e2e
kayg:fix/guards-1153-visibility-doc
kayg:feat/paper-grey-1116
kayg:fix/flake-1165
kayg:fix/flake-1119
kayg:docs/imap-766-plan-v2
kayg:fix/e2e-unique-ports
kayg:wip/mail1011-final-1115
kayg:docs/tasks-float-port
kayg:perf/editor-first-paint-1c
kayg:feat/imap-notes-fetch
kayg:feat/imap-notes-projection
kayg:feat/imap-notes-readonly
kayg:feat/imap-notes-auth
kayg:feat/imap-notes-server-foundation
kayg:wip/mail1011-txn-ownvocab-1115
kayg:wip/mail1011-txn-novocab-1115
kayg:perf/p1117-final-harness
kayg:perf/single-shot-repeats
kayg:port/tasks-matrix
kayg:wip/mail1011-txn-1115
kayg:fix/static-gates-1155
kayg:feat/files-s1-identity-r7
kayg:fix/files-r7-idle-loop
kayg:fix/daily-train-1152
kayg:port/notes-float
kayg:fix/editor-tables-test-types
kayg:port/notes-float-listscript
kayg:feat/tasks-actions
kayg:port/notes-float-phone-preload
kayg:perf/sound-comparator
kayg:port/notes-float-listscroll
kayg:port/notes-float-budgets
kayg:port/notes-float-suite-fix-b
kayg:port/notes-float-sidebar-fix
kayg:port/notes-float-trim
kayg:port/notes-float-3-lists
kayg:fix/attachments-meta-capability
kayg:docs/carddav-writes-v2-plan
kayg:feat/contacts-companion-pure
kayg:issue/carddav-read-perf-fix-r2
kayg:issue/carddav-read-r2
kayg:port/notes-float-devsync2
kayg:review/calendar-2
kayg:review/switcher-a-pills
kayg:port/notes-float-switcher-a
kayg:port/port-tables-2
kayg:review/switcher-ends
kayg:wip/whiteboard-s1-1114
kayg:port/port-tables
kayg:wip/mail1011-perfneutral
kayg:review/photo-tint
kayg:port/notes-float-shell
kayg:wip/local/collections-db
kayg:wip/local/mail-p1
kayg:wip/local/cold-growth-on-tiering
kayg:wip/local/tiering-v3-s1
kayg:wip/local/wal1051-cap
kayg:wip/local/tiering-v3-s1-resume
kayg:wip/local/index-position-startup-scan
kayg:port/notes-float-flat
kayg:port/notes-float-promote
kayg:wip/handover/mail1011-candidate
kayg:wip/handover/files-s1-candidate
kayg:port/notes-float-shell-only
kayg:port/notes-float-perf
kayg:feat/whiteboard-s1
kayg:feat/tiering-v5
kayg:fix/app-switch-hitch
kayg:wip/local/files-s1-dev-v4-final
kayg:feat/files-s1-dev-v4
kayg:fix/c2-glass-shared
kayg:feat/flat-lists
kayg:wip/handover/whiteboard-s1-resume
kayg:wip/att-lazy-861
kayg:feat/switcher-browse
kayg:wip/att-lazy-860
kayg:feat/tasks-float
kayg:recovered/flat-backup-candidate
kayg:perf/stalls-1054-kc
kayg:land/ai-toolbar
kayg:feat/collections-db
kayg:feat/collections-db-fixes
kayg:codex/mail-1011-redesign-20261111
kayg:fix/ai-toolbar
kayg:backup/macos-vm/st3-head
kayg:perf/trim-candidate-phonestack
kayg:feat/switcher-three
kayg:fix/1051-index-idle-checkpoint
kayg:perf/stalls-1054-kb
kayg:perf/stalls-1054-k
kayg:perf/stalls-1054-r3
kayg:fix/c2-contrast-tail
kayg:perf/stalls-1054-r3-preview
kayg:feat/collections-before
kayg:feat/tiering-v4
kayg:fix/timelog-caret
kayg:wip/local/tasks-actions
kayg:docs/tasks-writes-v2-plan
kayg:st3-r3
kayg:feat/pass8
kayg:review/calendar-2-before-1111
kayg:wip/tiering-v3-cold4
kayg:perf/stalls-1054-r2
kayg:fix/suite-A4
kayg:fix/suite-A5-probe
kayg:fix/suite-A6
kayg:fix/suite-A3
kayg:fix/suite-A2
kayg:fix/suite-A5
kayg:fix/suite-A1
kayg:wip/local/attachments-861-fix
kayg:feat/contrast
kayg:wip/local/ports-861
kayg:storage/wal-checkpoint-off-save-1051
kayg:wip/local/mail-1011-reconcile-20261110
kayg:feat/style-sheet-fixes
kayg:feat/money-round
kayg:perf/stalls-1054
kayg:wip/tiering-v3-cold5
kayg:t3/mail-1011-liveness
kayg:feat/iphone-fixes
kayg:feat/notes-approve
kayg:wip/local/shrow-work
kayg:feat/files-s1-identity
kayg:feat/quickfix
kayg:wip/tiering-v3-cold
kayg:wip/local/shared-row-swipes
kayg:backup/macos-vm/pfx-B
kayg:backup/macos-vm/pfx-C
kayg:backup/macos-vm/pfx-D
kayg:feat/contrast-r1
kayg:feat/tiering-v3-s2-tags
kayg:feat/folder-drop
kayg:t3/photos-s1
kayg:feat/tiering-v3-s1-namespace
kayg:wip/local/photos-s1
kayg:t3/photos-plan-slice-one
kayg:recovered/backup/p1b-61505
kayg:t3/paged-search-reconcile
kayg:t3/smooth-pane-transitions
kayg:t3/index-position-startup-scan
kayg:fix/private-staging-759b-r2
kayg:backup/macos-vm/hk/hk1009/pr877
kayg:backup/macos-vm/hk/hk1009/pr878
kayg:docs/undo-block-ids-plan
kayg:fix/undo-768
kayg:backup/macos-vm/hk/hk1009/pr875
kayg:backup/macos-vm/hk/hk1009/pr904
kayg:proto/block-identity-v7d
kayg:backup/macos-vm/hk/hk1009/pr846
kayg:backup/macos-vm/hk/hk1009/pr860
kayg:backup/macos-vm/hk/hk1009/pr861
kayg:backup/macos-vm/hk/hk1009/pr849
kayg:backup/macos-vm/hk/hk1009/pr848
kayg:backup/macos-vm/hk/hk1009/pr853
kayg:backup/macos-vm/hk/hk1009/pr957
kayg:backup/macos-vm/hk/hk1009/pr893
kayg:backup/macos-vm/hk/hk1009/pr889
kayg:backup/macos-vm/hk/hk1009/pr902
kayg:docs/imap-notes-plan
kayg:docs/quota-plan-2
kayg:fix/parallel-test-flakes
kayg:docs/calendar-backend-v2-plan
kayg:feat/calendar-ical-converter
kayg:backup/macos-vm/hk/hk1009/pr808
kayg:docs/contacts-import-v2-plan
kayg:issue/610-pm-midnight
kayg:feat/calendar-v2-s1-containment
kayg:backup/macos-vm/hk/hk1009/pr854
kayg:backup/macos-vm/hk/hk1009/pr845
kayg:backup/macos-vm/hk/hk1009/pr917
kayg:docs/dav-recorder-v2-plan
kayg:plan/previews-865
kayg:plan/save-log-durable-entry
kayg:backup/macos-vm/hk/hk1009/pr934
kayg:fix/e2e-data-on-ram
kayg:backup/macos-vm/hk/hk1009/pr888
kayg:feat/appwindow3
kayg:feat/appwindow2
kayg:feat/appwindow
kayg:feat/money-p1
kayg:feat/keys-sheet
kayg:review/calendar-2-themes
kayg:feat/smooth-cursor
kayg:fix/float-style
kayg:review/calendar-2-float
kayg:release/2026-11-06-hotfix
kayg:archive/port/rows-drop-code
kayg:archive/port/rows-actions
kayg:archive/port/rows
kayg:scratch/tasks-894-ui-gates
kayg:review/calendar-2-night-wip
kayg:recovered/flaky/toast-reduced
kayg:release/2026-11-05
kayg:archive/flaky/rows-drop-fixed
kayg:archive/flaky/rows-actions
kayg:archive/flaky/rows
kayg:sim/bm15-final
kayg:sim/bm15-bis-932
kayg:sim/bm15-bis-909
kayg:sim/bm15
kayg:sim/bm15-bis-887
kayg:perf/tiering-option-b
kayg:fix/sw-lazy-precache
kayg:archive/plan/save-log-durable-entry
kayg:mock/money-fix2
kayg:archive/fix/e2e-data-on-ram
kayg:mock/appearance-all
kayg:mock/pill-press
kayg:mock/pill-press-mac
kayg:backup/macos-vm/appearance-after
kayg:mock/auto-swipes
kayg:mock/mail-actions
kayg:backup/macos-vm/mock/mail-actions
kayg:mock/money-static
kayg:archive/review/standards-917
kayg:perf/tiering-761-fix
kayg:mock/type-audit
kayg:mock/third-pane
kayg:feat/contacts-import-v2-s1
kayg:perf/executor-hot-path
kayg:archive/port/hidden-blocks
kayg:archive/port/devices
kayg:scratch/executor-on-894
kayg:scratch/executor-spans2
kayg:scratch/executor-spans
kayg:archive/port/rows-drop
kayg:feat/tiering-761-d-scale
kayg:feat/tiering-761-c-index
kayg:feat/tiering-761-b-reader
kayg:archive/review/sharing-pr3-review-9fec3d1f
kayg:perf/ports-lazy-budgets
kayg:feat/tiering-761-a-migration
kayg:archive/review/sharing-pr3-review
kayg:archive/review/sharing-pr3-review-code
kayg:archive/plan/previews-865
kayg:archive/port/port-attachments-3
kayg:archive/port/contacts-merge
kayg:fix/motion-audit-859
kayg:fix/motion-audit-859-mac
kayg:archive/port/port-pickers
kayg:archive/port/port-tables-2
kayg:archive/port/port-tables
kayg:recovered/local/sharing-s1-pr2-room-snapshot-candidate
kayg:archive/fix/parallel-test-flakes-code-minipc01
kayg:docs/imap-766-readonly-slice
kayg:feat/dav-recorder-v3
kayg:research/788-diagnosis
kayg:archive/fix/parallel-test-flakes
kayg:archive/perf/pr792-cold-index-edit
kayg:docs/sharing-slice-1
kayg:recovered/feat/dav-recorder-v2
kayg:recovered/feat/dav-recorder-v2-edd7bbb
kayg:spike/imap-766-s0-cases
kayg:archive/fix/undo-768
kayg:recovered/feat/dav-recorder
kayg:recovered/feat/dav-recorder-901acd4
kayg:feat/contacts-import
kayg:perf/cold-growth-on-764
kayg:perf/cold-growth-on-tiering
kayg:recovered/feat/tasks-set-status
kayg:feat/tasks-move-reorder
kayg:feat/tasks-delete-promote-duplicate
kayg:feat/carddav-writes
kayg:perf/quota-on-tiering
kayg:perf/quota-simple
kayg:perf/cold-growth-on-quota-stack
kayg:recovered/perf/cold-growth-on-tiering
kayg:feat/calendar-identity
kayg:feat/calendar-event-parser
kayg:feat/calendar-props-maps
kayg:port/glass-when-ring
kayg:recovered/feat/tiering-761-s1-wip-8132a84
kayg:recovered/feat/tiering-761-s1-wip-9da4094
kayg:recovered/feat/tiering-761-s1-wip-724512c
kayg:recovered/feat/tiering-761-s1-wip-66e667e
kayg:recovered/feat/tiering-761-s1
kayg:wip/6by32-01-tier-761-s1-pause-20261030
kayg:spike/imap-766-s0
kayg:wip/6by32-02-calternal-pause-20261030
kayg:wip/8by64-01-review-688-pause-20261030
kayg:wip/6by32-01-verify-744-pause-20261030
kayg:wip/6by32-01-verify-742-pause-20261030
kayg:fix/private-staging-759b
kayg:wip/6by32-01-review-748-pause-20261030
kayg:wip/6by32-01-review-733c-pause-20261030
kayg:wip/6by32-01-review-733b-pause-20261030
kayg:review/calendar-month
kayg:wip/local/bm15-trash
kayg:plan/759b-staging
kayg:review/767b-tests
kayg:review/preview-2026-10-29
kayg:docs/tiering-731-plan
kayg:wip/c6b02-review-733d
kayg:wip/c6b02-bm1-full-a
kayg:docs/deploy-plan
kayg:fix/storage-owner-liveness-642
kayg:fix/storage-fix-7
kayg:feat/tiering-731
kayg:wip/tiering-731-first-attempt
kayg:perf/idle-honest-2
kayg:fix/storage-private-tmp-642-dev
kayg:fix/storage-exact-file-quarantine-642
kayg:perf/one-flush-save
kayg:review/calendar-static
kayg:review/indexing-ring
kayg:review/when-field-2
kayg:proto/block-identity-2-review
kayg:proto/block-identity-review
kayg:review/when-field
kayg:issue/tasks-create-ids
kayg:issue/tasks-create
kayg:review/combined
kayg:review/task-polish
kayg:review/top-buttons
kayg:review/q1-q5
kayg:archive/integ325-293
kayg:archive/integ325-ci
kayg:issue/calendar-adr
kayg:archive/old/train/2026-10-23bk2
kayg:archive/old/train/2026-10-23bk
kayg:issue/469-mockup-9a
kayg:issue/smart-tasks-mockup
kayg:issue/469-menus
kayg:issue/652-signout-flake
kayg:issue/652-history-fix7
kayg:issue/652-history-fix6
kayg:archive/old/issue/spring-check-perf
kayg:issue/spring-check-perf
kayg:issue/659-rename-fast
kayg:archive/old/train/2026-10-21ar
kayg:issue/search-hardening-3
kayg:issue/652-history-fix5
kayg:issue/660-port-sheets-glass
kayg:issue/652-history-fix4
kayg:issue/652-history-fix3
kayg:issue/652-history-fix2
kayg:issue/652-history-flake
kayg:train/2026-10-21an
kayg:issue/settings-admin-port
kayg:issue/search-port
kayg:train/2026-10-20am
kayg:issue/storage-split-fix2
kayg:issue/storage-split
kayg:archive/old/issue/folder-ids-fix
kayg:train/2026-10-20al
kayg:archive/old/issue/folder-ids
kayg:train/2026-10-20ak
kayg:issue/tables-mockup
kayg:train/2026-10-19aj
kayg:train/2026-10-19ai
kayg:issue/469-merge-fixes
kayg:issue/sidebar-band
kayg:archive/old/issue/608-settings-spec
kayg:train/2026-10-19ah
kayg:issue/swipe-offscreen
kayg:train/2026-10-19ag
kayg:archive/old/issue/590-nlp-adr
kayg:archive/old/issue/587-event-after-write-2
kayg:train/2026-10-19af
kayg:archive/old/issue/587-event-after-write
kayg:issue/469-pill-room-c
kayg:issue/469-pill-room
kayg:train/2026-10-19ae
kayg:issue/469-narrow-handle
kayg:issue/397-ios-swipe-2
kayg:issue/469-desk-fixes
kayg:archive/old/issue/auto-update-adr
kayg:issue/469-filter-gap
kayg:issue/469-port-1b
kayg:issue/442-opacity-flake
kayg:issue/327-web-fast-3
kayg:archive/old/issue/469-port-1
kayg:issue/469-port-1
kayg:issue/327-web-fast-2
kayg:archive/old/issue/327-web-fast
kayg:archive/old/issue/425-stt-bench-vq1
kayg:archive/old/issue/445-no-bleed
kayg:archive/old/issue/400-swipe-mockup-2
kayg:issue/426-client-review
kayg:issue/426-client-2
kayg:issue/426-client
kayg:archive/old/issue/476-safe-area-lab
kayg:archive/old/issue/445-top-light
kayg:issue/471-blocks-mockup
kayg:archive/old/issue/448-links-app-2
kayg:archive/old/issue/448-links-app
kayg:archive/old/issue/398-cold-links
kayg:issue/434-442-small-2
kayg:issue/434-442-small
kayg:archive/old/issue/398-unload
kayg:archive/old/issue/445-bottom-band
kayg:issue/445-bottom-band
kayg:issue/351-rem-3
kayg:issue/351-rem-2
kayg:issue/351-rem
kayg:archive/old/issue/327-first-note
kayg:issue/395-width-phone
kayg:archive/old/issue/327-typing
kayg:issue/396-ios-edges
kayg:issue/397-ios-swipe
kayg:archive/old/issue/327-notes-index
kayg:issue/345-347-contrast-empty-2
kayg:archive/old/issue/44-arenas
kayg:issue/44-arenas
kayg:archive/integ325
kayg:archive/old/issue/327-perf-harness
kayg:archive/old/issue/44-thp
kayg:issue/44-thp
kayg:archive/old/issue/285-sticky-pills
kayg:archive/old/issue/44-trim-3
kayg:issue/44-trim-3
kayg:archive/old/issue/165-cards
kayg:archive/old/issue/165-picker-2
kayg:archive/old/issue/212-multi-select
No reviewers
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!1011
Loading…
Reference in a new issue
No description provided.
Delete branch "t3/paged-search-reconcile-final"
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?
Rethink after the 2026-11-07 follow-up review
The review found that the legacy-cursor path scanned pages to find the final page, then checked only that page. A pre-fence cursor can already cover a stale
notes.savedentry several pages earlier, so this tail check cannot prove the whole cursor safe. The generation fence for new receipts remains unchanged; legacy cursor recovery is revised below.The implementation review found that ordinary room saves publish notes.saved through a separate path from Home executor actions. Both paths now attach the accepted per-note History version to the event and publish the same version with the accepted source. Room saves reuse the already durable Room.version; the version rides on the existing live_meta generation commit, with no added file read, wait, or fsync. The ordinary_room_save_receipt_matches_published_source_version regression proves that the receipt and provider agree.
Revised restart path
Engine::position; the indexer re-reads its last journal page and checks each known source generation before trusting the cursor.legacy_stale_receipt_before_final_page_forces_paged_reindexThis one-time legacy path can take as long as today's full reconcile because its old checkpoint carries no proof of which earlier pages were verified. The performance table will separate this compatibility repair from current-cursor startup and report both against the same-epoch control.
Design after the 2026-11-07 generation-fence ruling
P1b stays a shared, backend-only search change. Notes remains the current provider; Mail can use the same cursor and page API later. Notes search, save behavior, result order, and UI stay unchanged. The indexer owns the fence: it will not index a source older than a
notes.savedreceipt or checkpoint past that receipt.Fence and restart rules
History::install_executoralready returns the accepted per-note version. Append that value assource_versionto each newnotes.savedevent (at most 37 serialized bytes including its comma). Publish the same version with the accepted Notes source and expose it to search. Existing events without the field areunknown: read the item again from a fresh pinned Notes generation, compare its source stamp, and validate the snapshot before checkpointing.When a journal page touches an item, compare every saved version in that page with the published source version. If the source is behind, drop the private page stage, keep the previous cursor, and park the entry. Subscribe to the existing
MetaDb.populatedwatch before pinning the provider snapshot; its publication notification retries the same page without a polling loop. If the watch produces no notification, allow five bounded exponential-backoff rereads (10, 20, 40, 80, 160 ms), then wait on the watch. A still-pending entry never advances the cursor.Every commit covers a contiguous run of verified entries, with documents, use scores, and the page token in one SQLite transaction. On startup, validate a current cursor and re-read the final journal page before trusting it. Store that page's starting token beside each new cursor. A legacy cursor without that metadata cannot identify which earlier receipts may have raced, so treat it as wholly untrusted and run a full paged provider reconcile. Publish the verified documents, use scores and current cursor together; a crash leaves the legacy cursor untrusted and the reconcile repeats.
A missing or expired cursor does a full paged reconcile. Before publishing its head token, scan the retained journal through that head and stage the latest per-item fence in SQLite's temporary file. Compare each provider page against those fences; a pending source drops the whole private reconcile. A restored or truncated log is detected only through the engine contract: P1b uses
Engine::positionandEngine::journal; #928 remains the only owner of signed token proof and high-water restore detection. P1b does not read the high-water file or add/parse token formats. If #928 lands first, rebase and keep this API boundary.Sizes and cost
O(K log K + R + D); memoryO(256 + R + 64)O(256 + D)time and memoryO(K + N log M + M)time, bounded memorytemp_store=FILE, 2,000 KiB writer cacheO(K + N log M + M)forKjournal entries,Nprovider rows,Mindexed rows; RAM independent of Home size; temp diskO(S)for changed rows and per-item fencesNo page uses
OFFSETor retains a Home-sized vector. The version is returned by the existing history install; Notes does no extra work on the notes-save path beyond encoding the appended field.Failure table
notes.savedis visible before source publicationkill_restart_at_every_provider_page_boundary_convergeslegacy_stale_receipt_before_final_page_forces_paged_reindexEngine::positionreturnsSyncTokenExpiredpositionresult plus page sequence checksahead_cursor_reindexes_from_current_head,valid_behind_cursor_uses_pages_without_listingposition/page read expires, or cursor is absenttruncated_log_reindexes_from_pages,missing_index_rebuilds_in_pagesTests
Ordinary room save: edit and save a real Note, then prove the receipt version matches the published Notes source version.
Real Notes race: pause
EventRecorder::record_onceafter the durable receipt and before it returns toBatchPublished; run incremental catch-up and missing-index reconcile; prove neither indexes the old text nor passes the cursor; release publication, restart the indexer, and prove the new text is indexed.Crash before publication: stop after the receipt, reopen Notes so executor recovery replays it, and prove the cursor never skips the entry.
Reopen after every journal/provider page boundary and compare the final index to a clean build. A legacy cursor without page-start metadata must also repair a stale receipt more than 256 entries before the cursor.
Property test over save versions, delayed/reordered publication notifications, duplicate touches, arbitrary page cuts, and restarts; assert one indexed row per item, latest text, and a cursor no later than the contiguous verified prefix.
Restored-older-backup cursor, cursor ahead/behind, truncated log, missing index, and 1M-entry paged reconcile with a 256-row maximum and bounded memory.
Gates
CARGO_BUILD_JOBS=4 CARGO_INCREMENTAL=0 ~/bin/slot /nix/var/nix/profiles/default/bin/nix develop -c bash -c 'cd /home/claude/Developer/Worktrees/mail-p1b-test-e0fc && cargo fmt --check'CARGO_BUILD_JOBS=4 CARGO_INCREMENTAL=0 ~/bin/slot /nix/var/nix/profiles/default/bin/nix develop -c bash -c 'cd /home/claude/Developer/Worktrees/mail-p1b-test-e0fc && cargo clippy --workspace --all-targets -- -D warnings'CARGO_BUILD_JOBS=4 CARGO_INCREMENTAL=0 ~/bin/slot /nix/var/nix/profiles/default/bin/nix develop -c bash -c 'cd /home/claude/Developer/Worktrees/mail-p1b-test-e0fc && cargo test --workspace --no-fail-fast'cargo test -p calternal --test notes_crash_typing kill_nine_while_people_type_loses_and_doubles_nothing -- --exact~/bin/slot /nix/var/nix/profiles/default/bin/nix develop -c bash -c 'cd /home/claude/Developer/Worktrees/mail-p1b-test-e0fc/apps/web && CALTERNAL_BIN=/home/claude/Developer/Worktrees/mail-p1b-test-e0fc/target/debug/calternal bunx playwright test e2e/search-palette.spec.ts e2e/search-corpus.spec.ts e2e/editor.spec.ts e2e/list-catch-up.spec.ts --project=chromium-1440 --project=chromium-390 --workers=1'~/bin/slot /nix/var/nix/profiles/default/bin/nix develop -c bash -c 'cd /home/cua/Developer/Worktrees/mail-p1b-webkit-b822165c6/apps/web && CALTERNAL_BIN=/home/cua/Developer/Worktrees/mail-p1b-webkit-b822165c6/target/debug/calternal bunx playwright test e2e/search-palette.spec.ts e2e/search-corpus.spec.ts e2e/editor.spec.ts e2e/list-catch-up.spec.ts --project=webkit-1440 --project=webkit-390 --workers=1'~/bin/perf-lockon perf-01 then perf-02 for the complete same-epoch session. Run dev-vs-dev control and candidate/dev ABAB ×5; each sample runscalternal-perf --bin "$SERVER_BIN" --work "$WORK" --data-dir "$DATA" --state-dir "$STATE" --budgets perf/budgets.json --sizes 100k,1000000 --runs 1 --cold-runs 1 --idle-secs 0 --json "$OUT/run.json" --md "$OUT/run.md"andstorage-bench save --dir "$SAVE_DIR" --saves 200.Any regression beyond the control spread blocks qualification. Post commands, rates, all metric deltas, and the same-epoch control in PR comments. Never merge.
Design note: the indexer never waits forever on a receipt fence (liveness fix, 2026-11-09)
Problem. Search holds a save receipt back until the provider has published the version the receipt names (the "fence"). If that version is never published,
PublicationWait::retrywaits on the publication signal with no limit, and the full rebuild enforces the same fences, so it waits too. Search then reportsindexing: truefor ever. Seen on compute02 and perf-01 with the gap stage (idle server,DIAG waiting for publication signal)."Receipt ahead of provider". A receipt for item X names source version N (
SourceFence::Known(N)), but the provider's published document for X has version M < N (or none), and no further publication arrives. Real ways to get there: a Home restored from an older backup, or note history rebuilt, while the save-log keeps its receipts.The cap.
Options::publication_cap, default 30 s, counted as time stuck on one page: it starts at the first reread for that page, restarts when the page is staged, and is not extended by publication signals for other items (so steady typing elsewhere cannot keep it alive). Tests set it to milliseconds.After the cap (both places). One relaxed attempt for that page or rebuild, using the same pinned provider snapshot:
catch_up_to,recheck_cursor_tail,apply_live_batch): the page is staged without itsKnownfences;reconcile_pages): the attempt ignorescomparison.pending, passes no fences to the refresh, and skipshas_unseen_known_fence.The receipt is superseded: the provider's current document is indexed, the cursor advances,
indexinggoes false. OneWARNper pass names the provider and the time waited, and the process-wide countercalternal_search::fences_superseded()goes up by one per relaxed page or rebuild. Relaxing lasts for that page or attempt only; the next page is strict again.Why this does not publish stale search results.
Tests. (1) A receipt ahead of any publication:
sync_to_headfinishes, the doc is the provider's current one, andfences_superseded()rose, within cap + slack, for both the catch-up path and the rebuild path. (2) A publication that arrives inside the cap is honoured: the indexed doc has the receipt's version and the counter did not rise. Plus the in-repo gap stage in the perf runner and its ssh retry.Update (same day, after coding). Two details that were not in the note above:
--gap-saves Nincrates/perf(with--search-onlyfor the smoke set plus search). It makes a real gap through the real server: build the index (search.cold_reconcile), keep a copy, save N edits so every receipt is valid, then put the older index back. The earlier out-of-tree stage could not be recovered; this is a new, reproducible one.Crash-typing flake comparison
The first branch-native run reported candidate 18/20 and dev 2/20, but those runs used different test sources: the candidate test retries the documented retryable
not_saved_yetresponse, while dev's older test expects an immediate 200. I reran the test interleaved with the exact candidate test source on both revisions (SHA-256f9947402f29e4bacafbc5dc803c4236228411cd923bf63a80e2e65969b7d2555).0efea4a1cd7f8443b never convergedEach arm ran the exact command
CARGO_BUILD_JOBS=4 cargo test -p calternal --test notes_crash_typing kill_nine_while_people_type_loses_and_doubles_nothing -- --exact, alternating candidate then dev for 20 rounds. The dev-only failure is retained in the log; the candidate had no failures.macOS gate rerun on 2026-11-08
#995 is closed and marked superseded by #1011. The open #1011 head
5a83ac274504b0b5fdb9e657cafa6a82e2a6544fhasorigin/devmerge-base93d9a321a39044afddfe9075db2e1c1f729e3b78, so it already includes #1013.The first Mac run exposed a test-fixture path collision:
Notes::newcolocates data and state, and case-insensitive APFS aliases<user>/Noteswith<user>/notes. The write executor then correctly refused a journal inside Notes. Commitsf73e93209and5a83ac274change the P1b test fixtures to use separate data and state roots throughNotes::with_state; Notes runtime behavior is unchanged.Each Cargo gate below ran as its own Nix/slot step on
/Users/lume/Developer/Worktrees/mail-p1b-mac-1011-eb1a4294, with a 40-minute per-step timeout. The helper acquired/tmp/mac-bench.lock, wrote its holder, and removed it in its EXIT trap before the next step. Other Mac lanes used the lock between our steps.timeout --kill-after=30s 40m cargo fmt --checktimeout --kill-after=30s 40m cargo clippy --workspace --all-targets -- -D warningstimeout --kill-after=30s 40m cargo test -p calternal-search --libtimeout --kill-after=30s 40m cargo test --workspace --no-fail-fastThe full suite's first Mac attempt also had one
kill_nine_while_people_type_loses_and_doubles_nothingfailure (b never converged). It passed on the final full-suite rerun. The requested interleaved dev-02 repetitions passed: candidate 20/20, dev 20/20, usingcargo test -p calternal --test notes_crash_typing kill_nine_while_people_type_loses_and_doubles_nothing -- --exact.P1b perf remains pending; these results make no performance claim.
P1b perf ABAB status, 2026-11-09 ~10:45 CET (no numbers yet)
Head under test:
02baeb54212095d956d1fcce49594d6c36d36ea2. Staged binaries verified withsha256sum -c.data/statedirs (exact paths).block-1-a1-devfinished.block-1-a2-candidatethen stalled at "100000 notes, warm run 1" from 06:49. Harness and server were both idle, no sockets, every thread in futex/epoll wait. I stopped my own unit. Cause not found: the same stage passed on both dev arms.notes.list500 on dev too, at the same step as before. The 100k cold index writes 4.5 GB, so 1M needs about 45 GB, and the shared perf disk has 16-25 GB free. Unconfirmed as ENOSPC.Changes to the rig: 100k only (no 1M), 25-minute per-arm timeout with one retry.
Not done: the ABAB x5 and the dev-vs-dev control. Another lane held perf-01 for over 3 hours after 09:11, and I did not get a turn. I cancelled my queued unit and hold no lock.
The candidate stall is unresolved. If it recurs under the new timeout, treat it as a PR bug: capture its stack and fix it before merge.
P1b perf turn 2, 2026-11-09 (FIFO): candidate warm-run stall reproduced, no ABAB numbers
PR head (API
head.sha):02baeb54212095d956d1fcce49594d6c36d36ea2.refs/pull/1011/headstill shows000873f49…, which is the stale-ref gotcha; the brancht3/paged-search-reconcile-finalis at02baeb542.block-1-a1-devblock-1-a2-candidate100000 notes, warm run 1from 11:39:35 CET, same as the 06:49 stall in the first session.GET /healthzreturned 200 on its real port. Server idle:search-writerparked on an emptystd::sync::mpmc::Channel<calternal_search::index::Job>, all tokio workers in futex wait. Harness: main thread parked intokio::runtime::park::Inner::parkundercalternal_perf::main, all workers parked, one worker inepoll_wait, no TCP connection open, no timer armed.gdb -p <pid> thread apply all btof both processes, kept on perf-01 underresults-turn-patched-harness/block-1-a2-candidate/stall-gdb-*.txt.Reading: the harness is waiting on something that never arrives, while the server has finished its work. Dev arms pass the same stage on the same harness build. The staged harness (
harness/*/calternal-perf, sha21c0679b…candidate,e02f9fc2…dev) contains an "offline saves for a warm search catch-up gap" edit that is not in02baeb542, and its source is in no worktree I can find. So I cannot yet say whether the stall is in the candidate server or in that edit.Next test, queued but not run: the clean harnesses built from each tree (
bin/*/calternal-perf,c6149a26…candidate,fa53d86f…dev). If the stall disappears, it is the edit. If it stays, it is a PR bug and needs a fix on compute02 before merge.Not run: the ABAB x5 and any per-metric verdict.
Process notes:
~/bin/perf-turnwas edited while my waiting copy ran, so bash hitsyntax error near unexpected token doneat 13:56 CET and my ticket (2 h into the wait) was dropped. A ticket named0000000000-782670-sharing-842b(timestamp 0) was at the head of the line for about an hour. I now hold no ticket and no lock.P1b: stall root-caused off-lock (compute02, no perf lock), Mac gates re-run at
02baeb542PR head (API):
02baeb54212095d956d1fcce49594d6c36d36ea2. No perf numbers yet; I did not take the perf turn because the stall is a design question (below).Mac gates at
02baeb542(macos-01, one lock hold per step, each released)cargo fmt --checkcargo clippy --workspace --all-targets -- -D warningscargo test -p calternal-search --libcargo test --workspace --no-fail-fastStall repro, compute02 (12 cores), 100k warm, 20 min cap, no perf lock
e02f9fc2…, has the save-log gap stage)21c0679b…, gap stage)notes.list incomplete: true, host load ~35 (rc=124 at the cap)The clean harness has no gap stage, so
search.catch_upis about 0 s andsearch.cold_reconcileis absent. It does not measure what #1011 changes. The edited harnesses' gap source is in no repo or worktree I could find.Root cause (candidate server)
At the stall the server answers
/healthz200 andnotes.listreturnsincomplete: false, butsearch.queryreturnsindexing: trueindefinitely, with every thread idle. A diagnostic build (extrawarn!only) loggedDIAG waiting for publication signal provider="notes"and never logged that it arrived. The indexer is parked inPublicationWait::retry(crates/search/src/indexer/sync.rs): after its 5 backoff rereads it waits onreceiver.changed().awaitwith no cap, for a receipt whosesource_versionis ahead of what the notes provider publishes. Nothing publishes again, because the notes scan is already finished.What I tried and why I stopped
I capped that wait at 30 s and returned
SyncTokenExpiredso the caller rebuilds. The stall changed shape but did not go away: the rebuild (reconcile_pages) enforces the same receipt fences, so it waits and times out too, and the log repeatssearch receipt was never published; rebuilding/search could not synchronize its index. Diff kept on compute02 at~/perf/mail-1011-repro/bounded-wait-experiment.diff, not pushed.So the fence design has no escape when a receipt's version is never published. Decision needed from the owner, not a quick patch:
Cleanup: no ticket, no lock, no unit left on perf-01, perf-02 or compute02. Repro files kept at
~/perf/mail-1011-reproon compute02 (data 1.5 GB).P1b perf ABAB x5 with the save-log gap stage, 100k, perf-01/perf-02 (2026-11-09 18:52-19:30 CET)
PR head
dcb50cda8df62e2cad6d3fdd9218f7b3538f6352(candidate server built from it; harness--gap-saves 600 --search-only). Dev =93d9a321build. Run through plain FIFOperf-turn(front-of-line grant), both perf locks held for the whole run, released after.Order per block: dev, candidate, dev, candidate; 5 blocks, 20 arms, every arm passed (no stall, no failure). The control is dev vs dev: "spread" is the median relative gap between the two dev arms of a block.
arms: 20 failures: []
| metric | stat | dev median | cand median | delta | dev-vs-dev spread (median |a1-a3|) | cand/dev blocks worse | verdict |
|---|---|---:|---:|---:|---:|---:|---|
| search.catch_up | p50 | 2.01 | 2.01 | -0.3% | 0.4% | 1/5 | better |
| search.cold_reconcile | p50 | 47.9 | 49.2 | +2.8% | 2.3% | 4/5 | SLOWER beyond noise |
| search.query | p50 | 1.61 | 3.2 | +98.1% | 8.1% | 5/5 | SLOWER beyond noise |
| search.query | p95 | 3.94 | 7.46 | +89.6% | 8.2% | 5/5 | SLOWER beyond noise |
| search.first_query | p50 | 3.44e+03 | 2.09e+03 | -39.1% | 18.7% | 0/5 | better |
| startup.healthz | p50 | 5.15 | 5.28 | +2.5% | 31.3% | 2/5 | flat/better |
| open.api_get | p50 | 2.49 | 2.94 | +18.1% | 6.4% | 4/5 | SLOWER beyond noise |
| open.api_get | p95 | 21.9 | 20.5 | -6.5% | 10.9% | 1/5 | better |
| open.note | p50 | 2.53 | 3.27 | +29.2% | 6.1% | 5/5 | SLOWER beyond noise |
| open.note | p95 | 9.61 | 98.7 | +927.0% | 23.6% | 5/5 | SLOWER beyond noise |
This is not mergeable as it stands.
search.queryis consistently about 2x slower on the candidate in all 5 blocks (dev 1.5-1.7 ms, candidate 3.0-3.7 ms at p50; p95 3.9 vs 7.4 ms), far outside the dev-vs-dev spread.open.notep50 is a little higher (about +0.5 ms) and its p95 is outlier-driven (one ~100 ms open in 7 of 10 candidate arms against 1 of 10 dev arms).search.cold_reconcileis +2.8% against a 2.3% spread (borderline).search.first_queryis better andsearch.catch_upis flat.Caveats on this table:
search.catch_upreads 2.01 s in both arms because the harness polled "still indexing?" every 2 s, so any catch-up under 2 s is invisible. The poll is now 50 ms inae2383a7d(harness only); a second turn with the fine harness is needed for a real catch-up number.Investigating the
search.queryslowdown next (index shape after the paged rebuild is the first suspect; no read-path code changed in the PR).P1b: liveness fix done; perf regression on
search.queryfound, plan below (stopping, not patching)PR head
dcb50cda8df62e2cad6d3fdd9218f7b3538f6352(the liveness fix and the gap stage are pushed to it;ae2383a7don the side brancht3/mail-1011-livenessadds a 50 ms catch-up poll to the harness and is not on the PR yet).Done
crates/search/src/indexer/publication.rs,sync.rs): the wait is capped (Options::publication_cap, 30 s) and the page or rebuild is then staged without its fences. Counterfences_superseded(), one warn per pass.fence_liveness.rs(receipt ahead of provider finishes on the catch-up path and on the rebuild path; late publication inside the cap is honoured on both). Search lib: 44 passed.--gap-saves N,--search-only. Candidate with gap stage: 3/3 warm runs pass on compute02 (the stall was 2/2 before).dcb50cda8(macos-01): fmt, clippy pass; search lib 44 passed; workspace 1,614 passed, 0 failed, 22 ignored. The first Mac run atb4cb96a7ehad onekill_nine_while_people_type_loses_and_doubles_nothingfailure; ten reruns atdcb50cda8gave 8 pass, 2 FAIL (13.6 s, the same failure shape). It is the known flaky test (see the 11-08 comment: dev also failed 1 of 20 on Linux), but I have not shown it is unrelated on macOS, so I am not calling it clean.Not mergeable:
search.queryabout 2x slower (5 of 5 blocks)p50 dev 1.5-1.7 ms vs candidate 3.0-3.7 ms; p95 3.9 vs 7.4 ms. Also
open.notep50 +0.5 ms (p95 outliers of ~100 ms in 7 of 10 candidate arms),search.cold_reconcile+2.8% (spread 2.3%). Better:search.first_query(-39%); flat:search.catch_up(but the poll was too coarse to see it).What I narrowed down (compute02, loaded, so ratios only)
Search::queryandindex.searchare the same code).search.queryp50 5.1 / 3.6 ms vs dev 7.5 / 8.2 ms). So the slowdown comes from the save-log catch-up path leaving the index in a state that queries more slowly, not from the cold build or the query code.Plan (needs a decision: this is round 2 of "new problem found", so no blind patch)
ae2383a7d), gap on, and readPRAGMA wal_checkpointand WAL size at query time for both arms (one front-of-line turn, 30 min).wal_autocheckpoint = 0): checkpoint (passive) once after catch-up finishes, in the indexer, with a test that WAL size is bounded after a catch-up of N pages.ftssegment structure andANALYZE/stat tables between arms, then thegeneration/vocab cache invalidation counts (candidate bumpsgenerationonce per page).search.queryas the gate. Nothing merges untilsearch.query,open.noteandcold_reconcileare flat against dev.Cleanup done: compute02 repro data and targets deleted (59 MB of scripts left), perf-01 run data deleted, no ticket, lock or unit held on either perf VM.
P1b round 2:
search.queryregression explained (harness artifact); ABAB x5 re-run; two gates still openPR head
3d5999c7a775725b842ae85fbec24d08f139d78f(candidate server = the PR's search code; the commits sincedcb50cda8are harness-only: 50 ms catch-up poll, populated-baseline gap stage).Why
search.querylooked 2x slowerfrecencyrows, the candidate-built one 593. The candidate's catch-up replays the save "uses" (correct); dev's legacy-cursor path deliberately skips them.read.rs::frecent()returns at once whenfrecencyis empty; otherwise it reads the 64 most recent used notes for every query. A fixed cost that saturates at 64 rows, which every Home in use pays on dev too.3d5999c7a): the gap stage opens 100 notes before the gap so both arms start with a used-notes table (checked: dev arm 100 rows, candidate 593).ABAB x5, 100k, gap stage, populated baseline (perf-01/02, 2026-11-10 06:36-~07:30 CET), 20 arms, 0 failures
arms: 20 failures: []
| metric | stat | dev median | cand median | delta | dev-vs-dev spread (median |a1-a3|) | cand/dev blocks worse | verdict |
|---|---|---:|---:|---:|---:|---:|---|
| search.catch_up | p50 | 1.27 | 0.85 | -33.0% | 3.0% | 0/5 | better |
| search.cold_reconcile | p50 | 45.6 | 47.3 | +3.5% | 1.2% | 5/5 | SLOWER beyond noise |
| search.query | p50 | 3.34 | 3.23 | -3.4% | 7.3% | 2/5 | better |
| search.query | p95 | 7.39 | 7.48 | +1.2% | 8.4% | 3/5 | flat/better |
| search.first_query | p50 | 5.62 | 7.43 | +32.2% | 11.0% | 5/5 | SLOWER beyond noise |
| startup.healthz | p50 | 5.55 | 5.05 | -9.1% | 47.2% | 0/5 | better |
| open.api_get | p50 | 0.851 | 0.819 | -3.8% | 6.8% | 3/5 | better |
| open.api_get | p95 | 3.89 | 4.61 | +18.5% | 238.4% | 4/5 | flat/better |
| open.note | p50 | 0.947 | 0.851 | -10.1% | 16.3% | 2/5 | better |
| open.note | p95 | 36.7 | 4.86 | -86.8% | 16.1% | 0/5 | better |
Gate "search.query, open.note, cold_reconcile all <= dev"
search.queryp50 3.34 -> 3.23 ms, p95 7.39 -> 7.48 ms: flat (inside the 7-8% spread). Pass.open.notep50 -10%, p95 36.7 -> 4.9 ms: pass (dev p95 had a ~90 ms outlier in 3 of 10 arms).search.catch_up1.27 -> 0.85 s (-33%, 0/5 blocks worse): better.search.cold_reconcile45.6 -> 47.3 s (+3.5%, 5 of 5 blocks worse, spread 1.2%): FAIL, a steady ~+2 s. Likely the receipt-fence scan the rebuild now does before listing providers (stage_source_fences, then fence joins incompare_page); not yet profiled.search.first_queryp50 5.6 -> 7.4 ms (+32%, 5 of 5 blocks): mostly 4 of 10 candidate arms at 9.9-17.7 ms; the other arms are 5-7 ms like dev. Small in absolute terms but not flat: FAIL by the no-regression rule until explained.macOS flake
kill_nine_while_people_type_loses_and_doubles_nothing(macos-01, same command, 20 runs each)9438918f3: 20/20 pass.... never converged, the rejoined-tab text check atnotes_crash_typing.rs:413). Earlier PR runs: 1 of 1 and 2 of 10 failed. Pooled that is 5 failures in ~31 PR runs vs 0 in 20 on dev.room/save.rs,room/mod.rslistednow keyed by version,meta.rs live_metagetssource_version). Not diagnosed.State
Liveness fix, tests and gap stage are pushed. Not mergeable:
cold_reconcileandfirst_queryregress, and the Mac flake looks PR-specific. Two follow-ups for a decision (the 3-round rule applies, so I am stopping here):cold_reconcile+2 s), then either speed it up or accept it as the cost of fenced receipts, with kayg's call since the rule is "no regression".Also worth its own issue:
search.querypays a fixedfrecent()cost for any Home with 64+ used notes, on dev too.Cleanup: perf-01/perf-02 locks and units released, compute02 and perf-01 run data removed.
P1b handoff to Codex (Claude usage limit), PR head
015546c00f9e3896a2088c89bc937ab5b36b5dcbPushed: everything is on the PR branch. Last commits:
015546c00(crash-test fix),2949f1e26(first_query breakdown metrics),3d5999c7a(gap stage opens 100 notes),ae2383a7d(50 ms catch-up poll). No perf lock, ticket or Mac lock held; my compute02 units are stopped.1. macOS flake
kill_nine_while_people_type…: found and fixed (test-only)Mac runs, 20 each (re-run once at 11:13-11:16Z with no window announced in infraternal#260):
93d9a321a93d9a321a015546c00)notes.savebefore the firstnotes.get(as the original test did). The exact mechanism is likely the read racing the room's post-restart replay, not proven; the comment in the test says only what is established.2.
search.cold_reconcile+2 s (45.6 -> 47.3 s, 5/5 blocks): NOT fixed, profile not finishedstage_source_fences(crates/search/src/indexer/sync.rs) scans the whole retained save-log (~200k entries at 100k notes) before listing; dev does no such scan.warn!linesPROF fence_scan,fence_scan_detailwith journal-read vsrecord_fencesms,list_and_compare,attempt_total) from3d5999c7aon compute02 (diff is uncommitted in~/Developer/Worktrees/mail-1011-fix; it is 24 lines insync.rs). Its first run was just launched and stopped, so there are no numbers yet.item.clone()for entries with no fence (created entries), batchrecord_fences, or pipeline the scan with provider listing. A scan avoided only for a brand-new empty index would change semantics, so no.3.
search.first_queryoutliers: not explained yetCandidate arms 4/10 at 9.9-17.7 ms vs 5-7 ms otherwise (dev 4.6-6.5). Queries use a pooled reader, so the first one opens a fresh connection (cold SQLite cache).
2949f1e26addssearch.first_query_sql(servertook_ms),search.second_queryandsearch.third_queryto the harness, so the next ABAB separates SQL time from open/queue time. I did not test the cold-page-cache idea itself.4.
frecent()fixed cost: issue #1053Evidence and the proposed top-64 in-memory cache are there. It explains the earlier 2x
search.query(emptyfrecencytable in the dev arm); harness fixed,search.queryis now flat.Next ABAB
Use plain
perf-turn; the harness needscalternal-perf-finerebuilt at2949f1e26. Perf-02 handshake note: ssh from perf-01 to perf-02 fails inside systemd units, and my poller must not delete the runner's ownreadyfile (it did, once).P1b follow-up evidence at head
d83711c292701d3190e8c748c69827b21ab89a0eVerdict: BLOCKED. The fixed macOS crash test is clean, but
search.cold_reconcileremains slower than dev beyond the dev/dev control spread. I did not patch the PR because the remaining optimization needs a design decision about atomic full-reconcile staging.Cold-reconcile profile and design note
I ran the existing
calternal-perfharness on compute02 through~/bin/slotwith--sizes 100k --runs 1 --cold-runs 1 --gap-saves 600 --search-only --idle-secs 0. Two diagnostic runs took 114 s and 123 s; these compute02 timings are not perf-VM comparisons.The timing-only build measured 391 provider pages. In the second run, the attempt took 82.130 s and final publish took 40.583 s (123 s total). The page breakdown was 1.365 s listing, 1.660 s comparing, and 78.578 s in document refresh/staging. Fence select took 46 ms; changed-item select took 86 ms. There was no pending-fence retry. The earlier fence-scan split measured 279 ms in journal reads, zero recorded fences, and 320 ms for the complete scan. The full save-log scan is not the source of the regression.
Design note for the orchestrator: the candidate's rebuild stages refreshed documents in a temporary SQLite table and then reads/deserializes them for one atomic publish. The evidence puts most candidate rebuild time in that stage/publish path. Removing that overhead while retaining pinned-source fence validation, bounded memory, old-index visibility until commit, and atomic document-plus-cursor publication needs a staging/publication design review. I stopped without a speculative code change; please choose the next design.
Perf ABAB x5, 100k
Five dev/candidate/dev/candidate blocks ran through the FIFO turn. All 20 arms passed. The dev-vs-dev column is the median relative gap between dev arms in a block.
search.catch_upsearch.cold_reconcilesearch.querysearch.querysearch.first_querysearch.first_query_serverstartup.healthzopen.api_getopen.api_getopen.noteopen.noteFirst-query outliers
Across ten candidate arms, first-query client time was 7.117 ms: 4.810 ms SQL, 1.483 ms server non-reader time, and 0.676 ms client non-server time. Second- and third-query SQL medians were 3.137 ms and 2.736 ms, with about 0.05 ms server remainder. Dev has no SQL timer; its first-query maxima were 11.188 ms server and 11.953 ms client, versus candidate maxima of 8.551 ms and 9.187 ms. The data points to first-reader/open/queue variation rather than SQL; it does not prove a PR-specific tail. The ABAB median is still +35.2%, so it remains unresolved under the no-regression rule.
macOS and other state
kill_nine_while_people_type_loses_and_doubles_nothingincrates/calternal/tests/notes_crash_typing.rspassed 20/20 twice on this head. The fix is test-only. Thefrecent()cost is tracked separately in #1053. The perf-02 hold was ours; PID 176135 was stopped and a follow-up check found both 176130 and 176135 absent.Approved cold-reconcile implementation plan (2026-11-11)
I will keep two fixed search-table generations behind a small
meta.active_generationmanifest. Reconcile lists and compares each provider page against the active generation, using the provider stamp as its content identity. Notes stamps areaccepted-v1BLAKE3 hashes. Unchanged documents are not fetched or staged. On the first changed or removed document, the writer copies the active indexed structures to the inactive set once, then applies changed documents and removals in bounded batches as each provider page is staged. An empty first-build index starts with an empty inactive set.The FTS tables stay separate per generation so the hidden build cannot change BM25 corpus statistics or query results. Searches read the manifest inside their existing SQLite read transaction and stay on one generation. Receipt fences, pinned provider snapshot validation, and journal-head validation remain required before publication. The final transaction updates only the active-generation pointer and the cursor/page-start metadata; an interrupted build leaves the old manifest and cursor intact, and retry resets the inactive set.
Bounds and cost
O(256 + 64 + 512)independent of Home size. The inactive search generation usesO(M)disk forMindexed rows. Existing indexes need one full SQLite-side copy on the first changed page; cold empty indexes skip that copy. Refresh work is proportional to changed content, not all listed documents. The listing/fence path remainsO(K + N log M + M).Engine::positionbefore publicationThe qualification remains ABAB ×5 against dev with dev-vs-dev control bounds, plus the macOS crash test ×20. Every reported metric must be no worse than its control bound.
P1b qualification status at
c5ad7946ee9b52bc3dd3bde50fe9638ad84e2fc1— BLOCKEDThe approved two-generation incremental reconcile redesign is pushed on this PR branch. The following table is the last valid ABAB ×5 evidence before that redesign, from
d83711c292701d3190e8c748c69827b21ab89a0e; it is not a qualification result for the current head. No post-redesign ABAB or Mac ×20 result was collected.search.catch_upsearch.cold_reconcilesearch.querysearch.querysearch.first_querysearch.first_query_serverstartup.healthzopen.api_getopen.api_getopen.noteopen.noteKnown cause and outstanding query attribution
The cold-reconcile profile found 78.578 s in staged document refresh and 40.583 s in the final publish transaction (82.130 s attempt time before publish). The full receipt-fence scan was 320 ms, so it was not the source of the cold-reconcile regression. The approved redesign addresses the measured staging/publish path by skipping unchanged content hashes, applying changed pages into an inactive generation, and switching only the small manifest with the cursor.
The candidate first-query breakdown was 4.810 ms SQL, 1.483 ms server time outside SQL, and 0.676 ms client time outside the server. Second/third-query SQL medians were 3.137/2.736 ms. That points toward open/queue variation, but it did not prove a PR-specific cause. The current head has no new split metrics, so query/first-query are unverified.
Why qualification stopped
After more than three hours of foreground waiting, perf-01 was still held by the rows B3 run (with editor typing queued), and the Mac lock was held by a Safari run. No current-head measurement started. The earlier crash test was 20/20 twice on the pre-redesign head; the required ×20 rerun at this head did not run.
BLOCKED — head
c5ad7946ee9b52bc3dd3bde50fe9638ad84e2fc1The branch is pushed. Current-head ABAB ×5 and macOS crash ×20 remain unrun after more than three hours waiting on shared locks. The last valid cold-reconcile result on the previous head was 47.383 s vs 45.372 s on dev (+4.433%; dev/dev spread 0.226%). Its profile attributed 78.578 s to staged document refresh and 40.583 s to final publish. That evidence predates the pushed redesign and does not qualify this head. See the preceding comment for the full prior metric table and query-breakdown evidence.
Mail #1011 handover, 13 Nov 2026 (written by the orchestrator; the lane was stopped before it could post its own)
Heads
t3/paged-search-reconcile-final:326e3cab580e. This contains the approved two-generation incremental reconcile redesign (plan, comment 90887).mail1011-recovery-candidate-927fe80-20261112, heade6db46203174, 22 commits beyond the remote) is pushed aswip/handover/mail1011-candidate. It adds SQL, reader-open and queue timing splits to the perf harness (56 metrics vs dev's 32). Check whether it holds any product fixes beyond the PR head before deciding what to keep.Gates on
326e3cab~/Developer/Worktrees/mail1011-perf-326e3-20261113.Kiq4rTon perf-01. Every arm the lane reported on passed the harness.b5-d2). The results have not been analysed yet.b5-d2as possibly incomplete and check its report.Last valid result before the redesign (head
d83711c2, comment 91798):search.cold_reconcilep50search.queryp95search.first_queryopen.api_getp95search.catch_upThe redesign targets the staging/publish path, which took 78.6 s refresh + 40.6 s publish in that profile.
Next steps
326e3cabABAB, using the same comparator as before.first_query,api_getp95).Analysis of the
326e3cabABAB ×5 (100k, perf-01): NOT READYHead
326e3cab580e. Merge dry run onto currentorigin/dev(796d80cba): clean, no conflicts (git merge-tree --write-tree, nothing pushed, not merged).Data check. 20/20 arms exit 0, no harness failures, 100000 notes each. The interrupted-looking
b5-d2is complete (exit 0, json+md written, 32 metrics,failures: [],perf-run-completepresent), so all 20 arms are included. Binaries on perf-01 (sha256): dev29a914ff…7361, candidate7efff113…ed7.Comparator (same as comment 91798): per block, the dev value is the mean of the two dev arms and the candidate value the mean of the two candidate arms. The table uses the median over the 5 blocks. Spread is the median over blocks of |d1−d2| / mean (dev/dev). "Worse" counts blocks where the candidate is slower than dev.
search.cold_reconcilesearch.querysearch.querysearch.query_serversearch.first_querysearch.first_query_serversearch.second_querysearch.third_querysearch.prefixsearch.catch_upopen.api_getopen.notestartup.healthzcold.indexcold.first_pagecold.disk_writtencold.mem_peaksearch.typoAlso better, no regression:
cold.startup,home.first_page,mem.after_search,mem.after_first_page,shutdown(314 → 22 ms; spreads of 30–50% mean treat these as noisy). Full per-metric output is on request; thesecond/third_query_*_client_non_serverandquery_client_non_serverp50/p95 are all +5–59%, mostly sub-ms.Not covered:
sync.save_ackandnotes_saveare not in this run. The harness ran--search-only, so the save scenarios were not measured. The run has no budget gate for the search metrics.Verdict
Cold reconcile and query p95 are both outside the dev/dev spread, and all of
search.query,query_server,second_query,prefixandcold.indexare worse in 5/5 blocks. Merging now would be a perf regression.d83711c2), although it is faster in absolute terms (34.8 s against 47.4 s).search.queryis 3.38 ms total, 2.99 ms server, 2.93 ms SQL, reader open 0.000, index open 0.000, blocking queue 0.015, non-reader server time 0.051, client outside server 0.41. So the extra time is not the queue, reader open or HTTP. It is the SQL itself (second/third query: 3.11/2.94 ms SQL). First query: 4.51 ms SQL, 0.27 ms reader open, 0.79 ms index open, 1.18 ms non-reader server time, so the cold-open costs are small next to SQL. Dev has no split metrics, so SQL-vs-dev is inferred fromquery_server(+0.32 ms), not measured directly.cold.index(+4.7%) andcold.disk_written(+79 MB) point at a heavier or less compact build, and FTS5 segments of a staged index may not be merged the way dev's single pass leaves them. This is a hypothesis; confirm with a segment/page count of the active FTS table in both arms.Proposed next fix
wip/handover/mail1011-candidate(e6db46203, merge base with this PR437f9ec89) holds product changes the PR head lacks, all aimed at the cold-reconcile cost:8dd871851batch reconcile provider pages,2a1502cc3batch pinned source reads,323083d44batch content comparisons,927fe80bddefer reconcile scratch tables,86f821b68skip redundant cold-reconcile lookups. They touchcrates/search/src/{write,indexer,index}.rsandcrates/notes/src/generation.rs. Rebase these onto the PR (it also has later commits the wip branch lacks, e.g.777f08264) and re-run ABAB; cold reconcile is the most likely win.optimizeormerge) on the new generation before publishing, or at least on the first publish, and confirm with the segment counts above. If equal, compareEXPLAIN QUERY PLANon the generation-table queries against dev's (an extra manifest join or per-query table-name resolution would show there).sync.save_ack) and a dev-vs-dev control pair at the start and end, asdocs/perf/comparing.mdrequires. This run had no separate control pair beyond the within-block d1/d2 spread above.No ticket or lock was taken; the run was read-only (results copied to a scratch dir on hd01).
#1011 perf-neutral pass, interim status (head
be4f42562). NOT READY yet: perf ABAB queuedPushed to
t3/paged-search-reconcile-final(fast-forward from326e3cab5; also onwip/mail1011-perfneutral). No merge.What the 326e3 regressions turned out to be (diagnosed on compute02; these timings are not gate numbers)
wip/handover/mail1011-candidate) was already done: the PR head carries rebased copies of8dd871851,2a1502cc3,323083d44,927fe80bd,86f821b68(identical diffs or context-adjusted, with the fetch fixups folded intoindexer/fetch.rs). The 326e3 ABAB already measured them.Index::searchcode on the dev index, PR code on a dev-shaped index, and PR code on the PR index time within noise (p50 5.3–5.5 ms each, interleaved ×3). FTS5 shape is close: fts 29 vs 30 segments, titles 12 vs 19, tri 6 vs 9, data 345.8 MB both. On a live server after background work settles, the PR's server-side p50 is 3.45 ms vs dev 3.60 ms. Nooptimizeor plan change needed; prefix indexes are intact (sameprefix='2 3'DDL).search.typolooked 69% faster: the PR's typo searches got no correction (correctedempty for every typo query in the warm run; dev corrected all of them). Fix: build the vocabulary in the background once the index has caught up (eb463d5aa). I tried pacing the catch-up too and reverted it (3efa9bc6c): it pushed the catch-up and vocab into the query window.079c5377d, at most two pages of documents held). Also,cold_reconcilestops when search reports ready. Dev checkpoints its big WAL after that point; the PR checkpointed every 64 writer jobs during the build. The periodic checkpoint now waits while a hidden generation builds (be4f42562). A one-transaction-per-64-pages variant didn't lower writer CPU, so it's reverted (f3238cc06/b31b2944a).cold.index+4.7%,cold.disk_written+79 MB: the PR's newsource_updated_id (updated, id)index was maintained row by row during a fresh 100k fill. It now joinsFRESH_DROPSand is built once at the end (c09539475); disk written is back within ~10 MB of dev.Bugs found and fixed on the way (all failing at
326e3cab5)source_version, but the archived note fetches as absent, so the fence never cleared (note_visibilitytimed out). AddedSearchProvider::fence_version(defaultNone; Notes reads the pinned row whatever its searchability). It's read only for removed rows under a known fence (9b2b7db3d).search/tests/hidden_blocks_upgrade.rsdidn't compile (nolist_page);opening.rsexpected the wrong index count;search_liveasserted perf-only timing fields; strict clippy failed in four places. All fixed.--search-onlynow also runs the typing round trip, sosync.save_ack/notes.saveare measured (4dc666057).Gates at
be4f42562cargo fmt --all --check(dev-01, slot)cargo clippy -j4 --workspace --all-targets --locked -- -D warningscargo test -j4 --workspace --locked --no-fail-fast(afterbun install --frozen-lockfile)cargo test -p calternal --test notes_crash_typing kill_nine_while_people_type_loses_and_doubles_nothing -- --exact×20, interleaved with dev796d80cba/tmp/mac-bench.lockbunx playwright test e2e/{search-palette,search-corpus,editor,list-catch-up,list-search,trash-search,visibility}.spec.ts --project=chromium-1440 --project=chromium-390 --workers=1--project=webkit-1440 --project=webkit-390Perf
Binaries staged on perf-01 and sha256-verified at both ends: dev
796d80cbabbe582a2…6dc, candidatebe4f42562179dc4d1…9c9, harnessb4989808…46d. Session: control pair, ABAB ×5, control pair, 100k,--search-only --gap-saves 600. Ticket re-queued behind s4h-1100 as the orchestrator asked. perf-01 couldn't reach perf-02 over NetBird (DNS failure, then connection refused), so perf-02's lock is now taken from hd01. Results to follow in the next comment.#1011 ABAB at
be4f42562vs dev796d80cba, 100k, perf-01: NOT READYSession 2026-11-14 00:10–00:47 UTC (05:40–06:17 IST), one FIFO turn on perf-01 with perf-02's lock held throughout (taken from hd01). 24/24 arms exit 0 with no harness failures: control pair c0, ABAB ×5, control pair c6.
calternal-perf --sizes 100k --runs 1 --cold-runs 1 --gap-saves 600 --search-only --idle-secs 0(this now includes the typing round trip). sha256 on perf-01: devbbe582a2…6dc, candidate179dc4d1…9c9, harnessb4989808…46d. Release builds withoutperf-timings, so the*_server/*_non_serversplits come fromtook_msonly.Comparator as in 91798/95469: per block, the mean of the two dev arms vs the mean of the two candidate arms; median over the 5 blocks. "Block spread" is the median |d1−d2|/mean within blocks; "control spread" is the larger of the two dev/dev control pairs. The verdict column is the delta against the larger of the two spreads.
cold.disk_writtencold.disk_writtencold.first_pagecold.first_pagecold.indexcold.indexcold.mem_peakcold.mem_peakcold.notes_per_scold.notes_per_scold.startupcold.startuphome.first_pagehome.first_pagemem.after_first_pagemem.after_first_pagemem.after_opensmem.after_opensmem.after_searchmem.after_searchmem.idlemem.idleopen.api_getopen.api_getopen.long_noteopen.long_noteopen.noteopen.notesearch.catch_upsearch.catch_upsearch.cold_reconcilesearch.cold_reconcilesearch.first_querysearch.first_querysearch.first_query_client_non_serversearch.first_query_client_non_serversearch.first_query_serversearch.first_query_serversearch.prefixsearch.prefixsearch.querysearch.querysearch.query_client_non_serversearch.query_client_non_serversearch.query_serversearch.query_serversearch.second_querysearch.second_querysearch.second_query_client_non_serversearch.second_query_client_non_serversearch.second_query_serversearch.second_query_serversearch.third_querysearch.third_querysearch.third_query_client_non_serversearch.third_query_client_non_serversearch.third_query_serversearch.third_query_serversearch.typosearch.typoshutdownshutdownstartup.healthzstartup.healthzsync.durable_writesync.durable_writesync.round_tripsync.round_tripsync.save_acksync.save_ackVerdict
search.cold_reconcileis still +16.8% (27.2 s → 31.8 s), 5/5 blocks worse, against a 2.3% spread: this blocks. It is down from +25.8% at326e3cab5. On compute02 the pipelined build was writer-bound and close to dev by writer activity, but on perf-01's slower shared disk it is not. The next step is a perf-01 profile of the build (writer CPU vs I/O wait, WAL size). A variant that writes hidden pages in one transaction per 64 pages, built atf3238cc06(with the pacing I later removed), showed no win on compute02's fast disk but was never measured on perf-01. It is staged there asbin/candidate-txn-calternal, and its effect on a 6 ms-fsync disk is the open question.cold.disk_written+0.5% (+10 MB, 4/5) with a 0.0–0.1% spread: technically over. It was +79 MB before the page-index change.search.second_query_server+28.5% (control spread 6.7%, block spread 20.5%) andthird_query_client_non_serverare over on the stricter reading.first/second/third_query,search.queryp50/p95 (+6.7% / +12.4%, worse in 5/5 and 4/5 blocks) andquery_serverare within the session's noise but consistently worse. Steady-state queries on a settled server measured equal to dev on compute02 (3.45 vs 3.60 ms server p50), so these are startup-window effects, not SQL.search.catch_up−99%,search.typo−27% / −60% (with corrections working now),mem.after_search−12%,cold.index−0.7% (was +4.7%),sync.save_ack+0.2% / −7.3% (flat),home.first_page,open.api_get,startup.healthz.Not merged and not marked READY. All functional gates at this head are green (comment 95769).
#1011 resume, 15 Nov: cold build profiled on perf-01, cause found (interim, NOT READY)
Merge.
origin/devee50429e7merged into the PR branch (f06a1c4db). Conflicts: dev moved the Home list-sync methods intometa/sync.rs, so the branch'slive_metasource-version fence moved with them. Dev's Trash-as-executor change installs history for live images only, so the save receipt'ssource_versionis now taken by live position (Trash keeps dev'snotes.deletedreceipt), andexecutor_metachecks versions against the live count (8c6807e18; six Tasks delete tests failed without it).475751824fills dev's new plan fields in one search test. Gates at8c6807e18on dev-01:cargo fmt --all --checkPASS,cargo clippy -j4 --workspace --all-targets --locked -- -D warningsPASS,cargo test -j4 --workspace --locked --no-fail-fastPASS.Profile (perf-01, my own 100k fixture, one FIFO turn with perf-02 held from hd01, 12:36–12:45 IST). Same harness command as the ABAB (
--sizes 100k --runs 1 --cold-runs 1 --gap-saves 600 --search-only --idle-secs 0). A /proc sampler took per-thread state, current syscall and schedstat (on-CPU vs run-queue wait) every 20 ms, plus PSI and sda stats. Order: dev, cand, txn, txn, cand, dev. Diagnostic only: not a gate.f06a1c4db(2)search.cold_reconcilesearch-writeron CPUd035fd919, reapplyingf3238cc06on the current head), now with unit tests for the page budget, rollback and the failed-commit path.first_query(5.4–5.8 → 7.9–9.8 ms in every candidate arm) andsecond_query_serveraren't contention. My lead is the typo-vocabulary warm-up (eb463d5aa). Catch-up now ends in ~5 ms, so the warm-up starts right away, takes the pooled warm reader and scans the whole vocab table while the first queries run. In dev it's lazy. A second diagnostic turn (queued) compares txn against two variants: no warm-up, and warm-up on its own private connection.ADR 0070. Dev's #1156 made the size check a train blocker. This PR had
search/index.rs699,indexer/sync.rs808 andwrite.rs778 code lines (limit 500),read.rs891 (ceiling 845) andnotes/meta.rs1304 (ceiling 1289), and it grewwrite_executor/home.rsby 30. Split by job with pure moves (04026fa14plus fmt/visibility follow-ups), now onwip/mail1011-final-1115. Every PR-owned file is under its limit; the remainingcheck-size-budgets/check-file-docs/check-ui-primitivesmessages are the same ones devee50429e7prints. fmt, strict workspace clippy, andcargo test -p calternal-search -p calternal-notes -p calternal-taskspass there.Next: decide the vocab fix from the diagnostic turn, then the #1130 comparator turns (dev, dev2, inert sized to the candidate's growth, cand; mirrored; second turn to confirm).
#1011 #1130 comparator turn 1 at
ac5669771: cold reconcile −12%, steady queries flagged → fixed ina36df6760(NOT READY)Turn 1 (perf-01, FIFO turn 15:30–16:38 IST, perf-02 held from hd01 the whole time).
perf/vm/paired-turn.sh --sizes 100k --runs 1 --cold-runs 1 --deadline-min 80 --seed 1115 --order mirrored --warmup --handshake -- --gap-saves 600 --search-only --cold-timeout 900, with arms devee50429e7(e1d5542f…), dev2 (byte copy), inert (ee50429e7+perf/inert-patch.py --seed 1 --functions 1360, +303 KB against the candidate's +321 KB,c6626800…), and candac5669771(c0a8602b…). Harness646becde…. 10 rounds, 0 harness failures.python3 perf/compare.py layout.json --hot search.,cold.,sync. --layout inert: null block dev2 vs dev passed (no cell flagged), so the turn is valid.search.cold_reconcilecold.indexcold.disk_writtensearch.queryp50 / p95search.query_serverp50search.prefixp95search.first_querysearch.second_query_serversearch.typop95sync.save_ackp50 / p95All smoke cells ok. Comparator verdict: REGRESSION FLAGGED on 3 cells (
cold.disk_written,search.prefixp95,search.query_serverp50).Cause of the steady-query flags (dev-01, structure only, no timing claims). I built the 100k index once with each binary and compared the files. Schema and rows are the same (the
_nexttables have the same columns and indexes as dev's). The same search-shaped SQL (FTS newest + titles, 8 queries, 40 interleaved rounds, ×3) ran 4.4–5.4% slower on the candidate's file. AfterVACUUM INTOit was still slower, so it isn't page layout. After FTS5optimizeon both it was equal (2.77 vs 2.77–2.83 ms). So the gap is FTS segment shape from the batched commits. Merging only the candidate's smalltitlesandtritables made it 5–7% faster than dev (4.33–4.46 vs 4.62–4.70 ms). That costs 0.17 s + 0.2 s at 100k; a full-textoptimizewould cost 6.4 s, so I left that one alone.a36df6760mergestitles/triof a hidden generation inside the publish transaction, before the manifest switch.cold.disk_written+0.57% (+~10 MB of 1.92 GB): needs a decision, not a fix tonight. It's deterministic, so any delta flags. It comes from the branch'ssource_versionssnapshot table and its(updated, id)index in the notes list store. That index keeps each keyset search page O(page) instead of a sort over the whole list, and it's built once at the end of a fresh fill (FRESH_DROPS).cold.indextime andcold.mem_peakare flat. Removing it means redesigning the pinned snapshot, so I'm leaving that call to kayg/the orchestrator.Next: turn 2 (queued; candidate swapped to
a36df6760=09a246c8…before it started, so it's a fresh measurement of the fixed head). If it flags or comes back inconclusive, a confirming turn 3 with--only.243b21238is the PR head (rustfmt-only on top ofa36df6760).Other:
cargo test --workspaceatac5669771had one failure incalternal-auth(a_cold_valid_password_gets_through_a_concurrent_flood, 429 vs 200). It isn't touched by the PR, passed 10/10 alone on the PR head and on dev, and was green at8c6807e18. Filed as #1157 (flaky rule: not blocking).#1011 comparator turn 2 at
72c613833(dev42c219afdmerged): queries fixed,cold.indexflagged → profiling (NOT READY)Merge.
origin/dev42c219afdmerged into the branch as72c613833, with no conflicts. Dev's changes sinceee50429e7are web, docs and harness only, so the rebuilt release binaries are byte-identical to the last ones: deve1d5542f…, cand09a246c8…(=a36df6760/44bc6230a).Gates at
72c613833cargo fmt --all --checkPASS;cargo clippy -j4 --workspace --all-targets --locked -- -D warningsPASS.cargo test -j4 --workspace --locked --no-fail-fasthad 2 failures, both flaky on dev too (filed #1166):calternal-notessave_outside_retry: 5/30 on head, 3/29 on dev, interleaved;calternal-storea_once_commit_does_not_update_flush_activity: 1/10 on head, 0/10 on dev; the store code is identical on both.e2e/{search-palette,search-corpus,search-preview-cheap,editor,list-catch-up,list-search,trash-search,visibility,lazy-offline}.spec.ts --workers=1. There are no mail specs inapps/web/e2e.Turn 2 (perf-01, FIFO ticket, measured 21:41–22:54 CET = 02:11–03:24 IST; perf-02 held by my own unit
m1011-hold-tAonly during the turn).paired-turn.sh --sizes 100k --runs 1 --cold-runs 1 --deadline-min 80 --seed 1116 --order mirrored --warmup --handshake -- --gap-saves 600 --search-only --cold-timeout 900(same as turn 1, new seed).e1d5542f…;42c219afd+inert-patch.py --seed 1 --functions 1360=514a0c44…, +316,776 B against the candidate's +322,016 B;09a246c8….646becde…(the same binary as turn 1).compare.py tA/layout.json --hot search.,cold.,sync.(strict, without--layout):cold.disk_written(updated, id)index, kayg 16 Nov)cold.index(andcold.notes_per_s)search.cold_reconcilesearch.queryp50 / p95search.query_serverp50search.prefixp95search.first_querysearch.second_query_serversync.save_ackp50 / p95--layout inert, the three cold cells go to "layout, not code" (cand vs inert:cold.index1.170, U 1.294, p 0.16), and the verdict is INCONCLUSIVE (20 hot cells above the 10% MDE).cold.index.Reading it
titles/trimerge ina36df6760cleared all three steady-query flags from turn 1.search.cold_reconcileat 47–51 s, rounds 6–8 at 35–40 s, and turn 1 at 28–29 s. So the backup01 host was under outside load (perf-02 was held by me the whole time).cold.index(the notes list scan of a fresh Home, not search) was slower than dev in 8/8 rounds, by 2–5 s on 17–23 s. In turn 1 it was within ±1 s.Next
a36df6760(c0a8602b…), mirrored, with the /proc thread sampler and notesmeta.indexestimings in the server log. It separates the end-of-fill index build (source_updated_id) from the publish-time title merge and from host load.#1011 diagnostic turn (perf-01, 00:08–00:41 CET = 04:38–05:11 IST):
cold.indexisn't the candidate's code; single-root wake-ups flatThis was one FIFO ticket with perf-02 held by my own unit (
m1011-hold-prof) from want to done. It is a diagnostic, not a gate.--sizes 100k --runs 1 --cold-runs 1 --gap-saves 600 --search-only --idle-secs 0, withRUST_LOG=warn,calternal_notes=debug, a per-arm wrapper keeping every server's log, and the /proc thread sampler.09a246c8…, ac56 (c0a8602b…= cand withouta36df6760), ac56, cand, dev.cold.indexsmeta.indexesssearch.cold_reconcilescold.indexa36df6760can't touch it, and cand and ac56 spend the same CPU there.psi_io_full4.9 s against 1.2–1.7 s for the others, and 9.5 s in flushes against ~3.3 s.source_updated_id) costs about +0.0–0.4 s here. dev-01's offline SQL givesCREATE INDEX (updated, id)= 0.40 s on the 100kmeta.db(450 MB ofsourcetext).search.cold_reconcilereversed against turn 1source_versionsin(updated, id)order, which is random against the rowid order of the 450 MB table. Dev's singlelist()reads it sequentially.docs()), or a sequential first fill. That is a design change, so I'll write it up rather than rush it in at night.Part 2: prod-like single root (no
--state-dir: app data inside the Home, like prod's/data).calternal-perf --sizes 100k --runs 1 --cold-runs 1 --idle-secs 120, full scenario set, order dev, cand, cand, dev:idle.cpu_ticks(120 s)idle.cpu_pctidle.wakeups_per_sidle.threadsload.typing_cpu_pctload.typing_wakeups_per_ssync.save_ackp50 msmem.idleMBcold.indexsmem.idleis +2.0–2.6 MB (~+12%) in both cand runs. The comparator's split-state turn 2 had it at 1.002 (U 1.034), so it doesn't show in the gate layout. Two runs per arm isn't a test; I'm flagging it for the morning.Turn 3 (confirm, seed 1117, same command and binaries) started 00:41 CET.
#1011 turn 3 (confirm) at
72c613833:cold.index+13.8% CONFIRMED. The PR is blocked on it (NOT READY)Turn 3 (perf-01 FIFO ticket, measured 00:42–01:45 CET = 05:12–06:15 IST; perf-02 held by my own unit
m1011-hold-tBonly during the turn).compare.py tB/layout.json --only tA/flags-plain.json(confirmation of turn 2's flags):cold.disk_written(updated, id)index, kayg 16 Nov)cold.index/cold.notes_per_sFull strict family (
--hot search.,cold.,sync., no layout arm):search.cold_reconcile1.026 (U 1.044, MDE 2.6%, ok);search.queryp50 0.856 andsearch.query_serverp50 0.906;search.prefixp95 0.685;sync.save_ackp50 0.991 / p95 1.096 (ok).--layout inert: INCONCLUSIVE.Per round
cold.index: cand was +1.9 to +6.2 s on dev's 18.0–19.8 s in all 8 rounds, whatever its slot. dev2 and inert sat on dev except two inert outliers.ac5669771= cand withouta36df6760) the same cell was 1.019 (U 1.036), soa36df6760(or its LTO layout) is the prime suspect. But its title merge runs on the search writer, and the sampler saw that thread idle in the cold process.Next (diagnostic turn queued, behind tf1b, nf3c and dav794)
09a246c8…;c0a8602b…(cand withouta36df6760);bf070b8f…= cand +bff703553onwip/mail1011-sv-order-1116. Newsource_versionstables put the 4.5 KBsourcecolumn last, so page reads and the index build stop walking overflow chains. dev-01 gates: fmt, strict clippy, notes/search/calternal tests pass;notes_livehad one connection-reset failure, then passed 10/10 on rerun. The size/doc guards print exactly dev's messages.a36df6760gets reworked (for example the title merge after publish, off the critical path) or replaced.bff703553is not on the PR branch.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.