From 00991c1b0300aef9b061fd20873e6e7464f48325 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 15 Sep 2026 20:55:50 +0200 Subject: [PATCH] Pin storeless reads by directory snapshot, not one mtime Soul's Cut 1 finding F2: the two read pins only proved the seeded store file's mtime was unchanged, so a store attached at a shadow path (every read writing path.with_extension("shadow.cc")) survived all 156 tests. state_cache_reads_without_writing_the_store and persona_social_cache_reads_without_writing_the_store now snapshot every directory entry (name, length, mtime) before and after the read, require exactly the store and its lock file, and require the snapshot unchanged. cultcache-rs at a0813c6 exposes no backing-store count on CultCache, so the directory is the observable layer. Co-Authored-By: Claude Opus 5 --- epiphany-core/src/persona_social_state.rs | 16 +++++++++++++++- epiphany-core/src/resident_self.rs | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/epiphany-core/src/persona_social_state.rs b/epiphany-core/src/persona_social_state.rs index b1920e08..a755d7ff 100644 --- a/epiphany-core/src/persona_social_state.rs +++ b/epiphany-core/src/persona_social_state.rs @@ -914,13 +914,27 @@ mod tests { .write(true) .open(&store)? .set_modified(past)?; + let listing = || -> Result> { + let mut entries = std::fs::read_dir(temp.path())? + .map(|entry| { + let entry = entry?; + let metadata = entry.metadata()?; + Ok((entry.file_name(), metadata.len(), metadata.modified()?)) + }) + .collect::>>()?; + entries.sort(); + Ok(entries) + }; + let before = listing()?; + let names = before.iter().map(|entry| entry.0.clone()).collect::>(); + assert_eq!(names, ["social.cc", "social.cc.lock"]); let reopened = persona_social_cache(&store)?; assert_eq!( reopened .get::(PERSONA_SOCIAL_RETENTION_HEAD_KEY)?, Some(head) ); - assert_eq!(std::fs::metadata(&store)?.modified()?, past); + assert_eq!(listing()?, before, "a read attached or wrote a store"); Ok(()) } } diff --git a/epiphany-core/src/resident_self.rs b/epiphany-core/src/resident_self.rs index 21c4a46e..9871ca45 100644 --- a/epiphany-core/src/resident_self.rs +++ b/epiphany-core/src/resident_self.rs @@ -2745,13 +2745,27 @@ mod pressure_replay_tests { .write(true) .open(&store)? .set_modified(past)?; + let listing = || -> Result> { + let mut entries = std::fs::read_dir(temp.path())? + .map(|entry| { + let entry = entry?; + let metadata = entry.metadata()?; + Ok((entry.file_name(), metadata.len(), metadata.modified()?)) + }) + .collect::>>()?; + entries.sort(); + Ok(entries) + }; + let before = listing()?; + let names = before.iter().map(|entry| entry.0.clone()).collect::>(); + assert_eq!(names, ["resident.cc", "resident.cc.lock"]); let reopened = state_cache(&store)?; assert!( reopened .get::(RESIDENT_SELF_STATE_KEY)? .is_some() ); - assert_eq!(std::fs::metadata(&store)?.modified()?, past); + assert_eq!(listing()?, before, "a read attached or wrote a store"); Ok(()) }