fix(notes): reuse daily placeholder history during capture #847

Closed
kayg wants to merge 0 commits from fix/capture-daily-history-race into dev
Owner

Plan

Reuse the daily placeholder room and its history when a capture materializes an unwritten day. A concurrent reader may establish that history after the capture checks for it; creating a separate private seed then fails with an existing-history error. The capture stops at done:1 and its acknowledged task never gets a journal line. This path is unchanged on dev, so the fix belongs in this separate PR.

Replace only the unwritten daily-note placement branch with room acquisition followed by the existing daily_seed path. Keep ordinary new-note creation and existing-history handling. Production change about 10 lines; a focused regression uses the existing pre-write pause to force a reader to own history before placement finishes. Work and memory remain O(N) in the daily note bytes, using the existing room edit/flush path.

failure effect detection recovery test
Reader creates placeholder history during capture Keep the original history/lineage and finish the capture Existing room owner Seed properties and flush through that room Deterministic paused-placement reader race
Room load or flush fails Job refuses without an invented replacement history Existing action error Existing job/error handling Existing write failure tests
Concurrent prose exists Preserve prose and add capture once Existing daily_seed semantics Existing capture retry/undo machinery Capture/undo tests and composer repetitions

The deterministic reader-race regression failed on dev and passed with this fix. All 13 task-create regressions passed.

BM8 validation at scratch b9dac07806a398f53f8a9acaf1506d4b6f718a30: cargo fmt --all -- --check and cargo test --workspace -j4 passed on dev-01 in the standard Nix/slot shell, 1,483 passed and 22 ignored, with no skips or test-thread override. Four report selectors passed 22/22 on Chromium/WebKit, zero retries. Final production code passed 30 fresh Chromium composer invocations (90 tests, zero retries) during one ordinary slot build. Exact commands, head provenance, append samples, retained failures and attached raw evidence: #844 (comment). No merge or train change; owned jobs finished and VM targets/temp Homes cleaned.

## Plan Reuse the daily placeholder room and its history when a capture materializes an unwritten day. A concurrent reader may establish that history after the capture checks for it; creating a separate private seed then fails with an existing-history error. The capture stops at done:1 and its acknowledged task never gets a journal line. This path is unchanged on dev, so the fix belongs in this separate PR. Replace only the unwritten daily-note placement branch with room acquisition followed by the existing daily_seed path. Keep ordinary new-note creation and existing-history handling. Production change about 10 lines; a focused regression uses the existing pre-write pause to force a reader to own history before placement finishes. Work and memory remain O(N) in the daily note bytes, using the existing room edit/flush path. | failure | effect | detection | recovery | test | |---|---|---|---|---| | Reader creates placeholder history during capture | Keep the original history/lineage and finish the capture | Existing room owner | Seed properties and flush through that room | Deterministic paused-placement reader race | | Room load or flush fails | Job refuses without an invented replacement history | Existing action error | Existing job/error handling | Existing write failure tests | | Concurrent prose exists | Preserve prose and add capture once | Existing daily_seed semantics | Existing capture retry/undo machinery | Capture/undo tests and composer repetitions | The deterministic reader-race regression failed on dev and passed with this fix. All 13 task-create regressions passed. BM8 validation at scratch `b9dac07806a398f53f8a9acaf1506d4b6f718a30`: `cargo fmt --all -- --check` and `cargo test --workspace -j4` passed on dev-01 in the standard Nix/slot shell, 1,483 passed and 22 ignored, with no skips or test-thread override. Four report selectors passed 22/22 on Chromium/WebKit, zero retries. Final production code passed 30 fresh Chromium composer invocations (90 tests, zero retries) during one ordinary slot build. Exact commands, head provenance, append samples, retained failures and attached raw evidence: https://git.kayg.org/kayg/calternal/pulls/844#issuecomment-74911. No merge or train change; owned jobs finished and VM targets/temp Homes cleaned.
test(notes): reproduce capture racing a daily placeholder reader
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
68cecd2ba8
Author
Owner

BM8 validation at scratch b9dac07806a398f53f8a9acaf1506d4b6f718a30: cargo fmt --all -- --check and cargo test --workspace -j4 passed on dev-01 in the standard Nix/slot shell, 1,483 passed and 22 ignored, with no skips or test-thread override. Four report selectors passed 22/22 on Chromium/WebKit, zero retries. Final production code passed 30 fresh Chromium composer invocations (90 tests, zero retries) during one ordinary slot build. Exact commands, head provenance, append samples, retained failures and attached raw evidence: #844 (comment). No merge or train change; owned jobs finished and VM targets/temp Homes cleaned.

BM8 validation at scratch `b9dac07806a398f53f8a9acaf1506d4b6f718a30`: `cargo fmt --all -- --check` and `cargo test --workspace -j4` passed on dev-01 in the standard Nix/slot shell, 1,483 passed and 22 ignored, with no skips or test-thread override. Four report selectors passed 22/22 on Chromium/WebKit, zero retries. Final production code passed 30 fresh Chromium composer invocations (90 tests, zero retries) during one ordinary slot build. Exact commands, head provenance, append samples, retained failures and attached raw evidence: https://git.kayg.org/kayg/calternal/pulls/844#issuecomment-74911. No merge or train change; owned jobs finished and VM targets/temp Homes cleaned.
Author
Owner

Closing: head 40448327 is already in dev (reached via 8e8c86f3); nothing left to merge. Branch kept.

Closing: head 40448327 is already in dev (reached via 8e8c86f3); nothing left to merge. Branch kept.
kayg closed this pull request 2026-11-04 13:04:59 +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!847
No description provided.