feat(github): support user-defined PR labels#867
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughAdds an optional ChangesPR Label for GitHub Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Premature add here. We'll shake this out at CompanyCam and then I'll resubmit it for upstream inclusion. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/control-plane/src/db/integration-settings.ts (1)
283-289: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winConsider validating
prLabellength.Unlike
issueSessionInstructions(capped at 10000),prLabelhas no upper bound. GitHub rejects label names longer than 50 characters, and becauseensureLabels/addLabelsare best-effort, an over-length value would silently never be applied. Adding a length check here surfaces the problem at save time instead of failing quietly during PR creation.♻️ Proposed validation
if (settings.prLabel !== undefined && typeof settings.prLabel !== "string") { throw new IntegrationSettingsValidationError("prLabel must be a string"); } if (settings.prLabel !== undefined) { - settings = { ...settings, prLabel: settings.prLabel.trim() || undefined }; + const trimmed = settings.prLabel.trim(); + if (trimmed.length > 50) { + throw new IntegrationSettingsValidationError("prLabel must be 50 characters or fewer"); + } + settings = { ...settings, prLabel: trimmed || undefined }; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/control-plane/src/db/integration-settings.ts` around lines 283 - 289, Add an upper-bound validation for prLabel in the integration settings validation flow so oversized labels are rejected at save time. Update the logic in integration-settings validation where prLabel is checked and trimmed to also enforce GitHub’s 50-character limit, throwing IntegrationSettingsValidationError with a clear message when exceeded. Keep the existing prLabel string/type and trim handling in place, and apply the new check alongside issueSessionInstructions-style validation in the same validation path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/web/src/components/settings/integrations/github-integration-settings.tsx`:
- Around line 480-496: The PR Label field in github-integration-settings.tsx is
missing an accessible programmatic association between the visible label and the
Input. Add a stable id to the Input component in this PR Label section and set
the matching htmlFor on the corresponding label so clicks and screen readers
target the field correctly; use the existing PR Label block and Input element to
locate the change.
- Line 218: The `prLabel` value is trimmed before saving, but
`GithubIntegrationSettings` keeps the original untrimmed value in local state,
so the UI can drift from what was actually persisted. After the save completes
in this component, normalize `prLabel` in state to the same trimmed value (or
clear it when trimming results in empty) so the input reflects the saved backend
value. Update the state flow around the `prLabel` save path in
`github-integration-settings.tsx` and ensure the `initialized` guard does not
block this post-save normalization.
---
Nitpick comments:
In `@packages/control-plane/src/db/integration-settings.ts`:
- Around line 283-289: Add an upper-bound validation for prLabel in the
integration settings validation flow so oversized labels are rejected at save
time. Update the logic in integration-settings validation where prLabel is
checked and trimmed to also enforce GitHub’s 50-character limit, throwing
IntegrationSettingsValidationError with a clear message when exceeded. Keep the
existing prLabel string/type and trim handling in place, and apply the new check
alongside issueSessionInstructions-style validation in the same validation path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c3306a87-6794-410e-ad8f-38d182ce1ce7
📒 Files selected for processing (7)
packages/control-plane/src/db/integration-settings.tspackages/control-plane/src/routes/integration-settings.tspackages/control-plane/src/session/durable-object.tspackages/control-plane/src/session/pull-request-service.tspackages/control-plane/src/source-control/providers/github-provider.tspackages/shared/src/types/integrations.tspackages/web/src/components/settings/integrations/github-integration-settings.tsx
|
OK, confirmed this feature works in our fork. I'll flesh out the body of the PR with more information. |
c3a1180 to
6709ba0
Compare
6709ba0 to
9f5fdb4
Compare
|
This setting might make sense in a new 'Source Code Management' setting category (pending in #762) where it applies equally to GitHub and GitLab. |
Add a setting in the GitHub integration screen that lets the admin specify a label that should be applied to all Open Inspect-generated PRs. The use case here is tracking Open Inspect-generated PRs separately from the rest of the PRs (whether human or agent created).
Setting the label in Settings > Integrations > GitHub Bot:
Resulting PR:
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Validation