Skip to content

Catch reshaped assertions, verify shared-fixture patches, drop the checker list - #117

Merged
tarekziade merged 1 commit into
mainfrom
tarek/verify-scope-and-guard
Sep 7, 2026
Merged

tarekziade merged 1 commit into
mainfrom
tarek/verify-scope-and-guard

Conversation

@tarekziade

Copy link
Copy Markdown
Collaborator

Three gaps behind the 2026-09-04..06 task PRs on transformers.

expectation_guard: an assertion rewrite wearing a method call

Rule 2 asks whether removing literals leaves both sides identical, so a new identifier reads as a real code change. transformers#48553 added .flatten() to output.sequences.squeeze().tolist() and was therefore classified a real fix, keeping its verification claim — for a patch that cannot make the test pass.

A residue difference explained entirely by shape/ordering operations appearing on one side is now expectation_only, with its own sentence in reason() ("rewrites how an assertion compares its values… a shape or ordering difference is a sign the inputs changed"). .to(...), .cpu(), .float() are deliberately not in the set: those change the value rather than its shape, so a patch adding one keeps its claim. The module stays a label, not a blocker.

verify: the gate cannot see what it does not run

extract_verify_targets returns the failure group's own node-ids, which is full coverage for a patch confined to those tests and none at all for one that edits scaffolding they share. transformers#48425 changed the input_audio cached_property from one 2-channel sample to two mono samples, verified its 6 targeted tests green, and left test_to_rus_speech — same class, same fixture — comparing a nested list against a flat expectation. #48553 then tried to paper over that.

patch_needs_collateral(patch, node_ids) spots a hunk that shows scaffolding (setUp, tearDown, setUpClass, @cached_property, @classmethod, @property) or a def that is not one of the targeted tests, and _make_verify_gate turns the collateral suite on for that run even when VERIFY_RUN_COLLATERAL is off. The mechanism already existed; it just had to be asked for.

It is judged from the hunk text alone — the patch is the model's proposal, so its @@ headers carry no function context to trust. A change inside a targeted test's body, or an expectation hunk whose context shows no def, does not trigger it.

prod.yaml: the checker list had drifted

TASK_NORMALIZE_COMMAND spelled out 23 checker names instead of calling make fix-repo, and was missing noisy_comments, reviewers and add_dates — all three of which transformers' CI runs. A patch could clear this gate and still land a red check-code-quality / Check repository consistency. (noisy_comments is the one that stings: it flags comments that restate the code, which is exactly what an LLM patch adds.)

transformers' Makefile derives fix-repo from the CI sets precisely so the list cannot drift, and its utils/checkers-requirements.txt is already written for this --network none sandbox (per-checker opt-in). TRANSFORMERS_SKIP_CHECKER_REQUIREMENTS=1 keeps even those installs from burning retries. make is guaranteed by docker/Dockerfile.task-runner.

948 passed, 3 skipped (tests/test_app.py deselected — it needs flask, absent from my local env and unrelated).

…ecker list

Three gaps behind the 2026-09-04..06 task PRs on transformers.

expectation_guard: rule 2 asks whether removing literals leaves both sides
identical, so a *new identifier* reads as a real code change. transformers#48553
added `.flatten()` to `output.sequences.squeeze().tolist()` — an assertion
rewrite wearing a method call — and was classified a real fix, keeping its
verification claim. A residue difference explained entirely by shape/ordering
operations appearing on one side is now expectation-only, reported with its own
sentence. `.to(...)`/`.float()`/`.cpu()` stay out of the set: those change the
value, not its shape, so a patch that adds one keeps its claim.

verify: the gate re-runs the failure group's own node-ids, which is full
coverage for a patch confined to those tests and no coverage at all for one that
edits the scaffolding they share. transformers#48425 changed the `input_audio`
`cached_property` from one 2-channel sample to two mono samples, verified its 6
targeted tests green, and left `test_to_rus_speech` — same class, same fixture —
comparing a nested list against a flat expectation; #48553 then tried to paper
over it. `patch_needs_collateral` spots a hunk that shows scaffolding (`setUp`,
`tearDown`, `@cached_property`, `@classmethod`) or a `def` that is not one of
the targeted tests, and turns the collateral suite on for that run even when
`VERIFY_RUN_COLLATERAL` is off. Judged from the hunk text alone: the patch is
the model's proposal, so its `@@` headers carry no function context to trust.

prod.yaml: the normalizer spelled out 23 checker names instead of calling
`make fix-repo`, and had drifted — `noisy_comments`, `reviewers` and `add_dates`
were missing, so a patch could clear the gate and still land a red
`check-code-quality` / `Check repository consistency`. transformers' Makefile
derives `fix-repo` from the CI sets precisely so the list cannot drift, and its
`checkers-requirements.txt` is already written for this `--network none`
sandbox. `TRANSFORMERS_SKIP_CHECKER_REQUIREMENTS=1` keeps even the opt-in
installs from burning retries.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@tarekziade
tarekziade merged commit 1387c7b into main Sep 7, 2026
3 checks passed
@tarekziade
tarekziade deleted the tarek/verify-scope-and-guard branch September 7, 2026 07:47
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