Skip to content

chore: improve product labeling for issues and changelogs - #33394

Open
mvvmm wants to merge 4 commits into
productionfrom
chore/improve-product-labeling
Open

chore: improve product labeling for issues and changelogs#33394
mvvmm wants to merge 4 commits into
productionfrom
chore/improve-product-labeling

Conversation

@mvvmm

@mvvmm mvvmm commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Improves product labeling across issues and PRs:

  • Issue assigner: lowercases the docs URL before deriving the product: label, so /API/... produces product:api instead of creating a separate product:API label.
  • PR labeler: removes product:_headers and product:_redirects — those map root config files, not products.
  • Changelog labeling: adds per-product changelog globs so a changelog PR gets both the actual product label (e.g. product:workers) and the existing product:changelog label.
  • Generator: adds bin/generate-labeler.ts (pnpm run generate:labeler) that regenerates .github/labeler.yml from the content collections. The labeler header previously claimed the file was generated but no generator was committed.

The changelog mapping is derived from src/content/directory/*.yaml entry.url first segments (e.g. Zero Trust sub-products like access, gateway, casb map to cloudflare-one).

Behavior note: deriving release-notes from productLink also adds three previously-unlabeled release-notes files (workers.yaml, workflows.yaml, zaraz.yaml) to their product rules — a change to those files previously got no product label.

@mvvmm
mvvmm marked this pull request as ready for review September 11, 2026 16:32
@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Review

⚠️ 1 warning, 💡 1 suggestion found in commit 82cc056.

👉 Fix in your agent 👈
Fix the following review findings in PR #33394 (https://github.com/cloudflare/cloudflare-docs/pull/33394).

Before making changes, review each finding and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g. the fix requires disproportionate effort for minimal benefit,
  or the finding is factually incorrect), explain why
- If you need clarification before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

After triaging, follow this order:
1. Post a comment on this PR for any findings you are skipping, with the finding ID and your reasoning.
2. Then commit the fixes for the legitimate findings.

The comment must come before the commit — the bot reads PR comments when a new
push triggers a review, so skip comments posted after the push will be missed.

---

## Code Review

### Warnings (1)

#### CR-ce3d3f6bd344 · Overly broad error handling
- **File:** `bin/generate-labeler.ts` line 82
- **Issue:** The bare `catch {}` around `loadYaml` treats every failure — including YAML parse errors (js-yaml throws `YAMLException` on malformed input) and non-ENOENT read errors — as "No directory entry", then silently drops the changelog label rule for that folder. A typo in a directory YAML would produce a misleading warning and silently omit labels from the generated labeler.yml.
- **Fix:** Only skip on file-not-found (e.g., check `error.code === 'ENOENT'` or use `readFile` with a null-handling helper); rethrow any other error so parse problems fail loudly instead of being masked.

### Suggestions (1)

#### CR-9c0f0f6685b6 · Unhandled URL parse error
- **File:** `bin/generate-labeler.ts` line 49
- **Issue:** `new URL(url).pathname` throws a TypeError on malformed absolute URLs (e.g., `https://` with no host). Since `firstUrlSegment` is also applied to `productLink` values in release-notes YAML and directory entry URLs, one malformed URL in the data crashes the whole generator instead of skipping that entry.
- **Fix:** Guard the URL conversion (e.g., wrap in try/catch and fall back to the raw string, or validate with `URL.canParse` before constructing).

Code Review

This code review is in beta and may not always be helpful — use your judgment.

Warnings (1)
File Issue
bin/generate-labeler.ts line 82 Overly broad error handling — The bare catch {} around loadYaml treats every failure — including YAML parse errors (js-yaml throws YAMLException on malformed input) and non-ENOENT read errors — as "No directory entry", then silently drops the changelog label rule for that folder. A typo in a directory YAML would produce a misleading warning and silently omit labels from the generated labeler.yml. Fix: Only skip on file-not-found (e.g., check error.code === 'ENOENT' or use readFile with a null-handling helper); rethrow any other error so parse problems fail loudly instead of being masked.
Suggestions (1)
File Issue
bin/generate-labeler.ts line 49 Unhandled URL parse errornew URL(url).pathname throws a TypeError on malformed absolute URLs (e.g., https:// with no host). Since firstUrlSegment is also applied to productLink values in release-notes YAML and directory entry URLs, one malformed URL in the data crashes the whole generator instead of skipping that entry. Fix: Guard the URL conversion (e.g., wrap in try/catch and fall back to the raw string, or validate with URL.canParse before constructing).

Conventions

No convention issues found.

Style Guide Review

No style-guide issues found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.
/rebase Rebases the PR branch against production. On conflict, attempts to resolve automatically using AI. Stops with an explanation if confidence is not high enough.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 11, 2026

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://chore-improve-product-labeling.previews.developers.cloudflare.com (commit 82cc056)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://a2a60db9.previews.developers.cloudflare.com 82cc056 2026-09-11T18:16:49.362Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://b195c29e.previews.developers.cloudflare.com 5ada10d 2026-09-11T17:46:53.365Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://483a66d6.previews.developers.cloudflare.com 62f66bf 2026-09-11T16:42:50.287Z Visit the dashboard ↗

@mvvmm

mvvmm commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

/rebase

- readDir now fails loudly instead of returning [] on error, so a
  missing/renamed primary input dir aborts instead of silently dropping
  product rules and overwriting labeler.yml
- refuse to write labeler.yml when no rules were generated
- merge special rule globs with any existing rule instead of
  overwriting, so a future docs dir named changelog/email-routing
  wouldn't silently replace the special rule

Regenerating also picks up src/assets/images/sandbox/** for
product:sandbox (previously missed due to a stale working tree).
@mvvmm
mvvmm force-pushed the chore/improve-product-labeling branch from 137bf67 to 5ada10d Compare September 11, 2026 17:31
@github-actions

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/.github/ @ahaywood, @colbywhite, @MohamedH1998, @mvvmm, @cloudflare/content-engineering
*.ts @cloudflare/content-engineering
package.json @cloudflare/content-engineering
* @cloudflare/product-owners

@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

- firstUrlSegment now normalizes absolute URLs via new URL().pathname,
  so an absolute entry.url/productLink no longer yields a bogus 'https:'
  segment
- share the changelog folder alias map between content and image
  changelog mappings instead of only applying it to images
- skip (with a warning) changelog folders that have no directory entry
  or no entry.url instead of crashing the generator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants