sunchao commented on code in PR #5742: URL: https://github.com/apache/datafusion-comet/pull/5742#discussion_r3954081359
########## .ai/skills/pr-triage/SKILL.md: ########## @@ -0,0 +1,245 @@ +--- +name: pr-triage +description: Triage open Comet pull requests. Applies exactly one type label (`bug`/`enhancement`) plus the supporting type labels (`performance`, `correctness`, `crash`, `test`, `build`, `documentation`) and the `area:*` labels for the subsystems each PR touches, deriving the area from the PR's changed files rather than its title alone. Asks a human before creating any new area label, and prints a report instead of commenting on PRs. +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +Run a pull request triage pass for the `apache/datafusion-comet` repository. + +## Overview + +Comet carries a large backlog of open pull requests. Unlabeled PRs are hard to +route to a reviewer with the right expertise. This skill labels them so that +`is:pr is:open label:area:shuffle` is a useful query. + +For every open PR the skill: + +1. Applies exactly one type label: `bug` or `enhancement`. +2. Applies the supporting type labels that fit: `performance`, `correctness`, + `crash`, `test`, `build`, `documentation`. +3. Applies zero or more `area:*` labels for the subsystems the PR touches. +4. Prints a report of what it did. + +This skill does **not** review the PR, comment on it, request changes, edit its +title or body, or close it. Labels only. + +Priority labels (`priority:*`) are for issues, not PRs. Do not apply them here. + +## Step 1: Read the Triage Guide + +The area label table lives in the project's own guide: + +``` +docs/source/contributor-guide/bug_triage.md +``` + +Read it before classifying. If the guide and this skill disagree, the guide +wins. The guide is written for issues, but the bug-vs-enhancement definitions +and the area table apply to PRs unchanged. + +Then list the labels that actually exist in the repo, because you may only +apply labels that already exist: + +```bash +gh label list --repo apache/datafusion-comet --limit 200 +``` + +## Step 2: Gather the Open PRs + +```bash +gh pr list --repo apache/datafusion-comet --limit 300 \ + --json number,title,labels,isDraft \ + --jq '.[] | "\(.number)\t\(.labels|map(.name)|join(","))\t\(.title)"' +``` + +Triage drafts too. A draft PR still belongs to a subsystem, and the area label +is what makes it findable later. + +If every open PR already carries a type label and at least one area label (or +is a dependency bump, see Step 4), stop and tell the user there is nothing to +triage. + +## Step 3: Derive the Area From the Changed Files + +Titles are unreliable for area. `perf: reuse zstd compression contexts` does +not say "shuffle", and `fix: support empty struct types` does not say which +subsystem broke. The changed file paths do say it. Fetch them for every PR +before classifying anything: + +```bash +mkdir -p "$SCRATCH/files" +gh pr list --repo apache/datafusion-comet --limit 300 --json number --jq '.[].number' \ + > "$SCRATCH/nums.txt" +xargs -P 6 -I{} sh -c \ + 'gh pr view {} --repo apache/datafusion-comet --json files \ + --jq "[.files[].path]|join(\" \")" > '"$SCRATCH"'/files/{}.txt 2>/dev/null' \ Review Comment: ### Correctness [P2] Fetch the complete changed-file list before assigning areas With GitHub CLI 2.93.0, `gh pr view --json files` uses [`files(first: 100)`](https://github.com/cli/cli/blob/v2.93.0/api/query_builder.go#L146-L155), and [the number lookup](https://github.com/cli/cli/blob/v2.93.0/pkg/cmd/pr/shared/finder.go#L356-L383) makes one request without paging the files. For a PR changing more than 100 files, this silently omits the remaining paths. Any subsystem touched only by those paths will be missed, even though Step 7 can still report success because the PR already has other labels. Please use a paginated file query and check that collection completed before deriving the area labels, reporting an incomplete read instead of treating the first page as the whole diff. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
