Repository navigation
chore(xtask): lint test timeouts and negative waits, and key legacy sleeps by function - #530
Merged
Merged
Conversation
… guard Short real-time timeouts in qq-core tests become one 60 s hang guard, and the stop-route checks in qq-server use now_or_never instead of a 50 ms negative wait.
Collaborator
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Stacked on #529.
Change
Timeout and negative-wait ratchets (B8).
cargo xtask lintnow counts two more patterns in test code, next to fixed sleeps:timeout(Duration::from_millis|from_secs(N), …)bounds under 10 s;timeout(..)whose expected result is the elapsed branch (.await.is_err(),.unwrap_err(),let x = timeout(..).await;followed byassert!(x.is_err()), or.is_ok();followed byassert!(!x)).Both ratchet like the sleep count, in one
CEILINGSconstant: above the ceiling fails, and below it fails until the ceiling comes down.// lint: allow(timeout) <reason>is the escape hatch. It follows thelint: allow(sleep)convention, which chore: strip comments from code and config #504 already kept as the only comment the no-comments rule allows.within()hang guard.crate::test_support::within(fut)in qq-core gives one 60 s guard, and itsDebugfailure names the caller's location. 144 short qq-core timeouts becamewithin(..), including all of settlement.rs and every 1 s bound in qq-core. A bound becamewithin()only when it awaited a future that must finish (.await.unwrap()/.expect()). Real-time bounds that are the behavior under test stay counted, for examplecompleted_compaction_does_not_restart_the_original_duration(900 ms) andpipe_read_failure_is_unobserved…(a 5 s bound against a shellsleep 30). Also, I removed one expect message's "within one second" claim.Negative waits. The two 50 ms "a stop must not be requested" checks in
the_stop_route_signals_only_a_host_that_opted_in_and_requires_the_tokennow usenow_or_never(). The route has already answered (401/404) by then, and it writes the stop signal before it responds, so the absence can be checked immediately. The other 9 are left counted.Legacy lists keyed by function.
xtask/src/legacy-{sleeps,timeouts,negative-waits}.txtnow key each entry by file, enclosing fn, and whitespace-free call text, so moving lines no longer breaks lint. The enclosing fn is found with brace tracking, so a nestedfn streaminside a test no longer takes over as the key. Moving an occurrence to another function, or changing its call, still fails.pr-status.sh. Each check is judged by its latest run, ordered by Actions run ID. ACANCELLEDcheck is ignored when a newer run of the same workflow exists, for example one cancelled when a label was added..github/scripts/test-pr-status.shdrives the script with a stubghacross 5 fixtures and runs ascheck::tests::pr_status_judges_each_check_by_its_latest_run. Both script paths areCROSS_CRATE_INPUTSfor xtask. The.agents/copies are identical.Docs.
docs/runbooks/testing.mdtest policy coverswithin(), both new ratchets, the function keying, and the allow marker. Both copies of the babysit-pr skill say how superseded runs count.Verification
short_timeouts_are_counted_and_long_or_allowed_ones_are_notnegative_waits_are_counted_at_any_duration_and_cleanup_branches_are_noteach_wait_ratchet_fails_above_and_below_its_ceilinga_wait_is_keyed_by_its_enclosing_function_not_a_nested_onelegacy_entries_follow_their_function_and_cannot_be_spent_twice: shifted lines and reflowed calls pass; another file, fn, or call failsthe_checked_in_baselines_match_the_ceilingstest-pr-status.shagainst the old script fails witha run superseded by a label change: want [[],[]], got [["gate","platform"],[]]and passes with the new one.{"checks":{"total":15,"pending":[],"failing":[]},"ready":true}.cargo nextest run -p qq-core -p qq-server -p xtask: 1490 passed. qq-core still takes about 4.2 s, becausewithin()only lengthens the guard and not the waits.cargo xtask check --fullpassed on 0f8f34a: 3008/3008 workspace tests, plus 224/224 for the minimal provider.Known impact
lint::tests::replacing_a_sleep_cannot_spend_a_removed_legacy_entrybecamelegacy_entries_follow_their_function_and_cannot_be_spent_twice. It keeps every old case except "shifted lines fail", which now passes by design.withinimport in the all-cfg(unix)execution_context.rs. 3f9936e fixed it by using the qualified path.select!againstsleep. 47 short timeouts remain in headless, server, TUI, MCP, auth, host, and some qq-core integration tests, wherewithin()is not available because it lives in qq-core's private test support.