Apply ruff-format to tools/openrouter-chat.py#7
Open
mikemindel wants to merge 1 commit intomigratefrom
Open
Conversation
The project's ruff config sets line-length = 80 (pyproject.toml), but commit 9441b7b introduced a single-line payload dict at 86 characters. Pre-commit has been flagging it on every branch since, and I've been reverting the reformat each time, treating it as unrelated linter noise. The linter was right. How the long line slipped in: pre-commit is not installed as a git hook in this clone (.git/hooks/pre-commit was missing). That means `git commit` and .claude/hooks/do_commit.sh never ran pre-commit automatically — the ONLY thing running ruff-format in this repo was the /commit skill's Pass 0, which is manual. When 9441b7b landed, Pass 0 either wasn't run or wasn't the same shape as today. scripts/setup.sh installs the hook for you, but setup.sh was never run in this clone. Running 'pre-commit install' fixes it locally. - One-line payload dict → multi-line to fit line-length = 80 - No behaviour change; no logic change; same argument names - `pre-commit run --all-files` now clean repo-wide - `uv run tools/openrouter-chat.py --help` still works - Locally: ran 'pre-commit install' to restore the git hook in this clone so future commits are enforced at git-commit time, not just inside the /commit skill
14d217f to
33367b3
Compare
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.
Summary
tools/openrouter-chat.py: the single-line payload dict at 86 chars was violating the project'sline-length = 80(set inpyproject.toml). Split into a 5-line multi-line dict, matching what ruff-format has been asking for on every branch since9441b7b.tools/openrouter-chat.pymodified" warning that appeared on WB-62, WB-86, and WB-87 during/commitPass 0. Future branches start clean.Root cause
pyproject.tomlsetsline-length = 80. Commit9441b7b fix: Avoid openrouter 402introduced a payload dict whose line was 86 characters — a legitimate violation. Pre-commit has been flagging it correctly on every subsequent branch; I've been reverting the reformat each time assuming it was noise. It wasn't.How the long line originally slipped past
9441b7b's own pre-commit check is unclear — possibly the ruff-format hook inspected only staged hunks rather than the whole file. Fixing the file itself is the high-value move; chasing the historical bypass is not worth separate effort.Linear issue
WB-88 — Fix recurring ruff-format churn on tools/openrouter-chat.py
https://linear.app/webventurer/issue/WB-88
Test plan
pre-commit run --all-filesclean repo-wideuv run tools/openrouter-chat.py --helpstill works (no behaviour change)migratestarts withgit statusclean andpre-commit run --all-filesproduces no changes — will confirm on WB-85