Skip to content

Prove the class-split bound without a clock - #199

Merged
firegiant9000 merged 1 commit into
mainfrom
test/class-split-bound-without-clock
Nov 22, 2026
Merged

firegiant9000 merged 1 commit into
mainfrom
test/class-split-bound-without-clock

Conversation

@firegiant9000

Copy link
Copy Markdown
Owner

What changed

One test in tests/ImportWorker.Tests/ClassSplitBoundsTests.cs. No product code.

A_page_with_many_headings_is_read_in_bounded_time asserted that a 60-heading page is read in under 10 seconds of wall-clock time. It is replaced by A_page_with_many_headings_is_not_split_and_reads_no_window, which proves the R127 bound without a clock:

  • SplitClasses is called with a token that is already cancelled.
  • With three titles it throws OperationCanceledException, because the split checks the token before every window it reads.
  • With sixty titles it returns null. It gave up at MaxSplitClasses before reading any window.
  • The page is still read end to end, and yields one class at most.

Why

The old test failed once in CI (run 44956465891, 2026-11-21) and passed on re-run. It took 12 s on the runner and 7 to 16 ms locally. Three test assemblies went silent for 32 s and resumed in the same half second, so the runner stalled; the page was not slow to read. A wall-clock bound cannot tell those apart.

How it was checked

  • With MaxSplitClasses raised to 100 locally, the new test fails with OperationCanceledException. The change was reverted.
  • dotnet test tests/ImportWorker.Tests -c Release: 307 passed, 0 failed.

What this does not fix

The CI failure surfaced as a RegexMatchTimeoutException: the 1,000 ms detection regex timeout is wall-clock too, so a runner that stalls for over a second during a match can still fail any detection test. That is by design in the product (R151) and was 1 failure in the last 100 CI runs. Nine other tests in the suite still assert on elapsed time with 2 to 30 s bounds.

A_page_with_many_headings_is_read_in_bounded_time failed once in CI when the runner stalled: 12 s for a page that reads in 7 to 16 ms. The test now proves the R127 bound by behaviour: with a cancelled token, sixty titles return null (no window read) where three titles throw.
@firegiant9000
firegiant9000 merged commit 6dc3fc8 into main Nov 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant