Repository navigation
Conversation
…ed resolver tests The autouse fixture scales the resolver budget to 0.2 s (0.5 s with grace) for the stall doubles and reads every miss as a filesystem block. Five tests also need a REAL resolution to finish, and each starts a cold resolver child because the fixture drops the pool after every test. On a loaded macOS runner that start missed the deadline, the miss was charged as a stall, and a healthy path got the stall refusal. Those tests now put the shipped budgets back before the real resolution. Fixes kirodotdev#39127 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 task done
This branch has not been deployed
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.
Problem / Motivation
Goal: The bounded path-resolution tests that check a healthy path's answer stop going red on a loaded macOS runner.
Three tests in
test/test_security_path_resolve_bounded.pyfailed together on a macOS shard (#39127):test_a_match_and_a_benign_path_keep_their_answers,test_a_matched_path_spelled_like_the_stall_wording_is_still_a_matchandtest_unc_paths_are_never_probed_on_windows. A benigntmp_pathfile gotBlocked: the path could not be verified against the sensitive-path list within the resolver budgetinstead ofNone.Why it matters
A red macOS shard blocks unrelated PRs (the run was on #38803, which touches nothing under
security/). The failure also reads like a security regression, which sends the reader into the resolver logic.Not a goal
What changed (motivation → approach → change)
_fresh_resolver_statescales the candidate and rebuild budgets to 0.2 s (0.5 s with grace) and stubs_child_blocked_in_filesystemto say every miss is a filesystem block. That is right for the stall doubles, which wait out any deadline. But some tests need a real resolution to finish. Each of them starts a cold resolver child, because the fixture shuts the pool down after every test. On a loaded runner that start can miss 0.5 s; the miss is charged as a stall (off Linux the child cannot be sampled at all), and the healthy path gets the stall refusal._path_resolve_degradedfor each one. Each failing test hit its own miss._shipped_budgets(monkeypatch)insecurity_path_resolve_bounded_helpers.pyputs the shipped candidate and rebuild budgets back. The five tests whose assertion needs a real resolution to finish call it before that resolution: the three from the issue,test_symlink_alias_is_still_resolved_on_a_healthy_filesystem, and the healthy middle step oftest_the_cooldown_is_scoped_to_the_stalled_prefix, which then puts the fixture's 0.2 s back for its last stall double.Backwards compatibility
Compatible: test-only.
Removes nothing: no product code changes.
Tests
test/security_path_resolve_bounded_helpers.py: new_shipped_budgets.test/test_security_path_resolve_bounded.py: the five tests above call it.Forced condition: a local pytest plugin (not committed) made every real resolution in those five tests answer 0.6 s late, past the fixture's 0.5 s and well inside the shipped 5 s, standing in for a cold child on a loaded runner that cannot be sampled. On main that reproduces exactly the issue's three failures, with the same
could not be verified ... within the resolver budgetrefusal. With this change all of them pass. The two symlink tests skip on this Windows host either way.Proof: not provable -- test-only change
Locally (Windows 11, Python 3.13):
test_security_path_resolve_bounded.py66 passed, 4 skipped, in about the same time as main, since a healthy resolution answers well inside either budget. Two tests intest_security_path_resolve_bounded_child.pyfail identically on main on this host and are untouched. flake8, isort, black 26.10.1 and the flake-pattern ratchet are clean; the three budget lines carry# flake-okbecause they restore budgets rather than add a short wait.Manual verification
N/A — unit coverage sufficient: the forced-condition run above is the reproduction; there is no product behavior to check by hand.
Real-machine verification
N/A -- test-only: the diff changes test files and nothing that runs in the product. A macOS runner was not available; the forced condition above stands in for its load.
Related Issues
Fixes #39127
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
🤖 Generated with Claude Code