Skip to content

Flaky test: health report size check fails when the report is 200 bytes #374

Closed

Description

@txoof-bot

Problem

tests/test_health.py::test_report_is_replaced_and_never_grows fails now and then, on the Pi and so also in CI:

assert path.stat().st_size < 200
AssertionError: assert 200 < 200

It failed twice in a row on the Pi on 2026-11-09 (while working on #373), and passed on main a minute later.

Why

The test writes the health report 200 times and checks that the file stays one line and under 200 bytes. But one report line is already about 199–200 bytes, for example:

{"monotonic": 1597662.143459888, "time": "2026-11-09T07:58:07+01:00", "since_screen": null, "screen": null, "memory_mb": 22.9, "open_files": 3, "free_disk_mb": 951.1, "pid": 1142985, "reload": null}

Its length changes with numbers the test doesn't control: the process number (pid), the computer's uptime (monotonic), memory use and free disk space. When these have one more digit, the line reaches 200 bytes and the test fails. Nothing is wrong with the health code itself; the limit in the test is too tight.

What to do

Test what the check is for, that the file doesn't grow, instead of a fixed number of bytes. For example, write one report, note its size, write 199 more, and check that the size is about the same (within a few bytes, since the numbers change between reports). The other checks stay: one line, no temporary files left.

Area: core (tests only: tests/test_health.py)

Activity

  1. added
    bugSomething isn't working
    area:coreArea: see area map in CLAUDE.md
    in-progressClaimed: an agent or person is working on this
    on Nov 9, 2026
  2. txoof-bot commented on Nov 9, 2026

    @txoof-bot
    CollaboratorAuthor

    claimed by PaperPi-364-met-no-readable (fix goes into #373)

  3. removed
    in-progressClaimed: an agent or person is working on this
    on Nov 9, 2026
  4. txoof-bot commented on Nov 9, 2026

    @txoof-bot
    CollaboratorAuthor

    released: done in #375 (merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreArea: see area map in CLAUDE.mdbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions