feat: add projections to optimize queries#650
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughStandardizes docstrings and string quoting in the action launcher and storage-scenario UI, adds a PySide6/PySide2 Qt import fallback, and replaces a shorthand Project query with an explicit SELECT fetching id, full_name, and name. Functional behavior is unchanged. ChangesAction Launcher Widget Standardization
Entity Tree Query Refinement
Storage Scenario Configuration Compatibility
🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/connect/source/ftrack_connect/action_launcher/actions.py`:
- Around line 337-338: The query currently interpolates self.session.api_user
directly into the raw predicate string (the select id from User where
username=... call), which risks injection and quote-breaking; change it to use a
parameterized or escaped query mechanism instead—e.g., pass the username as a
bound parameter (or use the session/query API that accepts parameters) rather
than f-strings, locating the construction where self.session.api_user is
embedded and replacing it with a parameter placeholder and a parameters dict or
with a proper quoting/escaping helper.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f9824291-2398-47f8-9714-4884fb26cf8a
📒 Files selected for processing (3)
apps/connect/source/ftrack_connect/action_launcher/actions.pyapps/connect/source/ftrack_connect/ui/model/entity_tree.pyapps/connect/source/ftrack_connect/ui/widget/configure_scenario.py
| f'select id from User where username="{self.session.api_user}"' | ||
| ).one() |
There was a problem hiding this comment.
Avoid raw query interpolation for self.session.api_user.
Directly embedding self.session.api_user into the query can break on quotes and is query-injection-prone. Escape/sanitize before constructing the predicate.
Proposed fix
- user = self.session.query(
- f'select id from User where username="{self.session.api_user}"'
- ).one()
+ api_user = str(self.session.api_user).replace("\\", "\\\\").replace('"', '\\"')
+ user = self.session.query(
+ f'select id from User where username="{api_user}"'
+ ).one()🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/connect/source/ftrack_connect/action_launcher/actions.py` around lines
337 - 338, The query currently interpolates self.session.api_user directly into
the raw predicate string (the select id from User where username=... call),
which risks injection and quote-breaking; change it to use a parameterized or
escaped query mechanism instead—e.g., pass the username as a bound parameter (or
use the session/query API that accepts parameters) rather than f-strings,
locating the construction where self.session.api_user is embedded and replacing
it with a parameter placeholder and a parameters dict or with a proper
quoting/escaping helper.
@dennisweil this could potentially superseed : #648
Summary by CodeRabbit
New Features
Improvements
Chores