Skip to content

fix(mutation): wire auth/key_rotation live, fixing the py3.11 --basetemp coverage bug (B3, R2 8/8)#117

Merged
brownjuly2003-code merged 1 commit into
mainfrom
fix/mutation-key-rotation-basetemp
Jun 30, 2026
Merged

fix(mutation): wire auth/key_rotation live, fixing the py3.11 --basetemp coverage bug (B3, R2 8/8)#117
brownjuly2003-code merged 1 commit into
mainfrom
fix/mutation-key-rotation-basetemp

Conversation

@brownjuly2003-code

Copy link
Copy Markdown
Owner

What

Wires serving/api/auth/key_rotation.py into the live mutation gate (B3, last serving module) by fixing the CI-only coverage bug that blocked the three prior attempts. R2 mutation coverage → 8 of 8.

Root cause (CI-only, py3.11)

The previous wiring attempts went red only on CI (py3.11) while local mutmut (py3.10) always scored 94.2%. The runner symptom was could not find any test case for any mutant → no scored mutants → gate red.

The repo's [tool.pytest.ini_options].addopts sets a relative --basetemp=.tmp/pytest-basetemp. Inside the mutmut workspace under py3.11, that relative tmp path defeats coverage.py's line→file attribution for file-I/O-heavy targets — key_rotation writes its rotated key store under tmp_path — so mutmut maps zero tests onto the generated mutants and aborts. (manager, exercised without that file I/O, tolerated it; key_rotation, exercised via manager._key_rotator + file writes, did not.)

Fix

build_workspace_pyproject strips the --basetemp addopt from the per-module workspace pyproject so pytest uses its default (absolute) basetemp. The repo's own test config is unchanged — normal dev/CI runs keep .tmp/pytest-basetemp. Then key_rotation is added to MODULE_TARGETS @ 0.90.

Verification

Reproduced and fixed on a faithful py3.11 + editable-install environment (the true CI setup, built with uv). The full scripts/mutation_report.py run — all 8 modules meet thresholds:

module score thr
retry 75.0% 75
sql_guard 100% 90
masking 95.7% 90
rate_limiter 99.2% 90
sql_builder 96.0% 90
nl_queries 94.4% 90
manager 83.9% 80
key_rotation 94.2% 90

Mutation scores meet thresholds. The --basetemp strip leaves the other 7 modules unchanged. Also dispatched mutation.yml on this branch to confirm on real CI py3.11.

The 21 residual key_rotation survivors are documented equivalents (wall-clock boundary flips on datetime.now(UTC), the revoke-prune/timer-cancel masked by load()'s blanket cancel+reprune, model_copy "key" popped from the storage payload, write_text encoding/newline platform-equivalents); every behaviour-reachable create/rotate/revoke/grace mutant is killed.

…pytest --basetemp (B3, R2 8/8)

The three prior key_rotation wiring attempts went red only on CI (py3.11) while
local py3.10 always scored 94.2%. Root cause: the repo's
[tool.pytest.ini_options] addopts sets a RELATIVE --basetemp=.tmp/pytest-basetemp.
Inside the mutmut workspace under py3.11, that relative tmp path defeats
coverage.py's line->file attribution for file-I/O-heavy targets -- auth/key_rotation
writes its rotated key store under tmp_path -- so mutmut maps zero tests to the
generated mutants and aborts with "could not find any test case for any mutant",
the module scores zero and the gate goes red.

Fix: build_workspace_pyproject strips the --basetemp addopt from the per-module
workspace pyproject so pytest uses its default (absolute) basetemp. The repo's own
test config is unchanged (normal runs keep .tmp/pytest-basetemp). Wire
serving/api/auth/key_rotation.py into MODULE_TARGETS @ 0.90.

Verified on a faithful py3.11 + editable-install reproduction (the true CI
environment): all 8 modules meet thresholds -- key_rotation 94.2% (344/365), and
every other module unchanged (retry 75.0, sql_guard 100, masking 95.7,
rate_limiter 99.2, sql_builder 96.0, nl_queries 94.4, manager 83.9).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

DORA Metrics

  • Window: last 30 days
  • Branch: main
  • Deployment frequency: 138 total / 32.2 per week
  • Lead time for changes: avg 0.31h / median 0.0h
  • Change failure rate: 70.29% (97/138)
  • MTTR: 0.25h across 3 incident(s)

@brownjuly2003-code brownjuly2003-code merged commit 5814712 into main Jun 30, 2026
21 checks passed
@brownjuly2003-code brownjuly2003-code deleted the fix/mutation-key-rotation-basetemp branch June 30, 2026 05:26
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.

2 participants