acpmux: the open's write-back keeps the log's modified time
Summary
The open's write-back (#35866, D2/D3) writes a replayed log's verified bytes back over themselves. The bytes are the same, but the write set the segment's modified time to now. A closed chat's age is its log's modified time (hub/retention.rs), so a restart after a kill made a chat untouched for a month look written now, and retention passed it as recent. Found by the store.journal default-on run (hub::retention::tests::a_closed_chat_is_as_old_as_its_log and a_chat_whose_close_is_not_logged_yet_is_left_whole fail only with the journal on). store.journal stays default off.
What changes
The write-back reads the segment's modified time before the write and sets it back after. If that fails, it only logs: the chat's log is then kept whole longer, never less.
Testing
Red at b64ab0b3db4: the_write_back_at_the_open_keeps_the_logs_modified_time fails at its own assertion (journal_write_back_tests.rs:372, "the open's write-back of the bytes the log already held changed its modified time"), after a clean compile, in the full run and alone: Linux fleet 3cda69f5, macOS fleet 4a66c038.
Command: cmux-ci run --class isolated --script scripts/ci/cmux-tui-rust-check.sh --ref <sha> --os <linux|macos> --arg test --arg journal_write_back.
Green at 90f790d0421: running (see the PR comments).
Observed / Not run
- Observed: the fleet steps above, each log read.
- Not run: a real kill and restart of a daemon with the journal on; Windows (
set_modifiedexists there too, not run).
Changelog
none
Proof
No capture: a daemon log file's timestamp, no UI.
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
The open's write-back now preserves a log segment's modified time, so a restart after a kill no longer makes an untouched chat look recently written. Previously, the write-back wrote the same verified bytes back over the log but updated the segment's modified time to now, which caused retention to treat old closed chats as recent.
- Reads the segment's modified time before the write and restores it after; if restoring fails, it only logs, keeping the log whole longer.
- Adds a test covering a log set a month back, a simulated crash, and an open that must leave the modified time unchanged.