Add user message wire contract - #32
Open
atavism wants to merge 3 commits into
Open
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Comment |
There was a problem hiding this comment.
Pull request overview
Adds a new usermessage package that defines and validates a v1 JSON wire contract for fetching resolved in-app user messages, along with embedded fixtures and compatibility/validation tests.
Changes:
- Introduces v1 request/response/message/action types with explicit wire-size limits.
- Adds validation for request, response, resolved message content, and allowlisted actions (including HTTPS URL validation).
- Adds versioned embedded JSON fixtures and tests covering round-trip JSON compatibility and validation rules.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| usermessage/types.go | Defines the v1 wire-contract structs, enums, and size-limit constants. |
| usermessage/validation.go | Implements validation for the v1 request/response/message/action contract. |
| usermessage/types_test.go | Adds fixture round-trip tests and targeted validation/limits tests. |
| usermessage/testfixtures/fixtures.go | Exposes embedded, versioned JSON fixtures via an embed.FS. |
| usermessage/testfixtures/v1/request.json | Adds a v1 request fixture used for compatibility tests. |
| usermessage/testfixtures/v1/response_empty.json | Adds a v1 “no message” response fixture. |
| usermessage/testfixtures/v1/response_message.json | Adds a v1 response fixture containing a message with an HTTPS URL action. |
| usermessage/testfixtures/v1/response_no_action.json | Adds a v1 response fixture containing a message without an action. |
| usermessage/testfixtures/v1/response_open_plans.json | Adds a v1 response fixture containing a message with an open_plans action. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
For https://github.com/getlantern/engineering/issues/3784