codeant-ai-for-open-source[bot] commented on PR #36950: URL: https://github.com/apache/superset/pull/36950#issuecomment-3718540490
## Nitpicks 🔍 <table> <tr><td>🔒 <strong>No security issues identified</strong></td></tr> <tr><td>⚡ <strong>Recommended areas for review</strong><br><br> - [ ] <a href='https://github.com/apache/superset/pull/36950/files#diff-a75c0b815273844db2c4d225e6f4e7a1350ebfbdf311e976304cb96b8027a9b6R38-R61'><strong>Context restore semantics</strong></a><br>`preserve_g_context` sets attributes on `g` and then deletes them in the finally block. If the target app context already had attributes with the same keys, they will be overwritten and then removed, potentially losing original values. The context manager should preserve and restore previous values (or avoid deleting pre-existing attributes).<br> - [ ] <a href='https://github.com/apache/superset/pull/36950/files#diff-a75c0b815273844db2c4d225e6f4e7a1350ebfbdf311e976304cb96b8027a9b6R78-R96'><strong>g capture method</strong></a><br>Capturing attributes via `dir(g)` and `getattr(g, key)` may pick up class attributes, descriptors, callables, or attributes that raise on access. This can cause unexpected behavior or exceptions during capture and may include non-instance data that should not be copied to the streaming context. Consider using the g instance dict (e.g. `g.__dict__`) or defensive access to only copy user-set attributes.<br> - [ ] <a href='https://github.com/apache/superset/pull/36950/files#diff-a75c0b815273844db2c4d225e6f4e7a1350ebfbdf311e976304cb96b8027a9b6R218-R236'><strong>Capture timing / staleness</strong></a><br>The code captures `g` attributes in `__init__`. If the command object is constructed outside the request/app context (or long before `run()` is called), the captured data may be empty or stale. Capture request-scoped state at the time `run()` is invoked (or immediately before starting the streaming generator).<br> </td></tr> </table> -- 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]
