Skip to content

refactor: move MergeReadiness to kild-core#373

Merged
Wirasm merged 2 commits into
mainfrom
kild/330-merge-readiness-core
Feb 11, 2026
Merged

refactor: move MergeReadiness to kild-core#373
Wirasm merged 2 commits into
mainfrom
kild/330-merge-readiness-core

Conversation

@Wirasm

@Wirasm Wirasm commented Feb 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move MergeReadiness enum and compute_merge_readiness() from CLI layer (stats.rs) into kild-core so both CLI and kild-ui can reuse merge readiness logic
  • Pure refactor — zero behavior changes, identical CLI output
  • 11 unit tests moved to kild-core, 4 CLI-only tests remain

Closes #330

Move merge readiness business logic from CLI layer (stats.rs) into
kild-core so both CLI and kild-ui can import it without duplication.

- Add MergeReadiness enum to kild-core/src/git/types.rs
- Add compute_merge_readiness() to kild-core/src/git/operations.rs
- Export via git/mod.rs and lib.rs
- Update CLI to import from kild-core
- Move 11 unit tests to kild-core

Closes #330
Move computation logic from free function to MergeReadiness::compute()
for better type encapsulation. Remove backward-compat wrapper per
project guidelines. Add edge-case tests for CI Pending/Unknown states
and Draft PR handling.
@Wirasm

Wirasm commented Feb 11, 2026

Copy link
Copy Markdown
Owner Author

PR Review Summary

Critical Issues (0 found)

None.

Important Issues (2 found — both addressed)

Agent Issue Resolution
type-design-analyzer compute_merge_readiness is a free function, not attached to MergeReadiness type — poor encapsulation Moved to MergeReadiness::compute() inherent method
type-design-analyzer Cross-module git→forge dependency via free function in operations.rs Forge imports now scoped to types.rs where MergeReadiness lives, cleaner boundary

Suggestions (3 found — all addressed)

Agent Suggestion Resolution
pr-test-analyzer (6/10) No test for CI Pending state — implicit "ready" behavior undocumented Added test_readiness_ready_with_pending_ci
pr-test-analyzer (6/10) No test for CI Unknown state — implicit "ready" behavior undocumented Added test_readiness_ready_with_unknown_ci
pr-test-analyzer (5/10) No test for Draft PR state Added test_readiness_ready_with_draft_pr

Strengths

  • Clean refactor with zero behavior changes
  • All 14 readiness tests pass (11 original + 3 new)
  • Proper module organization following kild-core patterns
  • No backward-compatibility shims per project guidelines

Documentation Updates

  • None needed (confirmed by docs-impact-agent)

Verdict

READY TO MERGE

All checks pass: cargo fmt --check, cargo clippy --all -- -D warnings, cargo test --all

@Wirasm Wirasm merged commit 1edbfb2 into main Feb 11, 2026
6 checks passed
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.

refactor: move compute_merge_readiness from CLI to kild-core

1 participant