[WIP] Reuse note metadata and guard cold opens against stale state (#686) #752

Closed
kayg wants to merge 2 commits from perf/open-note-state-evaluation-2 into dev
Owner

Opening an unchanged indexed note previously rebuilt and rewrote derived metadata. This branch includes #751's verified metadata reuse and covering tag counts, and adds six cold-open regression tests that protect outside changes when durable history exists.

The SSD-history shortcut evaluated for perf-open-note-2 is rejected using today's freshness evidence. An unchanged history row, app journal and size/mtime/path stamp do not establish the current Home revision. A temporary state-only bypass failed four regression tests: missed and offline edits, changed bytes after an offline rename, and missed removal. The safe Home read is retained. Imports have no history copy before their first open, so the shortcut also misses the unchanged benchmark's measured first opens.

This remains a partial performance result and must stay a draft. It continues #751 on a new branch because this forge ignores updates to an open PR branch. Acceptance for #686 remains unmet. The only changes after 7dadf737 are tests and a code comment; no runtime optimization is claimed in this follow-up.

Existing full server reports from the previous job, on the frozen 7dadf737 runtime: 100k open.note p95 23.904924 / 34.379729 / 15.004543 ms against 15 ms; tag listing passed 3/3. These are historical measurements, not newly run before/after reports. No new server reports were run because no distinct runtime candidate survived the correctness evaluation. The harness and budgets are unchanged.

The next best option is #731's SSD placement of claimed text, retaining direct Home verification. A separate SSD byte-cache would need exact snapshots for imported files and an enforceable filesystem revision or writer-exclusion contract. This investigation rules out bypassing Home using the current evidence; it does not rule out every possible state-backed design.

Validation: fresh fmt, clippy with warnings denied, locked workspace tests, and all six new targeted tests. Mutation test: 4 failed, 2 passed under the temporary bypass; the safe implementation passes all six. A separate read-only review found no important code issues.

Previous full reports. State-copy findings and mutation evidence. The final issue comment links the fresh full gate logs. No generated evidence is committed. No merge, deployment or issue closure.

Head: bdd5b6fa52

Fresh full gate logs and mutation evidence.

Fresh gate output:

targeted exit=0
test tests::open_state::cold_open_cannot_serve_trashed_history_after_restart ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 439 filtered out; finished in 0.12s


fmt exit=0


clippy exit=0
    Checking calternal-daily v0.1.0 (/home/agent/wt/perf-open-note/crates/daily)
    Checking calternal v0.1.0 (/home/agent/wt/perf-open-note/crates/calternal)
    Checking calternal-perf v0.1.0 (/home/agent/wt/perf-open-note/crates/perf)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.69s

workspace exit=0
running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Opening an unchanged indexed note previously rebuilt and rewrote derived metadata. This branch includes #751's verified metadata reuse and covering tag counts, and adds six cold-open regression tests that protect outside changes when durable history exists. The SSD-history shortcut evaluated for perf-open-note-2 is rejected using today's freshness evidence. An unchanged history row, app journal and size/mtime/path stamp do not establish the current Home revision. A temporary state-only bypass failed four regression tests: missed and offline edits, changed bytes after an offline rename, and missed removal. The safe Home read is retained. Imports have no history copy before their first open, so the shortcut also misses the unchanged benchmark's measured first opens. This remains a partial performance result and must stay a draft. It continues #751 on a new branch because this forge ignores updates to an open PR branch. Acceptance for #686 remains unmet. The only changes after 7dadf737 are tests and a code comment; no runtime optimization is claimed in this follow-up. Existing full server reports from the previous job, on the frozen 7dadf737 runtime: 100k open.note p95 23.904924 / 34.379729 / 15.004543 ms against 15 ms; tag listing passed 3/3. These are historical measurements, not newly run before/after reports. No new server reports were run because no distinct runtime candidate survived the correctness evaluation. The harness and budgets are unchanged. The next best option is #731's SSD placement of claimed text, retaining direct Home verification. A separate SSD byte-cache would need exact snapshots for imported files and an enforceable filesystem revision or writer-exclusion contract. This investigation rules out bypassing Home using the current evidence; it does not rule out every possible state-backed design. Validation: fresh fmt, clippy with warnings denied, locked workspace tests, and all six new targeted tests. Mutation test: 4 failed, 2 passed under the temporary bypass; the safe implementation passes all six. A separate read-only review found no important code issues. [Previous full reports](https://git.kayg.org/kayg/calternal/issues/686#issuecomment-68467). [State-copy findings and mutation evidence](https://git.kayg.org/kayg/calternal/issues/686#issuecomment-68509). The final issue comment links the fresh full gate logs. No generated evidence is committed. No merge, deployment or issue closure. Head: bdd5b6fa529f4f0698bf7a546ac458c1754f4165 [Fresh full gate logs and mutation evidence](https://git.kayg.org/attachments/07cb8b40-a95c-45c3-af04-49f56e3b4b6f). Fresh gate output: ```text targeted exit=0 test tests::open_state::cold_open_cannot_serve_trashed_history_after_restart ... ok test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 439 filtered out; finished in 0.12s fmt exit=0 clippy exit=0 Checking calternal-daily v0.1.0 (/home/agent/wt/perf-open-note/crates/daily) Checking calternal v0.1.0 (/home/agent/wt/perf-open-note/crates/calternal) Checking calternal-perf v0.1.0 (/home/agent/wt/perf-open-note/crates/perf) Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.69s workspace exit=0 running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s ```
perf(notes): reuse verified metadata on indexed opens
Some checks failed
CI / server (pull_request) Successful in 1m15s
CI / rust (pull_request) Successful in 18m7s
CI / web (pull_request) Has been cancelled
7dadf737b5
test(notes): preserve Home freshness on cold opens
Some checks failed
CI / server (pull_request) Successful in 1m16s
CI / rust (pull_request) Successful in 17m38s
CI / web (pull_request) Has been cancelled
bdd5b6fa52
Author
Owner

Closing per #931: this PR belongs to the superseded ARM64 perf series.

Closing per #931: this PR belongs to the superseded ARM64 perf series.
kayg closed this pull request 2026-11-04 17:37:34 +00:00
Some checks failed
CI / server (pull_request) Successful in 1m16s
CI / rust (pull_request) Successful in 17m38s
CI / web (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!752
No description provided.