diff --git a/docs/development/overhead-budgets.md b/docs/development/overhead-budgets.md index 2607db8b..485cdcd0 100644 --- a/docs/development/overhead-budgets.md +++ b/docs/development/overhead-budgets.md @@ -88,6 +88,32 @@ Under bursty load (every core busy 0.7 s, idle 0.7 s) the old sequential harness After the alternating harness, on the same machine and load: 0 of 12 runs failed under load (overhead 0.119 to 0.191 ms, median noise 0.044 ms) and 0 of 10 quiet (0.117 to 0.160 ms, median noise 0.024 ms). The worst loaded run is still close to the budget, so a rare failure on a very busy runner remains possible; the noise in the message tells it apart. +## Moved budgets + +### Files sensor 6.0 to 7.0 µs per event (2026-11-30, owner's decision) + +`FILES_SENSOR_BUDGET` in `tests/engine/test_sensors_overhead.py` moved from 6.0 to 7.0 µs per audit event. + +Why: from 2026-11-28 every Windows 3.14 run measured about 1.33 times slower than before on every row, including the +side with no sensor enabled and the bare audit hook, with the same runner image (`win25-vs2026/20261123.321`), the same +Python (3.14.10) and no change to the sensor code: + +| Windows 3.14 run | bare audit hook | files off-side minimum | files, matcher on, 32 values | +|---|---|---|---| +| last passing (`a925b7c6`) | 0.031 µs | 0.554 µs | 4.42 µs | +| failing (`a6e300ba`) | 0.043 µs | 0.737 µs | 6.04 µs | + +The cause is most likely the machine, not the code: the `windows-latest` pool appears to have moved these jobs to slower +hardware, since the code-free rows slowed by the same factor. If a later run measures back near the earlier numbers, +the budget can return to 6.0 µs. The worst failing run measured 6.20 µs. + +A dedicated sbx cloud box (Linux, 2 CPUs, Python 3.14, 6 rounds of `main` at `a6e300ba`) shows +the same margin problem away from GitHub's pool: the 32-value row measured 5.01 to 6.27 µs, and one round of six went +over 6.0. On a small machine 6.0 µs was already at the edge. Inlining the audit delivery, the journal append and the matcher check gained +about 2.5 % in an alternating A/B against `origin/main` (32 values, minimum 3509 to 3417 ns locally), not the 15 to 20 % +the slower runner needs, so that change was not kept. 7.0 µs leaves about 12 % over the worst run on either machine. The other sensor +budgets are unchanged: the processes sensor measured 4.86 µs on the slower runner against 6.0. + ## Removed budgets ### security-logs hook per request (removed 2026-11-04, owner's decision) diff --git a/tests/engine/test_sensors_overhead.py b/tests/engine/test_sensors_overhead.py index 3377442d..f13e217a 100644 --- a/tests/engine/test_sensors_overhead.py +++ b/tests/engine/test_sensors_overhead.py @@ -23,7 +23,8 @@ PROCESSES_SENSOR_BUDGET = 6.0e-6 # us/event: minimise + offer, against the flag test # us/event on a hot set of 64 files (the sensor remembers 256 paths): lookup + offer. A path it has not seen costs about # 11 us once (pattern, mask, collapse); that is not budgeted here, it is paid per new file beside the open() itself. -FILES_SENSOR_BUDGET = 6.0e-6 +# 7.0 since 2026-11-30 (owner's decision): a slower Windows runner, docs/development/overhead-budgets.md +FILES_SENSOR_BUDGET = 7.0e-6 CHILD = """ import json, sys, time diff --git a/tests/pytest_plugin/test_plugin_masked_node_ids.py b/tests/pytest_plugin/test_plugin_masked_node_ids.py index 86ead973..323e41c2 100644 --- a/tests/pytest_plugin/test_plugin_masked_node_ids.py +++ b/tests/pytest_plugin/test_plugin_masked_node_ids.py @@ -7,6 +7,7 @@ from __future__ import annotations import json +import shutil from typing import Any import pytest @@ -46,6 +47,9 @@ def _write_baseline(pytester: pytest.Pytester) -> list[dict[str, Any]]: def _rerun(pytester: pytest.Pytester, source: str) -> dict[str, Any]: """A run against the baseline in its own process, so no leftover connection makes the SQL verdict incomplete.""" pytester.makepyfile(test_a=source) + # an older pytest validates its rewritten-bytecode cache by mtime and size alone: a same-size source written in the + # same second would run the first run's test + shutil.rmtree(pytester.path / "__pycache__", ignore_errors=True) pytester.runpytest_subprocess(*_RUN, "--sharpit-baseline=baseline.json", "--sharpit-report=report.json") return json.loads((pytester.path / "report.json").read_text(encoding="utf-8"))["baseline"]