Skip to content

Recorder mismatch: JSON float string representation differs in performance tests #196

@jcoffi

Description

@jcoffi

Summary
Recorded JSON expectations in tests/performance expect longer float representations than the current environment serializes. For example, tests expecting 0.011710000000000002 now see 0.01171, and 0.27404633746782125 becomes 0.2740463374678212. This causes recorder diffs without any code changes in the corresponding functions.

Steps to reproduce

  1. Run: pytest -q tests/performance/test_performance_model.py::test_get_covariance
    • Expected (from json record): 0.011710000000000002
    • Actual: 0.01171
  2. Run: pytest -q tests/performance/test_performance_model.py::test_get_beta
    • Expected (from json record): 0.27404633746782125
    • Actual: 0.2740463374678212

Observed behavior

  • Recorder detects change due to float string serialization differences (Python uses shortest round‑trip float formatting in newer environments).

Expected behavior

  • Tests pass with current records without recorder diffs.

Environment

  • Branch: main (upstream)
  • Python: recent version exhibiting shortest-repr float serialization
  • No changes to performance_model.get_covariance/get_beta

Potential approaches (for maintainers’ consideration)

  • Stabilize serialization for recorder outputs (e.g., format floats with a specified precision before json.dumps), or
  • Update recorded expected JSON values to reflect shortest-repr floats.

Additional information

  • This appears orthogonal to feature work and was surfaced while running the full suite. No changes proposed here; filing for visibility and guidance on preferred stabilization approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions