Skip to content

Split orbit-core command/search.rs (2,963 lines) into a search/ module#482

Merged
danieljhkim merged 1 commit into
agent-mainfrom
orbit/ORB-00354-6a1be149
May 31, 2026
Merged

Split orbit-core command/search.rs (2,963 lines) into a search/ module#482
danieljhkim merged 1 commit into
agent-mainfrom
orbit/ORB-00354-6a1be149

Conversation

@danieljhkim
Copy link
Copy Markdown
Owner

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 OrbitRuntime block (lines ~172-1030) plus a long tail of pure free helper functions that do not depend on OrbitRuntime and 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 multiple impl OrbitRuntime blocks across files, so the orchestration impl can stay in mod.rs and later be peeled per-domain (task/doc/learning/adr search) without touching the type.

Proposed Change

Convert search.rs into search/mod.rs and extract the free-function tail into submodules. Group by symbol; line ranges below are approximate (* = approximate, confirm at edit time):

New file Moves (approx current lines) Owns
search/types.rs 37-170 GlobalSearchKind / GlobalSearchMode / GlobalSearchParams / GlobalSearchResponse / GlobalSearchHit + their impls
search/path_match.rs ~1496-1557 selector_matches_path, normalize_path_for_match, paths_overlap, is_within, learning_scope_contains_path
search/hybrid.rs ~1095-1352* *HybridCandidate structs, blend_*, normalized_doc_scores, compare_global_hits_by_score, warn_*_fallback
search/convert.rs ~1031-1062, ~1357-1492* *_hit_to_global, *_result_to_global, adr_to_global_hit*, lexical_*_hit
search/filters.rs ~1393-1429, ~1559-1714* *_has_all_tags, SearchStatusFilters, resolve_*_statuses, task_open_statuses, push/extend_unique
search/mod.rs 172-1030 the impl OrbitRuntime orchestration (stays)

Start with path_match.rs and hybrid.rs — most self-contained and independently testable, so they give the biggest readability win for the least churn.

Constraints / Notes

  • Pure refactor: no behavior change, no public API change. The orchestration impl OrbitRuntime body stays byte-identical aside from use adjustments.
  • crates/orbit-core/src/command/mod.rs:32 declares pub mod search;, which resolves to either search.rs or search/mod.rs — likely no change needed; verify.
  • Default new items to pub(crate); keep pub only on symbols already part of the crate's public surface. Anything previously reachable via command::search::... must stay re-exported at the same path from search/mod.rs.
  • Follow the sibling test layout (docs/design-patterns/test_layout.md): there is no sibling search test file today; any test extracted alongside a moved symbol goes under search/tests/<file>.rs.
  • Do not modify call sites in other crates.

Acceptance Criteria

  • crates/orbit-core/src/command/search.rs is removed and replaced by crates/orbit-core/src/command/search/mod.rs plus the extracted submodules types.rs, path_match.rs, hybrid.rs, convert.rs, and filters.rs.
  • No resulting file under search/ exceeds ~1,100 lines (the impl OrbitRuntime orchestration in mod.rs is the largest).
  • cargo build -p orbit-core succeeds with no new warnings.
  • cargo test -p orbit-core passes with no fewer tests than before the split.
  • cargo clippy -p orbit-core --all-targets is clean under the workspace lints.
  • make ci-fast passes.
  • No public symbol path changes: rg 'command::search::' crates resolves to the same symbols (re-exported from search/mod.rs where they were previously reachable), and no call sites in other crates are edited.
  • git diff over the moved code shows move/extraction only (import adjustments), with no logic changes to the impl OrbitRuntime body.

Execution Summary

Click to expand

Outcome: success

Changes:

  • Split crates/orbit-core/src/command/search.rs into search/mod.rs and focused helper modules: types, path_match, hybrid, convert, and filters.
  • Moved the existing inline search tests into sibling search/tests/ modules while preserving all 36 search tests.
  • Preserved public command::search::* re-exports and verified the impl OrbitRuntime body 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= returns operation not permitted in this runner.

Design weaknesses / risks:

  • Full local cargo test -p orbit-core could not be green in this execution environment because process identity tests require ps; CI or a runner with ps access should re-run the full suite.

Validation

  • Not reported

Branch Freshness

  • Base ref: origin/agent-main
  • Head ref: orbit/ORB-00354-6a1be149
  • Behind base: 0
  • Ahead of base: 1

…rc… [ORB-00354]

Split orbit-core command/search.rs (2,963 lines) into a search/ module

Planned-By: codex
@danieljhkim danieljhkim merged commit 83922a5 into agent-main May 31, 2026
5 of 6 checks passed
@danieljhkim danieljhkim deleted the orbit/ORB-00354-6a1be149 branch May 31, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant