feat(core): score by distance from target size (#63)
ci / web (push) Successful in 48s
ci / rust (push) Successful in 1m13s
e2e / e2e (push) Successful in 1m15s

This commit was merged in pull request #63.
This commit is contained in:
2026-08-22 21:15:26 +01:00
parent 514628f089
commit 29d6831c83
5 changed files with 494 additions and 8 deletions
+29
View File
@@ -191,6 +191,35 @@ mod tests {
);
}
#[tokio::test]
async fn every_policy_carries_its_scoring_numbers() {
let (_dir, db) = fresh().await;
let rows = sqlx::query("SELECT size_bands, score_weights FROM policies")
.fetch_all(db.pool())
.await
.expect("policies");
assert_eq!(rows.len(), 2);
for row in rows {
let size_bands: String = row.get(0);
let score_weights: String = row.get(1);
// §5.5: floor, target and the penalty above target, per resolution.
assert!(size_bands.contains("floor_gib"), "{size_bands}");
assert!(size_bands.contains("target_gib"), "{size_bands}");
assert!(
size_bands.contains("penalty_points_per_gib_over"),
"{size_bands}"
);
// §5.5: the weights that keep source tier and seeders small
// against the size term are tuned by hand too.
assert!(score_weights.contains("size_at_target"), "{score_weights}");
assert!(score_weights.contains("source_tier"), "{score_weights}");
assert!(score_weights.contains("seeder_doubling"), "{score_weights}");
}
}
#[tokio::test]
async fn foreign_keys_are_enforced() {
let (_dir, db) = fresh().await;