Skip to content

Conversation

@asukaminato0721
Copy link
Contributor

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

part of #23579

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @asukaminato0721, 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 focuses on refactoring the RecommendedApp database model. The changes primarily involve updating the model's inheritance to TypeBase and introducing comprehensive type hints for all its attributes. These modifications enhance the model's type safety, improve code readability, and align it with modern ORM practices, contributing to a more robust and maintainable codebase.

Highlights

  • Model Refactoring: The RecommendedApp model has been refactored to inherit from TypeBase instead of Base, indicating a move towards a more modern ORM definition style.
  • Type Hinting: Explicit type hints (Mapped[str], Mapped[datetime], etc.) have been added to all column definitions within the RecommendedApp model for improved type safety and clarity.
  • ORM Initialization Control: The id, created_at, and updated_at columns now include init=False in their mapped_column definitions, preventing them from being part of the __init__ signature generated by the ORM.
  • Default Language Value: The language column now explicitly sets a default="en-US" in addition to its server_default, ensuring consistent default behavior.

🧠 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@asukaminato0721 asukaminato0721 marked this pull request as ready for review January 14, 2026 13:21
Copilot AI review requested due to automatic review settings January 14, 2026 13:21
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jan 14, 2026
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 refactors the RecommendedApp model to use TypeBase (which is a MappedAsDataclass), making the model definition more modern and type-safe. The changes correctly add Mapped type hints and init=False for generated fields.

I've found a few issues related to column types and nullability that could lead to runtime errors. Specifically, the description column has an incorrect type, and several non-nullable fields have null values in the seed data. My comments provide suggestions to fix these problems.

Copy link
Contributor

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@asukaminato0721 asukaminato0721 marked this pull request as draft January 14, 2026 14:31
asukaminato0721 and others added 3 commits January 14, 2026 23:33
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copy link
Contributor

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@asukaminato0721 asukaminato0721 marked this pull request as ready for review January 16, 2026 01:27
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. refactor and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jan 16, 2026
Copilot AI review requested due to automatic review settings February 5, 2026 09:53
Copy link
Contributor

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

copyright: Mapped[str] = mapped_column(String(255), nullable=False, default="")
privacy_policy: Mapped[str] = mapped_column(String(255), nullable=False, default="")
category: Mapped[str] = mapped_column(String(255), nullable=False, default="")
custom_disclaimer: Mapped[str] = mapped_column(LongText, default="")
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The custom_disclaimer field should have nullable=False according to the migration d07474999927_update_type_of_custom_disclaimer_to_text.py (line 35). The migration explicitly sets this column to nullable=False, but the model definition is missing this constraint. Add nullable=False to match the database schema.

Suggested change
custom_disclaimer: Mapped[str] = mapped_column(LongText, default="")
custom_disclaimer: Mapped[str] = mapped_column(LongText, nullable=False, default="")

Copilot uses AI. Check for mistakes.
privacy_policy: Mapped[str] = mapped_column(String(255), nullable=False)
id: Mapped[str] = mapped_column(StringUUID, primary_key=True, default=lambda: str(uuid4()), init=False)
app_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
description: Mapped[str] = mapped_column(LongText, nullable=False, default="")
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The description field type has been changed from sa.JSON() to LongText without a corresponding database migration. The original schema (see migrations/versions/64b051264f32_init.py lines 948 and 963) defines this column as sa.JSON(), but this change converts it to LongText. While the code usage suggests it should be a string (not JSON), changing the column type without a migration will cause issues for existing databases. A migration script is needed to alter the column type from JSON to TEXT/LONGTEXT before this model change can be safely deployed.

Suggested change
description: Mapped[str] = mapped_column(LongText, nullable=False, default="")
description: Mapped[str] = mapped_column(sa.JSON(), nullable=False, default="")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant