diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-07 23:31:38 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-07 23:31:38 +0000 |
| commit | c67ebe6f33bfa191f17eb0df24d3ee18092c74e1 (patch) | |
| tree | b86911bbb406f4aa0253b1cf1e0a82aed16c972b /src/git/mod.rs | |
| parent | 4dc0ed66a0bd3b4b00804bb13adf93b207bb5fc4 (diff) | |
refactor: unify event processing logic
Eliminates code duplication by extracting core event processing into
reusable functions. All state and PR event processing now uses the same
unified logic from src/git/process.rs.
Changes:
- Add src/git/process.rs with unified processing functions
- process_state_with_git_data() for state events
- process_pr_with_git_data() for PR events
- Pure functions with comprehensive result types
- Refactor policy handlers to use unified processing
- src/nostr/policy/state.rs: Remove ~70 lines of duplicated logic
- src/nostr/policy/pr_event.rs: Remove ~40 lines of duplicated logic
- Refactor purgatory processing to use unified functions
- src/git/sync.rs: Remove ~125 lines of duplicated logic
- Make extract_owner_from_repo_path() public for reuse
Benefits:
- DRY: Single source of truth for event processing
- Testable: Pure functions with clear contracts
- Maintainable: Changes happen in one place
- Consistent: All code paths use same logic
All 217 unit tests + 40 integration tests pass (257/257).
Diffstat (limited to 'src/git/mod.rs')
| -rw-r--r-- | src/git/mod.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/git/mod.rs b/src/git/mod.rs index fb17c53..205e3bc 100644 --- a/src/git/mod.rs +++ b/src/git/mod.rs | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | pub mod authorization; | 20 | pub mod authorization; |
| 21 | pub mod handlers; | 21 | pub mod handlers; |
| 22 | pub mod process; | ||
| 22 | pub mod protocol; | 23 | pub mod protocol; |
| 23 | pub mod subprocess; | 24 | pub mod subprocess; |
| 24 | pub mod sync; | 25 | pub mod sync; |