Repository navigation
Send back expectation changes that are not on the CI runner's key - #153
Merged
Merged
Conversation
reviewbot/expectation_keys.py compares each changed test file's Expectations blocks
before and after: only ("cuda", 8) / ("cuda", (8, 6)) may change, other keys keep
their value (demotion to (None, None) allowed), runner values may not move >5% of
the block's scale, no tolerance may loosen. A violation is validation feedback on the
normalizer's retry budget; one that survives is flagged in the PR body.
TASK_EXPECTATION_KEY_CHECK=0 turns it off.
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.
serge's expectation updates mostly don't have the shape maintainers accept. Of the serge PRs opened in Sept–Oct 2026, the 3 value updates that touched only the CI runner's
("cuda", 8)entry all merged cleanly (huggingface/transformers#48515, #49068, #49076). The one that overwrote("cuda", None)merged with a wrong value (#48580). The open queue overwrote(None, None)(#47616, #49480), rewrote XPU values with no XPU evidence (#48955), loosened tolerances (#49143) and edited plain literals in place (#47840). The prompt already asked for a device key. This PR enforces it.reviewbot/expectation_keys.pyparses each changed test file before and after the patch (ast), maps everyExpectations({...})block key → value, and reports:("cuda", 8)/("cuda", (8, 6))(A10G, compute capability 8.6). Demotion is allowed: an existing value moved unchanged to(None, None), which is what #48198 did;(None, None)value that isn't an existing one;atol/rtol, in any patch;Expectationsblock. Test-code fixes are left alone (#47697 renamed a config key).Wiring.⚠️ Expectation change not in the maintainer shape" section listing the problems.
_validate_patchruns it after the patch applies, before the brevity pass and the normalizer. A violation resets the worktree and comes back as correction feedback (rule text included), using the sameTASK_NORMALIZE_MAX_RETRIESbudget. If a violation survives the budget, the PR still opens, with a "TASK_EXPECTATION_KEY_CHECK=0turns the check off.Checked against real PRs. Every serge PR since 2026-07-20, comparing each test file at its base and head commits:
Expectationswith the runner key.The prompt side (the guidance now names the runner key, and a routing bug kept it from reaching most assertion groups) is in huggingface/transformers-ci#215.
Tests:
tests/test_expectation_keys.py(17 cases cut down from the PRs above) andExpectationShapeValidationTestsintests/test_tasks.py. Full suite: 1390 passed.🤖 Generated with Claude Code