Skip to content

fix: resolve 5 clippy errors blocking CI on master#29

Merged
Liorrr merged 5 commits into
masterfrom
fix/ks78-supersession-demotion
Jun 18, 2026
Merged

fix: resolve 5 clippy errors blocking CI on master#29
Liorrr merged 5 commits into
masterfrom
fix/ks78-supersession-demotion

Conversation

@Liorrr

@Liorrr Liorrr commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • echo.rs: replace sort_by(|a, b| b.x.cmp(&a.x)) with sort_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 on master and all open branches.

Test plan

  • cargo clippy -p shrimpk-memory --all-targets -- -D warnings passes locally
  • CI green on this PR

Liorrr and others added 5 commits April 10, 2026 05:08
- 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>
- 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 Liorrr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (returns 0.40) and wires it via #[serde(default = "default_supersedes_demotion")]. Fixes the serde-default bug where old configs without the field would deserialize to 0.0 instead of the intended value. Default impl updated to 0.40 for consistency.

  • crates/shrimpk-memory/src/echo.rs — Three sort_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> implements IntoIterator directly; 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.

@Liorrr
Liorrr merged commit 15498cd into master Jun 18, 2026
5 of 6 checks passed
Liorrr added a commit that referenced this pull request Jun 19, 2026
)

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant