Skip to content

[no-ci] fix(ci): pr-metadata-check — blocked-label bug, exact match, multi-word labels#1836

Merged
rwgk merged 5 commits intoNVIDIA:mainfrom
rwgk:pr-metadata-check-fixes
Mar 31, 2026
Merged

[no-ci] fix(ci): pr-metadata-check — blocked-label bug, exact match, multi-word labels#1836
rwgk merged 5 commits intoNVIDIA:mainfrom
rwgk:pr-metadata-check-fixes

Conversation

@rwgk
Copy link
Copy Markdown
Collaborator

@rwgk rwgk commented Mar 31, 2026

Summary

Fixes the PR metadata workflow’s blocked-label false positive and incorrect handling of multi-word GitHub labels; tightens blocked-label detection to exact name matches (case-insensitive); error text for blocked labels uses GitHub’s spelling of the label name.

Fixes

  1. Blocked-label false positiveBLOCKED_PATTERNS was unquoted in a for pattern in $BLOCKED_PATTERNS loop, so the shell split the string into tokens (blocked, DO, NOT, …). Each token was passed to grep against the full label name, so DO matched the substring do in documentation, incorrectly reporting a blocked label. The workflow now derives blocked matches from the JSON payload with jq; error lines use each label’s original spelling from GitHub, not a lowercased form.

  2. Module / type label iterationLABEL_NAMES was filled with jq -r '.[].name' but then iterated with for label in $LABEL_NAMES, so multi-word label names were split on spaces and never matched the allowed module/type lists. Module and type checks now read label names line-by-line from jq (and the success summary builds the label list from the same jq stream).

Behavior change (intentional)

Blocked labels — Detection no longer uses substring grep on label text. It matches only labels whose name is exactly blocked or do not merge, case-insensitive (via jq). Custom labels that merely contain those words (e.g. blocked-by-review) are not treated as blocked; that is stricter than substring matching and matches reviewer feedback.


Workflow logs reviewed while working on this PR

Run Labels Expected failures Blocked false positive?
23748478947 (PR #1822) documentation, cuda.bindings assignee, milestone Yes -- documentation flagged
23748648922 (PR #1830) enhancement, feature, cuda.bindings assignee No
23757944518 (PR #1793) (none) module label, type label, milestone No

The blocked-patterns loop word-split "DO NOT MERGE" into individual
words, so "DO" matched as a substring of "documentation" via grep.
Replace with a single grep -qiE regex and read labels line-by-line
from jq to also handle multi-word label names correctly.

Made-with: Cursor
@rwgk rwgk added this to the ci backlog milestone Mar 31, 2026
@rwgk rwgk added bug Something isn't working P0 High priority - Must do! CI/CD CI/CD infrastructure labels Mar 31, 2026
@rwgk rwgk self-assigned this Mar 31, 2026
@rwgk rwgk requested review from cpcloud and rparolin March 31, 2026 04:34
@rwgk rwgk enabled auto-merge (squash) March 31, 2026 04:36
Copy link
Copy Markdown
Contributor

@cpcloud cpcloud left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the word-splitting bug here.

I think we should still avoid the remaining grep -qiE \"blocked|do not merge\" check, since it is still doing substring matching rather than exact label matching. The workflow already has the PR labels in LABELS, so this can be an exact, case-insensitive jq check instead.

I left an inline suggestion on the changed block with one way to do that.

…tively)

Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com>
@rwgk
Copy link
Copy Markdown
Collaborator Author

rwgk commented Mar 31, 2026

Archiving a Cursor-generated review below. I'll try to get it to fix the "Minor UX detail" and LABEL_NAMES issue it uncovered.


Net change @ c6b46b5

Scope: .github/workflows/pr-metadata-check.yml — the “blocked label” block only (replaces the nested for / grep loop with a jq pipeline + while read loop).

Bug fix

The previous code put BLOCKED_PATTERNS="blocked DO NOT MERGE do not merge" in an unquoted for pattern in $BLOCKED_PATTERNS loop. The shell word-split that string into tokens (blocked, DO, NOT, MERGE, …). Each token was passed to grep -qi against the full label string, so the token DO matched the substring do in documentation, producing a false “Blocked label detected” result.

Follow-up behavior change (reviewer suggestion)

The fix is not only “stop splitting patterns.” The shipped logic also changes substring matching (grep on label text) to exact label name matching (case-insensitive): only labels whose GitHub name is exactly blocked or do not merge (after lowercasing in jq) are treated as blocked.

So compared to the old intent of “grep for blocked-ish text,” this is stricter: a label like blocked-by-security (or any name that merely contains blocked but is not exactly blocked) would have been caught by substring grep but will not be caught by the jq intersection. That tightening is intentional per review; it should be explicit in the PR description.

Minor UX detail

Error messages use the lowercased names emitted by jq, not necessarily the exact casing shown in the GitHub UI.

Unchanged in this PR

LABEL_NAMES is still built with jq -r '.[].name' and iterated with for label in $LABEL_NAMES, which can still mishandle multi-word labels for the module/type label checks. The blocked-label path correctly avoids that by reading from LABELS via jq instead of reusing $LABEL_NAMES for matching.

@rwgk rwgk marked this pull request as draft March 31, 2026 20:12
auto-merge was automatically disabled March 31, 2026 20:12

Pull request was converted to draft

@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot bot commented Mar 31, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

rwgk added 2 commits March 31, 2026 13:16
Shell word-splitting on $LABEL_NAMES broke multi-word GitHub label names.
Read jq output with while read and build LABEL_LIST from the same jq stream.

Made-with: Cursor
Emit each label's original .name from the PR payload when it matches the
blocked list case-insensitively, instead of lowercased names from jq.

Made-with: Cursor
@rwgk rwgk changed the title [no-ci] Fix blocked-label check falsely matching "documentation" [no-ci] fix(ci): pr-metadata-check — blocked-label bug, exact match, multi-word labels Mar 31, 2026
@rwgk rwgk marked this pull request as ready for review March 31, 2026 20:29
@rwgk
Copy link
Copy Markdown
Collaborator Author

rwgk commented Mar 31, 2026

@cpcloud this is ready for review again. I replaced the PR title and rewrote the description (there are now three changes in this PR).

@rwgk rwgk merged commit fc1ff27 into NVIDIA:main Mar 31, 2026
15 checks passed
@rwgk rwgk deleted the pr-metadata-check-fixes branch March 31, 2026 21:00
@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Doc Preview CI
Preview removed because the pull request was closed or merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CI/CD CI/CD infrastructure P0 High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants