-
Notifications
You must be signed in to change notification settings - Fork 1
perf: skip contended retention housekeeping #418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
codeforester
merged 53 commits into
main
from
enhancement/386-20261003-perf-retention-serializes-concurrent-invocations-on-an-untim
Oct 5, 2026
+138
−12
Merged
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
30e9e71
ci: cover all consumer fixtures in style and strict typing gates
codeforester 710208b
ci: keep Markdown examples under the documentation gate
codeforester 8bb0562
fix: preserve consumer logging ownership and routing
codeforester 6556889
perf: reuse logging locks and cache source paths
codeforester c87eeda
fix: enforce native Windows bundle retention safely
codeforester f0f9ece
ci: satisfy Windows retention style and typing checks
codeforester 9679928
perf: skip contended retention housekeeping
codeforester a166e45
perf: cache second-precision human log timestamps
codeforester baf0ff3
Merge branch 'enhancement/381-20261003-perf-lifecycle-logging-costs-1…
codeforester c7c21ae
Merge branch 'bug/378-20261003-bug-run-bundle-retention-is-inoperativ…
codeforester d352e43
Merge remote-tracking branch 'origin/main' into ci/393-20261003-ci-ru…
codeforester 6ee5cc9
Merge branch 'ci/393-20261003-ci-ruff-check-and-mypy-do-not-cover-the…
codeforester f9787b1
Merge branch 'bug/387-20261003-bug-configure-logger-closes-consumer-o…
codeforester 3780821
Merge branch 'enhancement/381-20261003-perf-lifecycle-logging-costs-1…
codeforester 333ac40
Merge branch 'bug/378-20261003-bug-run-bundle-retention-is-inoperativ…
codeforester 6e4394f
fix: avoid racing Windows lock-sidecar initialization
codeforester bd210cd
Merge branch 'enhancement/381-20261003-perf-lifecycle-logging-costs-1…
codeforester f1bda9a
Merge branch 'bug/378-20261003-bug-run-bundle-retention-is-inoperativ…
codeforester 73770a5
ci: separate sustained persistence cost from hosted filesystem tails
codeforester bdf26d9
Merge branch 'ci/393-20261003-ci-ruff-check-and-mypy-do-not-cover-the…
codeforester c3eb5dc
Merge branch 'bug/387-20261003-bug-configure-logger-closes-consumer-o…
codeforester 0597aaa
Merge branch 'enhancement/381-20261003-perf-lifecycle-logging-costs-1…
codeforester b24372d
Merge branch 'bug/378-20261003-bug-run-bundle-retention-is-inoperativ…
codeforester 8ca0027
docs: regenerate public API signatures for configuration trust options
codeforester 9191a7e
Merge branch 'bug/387-20261003-bug-configure-logger-closes-consumer-o…
codeforester b7fd5df
Merge branch 'enhancement/381-20261003-perf-lifecycle-logging-costs-1…
codeforester 6e9d231
Merge branch 'bug/378-20261003-bug-run-bundle-retention-is-inoperativ…
codeforester 857e52e
Merge main for branch maintenance (#426)
codeforester b48e444
Merge updated PR #414 for branch maintenance (#426)
codeforester c4af745
Merge updated PR #417 for branch maintenance (#426)
codeforester 66ce268
Merge updated PR #415 for branch maintenance (#426)
codeforester e82ce1f
Merge updated PR #416 for branch maintenance (#426)
codeforester b00c288
fix: defer contended retention index refresh
codeforester 9db3464
fix: preserve logger routing and levels
codeforester fbcc75c
fix: harden logging caches and sidecar locks
codeforester 841d1e6
fix: handle Windows retention reparse leaves
codeforester 72336ec
ci: expose consumer typing source coverage
codeforester 311c280
test: verify retention converges after contention
codeforester ae935d1
fix: serialize logger reconfiguration
codeforester f15f2c2
style: clean retention convergence test
codeforester 990cb66
style: format typing gate test
codeforester 50b0695
style: format sidecar lock condition
codeforester c8e829d
Merge remote-tracking branch 'origin/enhancement/381-20261003-perf-li…
codeforester 496decf
style: format retention lock logging
codeforester 0f35aae
Merge remote-tracking branch 'origin/main' into ci/393-20261003-ci-ru…
codeforester 6efcb60
test: cover debug logging with consumer handlers
codeforester 436807b
test: cover concurrent and inherited logging state
codeforester 2a916ea
test: verify Windows retention pinning and reparse cleanup
codeforester 3f58457
Merge remote-tracking branch 'origin/ci/393-20261003-ci-ruff-check-an…
codeforester 92cad10
Merge remote-tracking branch 'origin/bug/387-20261003-bug-configure-l…
codeforester e15763e
Merge remote-tracking branch 'origin/enhancement/381-20261003-perf-li…
codeforester 2f96072
Merge remote-tracking branch 'origin/bug/378-20261003-bug-run-bundle-…
codeforester b8feb66
Merge main into retention contention performance fix
codeforester File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import logging | ||
| import os | ||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
| from unittest.mock import patch | ||
|
|
||
| from base_cli import _runtime as runtime | ||
|
|
||
|
|
||
| def test_contended_retention_returns_without_waiting(tmp_path: Path) -> None: | ||
| # A separate process faithfully models advisory lock contention on both OSes. | ||
| code = """ | ||
| import sys | ||
| from pathlib import Path | ||
| from base_cli._runtime import _retention_lock | ||
| with _retention_lock(Path(sys.argv[1])): | ||
| print('locked', flush=True) | ||
| sys.stdin.readline() | ||
| """ | ||
| env = {**os.environ, "PYTHONPATH": str(Path(runtime.__file__).resolve().parents[1])} | ||
| child = subprocess.Popen( | ||
| [sys.executable, "-c", code, str(tmp_path)], | ||
| stdin=subprocess.PIPE, | ||
| stdout=subprocess.PIPE, | ||
| stderr=subprocess.PIPE, | ||
| text=True, | ||
| env=env, | ||
| ) | ||
| try: | ||
| assert child.stdout.readline().strip() == "locked" | ||
| probe = subprocess.run( | ||
| [ | ||
| sys.executable, | ||
| "-c", | ||
| """ | ||
| import sys | ||
| from pathlib import Path | ||
| from base_cli._runtime import prune_run_bundles, refresh_run_bundle_index | ||
| root = Path(sys.argv[1]) | ||
| prune_run_bundles(root, max_bundles=1) | ||
| refresh_run_bundle_index(root) | ||
| """, | ||
| str(tmp_path), | ||
| ], | ||
| env=env, | ||
| capture_output=True, | ||
| text=True, | ||
| timeout=5, | ||
| ) | ||
| assert probe.returncode == 0, probe.stderr | ||
| finally: | ||
| child.communicate("done\n", timeout=5) | ||
|
|
||
|
|
||
| def test_contended_index_refresh_is_eventually_consistent(tmp_path: Path) -> None: | ||
| logger = logging.getLogger("retention-index-refresh") | ||
| with patch.object(runtime, "_retention_lock", side_effect=BlockingIOError("busy")): | ||
| runtime.refresh_run_bundle_index(tmp_path, logger=logger) | ||
|
|
||
|
|
||
| def test_concurrent_passes_converge_after_a_serial_pass(tmp_path: Path) -> None: | ||
| for index in range(8): | ||
| bundle = tmp_path / f"run-{index:02d}" | ||
| bundle.mkdir() | ||
| (bundle / "run.json").write_text( | ||
| f'{{"run_id": "run-{index:02d}", "status": "ok", "started_at": "2020-01-01T00:00:00Z"}}', | ||
| encoding="utf-8", | ||
| ) | ||
| code = """ | ||
| import sys | ||
| from pathlib import Path | ||
| from base_cli._runtime import prune_run_bundles | ||
| prune_run_bundles(Path(sys.argv[1]), max_bundles=3) | ||
| """ | ||
| env = {**os.environ, "PYTHONPATH": str(Path(runtime.__file__).resolve().parents[1])} | ||
| children = [ | ||
| subprocess.Popen( | ||
| [sys.executable, "-c", code, str(tmp_path)], | ||
| env=env, | ||
| stdout=subprocess.PIPE, | ||
| stderr=subprocess.PIPE, | ||
| ) | ||
| for _ in range(8) | ||
| ] | ||
| for child in children: | ||
| _stdout, stderr = child.communicate(timeout=10) | ||
| assert child.returncode == 0, stderr.decode() | ||
|
|
||
| runtime.prune_run_bundles(tmp_path, max_bundles=3) | ||
| assert len([path for path in tmp_path.iterdir() if path.is_dir() and path.name.startswith("run-")]) <= 3 |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.