fix: discussion label updates truncated to 3 instead of max labels#25430
fix: discussion label updates truncated to 3 instead of max labels#25430
Conversation
The validateLabels call in update_discussion.cjs was not passing maxCount, so it defaulted to 3. Now passes MAX_LABELS (10) to be consistent with the tryEnforceArrayLimit check above it. Fixes: Discussion labels limited to 3 per item Agent-Logs-Url: https://github.com/github/gh-aw/sessions/11bde075-8540-40c3-955b-2bc46c63e5b5 Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
|
@copilot Compare to max count and behavior for issue and PR labels, so as to stay consistent. |
Checked the consistency:
The fix in cc03161 aligns |
|
@copilot Also add a test case for more than 10 items. |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cef10ec6-e0ed-4975-a99c-e518e1bf693d Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Added in e2900ea — a new test case requests 11 labels (> MAX_LABELS = 10) and asserts the result is |
There was a problem hiding this comment.
Pull request overview
Fixes update_discussion label updates being unintentionally truncated to 3 labels by aligning validateLabels’ maxCount with the existing MAX_LABELS = 10 enforcement.
Changes:
- Pass
MAX_LABELSexplicitly intovalidateLabelswithinupdate_discussion.cjsto prevent the implicitmaxCount=3default from truncating label arrays. - Add regression coverage ensuring 5 labels are applied (no truncation) and that requesting >10 labels fails with
E003and performs no label mutations. - Extend the test label fixture to include
Label5–Label11so the new cases can resolve label IDs.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/update_discussion.cjs | Ensures label validation uses MAX_LABELS (10) instead of validateLabels’ default (3). |
| actions/setup/js/update_discussion.test.cjs | Adds regression tests for the 10-label limit and prevents silent truncation to 3. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
|
@copilot Investigate failing CI checks/tests. |
The CI failure is pre-existing and unrelated to this PR. My changes only touch The failing job is Integration: Workflow Misc Part 2 → |
|
Hey
This PR looks ready for maintainer review. Nice work! 🚀
|
update_discussionwas silently truncating labels to 3 due tovalidateLabelsdefaultingmaxCountto 3 when not explicitly provided — despitetryEnforceArrayLimitabove it correctly usingMAX_LABELS = 10.Changes
update_discussion.cjs: PassMAX_LABELSexplicitly tovalidateLabels, aligning both limit checks:update_discussion.test.cjs: Added regression test asserting all 5 requested labels are applied (not truncated to 3); extendeddefaultLabelsfixture to include Label5–Label11. Added a test case asserting that requesting more than 10 labels (> MAX_LABELS) is rejected with anE003error and no label mutations are called.