Skip to content

Read the Comments Label Live Rather Than off the Event Payload - #2356

Merged
ptr727 merged 4 commits into
developfrom
feature/1703-live-comments-label
Oct 4, 2026
Merged

ptr727 merged 4 commits into
developfrom
feature/1703-live-comments-label

Conversation

@ptr727

@ptr727 ptr727 commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Summary

The comments label was computed from github.event.pull_request.labels, a snapshot taken when the event fires. gh pr create --label applies its labels after the opened event, so that run saw no label, and a rerun reused the same snapshot.

  • validate-task.yml: a new Read comments label step in the lint job reads the pull request's labels through the API (gh api --paginate --jq '.[].name' repos/<repo>/issues/<n>/labels) with the job's GITHUB_TOKEN, matching comments case-insensitively as contains() does. It writes a step output that allow-comments reads, beside the unchanged promotion clause. A failed read falls back to the payload value and says so in the log rather than turning into a silent false.
  • No permission is added. Every caller grants the validate job contents: read only, and a reusable workflow cannot raise that, so the live read works on public repositories and a private repository falls back to the payload. That is public-only by decision. Granting pull-requests: read fleet-wide is the follow-up in Grant pull-requests: read So the Live comments Label Read Reaches Private Repositories #2354.
  • comment-and-doc-style, drive-pr, and scripts/README.md now say the label is read live where the lint log shows "Read the pull request's labels live", so a rerun picks up a label added since, and otherwise (a private repository, or a fallback) the label applies to the next push. drive-pr says to add the label after creating the pull request.
  • tests/test_prose_lint.py runs the step's own run: body against a stub gh and covers live-wins-both-ways, case-insensitive matching, the exact-line match, the call's path, --paginate and .[].name projection, and the payload fallback. Each of those was mutation-checked against the step.

This PR's own lint log is the first real-API check of the live read under contents: read.

Addresses #1703

🤖 Generated with Claude Code

ptr727 and others added 4 commits October 4, 2026 10:49
The event payload's labels are a snapshot taken when the event fires, so a
label applied after it, as gh pr create --label applies its own, never
reaches that run or a rerun of it. The lint job now reads the pull
request's labels through the API when it reaches the prose gate, and falls
back to the payload, saying so in the log, only where the read fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A repository pinned before the live read has no fallback line to warn a
driver, so the skills now name the positive line instead. The live read
also matches the label case-insensitively, as the payload's contains()
does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The live read runs under the callers' contents-only grant, which reaches a
public repository's labels and not a private one's, so the docs say a
private repository falls back to the event snapshot. drive-pr now says to
add the label after creating the pull request, since a label applied at
create misses the opening event's snapshot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The README now states the rerun the way the skills do, with the next-push
remedy for a private repository or a fallback. The label-read test also
asserts the jq projection gh receives.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 4, 2026 18:35
@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a7c2d2e7-39a6-4554-98a5-ff7809d07617
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.70%. Comparing base (f63c3fb) to head (15fdf8a).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2356   +/-   ##
========================================
  Coverage    57.70%   57.70%           
========================================
  Files           16       16           
  Lines         7919     7919           
========================================
  Hits          4570     4570           
  Misses        3349     3349           
Flag Coverage Δ
python-3.13 57.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Tests do not validate the workflow environment wiring used by the live label lookup.

Review effort: Lite
Findings: None

What changed in this PR

Updates comment-label handling to read labels live via the API, with payload fallback, tests, and synchronized documentation.

Changes:

  • Adds live label lookup and fallback logging.
  • Adds focused workflow-step tests.
  • Updates guidance and generated skill copies.
File Description
tests/​test_prose_lint.py Tests live lookup and fallback behavior.
scripts/​README.md Documents live label behavior.
.github/​workflows/​validate-task.yml Reads labels through the API.
.github/​skills/​drive-pr/​SKILL.md Updates PR workflow guidance.
.github/​skills/​comment-and-doc-style/​SKILL.md Documents label resolution.
.claude-plugin/​fleet-skills/​skills/​drive-pr/​SKILL.md Updates generated guidance.
.claude-plugin/​fleet-skills/​skills/​comment-and-doc-style/​SKILL.md Updates generated documentation.
.claude-plugin/​fleet-skills/​.source-digests/​drive-pr Refreshes source digest.
.claude-plugin/​fleet-skills/​.source-digests/​comment-and-doc-style Refreshes source digest.
.agents/​skills/​drive-pr/​SKILL.md Updates canonical PR guidance.
.agents/​skills/​comment-and-doc-style/​SKILL.md Updates canonical label guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ptr727
ptr727 merged commit e450e12 into develop Oct 4, 2026
13 checks passed
@ptr727
ptr727 deleted the feature/1703-live-comments-label branch October 4, 2026 18:39
ptr727 added a commit that referenced this pull request Oct 4, 2026
…nd Review Digest Tolerance (#2360)

## Summary

Promotes `develop` to `main` with four pull requests, each already
reviewed and merged into `develop`:

- [#2352](#2352) asserts
that `hub-fetch-run.py`'s fallback fetch uses the `main` path.
- [#2355](#2355) tolerates
a per-field `workflowRun` error in `pr_review.py`, keying unreadable
Actions runs per suite so no failure is hidden.
- [#2356](#2356) reads the
`comments` label live in the validate task's lint job rather than off
the event payload, on public repositories, with private repositories
following in #2354.
- [#2359](#2359) reads
composite-action files through PyYAML under `uvx`, in isolated mode,
where PyYAML is not importable, replacing the unprovisioned `yq`
fallback.

Closes #2339
Closes #2338
Closes #1703
Closes #2348

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants