chore(code-quality): Set max 200 line limit for long methods - #595
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a Clippy-enforced maximum line-count for Rust functions/methods (200 lines) and refactors several long runtime/network/UI/test routines into smaller helpers to satisfy the new constraint and keep core runtime logic more readable.
Changes:
- Enable
clippy::too_many_lines(warn) at the workspace level and configuretoo-many-lines-threshold = 200. - Refactor long functions across runtime startup/auto mode, OpenAI ingress proxy routing, runtime-data view building, and dashboard event handling into smaller helper functions/structs.
- Restructure API payload-stability tests into reusable seed/request/assert helpers.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/mesh-llm-host-runtime/src/runtime/mod.rs | Extracts startup publishing + event loop pieces and introduces grouped run-auto state/context structs to reduce long function bodies. |
| crates/mesh-llm-host-runtime/src/runtime/local.rs | Extracts downstream stage-loading loop and stage-load request construction for split runtime generation. |
| crates/mesh-llm-host-runtime/src/runtime_data/collector.rs | Breaks up build_model_view payload construction into helper functions and a build context. |
| crates/mesh-llm-host-runtime/src/network/router.rs | Refactors classification heuristics into smaller helpers and structures signal scoring. |
| crates/mesh-llm-host-runtime/src/network/openai/ingress.rs | Splits the API proxy request handling into discrete helpers (binding, control endpoints, auto-route decision, routing). |
| crates/mesh-llm-host-runtime/src/cli/output/mod.rs | Refactors dashboard event application into focused helper methods; expands and de-duplicates test helpers. |
| crates/mesh-llm-host-runtime/src/api/tests.rs | Extracts state seeding + request helpers and assertion helpers for management API payload stability tests. |
| clippy.toml | Configures Clippy too-many-lines-threshold = 200. |
| Cargo.toml | Enables workspace Clippy lint too_many_lines = "warn". |
| AGENTS.md | Documents new “code quality rules” (line count, file size, cognitive complexity) for new code. |
michaelneale
added a commit
that referenced
this pull request
May 20, 2026
* origin/main: fix(mesh): skip filtered peers in gossip dial loop to unwedge `--auto` (#602) docs(agents): clarify just build vs release-build for serious testing (#599) build: ozempic — slim binary -42 MB / -47 MB (#592) fix(runtime): proxy through mesh during serve --auto startup (#591) chore(code-quality): Set max 200 line limit for long methods (#595) fly size bump (#590) agents is now up to date (#588) fix(ci): fix CI PR cleanup job to delete in batches (#587)
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.
Adds a 200 line limit to Rust methods, so we don't have giant unreadable code blocks