fix(service): check trial app feature flag before fetching info#33555
fix(service): check trial app feature flag before fetching info#33555BillionClaw wants to merge 1 commit intolanggenius:mainfrom
Conversation
The useGetTryAppInfo hook was unconditionally calling the trial app endpoint whenever appId was truthy. When ENABLE_TRIAL_APP is false, the backend returns 403, causing the Explore Detail modal to fail. Add systemFeatures.enable_trial_app check to the enabled option so the query only runs when the feature is enabled. Fixes langgenius#33549
Summary of ChangesHello, 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 addresses an issue where the application attempted to fetch trial app information even when the trial app feature was disabled, leading to a 403 error in the Explore Detail modal. By integrating a system-level feature flag check into the data fetching logic, the application now intelligently prevents unnecessary API calls, ensuring a smoother user experience and preventing errors in environments where trial features are not active. Highlights
🧠 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. Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a bug where an API for trial apps was called even when the feature was disabled, leading to an error. The fix involves adding a feature flag check within the useGetTryAppInfo hook. My review includes a suggestion to apply this same fix to other related hooks in the same file for consistency and to prevent similar issues.
| return fetchTryAppInfo(appId) | ||
| }, | ||
| enabled: !!appId, | ||
| enabled: !!appId && systemFeatures.enable_trial_app, |
There was a problem hiding this comment.
This conditional logic correctly prevents the query from running when trial apps are disabled. It appears that other hooks in this file (useGetTryAppParams, useGetTryAppDataSets, useGetTryAppFlowPreview) also interact with trial app endpoints but lack this check. To ensure consistency and prevent potential 403 errors, it would be beneficial to apply the same logic to them.
|
Friendly bump -- this PR has been open for a while. Happy to make any changes if needed, or close it if no longer relevant. |
Fixes #33549
The Explore Detail modal was returning 403 when trial apps are disabled because
useGetTryAppInfounconditionally called the trial app endpoint wheneverappIdwas truthy.When
ENABLE_TRIAL_APP=false, the backendtrial_feature_enabledecorator returns 403 "Trial app feature is not enabled." This caused the Explore Detail modal to fail loading in self-hosted environments.Add
systemFeatures.enable_trial_appcheck to theenabledoption so the query only runs when the feature is enabled. This follows the same pattern used elsewhere in the codebase for conditional trial app features.Changes
web/service/use-try-app.tsto checksystemFeatures.enable_trial_appbefore enabling the queryVerification