Conversation
📝 WalkthroughWalkthroughAdds model-specific allowed file-type configuration, exposes it via a new exported constant, extends the AIScenario schema with an Changes
Sequence Diagram(s)(Skipped — changes are configuration/schema/localization only and do not introduce multi-component sequential flows.) Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.42.1)app/locale/en.jsThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/schemas/models/ai_scenario.schema.js (1)
104-111: HardenallowedFileTypesvalidation at schema level.Line 104 currently accepts any string, so invalid MIME values can be saved and later break filtering behavior. Add basic MIME-shape validation and dedupe guard.
Proposed diff
allowedFileTypes: { title: 'Allowed Types of Uploaded File', description: 'MIME types of files that can be uploaded', type: 'array', + uniqueItems: true, items: { type: 'string', + pattern: '^([A-Za-z0-9!#$&^_.+-]+|\\*)/([A-Za-z0-9!#$&^_.+-]+|\\*)$', }, },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/schemas/models/ai_scenario.schema.js` around lines 104 - 111, The allowedFileTypes array currently permits any string; update the allowedFileTypes schema to enforce MIME-shape validation and deduplication by adding uniqueItems: true and replacing the simple items type with an object that has type: "string" and a pattern that matches basic MIME types (e.g. token/token with allowed characters like letters, digits, ".", "+", "-" ), and optionally set a sensible minItems if required; target the allowedFileTypes field in the schema to make these changes so saved values conform to expected MIME format and duplicates are prevented.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/locale/en.js`:
- Line 6402: The label string for ScenarioDetailsPanel_allowed-file-types has
grammatical errors; update its value to a clearer phrase such as "Allowed file
types users can upload" (or simply "Allowed file types") by replacing the
existing text for the ScenarioDetailsPanel_allowed-file-types key in
app/locale/en.js with the corrected wording.
---
Nitpick comments:
In `@app/schemas/models/ai_scenario.schema.js`:
- Around line 104-111: The allowedFileTypes array currently permits any string;
update the allowedFileTypes schema to enforce MIME-shape validation and
deduplication by adding uniqueItems: true and replacing the simple items type
with an object that has type: "string" and a pattern that matches basic MIME
types (e.g. token/token with allowed characters like letters, digits, ".", "+",
"-" ), and optionally set a sensible minItems if required; target the
allowedFileTypes field in the schema to make these changes so saved values
conform to expected MIME format and duplicates are prevented.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2ec84cdd-51dc-4296-a33d-3b60fe1de40c
📒 Files selected for processing (3)
app/core/constants.jsapp/locale/en.jsapp/schemas/models/ai_scenario.schema.js
| 'ScenarioDetailsPanel_save-scenario': 'Save Scenario', | ||
| 'ScenarioDetailsPanel_scenario-settings': 'Scenario settings', | ||
| 'ScenarioDetailsPanel_allow-user-upload-file': 'Allow user to upload file', | ||
| 'ScenarioDetailsPanel_allowed-file-types': 'Allowed Files Types user can upload', |
There was a problem hiding this comment.
Fix grammar in the new UI label.
The string has wording issues (Files Types, singular user). Please update it to a clearer label, e.g. "Allowed file types users can upload" (or shorter: "Allowed file types").
✏️ Suggested text fix
- 'ScenarioDetailsPanel_allowed-file-types': 'Allowed Files Types user can upload',
+ 'ScenarioDetailsPanel_allowed-file-types': 'Allowed file types users can upload',📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 'ScenarioDetailsPanel_allowed-file-types': 'Allowed Files Types user can upload', | |
| 'ScenarioDetailsPanel_allowed-file-types': 'Allowed file types users can upload', |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/locale/en.js` at line 6402, The label string for
ScenarioDetailsPanel_allowed-file-types has grammatical errors; update its value
to a clearer phrase such as "Allowed file types users can upload" (or simply
"Allowed file types") by replacing the existing text for the
ScenarioDetailsPanel_allowed-file-types key in app/locale/en.js with the
corrected wording.
|
|
||
| const USER_CREDIT_HACKSTACK_KEY = 'HACKSTACK_QUERY' | ||
|
|
||
| const FILE_TYPES_BY_MODEL = [ |
There was a problem hiding this comment.
if we want to restrict this, I would rather have it as static strings here or in AI folder than store in AIScenario so that we don't need to run a script for old scenarios
There was a problem hiding this comment.
put in ai will make server cannot access it. i first want to double check in server side if uploaded file is in correct format(since in frontend user can anyway change the file types to . so override the limited file types. -- in file upload modal) while in current pr i didn't check that. so make this string in coco repo little strange.
There was a problem hiding this comment.
♻️ Duplicate comments (1)
app/locale/en.js (1)
6403-6403:⚠️ Potential issue | 🟡 MinorFix grammar in the new label text.
Line 6403 still has grammatical issues in a user-facing string.
✏️ Suggested text fix
- 'ScenarioDetailsPanel_allowed-file-types': 'Allowed Files Types user can upload', + 'ScenarioDetailsPanel_allowed-file-types': 'Allowed file types users can upload',🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/locale/en.js` at line 6403, Update the user-facing string for the i18n key 'ScenarioDetailsPanel_allowed-file-types' in app/locale/en.js to correct grammar; replace "Allowed Files Types user can upload" with a grammatically correct variant such as "Allowed file types users can upload" (or "Allowed file types a user can upload"/"Allowed file types that users can upload") so the label reads naturally.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@app/locale/en.js`:
- Line 6403: Update the user-facing string for the i18n key
'ScenarioDetailsPanel_allowed-file-types' in app/locale/en.js to correct
grammar; replace "Allowed Files Types user can upload" with a grammatically
correct variant such as "Allowed file types users can upload" (or "Allowed file
types a user can upload"/"Allowed file types that users can upload") so the
label reads naturally.
fix ENG-2411
Summary by CodeRabbit
New Features
Localization