Skip to content

build: add PR severity classification workflow#10526

Merged
Roasbeef merged 1 commit intomasterfrom
pr-severity-workflow
Jan 28, 2026
Merged

build: add PR severity classification workflow#10526
Roasbeef merged 1 commit intomasterfrom
pr-severity-workflow

Conversation

@Roasbeef
Copy link
Member

This PR adds a GitHub Actions workflow that uses Claude Code to automatically classify pull requests by severity based on the files they touch. When a PR is opened or updated, Claude analyzes the changed files against a predefined severity mapping and applies an appropriate label to help reviewers quickly understand the complexity and risk level of the changes.

The severity classification follows a four-tier system. Critical severity is assigned to changes touching security-sensitive code paths including lnwallet, htlcswitch, contractcourt, peer/brontide, keychain, input, channeldb, funding, lnwire, and the core server files. High severity covers important subsystems like routing, invoices, sweep, discovery, graph, watchtower, feature bits, and the RPC layer. Medium severity applies to infrastructure components such as payments, autopilot, configuration, and protocol buffer definitions. Low severity is reserved for documentation, tests, scripts, and CI/CD configuration changes.

Claude posts a detailed comment on each PR explaining its classification decision. The comment includes collapsible sections showing which files fall into each severity tier, along with an analysis explaining why the overall severity level was chosen. When new commits are pushed to the PR, Claude updates its existing comment rather than creating duplicate comments, keeping the PR thread clean.

The workflow supports manual overrides through dedicated labels. Maintainers can apply a severity-override-critical, severity-override-high, severity-override-medium, or severity-override-low label to force a specific classification. When an override label is present, Claude respects it and notes the manual override in its comment. This allows human judgment to take precedence when the automated classification doesn't capture the full context.

Additional classification rules help catch edge cases. PRs touching more than 20 files or changing more than 500 lines get bumped up one severity level to account for increased review complexity. Changes to database migration files are always treated as critical regardless of their location. PRs touching multiple distinct critical packages are flagged with additional urgency in Claude's analysis.

This workflow integrates with the existing Claude Code infrastructure added in PR 10525, using the same OAuth token and action version. Eight new labels have been created in the repository to support the classification system.

@gemini-code-assist
Copy link

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

Copy link
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

looks good, pending CI

Copy link
Member

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

🤖

@Roasbeef
Copy link
Member Author

Addressed review feedback:

  1. sweep/ moved to CRITICAL* - Agreed, fund recovery is security-critical
  2. Added exclusions for line/file counting - Tests, auto-generated files (*.pb.go, *.pb.gw.go, *.sql.go, *_generated.go), and mocks are now excluded from the >20 files / >500 lines threshold

Regarding the labels question from @ziggie1984: Yes, all 8 labels have already been created in the repository (4 severity + 4 override labels).

@Roasbeef Roasbeef force-pushed the pr-severity-workflow branch 4 times, most recently from 0a7531b to 86034aa Compare January 28, 2026 17:48
@lightninglabs-deploy lightninglabs-deploy added the severity-low Best-effort review label Jan 28, 2026
Copy link
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

LGTM (pending bot comment)

@Roasbeef Roasbeef force-pushed the pr-severity-workflow branch 3 times, most recently from b42273d to 273ec34 Compare January 28, 2026 18:22
@lightninglabs-deploy
Copy link
Collaborator

🟢 PR Severity: LOW

Automated classification | 1 file | +167/-0 lines

🟢 Low (1 file)
  • .github/workflows/pr-severity.yml - CI/CD workflow configuration for automated PR severity classification

Analysis

This PR adds a GitHub Actions workflow for automated PR severity classification. Changes are limited to CI/CD configuration files (.github/*), which are classified as LOW severity per the project's classification guidelines.

Why LOW severity:

  • Single file change in .github/workflows/
  • No impact on runtime code, protocol implementation, or critical systems
  • Changes affect only the CI/CD pipeline
  • Best-effort review is sufficient for workflow configurations

Review focus areas:

  • Workflow permissions and security (token usage)
  • Trigger conditions and workflow logic
  • Label management correctness

To override, add a severity-override-{critical,high,medium,low} label.

Copy link
Collaborator

@saubyk saubyk left a comment

Choose a reason for hiding this comment

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

Concept Ack

Add a GitHub Actions workflow that uses Claude Code to automatically
classify PRs by severity based on the files changed. This helps
reviewers prioritize and understand PR complexity at a glance.

The workflow:
- Triggers on PR open and synchronize events
- Uses Claude Code to analyze changed files against severity mapping
- Applies one of four severity labels (critical/high/medium/low)
- Posts a detailed comment explaining the classification
- Supports manual override via severity-override-* labels

Severity mapping:
- CRITICAL: lnwallet, htlcswitch, contractcourt, peer, keychain, input,
  channeldb, funding, lnwire, server.go, rpcserver.go
- HIGH: routing, invoices, sweep, discovery, graph, watchtower, feature,
  lnrpc, macaroons, chainntnfs, etc.
- MEDIUM: payments, autopilot, lncfg, kvdb, proto files, etc.
- LOW: docs, tests, scripts, CI/CD config
@Roasbeef Roasbeef force-pushed the pr-severity-workflow branch from 273ec34 to ba52a27 Compare January 28, 2026 18:33
@lightninglabs-deploy
Copy link
Collaborator

🟢 PR Severity: LOW

CI/CD configuration | 1 file | 170 lines changed

🟢 Low (1 file)
  • .github/workflows/pr-severity.yml - GitHub Actions workflow configuration (CI/CD)

Analysis

This PR introduces a new GitHub Actions workflow for automatic PR severity classification. Since it only modifies CI/CD configuration under .github/*, it falls into the LOW severity category according to our classification rules.

Why LOW severity?

  • Changes are isolated to workflow automation
  • No impact on Lightning Network protocol, wallet operations, or runtime code
  • Workflow changes can be reviewed and iterated quickly
  • Easy to revert if issues are discovered

The change adds valuable automation for triaging PRs but carries minimal risk to the Lightning Network Daemon's core functionality.


To override, add a severity-override-{critical,high,medium,low} label.

@Roasbeef Roasbeef merged commit 22c2cc2 into master Jan 28, 2026
35 of 36 checks passed
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.

5 participants