Pin CultLib 75188fde (stamp hardening #175; includes #171 #172 #174)

The workspace's one CultLib pin moves 8fc74c70 -> 75188fdefa0b4baf131dbfd94e77d06a965f0cc6
(cultcache-rs 0.2.0 -> 0.3.1, cultnet-rs 0.1.0 -> 0.3.0 in the lock; the lock drops
the crates the old revision alone needed and gains sha2/stacker for the new one).

Adaptations the new cultcache-rs forces:
- CacheBackingStore::push/push_all return the stamps written; the five test
  stores follow (store.rs, receipt.rs, read_tests.rs).
- A pull now carries a record no registered type claims instead of refusing it,
  so the heartbeat writer's open() checks foreign_records() and keeps its
  fail-closed refusal of an old initiative store.
- A cache refuses writes until it has pulled, and a zero-byte file is not a
  store: two test fixtures pull first / plant a real store.

Not deployed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Eureka 2026-11-14 09:14:30 +00:00
commit 477482b1a0
8 changed files with 59 additions and 148 deletions

View file

@ -330,13 +330,13 @@ impl CacheBackingStore for LandsThenFails {
fn pull_all(&self) -> Result<Vec<CultCacheEnvelope>> {
self.inner.pull_all()
}
fn push(&mut self, entry: &CultCacheEnvelope) -> Result<()> {
fn push(&mut self, entry: &CultCacheEnvelope) -> Result<String> {
self.inner.push(entry)
}
fn delete(&mut self, entry: &CultCacheEnvelope) -> Result<()> {
self.inner.delete(entry)
}
fn push_all(&mut self, entries: &[CultCacheEnvelope], options: PushAllOptions) -> Result<()> {
fn push_all(&mut self, entries: &[CultCacheEnvelope], options: PushAllOptions) -> Result<Vec<String>> {
self.inner.push_all(entries, options)
}
}
@ -547,13 +547,13 @@ impl CacheBackingStore for FailsTheLook {
}
self.inner.pull_all()
}
fn push(&mut self, entry: &CultCacheEnvelope) -> Result<()> {
fn push(&mut self, entry: &CultCacheEnvelope) -> Result<String> {
self.inner.push(entry)
}
fn delete(&mut self, entry: &CultCacheEnvelope) -> Result<()> {
self.inner.delete(entry)
}
fn push_all(&mut self, entries: &[CultCacheEnvelope], options: PushAllOptions) -> Result<()> {
fn push_all(&mut self, entries: &[CultCacheEnvelope], options: PushAllOptions) -> Result<Vec<String>> {
self.inner.push_all(entries, options)
}
}

View file

@ -374,7 +374,7 @@ mod tests {
self.inner.pull_all()
}
fn push(&mut self, entry: &CultCacheEnvelope) -> anyhow::Result<()> {
fn push(&mut self, entry: &CultCacheEnvelope) -> anyhow::Result<String> {
self.inner.push(entry)
}
@ -382,7 +382,7 @@ mod tests {
self.inner.delete(entry)
}
fn push_all(&mut self, entries: &[CultCacheEnvelope], options: PushAllOptions) -> anyhow::Result<()> {
fn push_all(&mut self, entries: &[CultCacheEnvelope], options: PushAllOptions) -> anyhow::Result<Vec<String>> {
self.inner.push_all(entries, options)
}
}

View file

@ -116,9 +116,9 @@ pub(crate) mod test_stores {
Ok(self.rows())
}
fn push(&mut self, entry: &CultCacheEnvelope) -> Result<()> {
fn push(&mut self, entry: &CultCacheEnvelope) -> Result<String> {
self.plant(entry.clone());
Ok(())
Ok(entry.stored_at.clone())
}
fn delete(&mut self, entry: &CultCacheEnvelope) -> Result<()> {
@ -126,9 +126,9 @@ pub(crate) mod test_stores {
Ok(())
}
fn push_all(&mut self, entries: &[CultCacheEnvelope], _options: PushAllOptions) -> Result<()> {
fn push_all(&mut self, entries: &[CultCacheEnvelope], _options: PushAllOptions) -> Result<Vec<String>> {
*self.rows.lock().unwrap() = entries.iter().map(|entry| (identity(entry), entry.clone())).collect();
Ok(())
Ok(entries.iter().map(|entry| entry.stored_at.clone()).collect())
}
}
@ -199,7 +199,7 @@ pub(crate) mod test_stores {
self.inner.pull_all()
}
fn push(&mut self, entry: &CultCacheEnvelope) -> Result<()> {
fn push(&mut self, entry: &CultCacheEnvelope) -> Result<String> {
self.inner.push(entry)
}
@ -207,7 +207,7 @@ pub(crate) mod test_stores {
self.inner.delete(entry)
}
fn push_all(&mut self, entries: &[CultCacheEnvelope], options: PushAllOptions) -> Result<()> {
fn push_all(&mut self, entries: &[CultCacheEnvelope], options: PushAllOptions) -> Result<Vec<String>> {
self.inner.push_all(entries, options)
}
}

View file

@ -62,6 +62,7 @@ fn a_brake_payload_that_does_not_decode_makes_the_store_undecodable() {
let mut cache = CultCache::new();
cache.register_entry_type::<WrongBrake>().unwrap();
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&path)).unwrap();
cache.pull_all_backing_stores().unwrap();
cache.put(BRAKE_KEY, &WrongBrake { released: "yes".into() }).unwrap();
assert_eq!(effective(&path), held(HeldReason::Undecodable));
}

View file

@ -309,6 +309,10 @@ impl FileStore {
let mut cache = Self::registered()?;
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&self.path))?;
cache.pull_all_backing_stores().with_context(|| self.refusal())?;
// A pull now carries a record no registered type claims instead of refusing it; the writer still must not write beside one.
if !cache.foreign_records().is_empty() {
return Err(anyhow!(self.refusal()));
}
Ok(cache)
}

View file

@ -187,7 +187,12 @@ mod unsafe_installs {
std::fs::create_dir(&instance).unwrap();
for (name, mode) in [("control.cc.lock", lock_mode), ("control.cc", store_mode)] {
if let Some(mode) = mode {
std::fs::write(instance.join(name), b"").unwrap();
if name == "control.cc" {
// A store is a store the runtime reads: CultCache refuses a zero-byte file, as it refuses any file it cannot read.
ControlWriter::open(instance.join(name)).unwrap().set_brake(false, at(0), "fixture").unwrap();
} else {
std::fs::write(instance.join(name), b"").unwrap();
}
chmod(&instance.join(name), mode);
}
}