Commit 53cb8d2
test: prove real handler output conforms to every declared output schema
Extends TestIssueReadOutputValidatesAgainstDeclaredSchema to the remaining
six tools, taking method coverage from 3 of 28 to 28 of 28. Each tool gets
its own file; each subtest runs the real handler against the existing mock
harness, then validates the emitted payload against the schema the tool
advertises.
Validating the text block is equivalent to validating what a client
receives, because the structured-content mirror publishes those exact bytes
as structuredContent.
Beyond the happy path, the tests cover the cases that actually exercise a
schema's required sets: empty collections, sparse objects with every
optional field absent, and — for actions_get — a different single surviving
key per method, so a non-first branch of each anyOf is exercised rather than
always the first.
Fixes a latent bug the tests surfaced. go-github decodes GetWorkflowRunByID,
GetWorkflowJobByID and GetWorkflowRunUsageByID into a *T, so a 200 carrying
a null body leaves the pointer nil and json.Marshal emits the literal
`null`, which cannot validate against an object-rooted schema. Same class as
the sub-issues bug already fixed here; these three now report the anomaly
instead of returning a payload no caller can use.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 9b7d725 commit 53cb8d2
8 files changed
Lines changed: 2620 additions & 0 deletions
File tree
- pkg/github
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
802 | 802 | | |
803 | 803 | | |
804 | 804 | | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
805 | 811 | | |
806 | 812 | | |
807 | 813 | | |
| |||
815 | 821 | | |
816 | 822 | | |
817 | 823 | | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
818 | 827 | | |
819 | 828 | | |
820 | 829 | | |
| |||
1007 | 1016 | | |
1008 | 1017 | | |
1009 | 1018 | | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
1010 | 1022 | | |
1011 | 1023 | | |
1012 | 1024 | | |
| |||
0 commit comments