Skip to content

test: unblock main: stale bytecode in the masked node id rerun, files sensor budget 7.0 us - #366

Merged
ffroliva merged 3 commits into
mainfrom
fix/main-red-tests
Nov 30, 2026
Merged

ffroliva merged 3 commits into
mainfrom
fix/main-red-tests

Conversation

@ffroliva

@ffroliva ffroliva commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

tests/pytest_plugin/test_plugin_masked_node_ids.py::test_masked_baseline_proves_a_real_fix fails on the lowest leg (Python 3.12, --resolution lowest-direct, pytest 8.2.0) on every run of main since 2026-11-28, which turns every open pull request red, including the Dependabot updates.

Cause

The test writes test_a.py with three queries per test, runs it in process, then rewrites it with one query and reruns it in a subprocess. The two sources have the same size (range(3) and range(1)) and are written within the same second. pytest 8.2 validates its assertion-rewrite bytecode cache by source mtime and size only, so the rerun executed the cached three-query test and the baseline reported existing: 2, fixed: 0. Newer pytest releases in uv.lock do not reuse the stale cache, which is why the locked legs pass.

Fix

_rerun removes the test directory's __pycache__ before the rerun. Test-only change.

finding test red output
stale rewritten bytecode reused on the lowest leg test_masked_baseline_proves_a_real_fix AssertionError: assert 0 == 2 (lowest-direct venv, pytest 8.2.0, before the fix); 10 passed after

Files sensor overhead budget 6.0 -> 7.0 us per event

tests/engine/test_sensors_overhead.py::test_the_sensors_overhead_budgets_by_event_count also fails on Windows 3.14 since the same date (files sensor, matcher on, 32 values: 6.04 to 6.20 us/event against a 6.0 us budget). The runner image (win25-vs2026/20261123.321) and Python (3.14.10) are unchanged; every measurement on that leg, including the side with no sensor enabled and the bare audit hook, is about 1.33x slower than on the last green run (off-side minimum 0.554 -> 0.737 us/event). Hot-path inlining (audit delivery, journal append, matcher check) gained about 2.5 % in an alternating A/B against origin/main, not the 15 to 20 % needed, and was not kept. A dedicated 2-CPU sbx box also measured 5.01 to 6.27 us on the same row, one round of six over 6.0. The owner approved moving FILES_SENSOR_BUDGET to 7.0 us; the measurements are recorded in docs/development/overhead-budgets.md under Moved budgets. The other budgets are unchanged.

…the masked node id tests

pytest 8.2 (the lowest-direct resolution) validates its assertion-rewrite cache by source mtime and size; the rerun wrote a source of the same size within the same second and ran the first run's three-query test, so the baseline never saw the fix.

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Windows 3.14 runners measure every row about 1.33x slower since 2026-11-28, the sensor-free rows included, with the image, Python and sensor code unchanged; a 2-CPU sbx box also crosses 6.0 us in one round of six. The measurements are recorded in docs/development/overhead-budgets.md (Moved budgets).

Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
@ffroliva ffroliva changed the title test: clear the rewritten-bytecode cache before the masked node id rerun test: unblock main: stale bytecode in the masked node id rerun, files sensor budget 7.0 us Nov 30, 2026
@ffroliva
ffroliva marked this pull request as ready for review November 30, 2026 14:12
@ffroliva
ffroliva merged commit 4ebb48c into main Nov 30, 2026
51 checks passed
@ffroliva
ffroliva deleted the fix/main-red-tests branch November 30, 2026 16:40
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.

1 participant