Repository navigation
Prove the posted-content guard rejects server-owned fields - #145
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the posted-content guard test improvements.
No open issues 🎉
What changed in this PR
This PR strengthens the contract tests by proving that the posted-content guard detects server-owned fields in synthetic message descriptors, rather than checking only the current valid schema.
Changes:
- Extracts
serverOwnedInand reuses it in the existing manifest check, preserving JSON-name lookup, write-route scope, diagnostics, and the nonempty-coverage guard. - Adds six fixture cases covering protected fields individually and together, empty content, ordinary fields, and similar names. No schema or generated files change.
| File | Description |
|---|---|
go/contract/signing_test.go |
Extracts the field-check helper and adds synthetic-descriptor tests for accepted and rejected content. |
Review effort: Balanced
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.
Refs #117 and #130.
The existing posted-content check only sees valid descriptors in today's contract. Extract its field lookup into
serverOwnedInand exercise it with synthetic descriptors: rejectid,recorded, and both together; accept empty content, ordinary fields, and similar names such astopic_idandrecorded_at.This retains #130's write-route scope, JSON-name lookup, diagnostics and nonempty-coverage guard. The same helper drives the manifest check and the six fixture cases. No schema or generated files change, and the descriptor builder uses existing protobuf dependencies.
Validation: both focused tests, both-module
make test, contractgo vet, formatting and diff checks pass. Removing either protected field makes the intended fixture cases fail; the original source was restored byte-for-byte and the focused suite passed again. Fullmake check, TypeScript, regeneration and downstream Chain checks were not run locally.