Skip to content

Format test_video_backend.py the way the pinned ruff wants - #10235

Merged
danielhanchen merged 1 commit into
mainfrom
ci-precommit-clean-main
Sep 3, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-precommit-clean-main

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

pre-commit run --all-files on a clean main leaves one file modified:

$ git checkout main && pre-commit run --all-files
...
=== EXIT 1 ===
 M studio/backend/tests/test_video_backend.py

That is enough to reach every open PR, because pre-commit.ci runs over all files, not just the ones a branch touched. On a branch it can push to, it lands an unrelated autofix commit on someone else's PR; on a fork branch it cannot push, so the pre-commit.ci - pr check just goes red. Ten open PRs are red on it right now: #10204, #10184, #10183, #10150, #10138, #10094, #10075, #10054, #9850, #9814. Two of my own PRs picked up the autofix commit while I was working on something else, which is how I noticed.

Where it came from

4a108e0ca (#10184, "Fix diffusion offload host RAM retention") added two asserts written in the style a current ruff formats to:

    assert resolved["requested"] is None, (
        f"the record reports {resolved['requested']!r} as the user's request; nothing was asked for"
    )

The repo's formatter is not a current ruff. .pre-commit-config.yaml runs the lint hook at ruff-pre-commit v0.15.18, but ruff-format-with-kwargs pins ruff==0.6.9 in its additional_dependencies, and 0.6.9 formats that as:

    assert (
        resolved["requested"] is None
    ), f"the record reports {resolved['requested']!r} as the user's request; nothing was asked for"

#10184 comes from a fork, so pre-commit.ci could not push the fix to it and the check stayed red through the merge. Nothing else is wrong with that PR: it was formatted by a ruff newer than the one this repo pins, which is an easy thing to do and nothing tells you about it.

This change

The one file, formatted the way the pinned formatter wants. Two hunks, 30 lines each side, and nothing else in the tree needs it.

Verified:

  • pre-commit run --all-files now passes all three hooks with a clean tree
  • running it again changes nothing, so this is the formatter's fixed point and not a step in an oscillation between the two ruff versions
  • the parse trees before and after are identical, so this is purely how the asserts are wrapped:
$ python -c "compare ast.dump of HEAD~1 vs working copy"
AST identical: True
text identical: False

The thing worth fixing next

Two ruff versions in one config is the actual defect here, and it will keep producing this. The lint hook rides rev: v0.15.18 while the formatter is held at 0.6.9, so anyone with a current ruff on their machine writes code the gate then rejects, and the only signal is a red check on a fork PR that nobody can push a fix to.

Moving the pin to 0.15.18 is the fix, but it reformats a large part of the tree in one commit, so it wants its own PR and its own decision rather than riding along with an unblock. Leaving it here as the note.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 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-09-03T08:50:32.817475Z fadbf39 PR opened
🔒 Security Review ✅ Completed 2026-09-03T08:52:16.733570Z fadbf39 PR opened
ℹ️ 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.

@danielhanchen
danielhanchen merged commit fc27952 into main Sep 3, 2026
30 of 34 checks passed
@danielhanchen
danielhanchen deleted the ci-precommit-clean-main branch September 3, 2026 08:55
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