Skip to content

fix: print the payload, not [object Object], when a command has no issue or pull number - #373

Merged
jeefy merged 2 commits into
cncf:mainfrom
jeefy:fix/missing-number-message
Oct 8, 2026
Merged

jeefy merged 2 commits into
cncf:mainfrom
jeefy:fix/missing-number-message

Conversation

@jeefy

@jeefy jeefy commented Oct 8, 2026

Copy link
Copy Markdown
Member

Bug

18 command handlers build their "missing issue/pull/pr number" error with ${context.payload}, so the message ends in [object Object]:

github context payload missing issue number: [object Object]

The other 9 "github context payload missing ..." errors already use JSON.stringify(...).

Affected: issueComment/{approve,assign,cc,close,lock,meow,milestone,reopen,retitle,trigger,unassign,uncc}.ts, labels/{fixed,hold,lgtm,prefixed,remove}.ts, pullReq/onPrLgtm.ts.

Fix

Interpolate ${JSON.stringify(context.payload)} in those 18 sites, matching the existing convention. Message prefix and error types are unchanged; no other behaviour change. dist/ regenerated with npm run pack.

Tests

  • New __tests__/missingNumberMessage.test.ts: one parametrized case per site (18) feeding a payload without the number, asserting the exact message (github context payload missing <issue|pull|pr> number: <JSON payload>) and that it contains no [object Object]; msw with failOnUnhandledRequest, so the handlers must refuse before any API call. All 18 cases fail on main and pass here.
  • npm run all (1843 tests), npm run test:coverage (100 / 99.82 / 100 / 100), npm run test:coverage:e2e pass; a second npm run pack leaves dist/ clean.

Note: open PR #343's expected messages pin [object Object]; those expectations should drop it (they will become the JSON payload) once this lands.

…sue or pull number

18 handlers interpolated `${context.payload}` into their "github context
payload missing issue/pull/pr number" error, which renders as
`[object Object]`. They now use `JSON.stringify(context.payload)`, the
convention the other 9 "missing ..." errors already follow. The message
prefix and the thrown error types are unchanged.

A parametrized test drives each of the 18 sites with a payload lacking the
number and asserts the exact message and the absence of `[object Object]`.

Signed-off-by: Jeffrey Sica <me@jeefy.dev>
@jeefy
jeefy requested a review from jpmcb as a code owner October 8, 2026 00:54
Signed-off-by: Jeffrey Sica <me@jeefy.dev>
@jeefy
jeefy merged commit 05d35f4 into cncf:main Oct 8, 2026
5 checks passed
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.

1 participant