feat: type discussion and notification tool outputs - #3388
Open
SamMorrowDrums wants to merge 4 commits into
Open
SamMorrowDrums wants to merge 4 commits into
SamMorrowDrums wants to merge 4 commits into
Conversation
SamMorrowDrums
added this pull request to stack #3385
October 2, 2026 11:38
7 of 13 tasks
SamMorrowDrums
force-pushed
the
sammorrowdrums-typed-discussion-notification-outputs
branch
from
October 2, 2026 20:50
b9c2a32 to
ed9ac2e
Compare
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The discussion read normalizer inserts absent required fields, allowing invalid requests to bypass schema validation.
Review effort: Balanced
Findings: 1
What changed in this PR
Migrates discussion and notification tools to typed, protocol-gated structured outputs while preserving legacy text responses and input compatibility.
Changes:
- Adds typed input/output DTOs and compatibility normalizers for 11 tools.
- Adds strict union schemas and protocol compatibility tests.
- Updates explicit output-schema snapshots.
| File | Description |
|---|---|
pkg/github/discussion_notification_inputs.go |
Adds typed inputs and normalizers. |
pkg/github/discussion_notification_outputs.go |
Defines compact structured outputs. |
pkg/github/discussions.go |
Migrates discussion tools to typed registration. |
pkg/github/notifications.go |
Migrates notification tools to typed registration. |
pkg/github/typed_discussion_notification_outputs_test.go |
Tests schemas, protocol gating, and compatibility. |
pkg/github/__toolsnaps__/discussion_comment_write.snap |
Records comment-write union schema. |
pkg/github/__toolsnaps__/manage_notification_subscription.snap |
Records thread-subscription union schema. |
pkg/github/__toolsnaps__/manage_repository_notification_subscription.snap |
Records repository-subscription union schema. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+110
to
+112
| args["owner"] = input.Owner | ||
| args["repo"] = input.Repo | ||
| args["discussionNumber"] = input.DiscussionNumber |
Migrate all eleven tools to typed registration and compact output DTOs. Preserve legacy text, parameter compatibility, pagination, and mutation validation while publishing honest modern output unions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Trim notification hypermedia, preserve useful HTML links, and record all modern schemas in canonical snapshots. Preserve source presence during discussion read normalization and cover the Copilot review regression alongside empty/null outputs, IFC labels, sanitization, and output enums. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…O expectations
Add an explicit {} (fully-empty args) case to
TestDiscussionReadRequiredArguments proving the normalizer never
synthesizes placeholder owner/repo/discussionNumber values that would
let an empty request satisfy SDK required-schema validation and reach
GraphQL; verified both protocols reject it pre-handler with zero
GraphQL calls (addresses readiness-audit re-flag of already-fixed
Copilot review comment 4171698931 in 578e9929).
Also record the pending modern-text==structuredContent DTO contract
(2026-07-28 protocol) in test expectations; these assertions are
intentionally red pending the coordinator's central once-marshal
wrapper in pkg/inventory/typed_output.go, which this branch does not
yet have.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
SamMorrowDrums
force-pushed
the
sammorrowdrums-typed-discussion-notification-outputs
branch
from
October 3, 2026 13:46
ed9ac2e to
eb11e13
Compare
SamMorrowDrums
marked this pull request as ready for review
October 3, 2026 13:48
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.

Summary
Migrate all 5 discussion and 6 notification tools to typed input/output registration, compact concrete DTOs, and protocol-gated modern output schemas and structured results. Preserve existing legacy text responses and input schemas.
Why
Next typed-output migration layer, stacked on #3387. Exact refreshed base:
7ef5714b5880d9205610219ce6e3a16df13f8bd9. No issue closure or native stack metadata changes.What changed
NewTool[In, Out]. Model comment write results as a strict comment-reference versus discussion-answer-reference union; subscription tools return a strict subscription-versus-deletion-message union. Discussion replies have a concrete one-level DTO matching the queried API rather than a recursive schema.tools/listandtools/calltests for all tools, all six comment methods, both dismissal states, all subscription actions, output-schema conformance, impossible-union rejection, byte-exact legacy text, and error responses without structured success output. Update three explicit union schema snapshots; remaining schemas are SDK-inferred.MCP impact
Modern protocol
2026-07-28receives output schemas and compact structured results for these 11 tools; legacy protocol2025-11-25remains text-only. Names and advertised input schemas remain unchanged; legacy text is checked byte-for-byte.Prompts tested (tool changes only)
Security / limits
Existing scope requirements and IFC labels are preserved. Structured results trim repository details while legacy text retains its full existing response; discussion comment bodies continue using existing sanitization. Pagination and the API's one-level, up-to-100-reply query remain unchanged.
Tool renaming
deprecated_tool_aliases.goNo tool names or aliases changed.
Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.
Lint & tests
./script/lint./script/testCommands and results:
UPDATE_TOOLSNAPS=true go test ./pkg/github -run 'Test_(ListNotifications|DismissNotification|MarkAllNotificationsRead|GetNotificationDetails|Manage.*NotificationSubscription|ListDiscussions|GetDiscussion|ListDiscussionCategories|DiscussionCommentWrite)' -count=1— passed; updated intentional union snapshots.go test ./pkg/github -run 'Test(TypedDiscussionNotificationOutputs|DiscussionNotificationUnionsRejectImpossibleResults)|Test_(ListNotifications|DismissNotification|MarkAllNotificationsRead|GetNotificationDetails|Manage.*NotificationSubscription|ListDiscussions|GetDiscussion|ListDiscussionCategories|DiscussionCommentWrite)' -count=1— passed.script/lint— passed, 0 issues.script/test— passed, fullgo test -race ./...suite, including mcpcurl.script/generate-docs— passed; generated documentation unchanged.git diff --checkandgit diff --cached --check— passed.Live PAT-dependent E2E tests were not run.
Docs
script/generate-docspassed with no documentation content changes; tool descriptions and advertised input schemas are unchanged. Explicit union output contracts are captured in toolsnap updates.