refactor: simplify Wright production Rust - #419
Conversation
There was a problem hiding this comment.
This PR is still not bounded by an approved Issue, and its scope repeats the exact combination that got #370 CHANGES_REQUESTED on 2026-09-19 (#370 (review)): a ≥30% Rust-LOC-reduction target as the acceptance criterion, applied across analyzer, CLI, driver, language, LPP, and LSP.
The closest recorded contract is #355, and it excludes exactly this:
- "Non-goals: Removing code solely to meet a line-count or crate-count target."
- "Non-goals: Refactoring unrelated analyzer, transform, driver, or CLI code."
- Scope is limited to removing the legacy pre-canonical analyzer/transform path; it says nothing about
wright-cli,wright-driver,wright-language,wright-lpp, orwright-lsp.
PR #419 touches crates/wright-cli/{cli.rs,main.rs,completion.rs,present.rs,update.rs,bin/wright-serve.rs}, crates/wright-driver/*, crates/wright-language/*, crates/wright-lpp/*, and crates/wright-lsp/main.rs — all outside #355's scope — driven by the same unapproved LOC mandate the PR body restates ("the agreed 30% production Rust LOC reduction target ... is not met").
No new Issue authorizing this cross-crate, LOC-driven mandate exists (checked open/closed issues #350-419). Per org policy, an agent must not self-authorize a scope/architecture decision reserved for the owner, and this exact mismatch was already raised once without a follow-up Issue being opened to settle it.
Required: either open/approve an Issue that explicitly authorizes this cross-crate, LOC-driven simplification (superseding #355's non-goals), or re-scope this PR to #355's actual boundary (legacy pre-canonical analyzer/transform removal only) and move the wright-cli/wright-driver/wright-lpp/wright-lsp changes into separately-scoped, Issue-bound PRs.
Separately, on execution quality: I traced the diff hunk-by-hunk against main for the highest-risk changes (the "remove unreachable source edit analysis" deletion in wright-driver/src/edit.rs, the wright-language hover/definition/rename stubs, the wright-driver/session.rs branch merges, the CLI completion rewrite, the LPP Capability-derived method dispatch, and the canonical-analyzer file split) and found no behavioral regression — the "unreachable" claims check out against actual call sites on main, not just local diff context. That part of the work is sound; the open issue is scope authorization, not correctness.
There was a problem hiding this comment.
Confirmed with the requester: this refactor was directed locally out-of-band (no Issue opened), which resolves the scope-authorization objection from my previous review — the owner has authorized superseding #355's non-goals for this effort. No commits changed since that review (still bce3c7f), and the earlier hunk-by-hunk correctness pass found no behavioral regressions. Approving.
Summary
This branch consolidates repeated control flow and data handling across the analyzer, CLI, driver, language, LPP, and LSP crates. It also removes redundant wrappers and unreachable source-edit analysis while preserving the existing supported behavior and external contracts.
Accepted result
The original target was a reduction of at least 30% in production Rust LOC. The measured result is 14,877 baseline lines to 12,854 lines: 2,023 fewer lines (13.60%), leaving a 2,441-line gap to the original target. On 2026-09-27, the user accepted the current simplification as completion of this effort despite the unmet 30% metric. This is an explicit acceptance adjustment; it does not claim that the 30% target was reached.
PR #419 was merged at
93a5914dc77899a9c674a692b27a38df4cd941b9.Verification
Local checks passed on commit
bce3c7feee3dd7ff465a56a909185d7754300b5b:cargo +1.85.0 fmt --all -- --checkcargo +1.85.0 clippy --locked --all-targets --all-features -p wright-analyzer -p wright-transform -p wright-lpp -- -D warningscargo +1.85.0 test --locked --all-targets --all-features -p wright-analyzer -p wright-transform -p wright-lpp </dev/nullcargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --all-targets --all-features </dev/nullgit diff --checkHosted CI run 36313151674 completed successfully at the same commit: 22 jobs passed, including Rust 1.85.0, stable quality, integration and Workshop dogfood jobs, cross-platform builds, and distribution validation.
Tests and fixtures are unchanged from
origin/main.