Skip to content

refactor: EnumText for preferred_provider_type MessageChain, Banner#33696

Merged
asukaminato0721 merged 2 commits intolanggenius:mainfrom
tmimmanuel:refactor/enum-provider-banner-chain
Mar 18, 2026
Merged

refactor: EnumText for preferred_provider_type MessageChain, Banner#33696
asukaminato0721 merged 2 commits intolanggenius:mainfrom
tmimmanuel:refactor/enum-provider-banner-chain

Conversation

@tmimmanuel
Copy link
Contributor

Summary

  • Replace sa.String with EnumText(ProviderType) for TenantPreferredModelProvider.preferred_provider_type
  • Replace sa.String with EnumText(MessageChainType) for MessageChain.type
  • Replace sa.String with EnumText(BannerStatus) for ExporleBanner.status
  • Remove redundant ProviderType.value_of() and .value conversions

Continues #33294 (provider + model domain, part 2)

Details

Model Column Before After
TenantPreferredModelProvider.preferred_provider_type String(40) EnumText(ProviderType)
MessageChain.type String(255) EnumText(MessageChainType)
ExporleBanner.status String(255) EnumText(BannerStatus)

With EnumText, the column now returns the enum directly — no need for ProviderType.value_of() to parse the raw string on read, or .value to extract the string on write.

Test plan

  • basedpyright passes (0 errors on changed files)
  • 123 unit tests pass (provider models + provider configuration + banner)
  • CI lint + type-check + full test suite

🤖 Generated with Claude Code

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. refactor labels Mar 18, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors several SQLAlchemy model columns to use EnumText instead of sa.String for enum-backed fields. This change enhances type safety, improves code readability by allowing direct enum usage, and eliminates the need for manual string-to-enum and enum-to-string conversions when interacting with the database.

Highlights

  • TenantPreferredModelProvider.preferred_provider_type: Replaced sa.String with EnumText(ProviderType) for the preferred_provider_type column.
  • MessageChain.type: Replaced sa.String with EnumText(MessageChainType) for the type column.
  • ExporleBanner.status: Replaced sa.String with EnumText(BannerStatus) for the status column.
  • Enum value conversions: Removed redundant ProviderType.value_of() and .value conversions, simplifying enum handling.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Contributor

Pyrefly Diff

No changes detected.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively refactors the codebase to leverage EnumText for TenantPreferredModelProvider.preferred_provider_type, MessageChain.type, and ExporleBanner.status. This change significantly improves type safety and readability by allowing direct use of enum members instead of string literals, and correctly removes redundant .value_of() and .value conversions. The changes are well-implemented across models, controllers, and tests, demonstrating a thorough approach to the refactoring. All modifications align with the stated goals of the pull request and enhance the maintainability of the code.

@github-actions
Copy link
Contributor

Pyrefly Diff

No changes detected.

@tmimmanuel
Copy link
Contributor Author

@asukaminato0721 Please review my PR. Thanks.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 18, 2026
@asukaminato0721 asukaminato0721 merged commit 29577ca into langgenius:main Mar 18, 2026
14 checks passed
@tmimmanuel
Copy link
Contributor Author

@asukaminato0721 Thank you.

@tmimmanuel tmimmanuel deleted the refactor/enum-provider-banner-chain branch March 18, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants