feat(error): expand InferenceError; convert boundary asserts to Result

InferenceError gains MismatchedShape (user-input length mismatches),
InvalidProbability (p_draw out of [0, 1]), and ConvergenceFailed
(exceeded max_iter without hitting epsilon). NegativePrecision stays.

History::add_events_with_prior and History::add_events now return
Result<(), InferenceError>. The previous assert! macros checking
composition/results/times/weights shape are replaced by matched
error returns.

Internal debug_assert! macros for arithmetic invariants stay; this
change only affects boundary validation of user input.

Tests updated to call .unwrap() on the Result. The old signatures
will be fully replaced in Task 15 (typed add_events(iter)) and the
nested-Vec wrapper removed in Task 20.

Part of T2 of docs/superpowers/specs/2026-04-23-trueskill-engine-redesign-design.md.
This commit is contained in:
2026-04-24 12:26:13 +02:00
parent a6e008f8ff
commit a83c9acacb
3 changed files with 88 additions and 33 deletions

View File

@@ -40,7 +40,8 @@ fn main() {
let mut hist = History::builder().sigma(1.6).gamma(0.036).build();
hist.add_events(composition, results, times, vec![]);
hist.add_events(composition, results, times, vec![])
.unwrap();
hist.convergence(10, 0.01, true);
let players = [