Skip to content

test: kill the mutations that survived a green suite - #192

Merged
fdaviddpt merged 3 commits into
mainfrom
max/kill-mutants-175
Jul 26, 2026
Merged

fdaviddpt merged 3 commits into
mainfrom
max/kill-mutants-175

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Closes #175.

Eight changes to the code passed 695 tests. A surviving mutant is a line the tests do not depend on — it could be wrong and nothing would say so.

Every test here was written against its mutant: applied by hand, confirmed to make the test fail, reverted. A test that does not fail against the change it describes is decoration.

The two high-severity ones

LRU eviction. test_a_session_that_keeps_saving_is_not_evicted made exactly _POSITION_SLOTS saves, so the eviction loop never ran and deleting sessions.pop(...) — the line the test exists for — passed.

Overflowing the store turned out not to be enough either: the active session is re-saved last on every round, so it is present at the end whichever way the code behaves. I only found that by simulating both variants side by side. What actually separates them is a burst of other sessions after its last save — re-inserted it survives; keyed on first insertion it is the oldest thing in the store, gets evicted, resumes from 0, and re-summarizes its whole span. That is #140, reintroduced silently.

The TZ="" fallback. The regression test compared UTC against America/Los_Angeles, which share a calendar date for most of the day — so removing the [ -n "$REMEMBER_TZ" ] guard, the literal historical bug, passed outside roughly 17:00–24:00 PT. It now picks Pacific/Kiritimati (+14) or Pacific/Niue (−11) based on the current UTC hour, so the two dates always differ, and it asserts that premise before relying on it.

The rest

  • HOME vs expanduser — on POSIX expanduser reads $HOME, so swapping the order is unobservable anywhere CI runs. Mocking them apart is the only way to assert which wins. The ordering exists for Windows, where expanduser prefers USERPROFILE and would ignore a fixture that sets only HOME.
  • The is_skip half of the consolidation guard — removable because every SKIP in the fixtures also failed the shape check. A response that says SKIP and carries a header would have been written into memory.
  • split("===ARCHIVE===", 1) — memory is prose the model wrote, and prose about this pipeline quotes its own delimiters. Without the maxsplit, an archive that mentions ===ARCHIVE=== is cut at the mention.
  • > vs >= at the prompt-size cap — a prompt of exactly the configured size was never exercised.
  • sorted(staging_contents.items()) — fixtures had one file each, so a consolidation could narrate days in whatever order the glob returned.
  • _POSITION_SLOTS — the existing assertion imports the constant it checks, so it holds for any value. The number is now pinned.

One that was already dead

Truncation direction (raw[-max:] vs raw[:max]) is listed as a HIGH survivor, but a test covering it landed after the issue was written. Verified by applying the flip rather than assuming — test_build_prompt_caps_oversized_extract fails. No change needed.

Full suite: 792 passed, 41 skipped.

fdaviddpt pushed a commit that referenced this pull request Jul 26, 2026
Review of #192. Only referenced inside a monkeypatch target string.

Co-Authored-By: Max <noreply>
fdaviddpt pushed a commit that referenced this pull request Jul 26, 2026
Review of #192. Only referenced inside a monkeypatch target string.

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt force-pushed the max/kill-mutants-175 branch from 098a6a7 to 41fa913 Compare July 26, 2026 22:33
vsajan added 3 commits July 27, 2026 00:54
#175. Eight changes to the code passed 695 tests. A surviving mutant is a line
the tests do not depend on — it could be wrong and nothing would say so.

Each test here was written against its mutant: applied by hand, confirmed to
fail, reverted. A test that does not fail against the change it describes is
decoration.

LRU eviction (HIGH). test_a_session_that_keeps_saving_is_not_evicted made
exactly _POSITION_SLOTS saves, so the eviction loop never ran and deleting
`sessions.pop(...)` passed. Overflowing the store is not enough either — the
active session is re-saved last on every round, so it is present at the end
whichever way the code behaves. What separates them is a burst of OTHER
sessions after its last save: re-inserted it survives, keyed on first insertion
it is the oldest thing there and is evicted, then resumes from 0 and
re-summarizes its whole span, which is #140.

TZ="" fallback (MEDIUM). The regression test compared UTC against
America/Los_Angeles, which share a calendar date most of the day, so removing
the `[ -n "$REMEMBER_TZ" ]` guard — the literal historical bug — passed outside
roughly 17:00–24:00 PT. It now picks Pacific/Kiritimati (+14) or Pacific/Niue
(-11) by the current UTC hour, so the two dates always differ, and asserts the
premise before relying on it.

HOME vs expanduser (MEDIUM). On POSIX expanduser reads $HOME, so swapping the
order is unobservable on any platform CI runs. Mocking them apart is the only
way to assert which wins; the ordering exists for Windows, where expanduser
prefers USERPROFILE and would ignore a fixture that sets only HOME.

The lower-severity four, in tests/test_mutation_survivors.py: the `is_skip`
half of the consolidation guard (removable because every SKIP in the fixtures
also failed the shape check); `split("===ARCHIVE===", 1)`'s maxsplit (memory is
prose, and prose about this pipeline quotes its own delimiters); `>` vs `>=` at
the prompt-size cap; and `sorted(staging_contents.items())` (fixtures had one
file each, so a consolidation could narrate days in glob order).

Truncation direction, listed as a HIGH survivor, is already dead — a test
landed after the issue was written. Verified by flipping `raw[-max:]` to
`raw[:max]` rather than assuming.

Full suite 792 passed, 41 skipped.

Co-Authored-By: Max <noreply>
The clock-independent zone pair assumed `date` honours IANA zone names. Git
Bash on the Windows runners ships no tzdata, so every TZ= resolves to UTC, the
two dates coincide, and the premise assertion fired — blaming the code for the
platform's missing data. Detected and skipped with the reason instead.

Caught by CI on windows-latest across all four Python versions; the fix was
verified against the local suite, which is POSIX and never saw it.

Co-Authored-By: Max <noreply>
Review of #192. Only referenced inside a monkeypatch target string.

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt force-pushed the max/kill-mutants-175 branch from 41fa913 to 2ef231e Compare July 26, 2026 22:54
@fdaviddpt
fdaviddpt merged commit 80a2c66 into main Jul 26, 2026
12 checks passed
@fdaviddpt
fdaviddpt deleted the max/kill-mutants-175 branch July 26, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mutation testing: 8 of 34 mutations survive a green suite, two on memory handling

2 participants