fix(mutation): wire auth/key_rotation live, fixing the py3.11 --basetemp coverage bug (B3, R2 8/8)#117
Merged
Conversation
…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>
DORA Metrics
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Wires
serving/api/auth/key_rotation.pyinto 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].addoptssets a relative--basetemp=.tmp/pytest-basetemp. Inside the mutmut workspace under py3.11, that relative tmp path defeatscoverage.py's line→file attribution for file-I/O-heavy targets —key_rotationwrites its rotated key store undertmp_path— so mutmut maps zero tests onto the generated mutants and aborts. (manager, exercised without that file I/O, tolerated it; key_rotation, exercised viamanager._key_rotator+ file writes, did not.)Fix
build_workspace_pyprojectstrips the--basetempaddopt 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. Thenkey_rotationis added toMODULE_TARGETS@ 0.90.Verification
Reproduced and fixed on a faithful py3.11 + editable-install environment (the true CI setup, built with
uv). The fullscripts/mutation_report.pyrun — all 8 modules meet thresholds:→
Mutation scores meet thresholds. The--basetempstrip leaves the other 7 modules unchanged. Also dispatchedmutation.ymlon 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 byload()'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.