Skip to content

Commit 824808a

Browse files
committed
refactor: split pipeline into domain modules
1 parent 3e159fc commit 824808a

13 files changed

Lines changed: 2004 additions & 1973 deletions

File tree

TODO.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Pipeline Refactor TODO
2+
3+
## Goals
4+
5+
- [x] Split `src/review/pipeline/helpers.rs` into focused modules with clearer ownership.
6+
- [x] Introduce shared pipeline session/services types so preparation, execution, and post-processing stop threading long parameter lists.
7+
- [x] Extract post-processing and verification orchestration into a dedicated pipeline submodule.
8+
- [x] Move pipeline tests out of `src/review/pipeline.rs` and colocate them with the modules that own the behavior.
9+
- [x] Keep the refactor behavior-preserving and validate with `cargo fmt`, `cargo clippy --all-targets --all-features -- -D warnings`, and `cargo test`.
10+
11+
## Planned module split
12+
13+
### 1. Shared pipeline state
14+
15+
- [x] Create `src/review/pipeline/types.rs` for shared pipeline result/progress types.
16+
- [x] Create `src/review/pipeline/session.rs` for `PipelineServices` and `ReviewSession` plus runtime/repo helpers:
17+
- local-model optimization detection
18+
- diff chunking
19+
- instruction file detection
20+
- git log gathering
21+
- convention store path resolution and saving
22+
23+
### 2. Context and guidance
24+
25+
- [x] Create `src/review/pipeline/context.rs` for:
26+
- symbol extraction from diffs
27+
- symbol index construction
28+
- related-file context gathering
29+
- test-file discovery helper
30+
- [x] Create `src/review/pipeline/guidance.rs` for review guidance assembly.
31+
32+
### 3. Comment preparation and execution support
33+
34+
- [x] Create `src/review/pipeline/comments.rs` for:
35+
- analyzer finding synthesis
36+
- diff-line filtering
37+
- analyzer comment detection
38+
- [x] Keep execution-specific validation and metric aggregation near `execution.rs`.
39+
40+
### 4. Dedicated post-processing stage
41+
42+
- [x] Create `src/review/pipeline/postprocess.rs` for:
43+
- specialized-pass deduplication
44+
- plugin post-processing orchestration
45+
- verification pass orchestration
46+
- semantic feedback confidence adjustment
47+
- enhanced feedback adjustment
48+
- review filtering, enhanced filters, and convention suppression
49+
50+
### 5. Test relocation
51+
52+
- [x] Move symbol/context tests into `context.rs`.
53+
- [x] Move guidance tests into `guidance.rs`.
54+
- [x] Move diff chunking tests into `session.rs`.
55+
- [x] Move response validation tests into `execution.rs`.
56+
- [x] Move comment filtering/dedup tests into `comments.rs` and `postprocess.rs`.
57+
- [x] Move prompt/config ownership tests to `src/core/prompt.rs` and `src/config.rs`.
58+
59+
## Execution checklist
60+
61+
- [x] Rewire `src/review/pipeline.rs` into a thin orchestration facade over the new modules.
62+
- [x] Run validators.
63+
- [x] Review git diff for scope and sensitive data.
64+
- [x] Commit and push the refactor.

src/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,12 @@ mod tests {
15081508
assert!(config.base_url.is_none());
15091509
}
15101510

1511+
#[test]
1512+
fn multi_pass_specialized_config_default_false() {
1513+
let config = Config::default();
1514+
assert!(!config.multi_pass_specialized);
1515+
}
1516+
15111517
#[test]
15121518
fn normalize_rejects_base_url_not_a_url() {
15131519
let mut config = Config {

src/core/prompt.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,4 +607,24 @@ mod tests {
607607
let unique: std::collections::HashSet<&&str> = tags.iter().collect();
608608
assert_eq!(unique.len(), tags.len());
609609
}
610+
611+
#[test]
612+
fn specialized_prompts_are_distinct() {
613+
let security = build_security_prompt();
614+
let correctness = build_correctness_prompt();
615+
let style = build_style_prompt();
616+
assert!(security.contains("security"));
617+
assert!(correctness.contains("correctness"));
618+
assert!(style.contains("style"));
619+
assert_ne!(security, correctness);
620+
assert_ne!(security, style);
621+
assert_ne!(correctness, style);
622+
}
623+
624+
#[test]
625+
fn specialized_pass_kind_tags() {
626+
assert_eq!(SpecializedPassKind::Security.tag(), "security-pass");
627+
assert_eq!(SpecializedPassKind::Correctness.tag(), "correctness-pass");
628+
assert_eq!(SpecializedPassKind::Style.tag(), "style-pass");
629+
}
610630
}

0 commit comments

Comments
 (0)