feat: Core Contracts - Define all package interfaces#34
Conversation
|
Warning Rate limit exceeded@jordanpartridge has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 22 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (16)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds seven new interface contracts and two supporting DTOs that scope out the API surface for features still in flight (Checks, Merge strategies, Files API, PR creation, Comments). Implementation PRs for those features can target these contracts directly. New interfaces: - CheckRunQueryInterface (#23) - CommentManagerInterface (#29) - FileQueryInterface (#25) - MergeManagerInterface (#24) - PullRequestBuilderInterface (#26) - PullRequestManagerInterface - ReviewQueryInterface New DTOs: - CheckSummary — aggregated check run statistics - FileStats — aggregated file change statistics Excluded vs. the original branch: - PullRequestQueryInterface — already shipped in master via #38, kept as-is. - ReviewBuilderInterface — already shipped via #36, kept as-is. - PullRequestActionsInterface — the package adopted a role-trait pattern instead (Assignable, Closeable, Mergeable, Labelable, Commentable, Reviewable, Auditable), so the bundled actions interface is omitted. Closes #27.
77334cc to
20b492f
Compare
|
Rebased onto post-#41 master and salvaged to scope. Kept (7 interfaces + 2 DTOs):
Dropped:
composer.json conflict: resolved to master's (`php: ^8.3`, `conduit-ui/connector: ^1.0.1`, `illuminate/support: ^12.43|^13.0`). The original PR's attempt to promote illuminate/support to `require` was dropped; the package currently keeps it as a dev dep. Quality gates:
`ContractsTest.php` was trimmed to drop assertions tied to the dropped interfaces. |
Closes #27
Summary
Implements comprehensive interface contracts for the entire package following interface-first design pattern, ensuring clean architecture and testability.
Changes
Core Contract Interfaces (10 new interfaces)
PullRequestQueryInterface - Fluent query builder for pull requests
PullRequestManagerInterface - CRUD operations for pull requests
PullRequestBuilderInterface - Builder pattern for PR creation
ReviewBuilderInterface - Builder pattern for reviews
ReviewQueryInterface - Query operations for reviews
CheckRunQueryInterface - Query operations for CI checks
MergeManagerInterface - Merge operations
FileQueryInterface - Query operations for changed files
PullRequestActionsInterface - State-changing operations
CommentManagerInterface - Comment management
Supporting DTOs (2 new DTOs)
CheckSummary - Aggregated check run statistics
FileStats - Aggregated file change statistics
Interface Design Principles
1. Fluent Chainability
All builder/action interfaces return
selffor method chaining:2. Query Segregation
Separate interfaces by responsibility:
*QueryInterface- Read operations returning Collections*BuilderInterface- Creation operations*ManagerInterface- CRUD operations*ActionsInterface- State-changing operations3. Type Safety
All interfaces use strict typing:
4. Collection Returns
Query operations return Laravel Collections for filtering/mapping:
Dependencies
illuminate/support: ^11.0for Collection supportQuality Gates
Tests
Static Analysis
Benefits
Next Steps
These contracts lay the foundation for:
Related Issues