chore/fix-some-stuff #2
|
|
@ -11,7 +11,7 @@ members = [
|
|||
[workspace.package]
|
||||
edition = "2021"
|
||||
version = "0.1.0"
|
||||
license = "AGPL-3"
|
||||
license = "AGPL-3.0-or-later"
|
||||
|
schaefera marked this conversation as resolved
Outdated
|
||||
|
||||
[workspace.dependencies]
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
|
|
|
|||
|
|
@ -93,16 +93,15 @@ pub fn engagement_score(
|
|||
return 0.0;
|
||||
}
|
||||
|
||||
let mut score = match opened {
|
||||
true => {
|
||||
let mut score = if !opened {
|
||||
|
schaefera marked this conversation as resolved
Outdated
claude-bot
commented
This rewrote This rewrote `if !opened {0.0} else {...}` as `match opened { true => {...}, false => 0.0 }` — a needless match-on-bool with no behavior change and extra nesting for no gain. Not currently caught by clippy in this workspace (verified `cargo clippy -p feedsignal-core --all-targets -- -D warnings` is clean), so it'll linger. Consider reverting to a plain `if`/`else`.
|
||||
0.0
|
||||
} else {
|
||||
match (dwell_seconds, estimated_read_seconds) {
|
||||
(Some(dwell), Some(est)) if est > 0 => (dwell as f64 / est as f64).min(1.0),
|
||||
// Opened but we don't yet know dwell time / read-time estimate:
|
||||
// credit partial engagement rather than 0 or 1.
|
||||
_ => 0.5,
|
||||
}
|
||||
}
|
||||
false => 0.0
|
||||
};
|
||||
|
schaefera marked this conversation as resolved
Outdated
claude-bot
commented
`cargo fmt --check` fails on this branch: the `false => 0.0` arm is missing a trailing comma, plus two more spots this diff introduces further down (the multi-line `assert_eq!` calls in `engagement_score_starred_adds_bonus` / `engagement_score_starred_bonus_caps_at_one`, which rustfmt collapses to one line). Since CI's `Format check` step runs before clippy/tests, this diff fails CI as-is — run `cargo fmt` before merging.
|
||||
|
||||
if starred {
|
||||
|
|
@ -366,19 +365,13 @@ mod tests {
|
|||
/// 0.3 on top of the dwell-ratio score.
|
||||
#[test]
|
||||
fn engagement_score_starred_adds_bonus() {
|
||||
assert_eq!(
|
||||
engagement_score(true, Some(30), Some(60), true, false),
|
||||
0.8
|
||||
);
|
||||
assert_eq!(engagement_score(true, Some(30), Some(60), true, false), 0.8);
|
||||
}
|
||||
|
||||
/// The +0.3 star bonus must also respect the 1.0 ceiling, even when
|
||||
/// the dwell ratio alone is already at the max.
|
||||
#[test]
|
||||
fn engagement_score_starred_bonus_caps_at_one() {
|
||||
assert_eq!(
|
||||
engagement_score(true, Some(60), Some(60), true, false),
|
||||
1.0
|
||||
);
|
||||
assert_eq!(engagement_score(true, Some(60), Some(60), true, false), 1.0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
AGPL-3isn't a valid SPDX license identifier — the valid forms areAGPL-3.0-only/AGPL-3.0-or-later(or the deprecatedAGPL-3.0). Tools that validate SPDX metadata (cargo-deny, crates.io) will reject this. Also this is a real license change (MIT → AGPL) bundled into a "chore" commit with no LICENSE file added to match — probably worth calling out explicitly or splitting into its own commit/PR.