Skip to content

refactored plain Enum to StrEnum - #4668

Open
InfantSavari wants to merge 2 commits into
Tracer-Cloud:mainfrom
InfantSavari:refactor/4659-GuardrailAction-plain-Enum-to-StrEnum
Open

refactored plain Enum to StrEnum#4668
InfantSavari wants to merge 2 commits into
Tracer-Cloud:mainfrom
InfantSavari:refactor/4659-GuardrailAction-plain-Enum-to-StrEnum

Conversation

@InfantSavari

@InfantSavari InfantSavari commented Aug 2, 2026

Copy link
Copy Markdown

Fixes #

Refactored plain Enum in GuardrailAction to StrEnum -

Demo/Screenshot for feature changes and bug fixes -

Screenshot 2026-08-02 122040 image

Code Understanding and AI Usage

Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?

  • [X ] No, I wrote all the code myself
  • Yes, I used AI assistance (continue below)

If you used AI assistance:

  • I have reviewed every single line of the AI-generated code
  • I can explain the purpose and logic of each function/component I added
  • I have tested edge cases and understand how the code handles them
  • I have modified the AI output to follow this project's coding standards and conventions

Explain your implementation approach:

Changed GuardrailAction from a plain Enum to StrEnum to improve string compatibility and follow the existing convention for string-based enums using Issue #4521 as reference.
The implementation only changes the enum base class and import while keeping all existing member values byte-identical.
Using StrEnum allows GuardrailAction members to compare directly with string values and provides cleaner string formatting when used in logs or string-based operations.
No additional functionality was introduced, and no existing logic outside the enum definition was modified.


Checklist before requesting a review

  • [X ] I have added proper PR title and linked to the issue
  • [X ] I have performed a self-review of my code
  • [X ] I can explain the purpose of every function, class, and logic block I added
  • [ X] I understand why my changes work and have tested them thoroughly
  • [X ] I have considered potential edge cases and how my code handles them
  • If it is a core feature, I have added thorough tests
  • [ X] My code follows the project's style guidelines and conventions

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile code review

This repo uses Greptile for automated review. Before merge, aim for Confidence Score: 5/5 with zero unresolved review threads — see CONTRIBUTING.md.

Run a review — add a PR comment with:

@greptile review

Give it ~5-10 minutes (sometimes longer) for results, then fix feedback and re-trigger until you reach Confidence Score: 5/5.

Optional: automate with the greploop skill.

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Converts GuardrailAction from Enum to the standard-library StrEnum.

  • Preserves all existing enum member names and values.
  • Aligns the guardrail action type with the repository’s established string-enum convention.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable regressions identified.

The repository requires Python 3.12 or newer, and existing GuardrailAction consumers use unchanged member values, enum-to-enum comparisons, or explicit .value access.

Important Files Changed

Filename Overview
platform/guardrails/rules.py Replaces Enum with StrEnum; supported Python targets provide StrEnum, and existing consumers remain compatible.

Reviews (1): Last reviewed commit: "refactored plain Enum to StrEnum" | Re-trigger Greptile

@Devesh36

Devesh36 commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

link the issue for this

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