Repository navigation
test: bound the writer-rollover follow test's wait on what it emitted - #26732
Conversation
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. This is a test-only change: the test now stops when follow emits [DESIGN-REVIEWED] e50eaf4 Description read[DESCRIPTION-READ] aaf35ff4fae425992236c893b720628dc7d8183cfc659249eb5418337e0127e4 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
test_follow_allows_real_writer_rollover stopped follow only when the fake sleep saw exactly its third tick. On a macOS run (#24662) one tick went to a neighbour thread through the then-shared stdlib sleep, the count passed 3 for good, and follow polled until the 180s per-test timeout, though it had already printed the rolled-over records. #24928 moved the sleep onto a private ManualClock, which removes that neighbour. The stop is still an exact count, so any missed or extra tick hangs again. Stop once follow has emitted the rollover, and fail with the emitted text after 1000 ticks (no wall-clock cost). The assertion that the real writer's rollover is followed is unchanged. Closes #24662
8ff37a9 to
e50eaf4
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: test (1 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: test-only change: the writer-rollover follow test now stops on what follow emitted instead of an exact tick count, with a 1000-tick cap so a missing tick fails fast instead of hanging.
Problem / Motivation
Goal:
test_follow_allows_real_writer_rollovereither passes or fails fast, and never sits on the 180 s per-test timeout.On a macOS run the
[reader-open]case hitFailed: Timeout >180.0s(run 40420314931, job 121913820382, PR #24648 head0fbb51667d9c). That log's captured stdout already holdsxxx…\nafter-1\nafter-2\n, so follow had read the rolled-over file. What never came was theKeyboardInterruptthat ends the test.Why it matters
A hung test costs a macOS shard 3 minutes, turns the shard red on PRs that do not touch this code, and gets re-run as a flake.
Not a goal
_tail_log_fileoropen_log_file_for_tail. The follow code did what it should in the failing run (it emitted both rolled-over records), so this is a test defect, not a follow bug.What changed (motivation → approach → change)
tickraisedKeyboardInterruptonly whenlen(ticks) == 3. When the run failed (Oct 26) the test patchedcli_server.time.sleep, which is the stdlib module, so any other thread in the worker that slept also calledtick. One of those calls took tick refactor: remove dead legacy compatibility shims #3 (and swallowed itsKeyboardInterrupt), the count went past 3, and the equality never held again. Follow then looped on a zero-cost fake sleep for good. test: keep two more test files' clocks off the shared stdlib module #24928 (68fd509f6, merged Oct 30) moved these tests onto a privateManualClock, which removes the neighbour thread, but the stop is still an exact count: any missed or extra tick brings the hang back.ticknow collects what follow has emitted and stops follow onceafter-2\nis out, which is the event the test waits for. It raisesAssertionErrorwith the emitted text after 1000 ticks, so a missed rollover fails at once instead of hanging (sleep is the fake, so the cap costs no wall-clock time). The rotation trigger points are unchanged, and the test still asserts that the writer's rolled file holdsafter-1\nafter-2\nand that follow printed the seed plus both rolled records.Backwards compatibility
Compatible: test-only change; no production code or contract is touched.
Removes nothing: the diff changes one test's stop condition and keeps every assertion it had.
Tests
test/test_windows_logs_and_diagnostics.py::test_follow_allows_real_writer_rollover(both cases): stops on the emitted rollover with a 1000-tick cap, and keeps its assertions.Proof: not provable -- test-only change
Rate, whole test file run alone at
-n 0on Linux, each run killed at 30 s if it hangs. "Neighbour" loads a local-only pytest plugin that starts one daemon thread callingtime.sleep(0.0005)in a loop, standing in for the background threads (skill catalog, sel writer, pools) seen in the failing job's stack dump:68fd509f6^)[reader-open])origin/main271808883The plugin is not committed.
test/test_flake_pattern_ratchet.pyandtest/test_wait_discipline_ratchet.pypass locally with this change (137 passed together with this file).Manual verification
N/A — unit coverage sufficient: the change is a test's stop condition, measured by the repeated runs above.
Related Issues
Closes #24662
Sibling sweep
Swept:
git grep -nE "len\((ticks|waits)\) == [0-9]+:" -- test/test_windows_logs_and_diagnostics.pySibling: test/test_windows_logs_and_diagnostics.py:153 -- not affected --
test_windows_follow_handles_truncationalso stops onlen(waits) == 3, but since #24928 its sleep is a private clock that only the follow loop calls and no writer races its reader, so no tick can be missed; left for its own change if it ever flakesPattern harvest
Rule candidate: review-prompt
Pattern: a fake-sleep test that ends an endless poll loop only on an exact tick count, with no cap, hangs to the per-test timeout when one tick is missed
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.