feat(rest-api-application): migrate whitelist context to contract-first architecture - #1947
Merged
josecelano merged 3 commits intoJun 26, 2026
Merged
Conversation
…st architecture - Add WhitelistError protocol type in rest-api-protocol - Define WhitelistCommandPort trait in rest-api-application - Implement WhitelistApiService use-case in rest-api-application - Implement TrackerWhitelistAdapter in rest-api-runtime-adapter - Rewire Axum handlers to dispatch through WhitelistApiService - Update issue spec progress
There was a problem hiding this comment.
Pull request overview
Migrates the REST API whitelist context to the contract-first architecture (protocol → application → runtime-adapter → axum transport), aligning this context with the layered pattern introduced by the earlier PoC and reducing direct coupling between Axum handlers and tracker internals.
Changes:
- Added a whitelist protocol context with a dedicated
WhitelistErrortype inrest-api-protocol. - Introduced the application-layer port (
WhitelistCommandPort) and use-case (WhitelistApiService) for whitelist commands. - Implemented a runtime adapter (
TrackerWhitelistAdapter) and rewired Axum routes/handlers to dispatch through the use-case service.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/rest-api-runtime-adapter/src/adapters/whitelist.rs | New runtime adapter implementing WhitelistCommandPort by delegating to WhitelistManager. |
| packages/rest-api-runtime-adapter/src/adapters/mod.rs | Exposes the new whitelist adapter module. |
| packages/rest-api-protocol/src/v1/context/whitelist/resources/whitelist.rs | Adds WhitelistError protocol error type for whitelist command failures. |
| packages/rest-api-protocol/src/v1/context/whitelist/resources/mod.rs | Registers whitelist resources module. |
| packages/rest-api-protocol/src/v1/context/whitelist/mod.rs | Adds protocol-level whitelist context module. |
| packages/rest-api-protocol/src/v1/context/mod.rs | Exposes the new whitelist context under v1::context. |
| packages/rest-api-application/src/use_cases/whitelist.rs | Adds WhitelistApiService use-case service for whitelist operations. |
| packages/rest-api-application/src/use_cases/mod.rs | Exposes the new whitelist use-case module. |
| packages/rest-api-application/src/ports/whitelist.rs | Adds WhitelistCommandPort trait defining the application/runtime boundary. |
| packages/rest-api-application/src/ports/mod.rs | Exposes the new whitelist port module. |
| packages/axum-rest-api-server/src/v1/routes.rs | Wires TrackerWhitelistAdapter + WhitelistApiService into the v1 router composition. |
| packages/axum-rest-api-server/src/v1/context/whitelist/routes.rs | Switches whitelist route state from WhitelistManager to WhitelistApiService. |
| packages/axum-rest-api-server/src/v1/context/whitelist/handlers.rs | Replaces direct WhitelistManager calls with WhitelistApiService dispatch. |
| docs/issues/open/1940-1938-si-2-migrate-whitelist-context.md | Updates SI-2 spec progress/checklists to reflect completed migration tasks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove the "database error: " prefix from the Display impl to preserve the original error message format (out-of-scope to change). Also check the pre-commit/pre-push verification boxes in the spec.
Member
Author
|
ACK 8b6d92d |
6 tasks
6 tasks
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.
Description
Implements SI-2: Migrate
whitelistcontext to contract-first architecture (sub-issue of #1938).Changes
rest-api-protocol: Addedv1::context::whitelist/withWhitelistErrorprotocol error typerest-api-application: DefinedWhitelistCommandPorttrait andWhitelistApiServiceuse-caserest-api-runtime-adapter: ImplementedTrackerWhitelistAdapterwrappingWhitelistManageraxum-rest-api-server: Rewired handlers to dispatch throughWhitelistApiServiceinstead of callingWhitelistManagerdirectlyArchitecture flow
Verification
WhitelistCommandPorttrait definedWhitelistApiServiceuse-case implementedTrackerWhitelistAdapterimplemented