Repository navigation
[CTX-1375] fix(runtime): deflake fs.list cap tests against wall-clock expiry - #2281
Merged
Merged
Conversation
… wall-clock expiry `FsListBackend::list` spends the accepted RC-1 50 ms budget on the whole call and checks the deadline at walk index 0. Every cap, containment, and security test called it, so a saturated runner only had to burn 50 ms in pre-scan work (grant matching, canonicalization, `read_dir`) plus scheduling jitter for a tiny fixture listing to abort with `E_TIMEOUT` before reaching the property under test. That is what failed `granted_prefix_lists_expected_entries_deterministically` on PR #2277. - Route all 33 non-timing test call sites through the existing `list_with_generous_deadline` helper (test-only 60 s fixture deadline), so cap/containment/security assertions are decided by entries and bytes. - Keep `large_directory_aborts_near_the_scan_deadline` as the only test that depends on wall-clock expiry (already-expired deadline plus a 2 ms live budget over 20k entries). - Assert in that test that `LIST_SCAN_BUDGET` still equals `RC1_WALL_CLOCK_BUDGET_MS`, so the tests cannot be "fixed" by loosening the production deadline. Production deadlines, `list_with_expiry`, and the bridge expiry plumbing are unchanged. No `cfg(test)` in production logic, no sleep-based retries. Closes #2280
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 46 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 20, 2026
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.
Summary
De-flakes the
fs.listunit tests merged in #2271.Quality gates (1)on PR #2277(and #2270) failed in
plugin_runtime::fs_list::tests::granted_prefix_lists_expected_entries_deterministicallywith
BridgeError { class: "budget", code: "E_TIMEOUT", message: "host call exceeded its deadline" },although neither PR touches
bitty-runtime.Root cause
FsListBackend::listapplies the accepted RC-1 50 ms budget to the whole call(
Instant::now() + LIST_SCAN_BUDGET) and checks the deadline at walk index 0,before the first entry. Cap, containment, and security tests called
list()directly, so a loaded CI runner only had to spend 50 ms in pre-scan work (grant
matching, canonicalization,
read_dir) plus scheduling jitter for a tinythree-entry fixture to abort with
E_TIMEOUTbefore reaching its assertion.#2271 already introduced a
FIXTURE_SCAN_DEADLINEhelper but only theoversized-directory test used it.
Changes
list_with_generous_deadlinehelper (test-only 60 s fixture deadline), soentry/byte caps, containment, and denial assertions are decided by entries
and bytes, never runner speed.
large_directory_aborts_near_the_scan_deadlinestays the only test thatdepends on wall-clock expiry: an already-expired deadline aborts
deterministically at the first check, and a 2 ms live budget aborts a
20k-entry walk mid-scan.
LIST_SCAN_BUDGET == RC1_WALL_CLOCK_BUDGET_MS, soa future "fix" cannot loosen the production deadline instead of opting the
tests out.
Production deadlines,
list_with_expirysemantics, and the bridge expiryplumbing are untouched. No
cfg(test)in production logic, no sleep-basedretries.
Verification
cargo nextest run -p bitty-runtime plugin_runtime::fs_list --no-fail-fast— 32 runs (4 concurrent workers x 8) with
CARGO_BUILD_JOBS=8: every run18 tests run: 18 passed, zero failures.cargo fmt --all -- --check: clean.RUSTFLAGS="-D warnings" cargo clippy --workspace --all-targets: clean.RUSTFLAGS="-D warnings" cargo check --target x86_64-pc-windows-gnu --workspace --all-targets --locked: clean.bash scripts/check-scratch-paths.sh: OK.Priority: P1 | Area: runtime | Labels: bug,P1,area:runtime | Milestone: 0.0.24 | RFC: RFC-0005 | Task: CTX-1375
Closes #2280