Split orbit-core command/search.rs (2,963 lines) into a search/ module#482
Merged
Conversation
…rc… [ORB-00354] Split orbit-core command/search.rs (2,963 lines) into a search/ module Planned-By: codex
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.
Task
ORB-00354 — Split orbit-core command/search.rs (2,963 lines) into a search/ module
Description
Problem
crates/orbit-core/src/command/search.rs is 2,963 lines: one ~860-line
impl OrbitRuntimeblock (lines ~172-1030) plus a long tail of pure free helper functions that do not depend onOrbitRuntimeand extract cleanly. A single file this size is hard to navigate and review.Why It Matters
Low-risk, high-readability win. The helpers are free functions, so moving them is mechanical (move + adjust
use/pub(crate)visibility). Rust allows multipleimpl OrbitRuntimeblocks across files, so the orchestration impl can stay inmod.rsand later be peeled per-domain (task/doc/learning/adr search) without touching the type.Proposed Change
Convert
search.rsintosearch/mod.rsand extract the free-function tail into submodules. Group by symbol; line ranges below are approximate (*= approximate, confirm at edit time):search/types.rsGlobalSearchKind/GlobalSearchMode/GlobalSearchParams/GlobalSearchResponse/GlobalSearchHit+ their implssearch/path_match.rsselector_matches_path,normalize_path_for_match,paths_overlap,is_within,learning_scope_contains_pathsearch/hybrid.rs*HybridCandidatestructs,blend_*,normalized_doc_scores,compare_global_hits_by_score,warn_*_fallbacksearch/convert.rs*_hit_to_global,*_result_to_global,adr_to_global_hit*,lexical_*_hitsearch/filters.rs*_has_all_tags,SearchStatusFilters,resolve_*_statuses,task_open_statuses,push/extend_uniquesearch/mod.rsimpl OrbitRuntimeorchestration (stays)Start with
path_match.rsandhybrid.rs— most self-contained and independently testable, so they give the biggest readability win for the least churn.Constraints / Notes
impl OrbitRuntimebody stays byte-identical aside fromuseadjustments.pub mod search;, which resolves to eithersearch.rsorsearch/mod.rs— likely no change needed; verify.pub(crate); keeppubonly on symbols already part of the crate's public surface. Anything previously reachable viacommand::search::...must stay re-exported at the same path fromsearch/mod.rs.searchtest file today; any test extracted alongside a moved symbol goes undersearch/tests/<file>.rs.Acceptance Criteria
crates/orbit-core/src/command/search.rsis removed and replaced bycrates/orbit-core/src/command/search/mod.rsplus the extracted submodulestypes.rs,path_match.rs,hybrid.rs,convert.rs, andfilters.rs.search/exceeds ~1,100 lines (theimpl OrbitRuntimeorchestration inmod.rsis the largest).cargo build -p orbit-coresucceeds with no new warnings.cargo test -p orbit-corepasses with no fewer tests than before the split.cargo clippy -p orbit-core --all-targetsis clean under the workspace lints.make ci-fastpasses.rg 'command::search::' cratesresolves to the same symbols (re-exported fromsearch/mod.rswhere they were previously reachable), and no call sites in other crates are edited.git diffover the moved code shows move/extraction only (import adjustments), with no logic changes to theimpl OrbitRuntimebody.Execution Summary
Click to expand
Outcome: success
Changes:
crates/orbit-core/src/command/search.rsintosearch/mod.rsand focused helper modules:types,path_match,hybrid,convert, andfilters.search/tests/modules while preserving all 36 search tests.command::search::*re-exports and verified theimpl OrbitRuntimebody is byte-identical to the pre-split source.Assessment: Pure module extraction with no intended behavior changes; all new files are under the requested size limit and no other crate call sites were edited.
Validation:
cargo build -p orbit-core: passed.cargo test -p orbit-core command::search::tests: passed (36 tests).cargo clippy -p orbit-core --all-targets: passed.make ci-fast: passed.cargo test -p orbit-core: attempted; 442 passed, 3 failed, 1 ignored. The failures are unrelated job owner/process identity tests and match known environment issue L-0025:ps -p $$ -o lstart=returnsoperation not permittedin this runner.Design weaknesses / risks:
cargo test -p orbit-corecould not be green in this execution environment because process identity tests requireps; CI or a runner withpsaccess should re-run the full suite.Validation
Branch Freshness
origin/agent-mainorbit/ORB-00354-6a1be149