fix: resolve 5 clippy errors blocking CI on master#29
Conversation
- Change supersession demotion from absolute penalty to multiplicative factor: score *= (1 - factor)^count instead of score -= constant - Default changed from 0.15 (absolute) to 0.40 (multiplicative, retains 60%) - Combines direct Supersedes edges and parent supersession into one factor - Fixes case where old memory with high cosine sim still outranked new memory despite being superseded (e.g., 0.85 - 0.15 = 0.70 > 0.65) - Updated tests to verify multiplicative math Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The hebbian_boosts closure referenced `superseded_count` but only declared `demotion: f64` — renamed variable + fixed Vec<f64> to Vec<(f64, u32)> to match downstream destructuring at line 1507. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…into worktree-agent-aaad197a
- Add `default_supersedes_demotion()` helper returning 0.40 - Change `#[serde(default)]` to `#[serde(default = "default_supersedes_demotion")]` - Prevents partial config.toml from silently zeroing out supersession demotion Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- echo.rs: use sort_by_key(Reverse(...)) instead of sort_by for 3 descending sorts - persistence.rs: remove redundant .into_iter() in zip() calls (x2) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Liorrr
left a comment
There was a problem hiding this comment.
pr-review Summary
This PR resolves 5 clippy -D warnings-level errors introduced by recent KS78 commits, plus upgrades the supersession demotion model from flat-additive to multiplicative.
Changes reviewed:
-
**** — Adds a named
default_supersedes_demotion()function (returns0.40) and wires it via#[serde(default = "default_supersedes_demotion")]. Fixes the serde-default bug where old configs without the field would deserialize to0.0instead of the intended value.Defaultimpl updated to0.40for consistency. -
crates/shrimpk-memory/src/echo.rs— Threesort_by(|a, b| b.x.cmp(&a.x))→sort_by_key(|b| Reverse(b.x))rewrites (semantically equivalent, clippy-clean). The main logic change replaces the flat additive demotion (final_score += -demotion) with a multiplicative model (final_score *= retain.powi(count)). The Hebbian boost tuple(f64, u32)is correctly destructured and the boost element is still applied at line 1551 — no signal is lost. Tests updated with correct math:1.027 * 0.60 = 0.6162 < 1.001. -
crates/shrimpk-memory/src/persistence.rs— Two redundant.into_iter()calls removed from.zip()arguments.Vec<T>implementsIntoIteratordirectly; the coercion is automatic.
All changes are correct and internally consistent. No logic, safety, or data-corruption issues found.
Confidence Score: 5/5
No findings — recommend merge.
) cli/tui.rs: convert KeyCode::Home/End arms with inner `if !filtered.is_empty()` into match guards. Behavior-preserving — an empty list falls through to the no-op `_` arm exactly as before. This was the last clippy error breaking master CI. It was hidden behind the shrimpk-memory errors (fixed in #29) because clippy stops at the first failing crate. Surfaced only on Rust 1.96 stable; CI's floating @stable toolchain picked up the new lints, turning already-committed code into hard errors. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
echo.rs: replacesort_by(|a, b| b.x.cmp(&a.x))withsort_by_key(|b| Reverse(b.x))(3 occurrences flagged by clippy)persistence.rs: remove redundant.into_iter()in.zip(...)calls (2 occurrences)All 5 were
-D warnings-level errors introduced in recent KS78 commits, causing CI to fail onmasterand all open branches.Test plan
cargo clippy -p shrimpk-memory --all-targets -- -D warningspasses locally