Skip to content

Tests: the skipped-menu linearity check times each size as the best of five - #16170

Merged
danielhanchen merged 1 commit into
mainfrom
tests-linear-menu-timing-best-of-five
Oct 30, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
tests-linear-menu-timing-best-of-five

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

studio/backend/tests/test_web_fetch_extraction.py::test_stray_end_tags_in_a_skipped_menu_stay_linear failed in (Python 3.13, a-f) on an unrelated PR (the staging run for #16071, a LoRA change):

AssertionError: [0.01457291399992755, 0.41335185699995236]
assert 0.41335185699995236 < (0.01457291399992755 * 24)

The test times one call of html_to_markdown at 1000 and at 8000 repeats and requires the second to stay under 24x the first (8x input, so linear growth is about 8x and quadratic about 64x). Each size is a single call, and the small one takes only about 10 to 15 ms, so a single descheduling of either call on a shared runner moves the ratio. Here it read 28x. Locally the single-call ratio ranges 6.4x to 8.8x over 15 trials for both inputs, so the extractor is linear; the measurement was noisy. The test came in with #13489.

Fix

Each size is timed as the best of five calls on the same input. The bound and the claim are unchanged: eight times the input must cost less than 24 times the time. The minimum discards a call that lost the CPU and keeps the cost of the code itself.

Verification

  • Locally the best-of-three ratio stays between 7.8x and 8.2x for both inputs over 5 trials, against single-call ratios up to 8.8x. Three reruns of the changed test pass.
  • Sabotage: wrapping html_to_markdown with extra work quadratic in the input length fails the test ([0.022, 0.814], 36x), so the best-of-five timing still catches superlinear growth.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T17:30:47.978370Z 3cd84fa Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 3cd84fa936

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@danielhanchen
danielhanchen merged commit 19a5770 into main Oct 30, 2026
@danielhanchen
danielhanchen deleted the tests-linear-menu-timing-best-of-five branch October 30, 2026 18:04
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