Skip to content

fix(core): generate correct string values for StrEnum backport on Python 3.10 - #60

Merged
JacobCoffee merged 1 commit into
mainfrom
fix/strenum-auto-value-py310
Oct 11, 2026
Merged

JacobCoffee merged 1 commit into
mainfrom
fix/strenum-auto-value-py310

Conversation

@JacobCoffee

Copy link
Copy Markdown
Owner

On Python 3.10 (before the stdlib enum.StrEnum exists), this project falls back to a custom StrEnum(str, Enum) backport. That backport did not override _generate_next_value_, so auto() fell back to the default integer generator (1, 2, 3, ...) instead of the lowercase member name that the real enum.StrEnum produces on 3.11+.

Effect: on Python 3.10 only, WorkflowStatus.PENDING, StepStatus.*, and StepType.* stringified as '1', '2', etc. instead of 'pending', 'running', etc. This broke JSON/DTO serialization and any string comparisons (e.g. status == 'pending') for 3.10 users specifically — 3.11+ was never affected since it uses the real stdlib StrEnum.

Fix: add a _generate_next_value_ static method to the 3.10 backport that lowercases the member name, matching stdlib enum.StrEnum behavior exactly. No change to 3.11+ (unaffected, uses stdlib class) or to any explicitly-valued enum members (there are none here).

Verified locally: full test suite now passes on Python 3.10 (458 passed, 0 failed — previously 13 failed) and still passes on 3.11/3.15, plus ruff/ty clean.

Copilot AI balanced review requested due to automatic review settings October 11, 2026 03:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://JacobCoffee.github.io/litestar-workflows/pr-preview/pr-60/

Built to branch gh-pages at 2026-10-11 03:24 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@JacobCoffee
JacobCoffee force-pushed the fix/strenum-auto-value-py310 branch from 6822c2a to 0ab56e3 Compare October 11, 2026 03:23
@JacobCoffee
JacobCoffee merged commit eee4667 into main Oct 11, 2026
25 checks passed
@JacobCoffee
JacobCoffee deleted the fix/strenum-auto-value-py310 branch October 11, 2026 03:27
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