feat(api): add ConvergenceOptions, ConvergenceReport, History::converge

New public types:
- ConvergenceOptions { max_iter, epsilon } — config for the loop
- ConvergenceReport { iterations, final_step, log_evidence, converged,
  per_iteration_time, slices_skipped } — post-hoc summary

History and HistoryBuilder gain a third generic parameter
O: Observer<T> = NullObserver. Builder methods:
- .convergence(opts) sets the ConvergenceOptions
- .observer(o) plugs in an Observer (reshapes the builder's O param)

History::converge() runs the existing iteration loop driven by the
stored opts, emits observer callbacks on each iteration end and on
completion, and returns Result<ConvergenceReport, InferenceError>.

The old convergence(iters, eps, verbose) stays — gets removed in
Task 20 after tests are translated.

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

View File

@@ -10,6 +10,7 @@ mod time;
mod time_slice;
pub use time_slice::TimeSlice;
mod competitor;
mod convergence;
pub mod drift;
mod error;
mod event;
@@ -26,6 +27,7 @@ pub(crate) mod schedule;
pub mod storage;
pub use competitor::Competitor;
pub use convergence::{ConvergenceOptions, ConvergenceReport};
pub use drift::{ConstantDrift, Drift};
pub use error::InferenceError;
pub use event::{Event, Member, Team};