Skip to content

fix(benchmarks): apply limit after seeded shuffle - #33

Merged
dq-ai-dev merged 2 commits into
ApodexAI:mainfrom
Achordchan:fix/sample-after-shuffle
Sep 8, 2026
Merged

fix(benchmarks): apply limit after seeded shuffle#33
dq-ai-dev merged 2 commits into
ApodexAI:mainfrom
Achordchan:fix/sample-after-shuffle

Conversation

@Achordchan

Copy link
Copy Markdown
Contributor

Summary

Benchmark runs now load the full filtered question set before applying the seeded shuffle and --limit. Different seeds can therefore select different question subsets, while --no-shuffle continues to select the canonical prefix.

Fixes #32

Changes

  • stop truncating the dataset inside load_questions() before shuffling
  • retain the existing post-shuffle limit as the single selection boundary
  • add regression coverage for seed-dependent sampling and canonical no-shuffle ordering
  • document the fix in the unreleased changelog

Verification

  • .venv/bin/pytest tests/test_benchmark_runner_sampling.py -q — 2 passed
  • .venv/bin/ruff check benchmarks/public/runner/run_subprocess.py tests/test_benchmark_runner_sampling.py — passed
  • .venv/bin/python tools/import_smoke.py — 338/338 modules imported
  • full .venv/bin/pytest -q — 1707 passed, 4 skipped, 2 failed outside this change
    • the network failure also reproduces on untouched origin/main because this environment resolves www.iana.org to reserved address 198.18.1.21
    • the TUI timing failure passed on isolated rerun

The repository-wide Ruff baseline currently reports existing formatting and lint findings; the modified Python files pass ruff check, and the new test file passes the formatter check.

AI assistance was used during implementation. I reviewed the final diff and ran the verification listed above.

@dq-ai-dev

Copy link
Copy Markdown
Collaborator

The regression coverage makes sense, but could we combine these into one parameterized test for the two seeds and --no-shuffle, sharing the setup? A loader stub that honors limit would let the selected-ID assertions catch the original bug directly, without also asserting that limit was omitted from the call.

@Achordchan

Copy link
Copy Markdown
Contributor Author

Thanks, that makes sense. Updated in 2cff817: the two seeds and --no-shuffle now share one parameterized test, and the loader stub honors limit. The assertions check the selected IDs directly; the assertion about the loader call is gone.

All three cases pass, and Ruff passes. I also checked the regression by restoring the original limit-before-shuffle behavior in the test process: both seeded cases fail on the selected IDs, while --no-shuffle still passes.

@dq-ai-dev

Copy link
Copy Markdown
Collaborator

Thanks @Achordchan, this looks good to go. Merging...

@dq-ai-dev
dq-ai-dev merged commit b37b624 into ApodexAI:main Sep 8, 2026
1 check 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.

--limit truncates before the shuffle, so --seed and --runs pick the same questions every time

3 participants