feat: issue labeler logic moves to scripts/issue-labeler.js with a durable test - #63
Merged
Merged
Conversation
…rable test The labeler was the one workflow carrying logic — ~150 lines of JS inline in the YAML, testable only by extracting it by hand. The logic is now a plain Node module with pure functions and one run() entry point; the workflow checks out the default branch (pinned checkout, no credentials) and calls it in two lines. labels.yml is read from the checkout instead of the API. scripts/issue-labeler.test.js pins the behaviour (12 cases, node built-ins only) and runs from make check; in CI a missing node fails, locally it skips loudly. Hygiene rule 1 and AGENTS.md name the shape; ADR-0008 records it; check-label-forms.sh follows the constants to the script. Closes #49 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merged
2 tasks
Owner
Author
|
L3 done on |
TzuH-Hsu
pushed a commit
that referenced
this pull request
Sep 16, 2026
🤖 I have created a release *beep* *boop* --- ## [0.5.0](v0.4.1...v0.5.0) (2026-09-16) ### Features * issue labeler logic moves to scripts/issue-labeler.js with a durable test ([#63](#63)) ([f464cfb](f464cfb)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The labeler was the one workflow carrying logic — ~150 lines of JS inline in the YAML, testable only by hand-extracting it (#48 was validated that way). Per #49 option 1:
scripts/issue-labeler.js: the logic as a plain Node module — pureparseSections/matchAllowed/parseAllowedAreas/computeChanges, one I/Orun({github, context, core}).labels.ymlis read from the checkout instead of the API (same trust boundary: onissueseventsGITHUB_SHAis the default-branch head)..github/workflows/issue-labeler.yml: pinnedactions/checkout(persist-credentials: false,fetch-depth: 1, the SHA already used byci.yml) + a two-linegithub-scriptrequire. No adopter values; replace whole on upgrade, together with the script.scripts/issue-labeler.test.js(14 cases, node built-ins only) run byscripts/check-issue-labeler.shfrommake check. A missingnodefails with an install hint like every other toolmakeneeds — deviation from the issue text, which said "SKIP visibly locally": the Makefile's convention is fail-with-hint, and a green skip is what validation-ladder rule 7 forbids.nodeadded to CONTRIBUTING's tool table.scripts/check-label-forms.shfollows the constants to the script, and now fails two torn-upgrade states: a thin-caller workflow without the script, and the script present while the workflow still carries the inline copy.AGENTS.md, design principle 5, the architecture ledger,upgrading.md(full travel set), CODEOWNERS example.Related issue
Closes #49
Validation
make verifygreen (actionlint, yamllint, markdownlint, lychee, checks incl. the new test step)node --test scripts/issue-labeler.test.js: 14/14. Includes the read-failure-throws-before-any-API-call guarantee, the empty-allowlist warning, a 65k-char heading line parsing in linear time, and stray CR / U+2028 heading lines.main: 3,000 random bodies (LF and CRLF; dropdown case variants,_No response_, ticked/unticked/undeclared areas, exotic heading lines) × random current labels → 0 differences in add/remove decisions.check-label-forms.shverified on four labeler generations (pre-fix: issue labeler reads the area:* allowlist from labels.yml instead of a hardcoded list #48 inline, fix: issue labeler reads the area:* allowlist from labels.yml instead of a hardcoded list #48–v0.4.1 inline, extracted, and both torn states).issuesevents cannot be a fork ref.mainonissuesevents): open an issue tickingarea:ci, confirm the label; edit toarea:docs, confirm the swap. Recorded in a comment here.Risk / rollback
Checklist
*.local.mdfiles committed