Notes test Homes share a User writer lock and can cause a false Journal 404 #954

Open
opened 2026-10-02 22:20:57 +00:00 by kayg · 0 comments
Owner

During #731 verification on job/datafix at 73c441ff9, the per-crate Notes run with RUST_TEST_THREADS=4 reported:

---- tests::daily_and_composer_preserve_unrelated_bytes stdout ----
thread 'tests::daily_and_composer_preserve_unrelated_bytes' (197727) panicked at crates/plugins/notes/src/lib.rs:10290:9:
assertion `left == right` failed
  left: 404
 right: 200

The same test passed in one focused diagnostic, with unchanged source and expectations:

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

Evidence points to fixture isolation. The Notes tests::setup helper at lib.rs:6192 uses one fixed User ID for every independent temporary Home. The USER_LOCKS map is process-global and keyed by User ID. journal_snapshot at lib.rs:5012 repairs missing legacy block IDs only if that User writer lock is idle. If the lock is busy and no complete snapshot exists, the route returns 404. The test writes a legacy line without a block ID. Another test's independent Home can hold the same User lock.

This is an inference from the full-run failure, focused diagnostic and lock code. No test expectation or fixture was changed in #731. Use distinct User IDs for independent test Homes, or establish another fixture isolation method. Keep the existing assertion that the Journal read returns 200 after the accepted Log append. Do not weaken that assertion.

The two other full-run failures were existing IMAP read deadlines (Elapsed(()), imap.rs:1620 and :1690). The focused structural IMAP capture passed; the APPEND/STORE/EXPUNGE case again exceeded its 10-second read deadline. All saved Task view tests and the checked API contract test passed.

During #731 verification on job/datafix at 73c441ff9, the per-crate Notes run with RUST_TEST_THREADS=4 reported: ``` ---- tests::daily_and_composer_preserve_unrelated_bytes stdout ---- thread 'tests::daily_and_composer_preserve_unrelated_bytes' (197727) panicked at crates/plugins/notes/src/lib.rs:10290:9: assertion `left == right` failed left: 404 right: 200 ``` The same test passed in one focused diagnostic, with unchanged source and expectations: ``` test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 189 filtered out; finished in 29.32s ``` Evidence points to fixture isolation. The Notes `tests::setup` helper at lib.rs:6192 uses one fixed User ID for every independent temporary Home. The `USER_LOCKS` map is process-global and keyed by User ID. `journal_snapshot` at lib.rs:5012 repairs missing legacy block IDs only if that User writer lock is idle. If the lock is busy and no complete snapshot exists, the route returns 404. The test writes a legacy line without a block ID. Another test's independent Home can hold the same User lock. This is an inference from the full-run failure, focused diagnostic and lock code. No test expectation or fixture was changed in #731. Use distinct User IDs for independent test Homes, or establish another fixture isolation method. Keep the existing assertion that the Journal read returns 200 after the accepted Log append. Do not weaken that assertion. The two other full-run failures were existing IMAP read deadlines (`Elapsed(())`, imap.rs:1620 and :1690). The focused structural IMAP capture passed; the APPEND/STORE/EXPUNGE case again exceeded its 10-second read deadline. All saved Task view tests and the checked API contract test passed.
Sign in to join this conversation.
No labels
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#954
No description provided.