KAN-712 feat(api): scaffold kanban-api crate with ApiError and ChangeEventFrame#344
Open
fulsomenko wants to merge 5 commits into
Open
KAN-712 feat(api): scaffold kanban-api crate with ApiError and ChangeEventFrame#344fulsomenko wants to merge 5 commits into
fulsomenko wants to merge 5 commits into
Conversation
… dep, add std::error::Error to ApiError
…, clean constructor API Add ErrorCode enum with SCREAMING_SNAKE_CASE serialisation covering all KanbanError variants. Replace string code field on ApiError with ErrorCode. Add #[non_exhaustive] and #[serde(rename_all = "snake_case")] to both ApiError and ChangeEventFrame. Split ChangeEventFrame::new into new (explicit timestamp) and now (Utc::now convenience). Add serde(default) on correlation_id and issued_by with nil fallbacks for backward-compatible deserialisation. Make v1 private in lib.rs and re-export canonical names at the crate root.
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.
Add kanban-api crate with the shared HTTP wire types used by kanban-server and kanban-http-backend:
What: New kanban-api crate with two types: ApiError (returned by all server error responses) and ChangeEventFrame (broadcast over WebSocket on every successful mutation). The crate has no dependency above kanban-domain and forms the stable wire contract between server and clients.
Why: kanban-server and kanban-http-backend both need to share these types without circular dependencies. Defining them in a dedicated crate with minimal deps keeps the boundary clean.
How: ChangeEventFrame carries all four observability fields (writer_instance_id, detected_at, correlation_id, issued_by) from day one so the wire format does not need to be versioned later. KAN-731 (which would have added correlation_id and issued_by separately) is now redundant.
Testing: cargo test --package kanban-api (5 tests pass), cargo clippy --all-targets --all-features -- -D warnings (clean).