From 767ddca1cd037b496d6976d427f4ce618c2f3cf5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 21:06:16 +0000 Subject: [PATCH 1/3] deps: bump the rust-minor group across 1 directory with 3 updates Bumps the rust-minor group with 3 updates in the / directory: [rustc-hash](https://github.com/rust-lang/rustc-hash), [lru](https://github.com/jeromefroe/lru-rs) and [rand](https://github.com/rust-random/rand). Updates `rustc-hash` from 2.1.2 to 2.1.3 - [Changelog](https://github.com/rust-lang/rustc-hash/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-lang/rustc-hash/compare/v2.1.2...v2.1.3) Updates `lru` from 0.18.0 to 0.18.1 - [Changelog](https://github.com/jeromefroe/lru-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/jeromefroe/lru-rs/compare/0.18.0...0.18.1) Updates `rand` from 0.10.1 to 0.10.2 - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-random/rand/compare/0.10.1...0.10.2) --- updated-dependencies: - dependency-name: rustc-hash dependency-version: 2.1.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-minor - dependency-name: lru dependency-version: 0.18.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-minor - dependency-name: rand dependency-version: 0.10.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rust-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2c229b1..7ca7948 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,7 +123,7 @@ version = "0.1.0" dependencies = [ "base64", "cachekit", - "rand 0.10.1", + "rand 0.10.2", "rand_distr", "serde", "serde_json", @@ -179,7 +179,7 @@ dependencies = [ "parking_lot", "proptest", "quick_cache", - "rustc-hash 2.1.2", + "rustc-hash 2.1.3", "serde", "serde_json", "siphasher", @@ -693,9 +693,9 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "lru" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a860605968fce16869fd239cf4237a82f3ac470723415db603b0e8b6c8d4fb9" +checksum = "0b6180140927ee907000b0aa540091f6ea512ead4447c92b8fc35bc72788a5a6" dependencies = [ "hashbrown 0.17.1", ] @@ -917,9 +917,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" dependencies = [ "chacha20", "getrandom 0.4.2", @@ -958,7 +958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d431c2703ccf129de4d45253c03f49ebb22b97d6ad79ee3ecfc7e3f4862c1d8" dependencies = [ "num-traits", - "rand 0.10.1", + "rand 0.10.2", ] [[package]] @@ -1042,9 +1042,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" [[package]] name = "rustix" From 60c0e27f2ee8263d9e2e53c3069244e3c9c3041b Mon Sep 17 00:00:00 2001 From: Thomas Korrison Date: Tue, 14 Jul 2026 19:57:52 +0100 Subject: [PATCH 2/3] fix: update vulnerable dependencies and clippy lints --- Cargo.lock | 8 ++++---- src/ds/intrusive_list.rs | 10 ++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ca7948..67165cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,9 +77,9 @@ checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anyhow" -version = "1.0.102" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" +checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3" [[package]] name = "arbitrary" @@ -351,9 +351,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.18" +version = "0.9.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" dependencies = [ "crossbeam-utils", ] diff --git a/src/ds/intrusive_list.rs b/src/ds/intrusive_list.rs index a04cdc1..6e79008 100644 --- a/src/ds/intrusive_list.rs +++ b/src/ds/intrusive_list.rs @@ -871,11 +871,10 @@ impl IntrusiveList { #[inline] fn attach_front(&mut self, id: SlotId) -> Option<()> { let old_head = self.head; - if let Some(node) = self.arena.get_mut(id) { + { + let node = self.arena.get_mut(id)?; node.prev = None; node.next = old_head; - } else { - return None; } if let Some(old_head) = old_head { if let Some(head_node) = self.arena.get_mut(old_head) { @@ -891,11 +890,10 @@ impl IntrusiveList { #[inline] fn attach_back(&mut self, id: SlotId) -> Option<()> { let old_tail = self.tail; - if let Some(node) = self.arena.get_mut(id) { + { + let node = self.arena.get_mut(id)?; node.next = None; node.prev = old_tail; - } else { - return None; } if let Some(old_tail) = old_tail { if let Some(tail_node) = self.arena.get_mut(old_tail) { From 6dd43864ee6e56a607305d4769a03331aa4ac2d2 Mon Sep 17 00:00:00 2001 From: Thomas Korrison Date: Tue, 14 Jul 2026 20:08:41 +0100 Subject: [PATCH 3/3] fix: align LFU oracle tie-breaking --- tests/abstract_models/reference/lfu.rs | 17 +++++++++-------- tests/policy_semantics/lfu_tests.rs | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/tests/abstract_models/reference/lfu.rs b/tests/abstract_models/reference/lfu.rs index c6c77ff..527ae69 100644 --- a/tests/abstract_models/reference/lfu.rs +++ b/tests/abstract_models/reference/lfu.rs @@ -3,7 +3,7 @@ //! **Source:** [`docs/testing/specs/policies/exact/lfu.md`](../../../docs/testing/specs/policies/exact/lfu.md) ยท //! [matrix.md](../../../docs/testing/specs/matrix.md) //! **Tier:** reference (spec-first oracle). -//! **Formulation:** `HashMap` + append-only `first_seen` log for FIFO tie-break; +//! **Formulation:** `HashMap` + append-only bucket-arrival log for FIFO tie-break; //! independent of [`FrequencyBuckets`](cachekit::ds::FrequencyBuckets). use std::collections::{HashMap, HashSet, VecDeque}; @@ -14,7 +14,7 @@ use crate::abstract_models::{HitMiss, ModelStep, Op, OracleExpectation, PolicyMo #[derive(Debug, Clone)] pub struct NaiveLfuModel { freq: HashMap, - first_seen: VecDeque, + bucket_arrivals: VecDeque, capacity: usize, } @@ -25,7 +25,7 @@ where pub fn new(capacity: usize) -> Self { Self { freq: HashMap::new(), - first_seen: VecDeque::new(), + bucket_arrivals: VecDeque::new(), capacity, } } @@ -42,9 +42,9 @@ where self.freq.values().copied().min() } - /// Last append index for `key` in the tie-break log (re-inserts append again). - fn last_seen_index(&self, key: &K) -> usize { - self.first_seen + /// Last bucket-arrival index for `key` (touches and re-inserts append again). + fn bucket_arrival_index(&self, key: &K) -> usize { + self.bucket_arrivals .iter() .rposition(|k| k == key) .unwrap_or(usize::MAX) @@ -56,7 +56,7 @@ where .iter() .filter(|(_, f)| **f == min) .map(|(k, _)| k) - .min_by_key(|k| self.last_seen_index(k)) + .min_by_key(|k| self.bucket_arrival_index(k)) .cloned() } @@ -69,6 +69,7 @@ where fn touch(&mut self, key: &K) -> bool { if let Some(f) = self.freq.get_mut(key) { *f = f.saturating_add(1); + self.bucket_arrivals.push_back(key.clone()); true } else { false @@ -84,7 +85,7 @@ where evicted = self.evict_victim(); } self.freq.insert(key.clone(), 1); - self.first_seen.push_back(key); + self.bucket_arrivals.push_back(key); evicted } diff --git a/tests/policy_semantics/lfu_tests.rs b/tests/policy_semantics/lfu_tests.rs index a86d82a..625b935 100644 --- a/tests/policy_semantics/lfu_tests.rs +++ b/tests/policy_semantics/lfu_tests.rs @@ -95,6 +95,20 @@ fn smoke_lfu_naive_agreement() { assert_models_agree(&mut naive, &mut current, &ops); } +#[test] +fn lfu_naive_agreement_uses_bucket_arrival_for_ties() { + let ops = [ + Op::Insert(1), + Op::Insert(2), + Op::Touch(2), + Op::Touch(1), + Op::EvictOne, + ]; + let mut naive = NaiveLfuModel::new(2); + let mut current = LfuModel::new(2); + assert_models_agree(&mut naive, &mut current, &ops); +} + #[test] fn smoke_lfu() { let ops = [