Skip to content

fix(labels): say which values were refused instead of "command args missing" - #376

Merged
jeefy merged 2 commits into
cncf:mainfrom
jeefy:fix/label-command-messages
Oct 8, 2026
Merged

jeefy merged 2 commits into
cncf:mainfrom
jeefy:fix/label-command-messages

Conversation

@jeefy

@jeefy jeefy commented Oct 8, 2026

Copy link
Copy Markdown
Member

Bug. /kind foo where foo is not an allowed value (and the same for every prefixed/dynamic label command and its /remove-<key> form) failed with kind: command args missing from body although an argument was given: requestedLabels in src/labels/prefixed.ts threw that message whenever no allowed value survived filtering.

Fix. Args given but none allowed now fails with e.g. kind: no allowed value in "foo"; allowed: failing-test, cleanup (allowed: none for an empty section). No argument at all keeps <key>: command args missing from body. /remove-<key> of an allowed value that is not on the issue was never on this path (it is a no-op logged at debug) and is unchanged; plain /remove (src/labels/remove.ts) is a separate function and is untouched.

Tests changed (they pinned the old text for a disallowed value).

Added: several disallowed values, an empty section (allowed: none), /lifecycle and /remove-lifecycle with no value (unit) and /kind with no value (bundle) keeping the missing-args message. docs/labeling.md describes both messages. dist/index.js regenerated with npm run all.

Verified locally: npm run all (1851 tests), npm run test:coverage (thresholds pass), second npm run pack leaves dist/ clean, npm run test:coverage:e2e (215 tests).

…issing"

`/kind foo` where `foo` is not an allowed value, and the same for every
prefixed or dynamic label command and its `/remove-<key>` form, failed
with `kind: command args missing from body` although an argument was
given: requestedLabels threw that message whenever no allowed value was
left after filtering.

The message now says what happened, e.g.
`kind: no allowed value in "foo"; allowed: bug, feature` (`allowed: none`
for an empty section). A command with no argument at all keeps
`<key>: command args missing from body`.

Tests: the eleven unit cases under __tests__/label/ and the bundle case
in prefixedRemoveArms.test.ts (cncf#341) that passed a disallowed value
asserted the old text; they now assert the new one. New cases: several
disallowed values, an empty section, and /lifecycle, /remove-lifecycle
and (bundle) /kind with no value keeping the missing-args message.
docs/labeling.md describes both messages.

Signed-off-by: Jeffrey Sica <me@jeefy.dev>
@jeefy
jeefy requested a review from jpmcb as a code owner October 8, 2026 01:22
Signed-off-by: Jeffrey Sica <me@jeefy.dev>
@jeefy
jeefy merged commit 5061d57 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