refactor(impact): split five modes into impact/ submodules + fixture-based unit tests#648
Merged
Conversation
impact.rs was the hottest file in the repo (23 changes in 300 commits)
because it flat-packed five independent impact sub-modes (symbol,
baseline, literal, literal-coherence, coverage) into one 2143-line file
sharing a single BFS kernel. Splits into commands/impact/{mod,bfs,
symbol,baseline,literal,coverage}.rs, mirroring the existing
commands/{admin,dev,group}/ submodule convention.
Pure code motion: mod.rs keeps run() dispatch, ImpactArgs, and the
shared attach_*/resolve_min_conf/direction_str helpers plus pub
re-exports so every external call site (main.rs, group/impact.rs,
peers_plan.rs, review/aggregate.rs) keeps compiling unchanged. bfs.rs
holds run_bfs and the MergedNodeMeta/MergedEdgeRef merged-space
helpers; symbol.rs and baseline.rs both depend on it.
…symbol Every existing impact_*.rs test spawns the ecp binary + git init + ecp admin index subprocess. build_payload and run_for_symbol are pub fns taking &Engine, so they're unit-testable directly: serialize a synthetic ZeroCopyGraph to a tempdir graph.bin and Engine::load it, mirroring the fixture pattern in impact_heuristic_filter.rs and ecp_core::cypher::executor's build_two_node/build_three_chain helpers. Covers symbol-mode payload shape on a caller chain, the ambiguous-name error path (two same-named defs, no --file/--kind), direction up vs down producing different result sets, and depth-limit enforcement. Runs in milliseconds with zero subprocess/binary/git overhead.
coseto6125
enabled auto-merge (squash)
July 22, 2026 17:29
coseto6125
disabled auto-merge
July 22, 2026 17:35
Contributor
ecp impact cache (0 symbols) — internal, used by
|
coseto6125
enabled auto-merge (squash)
July 22, 2026 17:53
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.
What
Splits
crates/ecp-cli/src/commands/impact.rs(2143 lines — the hottest file in the repo, 23 changes across 300 commits) intocommands/impact/{mod,bfs,symbol,baseline,literal,coverage}.rs, mirroring the existingcommands/{admin,dev,group}/submodule convention. Adds the first non-subprocess unit tests for the mode logic.Why
The file flat-packed five independent "impact" sub-modes (symbol lookup, git-baseline diff, path-literal search, literal-coherence split-brain detection, test-coverage gap analysis) sharing one BFS kernel. High edit frequency + high line count made every change here carry unnecessary review surface and merge-conflict risk.
C1 — pure code motion
mod.rs:run()dispatch,ImpactArgs,Direction, shared helpers (resolve_min_conf,direction_str,attach_hidden_edges,attach_heuristic_fields,tag_heuristic,emit_hidden_edges_footer,parse_csv_lower), andpub usere-exports so every external call site (main.rs,group/impact.rs,peers_plan.rs,review/aggregate.rs) keeps compiling unchanged.bfs.rs: the sharedrun_bfskernel plusMergedNodeMeta/MergedEdgeRefmerged-space helpers — bothsymbol.rsandbaseline.rsdepend on it.symbol.rs:impact_by_name,LocalImpact,run_for_symbol,collect_blind_spots.baseline.rs:impact_with_baseline,hash_node_lines,head_blob_at.literal.rs:build_literal_payload,build_literal_coherence_payload, and the literal-similarity helpers, plus the existingliteral_coherence_testsmodule.coverage.rs:classify_symbol,coverage_analyses,build_coverage_json.Verified pure motion by sorting and diffing the original file's stripped body against the concatenated new modules — every line delta is accounted for by visibility keyword additions (
pub(super)), module-qualified call paths, and rustfmt re-wrapping; zero logic drift.C2 — fixture-based unit tests
Every existing
impact_*.rstest spawns the builtecpbinary +git init+ecp admin indexsubprocess.build_payloadandrun_for_symbolarepub fns taking&Engine, so they're directly unit-testable: serialize a syntheticZeroCopyGraphto a tempdirgraph.binandEngine::loadit — no subprocess, no CLI binary spawn, no.sample_repoor~/.ecptouch.New file
crates/ecp-cli/tests/impact_fixture_unit.rscovers:--file/--kinddisambiguator--filedisambiguator resolving the same ambiguous pairrun_for_symbolwrappingbuild_payloadcorrectly (direct_symbol_uids/direct_countconsistency)All 6 new tests run in ~0ms total, vs the 200-700ms+ per-test subprocess cost of the existing suite.
Verification
cargo test -p egent-code-plexus --tests— full suite green (all pre-existingimpact_*.rsfiles pass unchanged, plus the 6 new fixture tests)cargo clippy -p egent-code-plexus --tests— clean, no new warningsrustfmt --edition 2021on every touched file — no-op (already formatted)