Skip to content

Add missing enum constraints #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 15, 2025
Merged

Add missing enum constraints #278

merged 4 commits into from
Apr 15, 2025

Conversation

tonytrg
Copy link
Contributor

@tonytrg tonytrg commented Apr 15, 2025

This pr adds some missing enum constraints for string props with enum like categories.
It also removes those listed enums from the descriptions, as the llm already receives the list of possible candidates by the the enum constraint.

This will save tokens as noted by @SamMorrowDrums

In regard to #228

Example testing with Copilot(Model Claude 3.7 Sonnet):

Please list me all code scanning alerts from:
owner tonytrg
repo adventofcode
severity ultra

GitHub Copilot
I need to help you retrieve code scanning alerts from the GitHub repository, but I notice that you've specified a severity level of "ultra" which isn't a standard severity level for GitHub code scanning alerts.

GitHub's code scanning alerts use these severity levels: critical, high, medium, low, warning, note, and error. The value "ultra" isn't one of the supported severity options.

Would you like me to list the alerts with a different severity level? For example, would you prefer "critical" (highest severity), "high", or another valid severity level?

@Copilot Copilot AI review requested due to automatic review settings April 15, 2025 09:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds missing enum constraints for various string properties to ensure only the allowed values are accepted.

  • Enforced enum constraints for pull request state, sort options, merge methods, and review event types in pkg/github/pullrequests.go.
  • Added enum constraints for code scanning alert states and severity levels in pkg/github/code_scanning.go.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/github/pullrequests.go Added enum constraints for pull request query and review parameters.
pkg/github/code_scanning.go Added enum constraints for code scanning alerts parameters.

@tonytrg tonytrg force-pushed the tonytrg/add-constraints branch from 2928235 to a92e445 Compare April 15, 2025 14:37
@tonytrg tonytrg force-pushed the tonytrg/add-constraints branch from f810b65 to 5a7d13c Compare April 15, 2025 14:41
SamMorrowDrums
SamMorrowDrums previously approved these changes Apr 15, 2025
Copy link
Collaborator

@SamMorrowDrums SamMorrowDrums left a comment

Choose a reason for hiding this comment

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

Added one minor suggestion (the word category doesn't add much I think) but it's a nit, and this looks great. Thanks for all your work on finding all these!

@SamMorrowDrums SamMorrowDrums merged commit 4457d0a into main Apr 15, 2025
13 of 15 checks passed
@SamMorrowDrums SamMorrowDrums deleted the tonytrg/add-constraints branch April 15, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants