Repository navigation
Type-check all Python with ty and standard Ruff rules - #4647
Merged
Merged
Conversation
Run whole-tree ty through pre-commit and its existing CI gate. Match the standard F/E/W/I/UP Ruff families, including import sorting and modern Python syntax. Correct shared protocols, optional-value preconditions, heterogeneous containers, callback signatures and deliberate test-double injection boundaries across the application, developer tools, packaged scripts and tests. Keep the existing runtime behavior and callable fixture identity.
leaf-agent
previously approved these changes
Oct 28, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
Local validation found failures that reproduce on main at ed2bc25, so they do not withhold this approval:
- In the response-time tests,
test_query_keeps_input_identity_and_missing_observationsandtest_query_reports_clock_errors_and_requires_qualified_timestampsexpect summaries without the existingtotal_sfield. - In the App Server tests,
test_app_server_observer_connects_over_a_private_unix_socketandtest_codex_launch_owns_one_private_app_serverhit this sandbox's unsupportedAF_UNIXsockets (Errno 97). A direct socket creation fails too. I interrupted the larger selection after that limitation recurred; its remaining tests are unverified.
…ecking Keep absent lifecycles and bare-shell harnesses valid, retain the no-session hook no-op, and distinguish an omitted stop owner from explicit None. Let the browser fixture own page cleanup.
Keep the session-phase helpers main introduced while retaining the type fixes. Unregister page and context routes with Playwright ignoreErrors after health checks and before context close, so cancellation cannot leak a disposed-response exception into the next test.
leaf-agent
approved these changes
Oct 29, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 30, 2026
…ate capture as a Generator #4686 launched stills' browser with ignore_default_args, which the test's headless_shell stand-in refused, so all three stills tests failed on main. ty (#4647) asks a @contextmanager to return Generator.
max-sixty
added a commit
that referenced
this pull request
Oct 30, 2026
…ev stills (#4713) `leaf-dev stills` now says which rule is behind each computed-style difference it reports. Under the grouped differences in `styles.txt`, it takes each group's first element and lists the declarations that match it in only one arm, or in a different order, each labelled with its sheet, `@layer`, `@scope` and selector. The declarations come from Chrome's DevTools protocol (`CSS.getMatchedStylesForNode`). Two of the sessions surveyed for #4648 wrote this lookup by hand to find a cause. ## What it shows Replayed against #4637's base (`leaf-dev stills ae2e3f3 --state on-me`, about 2 minutes), it names both causes that session found by hand: ``` html + theme.css @layer lf-base :where(:root) { color: revert; } + theme.css @layer lf-base :where(:root) { font-family: revert; } …lf-options#ar-3ds-choice > form.lf-another.lf-ui + theme.css @layer lf-base lf-options:has(> lf-option > strong) > .lf-another { font: inherit; } ``` It also names a later commit's `:nth-child(1 of :not(.lf-ui, [data-lf-gen])) { margin-block-start: 0 }` behind a paragraph's margin change. Where an element's declarations match on both arms, such as the hidden-widget noise, it says `none: it inherits the difference or reads it from a custom property`. A separate probe read an element inside lf-diff's shadow tree on pr-walkthrough, which is where the `.lf-ui` reorder regression appeared. ## Design - **Declarations, not a winner.** Naming the declaration that wins would take part of the cascade. Shorthands such as `font: var(...)` leave their longhands blank in the protocol, and on top of that it would need logical properties, `!important` across layers, and shadow-tree ordering. Listing what changed, in the protocol's order, avoids all of that, and the reader infers the winner. A declaration that moved shows as a `-` line and a `+` line with the same text. - **Labels stable across arms.** The labels use a sheet's file name, or `constructed`, `<style>` or `user-agent`. Never a URL, since an inline sheet's URL is its document's and includes the arm's port. - **Both arms stay open.** `capture` is now a context manager, so the comparison can read both tabs after `style_changes` has found which elements differ. ## Also here `main`'s stills tests have failed since #4686, which launches the browser with `ignore_default_args`; the test's stand-in for `headless_shell` now accepts launch options. `capture` is annotated as a `Generator`, as ty (#4647) asks. > _This was written by Claude Code on behalf of max-sixty_
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.
Leaf had no Python type-check gate. Add
tyto the developer environment and pre-commit so the existing CI and local landing gates check all 573 tracked Python files, including developer tools, tests, hooks, bundled scripts and the website adapter.Match numbagg's standard Ruff families (
F,E,W,I,UP) and its formatter-compatible exceptions. Fix the discovered types throughout the tree: accurate shared protocols and container types, optional-value preconditions, callback signatures, and narrow test-double boundaries. Preserve the existing serving fixture's callable identity and runtime behavior. There is no diagnostic baseline or directory-wide type suppression; the few local type ignores describe dependency typing gaps and a cross-thread observation.The shared browser fixture also unregisters pending page and context routes before closing them. A controlled cancellation reproduces the disposed-response exception leaking into the next test; Playwright's native route cleanup prevents it while preserving errors during a live test.
Validation: whole-tree
ty, Ruff lint/format, full pre-commit, andpnpm run checkpass. Focused tests passed across the source/Codex model (105), website/bridge (100), developer tools (53), Markdown rendering (42), and shared test fixtures (57). Independent implementation and fixture reviews found no remaining issues.Inherited product-test failures were checked against the unchanged base commit: all six failing render-corpus cases (code-comparison, dynamic-widgets, notification-playground, ship-review, thread-panel-gallery, feature-gallery), the sampled focus-ring failure, and feature-gallery's unchanged disabled-property write reproduce with the same causes. The margin-group and folded-panel passive-shift failures also appear in the earlier main CI run. The baseline comparison finished with seven failures and one teardown error; these are inherited under the repository's test policy.
One additional developer preview subscription test has an inherited assertion failure: the candidate and the original implementation produce the same watch roots. Developer-tool tests are outside CI's product selection.