codeant-ai-for-open-source[bot] commented on code in PR #37367:
URL: https://github.com/apache/superset/pull/37367#discussion_r3677370420


##########
superset-frontend/src/preamble.ts:
##########
@@ -64,6 +64,11 @@ export default function initPreamble(): Promise<void> {
     // Setup SupersetClient early so we can fetch language pack
     setupClient({ appRoot: applicationRoot() });
 
+    // Initialize feature flags before the first await. Some entry points do 
not
+    // await initPreamble before importing plugins, and plugin modules can read
+    // feature flags during import.
+    initFeatureFlags(bootstrapData.common.feature_flags);

Review Comment:
   **Suggestion:** The initialization helper is intentionally a no-op when 
`window.featureFlags` already exists. Consequently, if an earlier-loaded 
integration or module has installed a partial or stale global, this call will 
not apply the current page's `bootstrapData.common.feature_flags`, and plugins 
imported afterward will evaluate against incorrect feature flags. Ensure the 
bootstrap payload is authoritative for this entry point, or explicitly replace 
the global with the current payload. [stale reference]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Embedded plugins may use stale feature configuration.
   - ❌ Dashboard controls can incorrectly appear or disappear.
   - ⚠️ Feature checks may log failures for missing flags.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=55de744eb226498bb3e5a9478d45d175&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=55de744eb226498bb3e5a9478d45d175&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/preamble.ts
   **Line:** 67:70
   **Comment:**
        *Stale Reference: The initialization helper is intentionally a no-op 
when `window.featureFlags` already exists. Consequently, if an earlier-loaded 
integration or module has installed a partial or stale global, this call will 
not apply the current page's `bootstrapData.common.feature_flags`, and plugins 
imported afterward will evaluate against incorrect feature flags. Ensure the 
bootstrap payload is authoritative for this entry point, or explicitly replace 
the global with the current payload.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37367&comment_hash=be5be72b80fefd17e9b6850d6065bb7fcd406b4815138194c30af85f23a19800&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37367&comment_hash=be5be72b80fefd17e9b6850d6065bb7fcd406b4815138194c30af85f23a19800&reaction=dislike'>👎</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to