Fix #990: Resolve task capture through daily successors #993

Closed
kayg wants to merge 0 commits from t3/fix-day-note-successor into dev
Owner

Plan

  • Resolve each date to the live note at its date path, or the same deterministic successor Journal selects when no live note exists.
  • Make task capture and bulk daily-note creation use that identity; never implicitly restore its trashed predecessor.
  • Keep each bulk job's resolved note id, so replay and Undo continue to target the exact incarnation. No undo-history schema or design change is expected.

Bounds: one indexed date-path lookup plus the existing O(D) successor checks for D reserved incarnations; O(1) extra memory and no Home scan. A task capture remains at most three bulk steps, with no migration.

failure effect detection recovery test
Prior daily identity is in Trash Capture uses a successor; retained file stays unchanged Resolver finds no live date path and skips reserved ids Retry uses the stored job identity Rust capture → Undo → successor capture
Successor placeholder is already live Capture appends into that exact daily identity Stored daily id and date path agree Bulk job resumes its stored steps Rust test opens Journal before capture
A date destination is occupied Outside bytes are preserved Existing exclusive-placement conflict Retry after reconciliation Daily collision tests
Earlier job is undone after a successor exists Undo affects only ids recorded by that job Each inverse step names an exact note id Other daily incarnations remain live or in Trash Rust test checks old and successor Trash bytes

Root cause

The pre-fix Rust reproduction reaches daily.open after the first capture is undone. Journal returns a UUID successor, but the bulk task job fails after creating its task note and before its daily-note step, with an idempotency conflict. The code path is keyed to the old day- prefix, while capture can still fall back to that reserved canonical id when no live date path is indexed.

Gates

Completed commands, gate results, dev-vs-dev control, and every measured delta are recorded in the gate and performance results comment.
No merge or deploy.

## Plan - Resolve each date to the live note at its date path, or the same deterministic successor Journal selects when no live note exists. - Make task capture and bulk daily-note creation use that identity; never implicitly restore its trashed predecessor. - Keep each bulk job's resolved note id, so replay and Undo continue to target the exact incarnation. No undo-history schema or design change is expected. **Bounds:** one indexed date-path lookup plus the existing O(D) successor checks for D reserved incarnations; O(1) extra memory and no Home scan. A task capture remains at most three bulk steps, with no migration. | failure | effect | detection | recovery | test | |---|---|---|---|---| | Prior daily identity is in Trash | Capture uses a successor; retained file stays unchanged | Resolver finds no live date path and skips reserved ids | Retry uses the stored job identity | Rust capture → Undo → successor capture | | Successor placeholder is already live | Capture appends into that exact daily identity | Stored daily id and date path agree | Bulk job resumes its stored steps | Rust test opens Journal before capture | | A date destination is occupied | Outside bytes are preserved | Existing exclusive-placement conflict | Retry after reconciliation | Daily collision tests | | Earlier job is undone after a successor exists | Undo affects only ids recorded by that job | Each inverse step names an exact note id | Other daily incarnations remain live or in Trash | Rust test checks old and successor Trash bytes | ## Root cause The pre-fix Rust reproduction reaches `daily.open` after the first capture is undone. Journal returns a UUID successor, but the bulk task job fails after creating its task note and before its daily-note step, with an idempotency conflict. The code path is keyed to the old `day-` prefix, while capture can still fall back to that reserved canonical id when no live date path is indexed. ## Gates Completed commands, gate results, dev-vs-dev control, and every measured delta are recorded in [the gate and performance results comment](https://git.kayg.org/kayg/calternal/pulls/993#issuecomment-83525). No merge or deploy.
docs: record capture regression reproduction plan
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled
2f17e34ddf
Author
Owner

#990 gate results

The pre-fix Rust regression reproduced capture → Undo → capture failing in the bulk daily-note open step with an idempotency conflict. Capture fell back to the reserved day-YYYY-MM-DD identity after Undo trashed the original, while Journal selected a UUID successor; the fix uses the shared daily resolver and stores that exact identity in the bulk job so its Undo cannot affect a later note.

Playwright invocations below ran from apps/web in the PR worktree, inside nix develop, with PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=1, CALTERNAL_BIN pointing at that worktree's target/debug/calternal, and the host's ~/bin/slot.

Gate Exact command(s) Result
Rust formatting /home/claude/bin/slot cargo fmt --all --check pass
Rust clippy /home/claude/bin/slot cargo clippy -j4 --locked -p calternal-notes -p calternal-tasks --all-targets -- -D warnings pass, exit 0
Rust tests /home/claude/bin/slot cargo test -j4 --locked -p calternal-notes -p calternal-tasks -p calternal-daily pass, 661 passed, 0 failed, 6 ignored
Composer task capture bunx playwright test e2e/composer-tasks.spec.ts --project=chromium-1440 --project=chromium-390 --repeat-each=10 --workers=1
bunx playwright test e2e/composer-tasks.spec.ts --project=webkit-1440 --project=webkit-390 --repeat-each=10 --workers=1
all four projects pass; 60 passed per engine (30 per project), 0 failures
Shortcuts and Journal Trash, desktop bunx playwright test e2e/shortcuts.spec.ts --project=chromium-1440 --repeat-each=10 --workers=1
bunx playwright test e2e/shortcuts.spec.ts --project=webkit-1440 --repeat-each=10 --workers=1
bunx playwright test e2e/journal-trash.spec.ts --project=chromium-1440 --repeat-each=10 --workers=1
bunx playwright test e2e/journal-trash.spec.ts --project=webkit-1440 --repeat-each=10 --workers=1
PR: shortcuts 100/100 and Journal Trash 30/30 pass per engine. Prod baseline: shortcuts 90/100 and Journal Trash 10/30 pass per engine, so PR is no worse.
Notes and Journal save specs bunx playwright test e2e/editor.spec.ts e2e/day.spec.ts e2e/fresh-note.spec.ts --project=chromium-1440 --project=chromium-390 --workers=1
bunx playwright test e2e/editor.spec.ts e2e/day.spec.ts e2e/fresh-note.spec.ts --project=webkit-1440 --project=webkit-390 --workers=1
all four projects pass; Chromium 37 passed / 3 skipped, WebKit 31 passed / 9 skipped
Phone Journal Trash follow-up after rebuilding PR head bunx playwright test e2e/journal-trash.spec.ts --project=chromium-390 --repeat-each=10 --workers=1
bunx playwright test e2e/journal-trash.spec.ts --project=webkit-390 --repeat-each=10 --workers=1
20 passed / 10 skipped per engine, 0 failures

Backend performance

Measured on perf-01 with both shared perf locks held, in the 2026-11-06 14:16 IST epoch. Binaries match dev 935fdcacd9 and PR 7ff4c7841f; all commands exited 0. Each run used 200 samples. Task capture used the 100k-note fixture plus a seeded live 2026-11-07.md daily note (100,001 indexed notes total).

Exact benchmark invocations:

  • Notes save: /home/claude/bin/slot /home/claude/day-note-990-perf/bin/storage-bench-{dev,pr} save --dir /home/claude/day-note-990-perf/storage/{run-label} --saves 200 --upload none. Two dev controls, then per cycle 1–3: dev a1, PR b1, dev a2, PR b2.
  • Task capture: /home/claude/bin/slot /home/claude/day-note-990-perf/bin/tasks-create-bench-{dev,pr} /home/claude/day-note-990-perf/task/{dev,pr}/data /home/claude/day-note-990-perf/task/{dev,pr}/state 0192f0a0-0000-7000-8000-00000000f1f0. Two dev controls, then the same dev/PR/dev/PR order for three cycles.
Path Dev-vs-dev control Dev ABAB ×3 median PR ABAB ×3 median PR minus dev
notes_save p50 / p90 / p99 (ms) 16.83 / 36.27 / 64.08; 21.77 / 41.71 / 78.08 (spread 4.94 / 5.44 / 14.00) 18.415 / 27.615 / 37.960 18.445 / 28.585 / 38.625 +0.030 (+0.16%) / +0.970 (+3.51%) / +0.665 (+1.75%); each delta is inside the dev-vs-dev spread
Task capture p50 / p95 / max (ms) 4.077 / 8.030 / 18.650; 3.942 / 6.192 / 41.301 (max spread 22.651) 3.915 / 6.453 / 23.793 3.936 / 6.146 / 30.202 +0.021 (+0.52%) / -0.307 (-4.76%) / +6.410 (+26.94%); p95 improves, max delta is inside the dev-vs-dev spread

The control shows the save measurements' noise is larger than the PR deltas; task-capture p95 improves and its maximum delta is within the control spread. No regression was detected in either path.

No merge or deploy.

## #990 gate results The pre-fix Rust regression reproduced capture → Undo → capture failing in the bulk daily-note open step with an idempotency conflict. Capture fell back to the reserved day-YYYY-MM-DD identity after Undo trashed the original, while Journal selected a UUID successor; the fix uses the shared daily resolver and stores that exact identity in the bulk job so its Undo cannot affect a later note. Playwright invocations below ran from apps/web in the PR worktree, inside nix develop, with PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=1, CALTERNAL_BIN pointing at that worktree's target/debug/calternal, and the host's ~/bin/slot. | Gate | Exact command(s) | Result | |---|---|---| | Rust formatting | /home/claude/bin/slot cargo fmt --all --check | pass | | Rust clippy | /home/claude/bin/slot cargo clippy -j4 --locked -p calternal-notes -p calternal-tasks --all-targets -- -D warnings | pass, exit 0 | | Rust tests | /home/claude/bin/slot cargo test -j4 --locked -p calternal-notes -p calternal-tasks -p calternal-daily | pass, 661 passed, 0 failed, 6 ignored | | Composer task capture | bunx playwright test e2e/composer-tasks.spec.ts --project=chromium-1440 --project=chromium-390 --repeat-each=10 --workers=1<br>bunx playwright test e2e/composer-tasks.spec.ts --project=webkit-1440 --project=webkit-390 --repeat-each=10 --workers=1 | all four projects pass; 60 passed per engine (30 per project), 0 failures | | Shortcuts and Journal Trash, desktop | bunx playwright test e2e/shortcuts.spec.ts --project=chromium-1440 --repeat-each=10 --workers=1<br>bunx playwright test e2e/shortcuts.spec.ts --project=webkit-1440 --repeat-each=10 --workers=1<br>bunx playwright test e2e/journal-trash.spec.ts --project=chromium-1440 --repeat-each=10 --workers=1<br>bunx playwright test e2e/journal-trash.spec.ts --project=webkit-1440 --repeat-each=10 --workers=1 | PR: shortcuts 100/100 and Journal Trash 30/30 pass per engine. Prod baseline: shortcuts 90/100 and Journal Trash 10/30 pass per engine, so PR is no worse. | | Notes and Journal save specs | bunx playwright test e2e/editor.spec.ts e2e/day.spec.ts e2e/fresh-note.spec.ts --project=chromium-1440 --project=chromium-390 --workers=1<br>bunx playwright test e2e/editor.spec.ts e2e/day.spec.ts e2e/fresh-note.spec.ts --project=webkit-1440 --project=webkit-390 --workers=1 | all four projects pass; Chromium 37 passed / 3 skipped, WebKit 31 passed / 9 skipped | | Phone Journal Trash follow-up after rebuilding PR head | bunx playwright test e2e/journal-trash.spec.ts --project=chromium-390 --repeat-each=10 --workers=1<br>bunx playwright test e2e/journal-trash.spec.ts --project=webkit-390 --repeat-each=10 --workers=1 | 20 passed / 10 skipped per engine, 0 failures | ## Backend performance Measured on perf-01 with both shared perf locks held, in the 2026-11-06 14:16 IST epoch. Binaries match dev 935fdcacd9cf2837d313817d6786d8a810b3bdaa and PR 7ff4c7841f693cc9cad9923bb755a46c19fabf92; all commands exited 0. Each run used 200 samples. Task capture used the 100k-note fixture plus a seeded live 2026-11-07.md daily note (100,001 indexed notes total). Exact benchmark invocations: - Notes save: /home/claude/bin/slot /home/claude/day-note-990-perf/bin/storage-bench-{dev,pr} save --dir /home/claude/day-note-990-perf/storage/{run-label} --saves 200 --upload none. Two dev controls, then per cycle 1–3: dev a1, PR b1, dev a2, PR b2. - Task capture: /home/claude/bin/slot /home/claude/day-note-990-perf/bin/tasks-create-bench-{dev,pr} /home/claude/day-note-990-perf/task/{dev,pr}/data /home/claude/day-note-990-perf/task/{dev,pr}/state 0192f0a0-0000-7000-8000-00000000f1f0. Two dev controls, then the same dev/PR/dev/PR order for three cycles. | Path | Dev-vs-dev control | Dev ABAB ×3 median | PR ABAB ×3 median | PR minus dev | |---|---|---|---|---| | notes_save p50 / p90 / p99 (ms) | 16.83 / 36.27 / 64.08; 21.77 / 41.71 / 78.08 (spread 4.94 / 5.44 / 14.00) | 18.415 / 27.615 / 37.960 | 18.445 / 28.585 / 38.625 | +0.030 (+0.16%) / +0.970 (+3.51%) / +0.665 (+1.75%); each delta is inside the dev-vs-dev spread | | Task capture p50 / p95 / max (ms) | 4.077 / 8.030 / 18.650; 3.942 / 6.192 / 41.301 (max spread 22.651) | 3.915 / 6.453 / 23.793 | 3.936 / 6.146 / 30.202 | +0.021 (+0.52%) / -0.307 (-4.76%) / +6.410 (+26.94%); p95 improves, max delta is inside the dev-vs-dev spread | The control shows the save measurements' noise is larger than the PR deltas; task-capture p95 improves and its maximum delta is within the control spread. No regression was detected in either path. No merge or deploy.
Author
Owner

Merged into dev as 1e903a13a (U1: targeted specs 0 failures with repeat-each=10 in all four projects, perf flat vs the dev-vs-dev control). Fixes #990, the only blocker of the 11-06 daily train (#989). A full-suite re-run on the new dev head gates the deploy.

Merged into dev as `1e903a13a` (U1: targeted specs 0 failures with repeat-each=10 in all four projects, perf flat vs the dev-vs-dev control). Fixes #990, the only blocker of the 11-06 daily train (#989). A full-suite re-run on the new dev head gates the deploy.
kayg closed this pull request 2026-11-07 02:54:44 +00:00
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!993
No description provided.