Skip to content

Event streaming (5/11): Add gh event subscription view - #15075

Merged
BagToad merged 1 commit into
babakks/event-sub-createfrom
babakks/event-sub-view
Nov 17, 2026
Merged

BagToad merged 1 commit into
babakks/event-sub-createfrom
babakks/event-sub-view

Conversation

@babakks

@babakks babakks commented Nov 17, 2026

Copy link
Copy Markdown
Member

Layer 5 of 11 in the stack tracked by #15070.

Description

Users and scripts need to inspect one subscription: which resource and event types it covers, and when it expires.

gh event subscription view ID [--json FIELDS]

On a terminal it shows the ID, when it was created and expires, the resource URL, and the event types, each with a short description when gh knows the type. Piped, it prints key:\tvalue lines with RFC 3339 times, like other view commands. --json exports the same fields as list. A subscription the API cannot find gets a message that it may have expired, been deleted, or not be accessible to the caller, since the API does not tell these apart.

How did you test this change?

Recording of gh event subscription view on babakks#17: the formatted view on a terminal, plain key and value lines when piped, --json output, and the not found error for an unknown ID.

05-sub-view.mp4

With a gh built from the complete stack, I ran the live smoke check from the evals PR against a sandbox pull request on github.com. Among other steps, it ran gh event subscription create with a merge conflict event type and got a sub_... ID on stdout, saw the same ID, resource URL, and event types in gh event subscription view ID --json id,resourceUrl,eventTypes, found the ID in gh event subscription list --limit 100 --json id, ran gh event subscription delete ID, and then saw gh event subscription view ID fail because the subscription was gone.

Key points

  • Event type descriptions come from the same list as the help text and completion, and unknown types are shown without one rather than rejected.

Notes for reviewers

Stack, bottom to top (this is 5 of 11, based on babakks/event-sub-create): babakks/event-client, babakks/event-listen, babakks/event-sub-list, babakks/event-sub-create, babakks/event-sub-view, babakks/event-sub-delete, babakks/event-hints, babakks/event-evals, babakks/event-listen-flush, babakks/event-listen-deleted-sub, babakks/event-check-suite.

The whole change is pkg/cmd/event/subscription/view/view.go and its tests.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @babakks will read and reply directly. Name the account.
  • An agent will draft replies and @username will read them before they are posted.
  • Nobody has explicitly committed to replying.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: bbce5a7f-103c-4e67-99c9-2d6dc3f6a02b
@babakks
babakks requested a review from a team as a code owner November 17, 2026 17:11
@babakks
babakks requested review from tidy-dev and a balanced review from Copilot and removed request for a team November 17, 2026 17:11
@babakks
babakks added this pull request to stack #15082 November 17, 2026 17:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Missing constructor tests leave argument validation and subscription ID/JSON-field wiring to the run function unverified.

1 open issue
What changed in this PR

Adds gh event subscription view as layer 5 of the event-streaming stack, allowing users and scripts to inspect a subscription’s resource, event types, and lifetime.

Changes:

  • Registers the new view <id> subcommand.
  • Supports formatted terminal output, plain piped output, JSON export, and a descriptive not-found error.
  • Tests output formats, supported JSON fields, and API error handling.
File Description
pkg/​cmd/​event/​subscription/​view/​view.go Implements subscription retrieval and display.
pkg/​cmd/​event/​subscription/​view/​view_test.go Tests output formats and error handling.
pkg/​cmd/​event/​subscription/​subscription.go Registers the view subcommand.

Review effort: Balanced

@babakks
babakks requested review from BagToad and removed request for tidy-dev November 17, 2026 17:16
@BagToad
BagToad merged commit 42d52b4 into trunk Nov 17, 2026
19 checks passed
@BagToad
BagToad deleted the babakks/event-sub-view branch November 17, 2026 19:18
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.

3 participants