Skip to content

Prove the posted-content guard rejects server-owned fields - #145

Merged
thavelin merged 1 commit into
mainfrom
thavelin/server-owned-fields-self-test
Nov 12, 2026
Merged

thavelin merged 1 commit into
mainfrom
thavelin/server-owned-fields-self-test

Conversation

@thavelin

Copy link
Copy Markdown
Collaborator

Refs #117 and #130.

The existing posted-content check only sees valid descriptors in today's contract. Extract its field lookup into serverOwnedIn and exercise it with synthetic descriptors: reject id, recorded, and both together; accept empty content, ordinary fields, and similar names such as topic_id and recorded_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, contract go 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. Full make check, TypeScript, regeneration and downstream Chain checks were not run locally.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 serverOwnedIn and 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

@thavelin
thavelin added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 9c31dc1 Nov 12, 2026
3 checks passed
@thavelin
thavelin deleted the thavelin/server-owned-fields-self-test branch November 12, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants