refactor: remove process module dependency on agents module (#326)#348
Merged
Conversation
Analyze the upward dependency from process to agents module and document implementation plan to decouple via caller-passed patterns.
The process module imported the agents module to look up agent-specific process name patterns during process detection, creating an upward dependency from a low-level utility to a domain-specific layer. Move agent pattern resolution to the caller (terminal/handler.rs) by adding an `additional_patterns` parameter to `find_process_by_name()` and `generate_search_patterns()`. Add `get_all_process_patterns()` to the agents module for bidirectional pattern resolution. Fixes #326
Owner
Author
Self Code ReviewSummaryThe refactor correctly addresses the architectural concern. No issues found. FindingsStrengths
Security
Checklist
|
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.
Summary
processmodule toagentsmodule by makingfind_process_by_name()accept caller-provided search patterns viaadditional_patternsparameterterminal/handler.rs(the only caller) where domain awareness belongsget_all_process_patterns()helper to agents module for bidirectional pattern resolutionRoot Cause
process/operations.rsimportedcrate::agentsto look up agent-specific process name patterns ingenerate_search_patterns(). This created an upward dependency from a low-level utility layer to a domain-specific layer, violating the existing pattern where callers pass metadata to process functions (likekill_process()already does).Changes
crates/kild-core/src/process/operations.rsadditional_patternsparam tofind_process_by_name()andgenerate_search_patterns(), removeduse crate::agentsimportcrates/kild-core/src/terminal/handler.rsfind_process_by_name()crates/kild-core/src/agents/registry.rsget_all_process_patterns()for bidirectional agent pattern resolutioncrates/kild-core/src/agents/mod.rsget_all_process_patternsTesting
cargo fmt --checkpassescargo clippy --all -- -D warningspassescargo test -p kild-corepasses (all 5 directly affected tests pass)cargo build --allsucceedsValidation
Issue
Fixes #326