Skip to content

Sort validation.py's leaf imports so ruff's isort rule passes - #89

Closed
leaf-agent wants to merge 1 commit into
mainfrom
fix/ci-33153186163-lint
Closed

Sort validation.py's leaf imports so ruff's isort rule passes#89
leaf-agent wants to merge 1 commit into
mainfrom
fix/ci-33153186163-lint

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Problem

The lint job is red on main. pre-commit fails on plugins/leaf/skills/leaf/scripts/leaf/validation.py, where ruff's isort rule wants from leaf import event_contracts ahead of from leaf.asks import (...) and from leaf.data import ...:

+from leaf import event_contracts
 from leaf.asks import (
     asking,
     quoted_in,
 )
 from leaf.data import data_binding_errors, read_data_store
-from leaf import event_contracts

The misordered import arrived with c4b7444, "Extract Python event contracts", and is still on main at 437cfa3. It reddens lint on every branch, not just the commit that introduced it — it is why PR #88's lint job failed on a one-line test change.

Solution

Move the import to the position ruff's autofix puts it in. This is the hook's own output, applied verbatim.

Testing

pre-commit run --all-files on this branch: all twelve hooks pass (it fails on ruff check at origin/main).


Automated fix for failed run

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Another occurrence, and the earliest one: run 33154672429 is the push run for c4b7444 itself, so lint went red on the commit that introduced the import and has stayed red through 437cfa3. Same single ruff check autofix on plugins/leaf/skills/leaf/scripts/leaf/validation.py — this PR covers it, so I have not opened a duplicate.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

The red test check here is not from this change. It is tests/test_render_navigation.py::test_a_label_press_keeps_the_controls_keyboard_standing at line 2885 — the same assertion #88 fixes — and it is the only failure in this PR's run (1 failed, 1363 passed).

Read together, the two open fixes cross-validate: each one's own target job is green, and each one's red job is the other's defect. Merging both greens ci on main; neither alone does.

PR lint test
#88 (adds panel_settled) fail — needs this PR's import order pass
#89 (this PR, import order) pass fail — needs #88's panel_settled

Both failures recurred again on run 33156005325 (commit 437cfa3), which is what prompted this check. Nothing new to fix — recording the pairing so the red check on a pure import reorder does not read as a regression.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Superseded — closing. 5689178 ("Split validation by input boundary") deleted plugins/leaf/skills/leaf/scripts/leaf/validation.py, so this branch is CONFLICTING against main and the import it reorders now lives in validation/compatibility.py, already in isort order. ruff@0.16.1 check --no-fix . passes on main.

lint is still red on main, but on a different hook: ruff format rewrites four of the modules ac8fe9e split out of the render gate. #90 fixes that.

@leaf-agent leaf-agent closed this Aug 28, 2026
max-sixty pushed a commit that referenced this pull request Aug 28, 2026
…passes (#94)

`lint` is red on main: `ruff format` rewrites
`tests/test_render_conversations.py`, so `pre-commit` reports "files
were modified by this hook" and the job fails. The two asserts
[dbfaeaa](dbfaeaa)
("End cancelled panel gestures") added carry ruff's older assert shape —
condition wrapped in parentheses, message trailing — where 0.16.1 puts
the message in parentheses after a bare condition. This commit applies
`ruff@0.16.1 format`, which is the hook's own output; there is no other
change.

Verified on the branch (rebased onto `ea2f4e7`, main's current head):
`ruff@0.16.1 format --check .` → `123 files already formatted`, and
`ruff@0.16.1 check --no-fix .` → `All checks passed!`. The `test` job
was already green on the failing run, and this diff is whitespace and
parentheses only, so behaviour is unchanged; the touched test collects
(its local run stops at `BrowserType.launch` — no Playwright browser in
the tend sandbox).

<details><summary>The hook's diff, from the failed run</summary>

```diff
@@ -2326,9 +2326,9 @@ def test_a_cancelled_panel_press_does_not_suppress_the_next_focus_landing(
         before = page.evaluate("() => document.querySelector('.lf-threads').scrollTop")
-        assert (
-            page.evaluate(UNDER_HEADING)["covered"] >= 20
-        ), "the setup did not put the first card under its heading"
+        assert page.evaluate(UNDER_HEADING)["covered"] >= 20, (
+            "the setup did not put the first card under its heading"
+        )
```

The second hunk is the same rewrite on the `COVERED_TOP` assert at line
2344.

</details>

<details><summary>Third `ruff` failure on main today</summary>

`lint` has gone red on four of the last twelve `ci` runs on main, each
on a different `ruff` finding in the commit that had just landed:
[5689178](5689178)
and [ac8fe9e](ac8fe9e9) (both
since fixed by later commits, closing #89 and #90), and now this one.
Nothing in the repo can catch these earlier — `wt merge`'s `pre-commit`
on the maintainer's machine is the only gate ahead of CI, and each of
these reached main with the hook's own output unapplied. That is a
local-flow observation, not something this PR changes.

</details>

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/33163125560)

Co-authored-by: leaf-agent <318509791+leaf-agent@users.noreply.github.com>
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