Skip to content

[Infra] Add deterministic readiness invariant tests #99

@shchukins

Description

@shchukins

Idea

Protect the deterministic readiness core with invariant and regression-style tests.

Problem

The readiness pipeline is becoming more complex:

  • load state
  • recovery state
  • fallback behavior
  • missing data handling
  • future recommendation layer

Without invariant tests, silent regressions may appear during refactoring or feature work.

Proposed solution

Add deterministic invariant tests for readiness and related model outputs.

Tests should validate system-level properties, not only individual formulas.

Suggested checks

Readiness invariants

  • readiness is always within expected range
  • same input always produces same output
  • readiness does not become NaN/null
  • missing HRV does not crash computation
  • fallback paths remain deterministic

Recovery/load behavior

  • higher acute load reduces readiness
  • poor sleep reduces recovery
  • improved recovery increases readiness
  • stale/missing data changes confidence/freshness state correctly

Recommendation safety (future-compatible)

  • recommendation layer never returns invalid state
  • degraded data quality produces warnings/fallbacks

Technical scope

Possible files:

  • tests/test_readiness_invariants.py
  • tests/test_recovery_invariants.py
  • fixtures for canonical physiological scenarios

Important constraints

  • tests must remain deterministic
  • no LLM logic in tests
  • prefer explicit expected behavior
  • avoid overfitting tests to implementation details

Value

High.

This creates a safety net for future:

  • recommendation engine
  • calibration work
  • feedback loops
  • refactoring
  • model evolution

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions