Skip to content

refactor(core): reduce clippy::too_many_lines suppressions (50 → 11)#1779

Merged
bug-ops merged 5 commits intomainfrom
reduce-clippy-too-many-lines
Mar 14, 2026
Merged

refactor(core): reduce clippy::too_many_lines suppressions (50 → 11)#1779
bug-ops merged 5 commits intomainfrom
reduce-clippy-too-many-lines

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 14, 2026

Closes #1734

Summary

  • Decomposed oversized functions across 8 crates to remove #[allow(clippy::too_many_lines)] suppressions
  • 50 → 11 suppressions workspace-wide (target was ≤10; +1 from run_scheduler_loop growth in merged main commits)
  • Merged origin/main twice during development; restored 2 tests and 2 CHANGELOG entries that were dropped during conflict resolution

Changes

zeph-core/agent/mod.rs: extracted dispatch_agent_command handler; removed 1 suppression

zeph-core/agent/tool_execution/: extracted check_repeat_detection, replaced module-level #![allow] with targeted #[allow] on the one remaining complex test; removed 3 suppressions

zeph-core/bootstrap/provider.rs: extracted shared per-backend factory helpers; removed 5 suppressions

zeph-memory/graph/resolver.rs: extracted embed_entity_text, handle_ambiguous_candidate; removed 2 suppressions

zeph-tui/src/app.rs: extracted handle_diff_ready, send_slash; removed 3 suppressions

zeph-tui/src/command.rs: split build_extra_commands into 3 sub-functions; removed 1 suppression

zeph-acp/src/agent/: extracted plan_to_updates; removed 1 suppression

Other crates (zeph-llm, zeph-tools, zeph-tui/widgets): standard extract-helper pattern; removed 34 suppressions

Remaining 11 suppressions (all have justification comments)

All kept suppressions are genuinely non-decomposable:

  • run_scheduler_loop: tokio::select! with 4 branches — cancel token, scheduler tick, channel recv + close, shutdown signal
  • new_with_registry_arc: flat struct literal initializing all Agent sub-structs
  • cascade_chat / cascade_chat_stream: per-provider error/ok/budget/escalation branches
  • Config::default(): flat struct literal, one field per config section
  • context/assembly ×2: async fanout + prompt assembly
  • subagent/manager: subagent spawn loop
  • tool_execution/native: parallel DAG tool execution
  • experiments/engine: experiment evaluation loop
  • One test function (117 lines)

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --features full -- -D warnings — 0 errors
  • cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins — 5560 passed

bug-ops added 4 commits March 14, 2026 19:07
…ide (#1734)

Extract helper functions from over-long functions across zeph-acp, zeph-tui,
and zeph-core to bring all functions under the 100-line clippy threshold.
Zero #[allow(clippy::too_many_lines)] suppressions remain. Zero behavior change.
Resolve conflicts in zeph-acp/agent/{helpers,mod}.rs,
zeph-core/agent/mod.rs, and zeph-core/bootstrap/provider.rs.
Keep both upstream changes and refactoring extractions.
REVIEW-01: restore prune_tool_outputs_preserves_overflow_reference in
context/mod.rs and scheduler_loop_channel_close_returns_failed in
tests.rs; also restore the prune_tool_outputs overflow-reference logic
in summarization.rs (extract_overflow_ref helper + three call sites)
and fix run_scheduler_loop to return GraphStatus::Failed on channel
close instead of Canceled (#1614).

REVIEW-02: restore two CHANGELOG entries for #1614 (COV-04 test) and
#1740 (overflow-reference preservation on pruning).

REVIEW-S01: add justification comments to three remaining suppressions
in cascade_chat, Config::default, and new_with_registry_arc.
@github-actions github-actions bot added refactor Code refactoring without functional changes documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) memory zeph-memory crate (SQLite) rust Rust code changes core zeph-core crate size/XL Extra large PR (500+ lines) and removed refactor Code refactoring without functional changes labels Mar 14, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 14, 2026 19:46
@bug-ops bug-ops linked an issue Mar 14, 2026 that may be closed by this pull request
8 tasks
@github-actions github-actions bot added the refactor Code refactoring without functional changes label Mar 14, 2026
@bug-ops bug-ops merged commit 6d47512 into main Mar 14, 2026
15 checks passed
@bug-ops bug-ops deleted the reduce-clippy-too-many-lines branch March 14, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) memory zeph-memory crate (SQLite) refactor Code refactoring without functional changes rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arch: codebase architecture improvements Reduce clippy::too_many_lines suppressions in agent module

1 participant