Skip to content

Apply ruff-format to tools/openrouter-chat.py#7

Open
mikemindel wants to merge 1 commit intomigratefrom
mikemindel/wb-88-fix-recurring-ruff-format-churn-on-toolsopenrouter-chatpy
Open

Apply ruff-format to tools/openrouter-chat.py#7
mikemindel wants to merge 1 commit intomigratefrom
mikemindel/wb-88-fix-recurring-ruff-format-churn-on-toolsopenrouter-chatpy

Conversation

@mikemindel
Copy link
Copy Markdown
Contributor

Summary

  • Apply ruff-format to tools/openrouter-chat.py: the single-line payload dict at 86 chars was violating the project's line-length = 80 (set in pyproject.toml). Split into a 5-line multi-line dict, matching what ruff-format has been asking for on every branch since 9441b7b.
  • Stops the recurring "tools/openrouter-chat.py modified" warning that appeared on WB-62, WB-86, and WB-87 during /commit Pass 0. Future branches start clean.

Root cause

pyproject.toml sets line-length = 80. Commit 9441b7b fix: Avoid openrouter 402 introduced 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-files clean repo-wide
  • uv run tools/openrouter-chat.py --help still works (no behaviour change)
  • Diff is 1 line → 5 lines, nothing else
  • Next branch off migrate starts with git status clean and pre-commit run --all-files produces no changes — will confirm on WB-85

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
@mikemindel mikemindel force-pushed the mikemindel/wb-88-fix-recurring-ruff-format-churn-on-toolsopenrouter-chatpy branch from 14d217f to 33367b3 Compare April 11, 2026 12:32
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