feat(studio): Templates from Data Designer Recipes#857
Conversation
Signed-off-by: Sean Teramae <[email protected]>
|
This change is part of the following stack: Change managed by git-spice. |
📝 WalkthroughWalkthroughRecipe templates now support multiple badges, three recipes are added, and the build toolbar no longer displays template badges. ChangesRecipe templates and toolbar metadata
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/packages/studio/src/components/CreateFilesetStart/types.ts (1)
54-65: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider
readonlyfor the newtagsfield.
tagsis a mutable array on a shared, exportedFilesetTemplatecatalog (FILESET_TEMPLATES) consumed by multiple components. Marking itreadonly StartOptionTag[]prevents accidental in-place mutation by any consumer.As per coding guidelines, "Use
readonlyfor immutable properties in TypeScript interfaces and types."♻️ Proposed fix
- tags: StartOptionTag[]; + tags: readonly StartOptionTag[];🤖 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 `@web/packages/studio/src/components/CreateFilesetStart/types.ts` around lines 54 - 65, Update the exported FilesetTemplate interface so its tags property uses a readonly StartOptionTag[] type, preventing consumers of FILESET_TEMPLATES from mutating the shared tag arrays while preserving the existing tag values and behavior.Source: Coding guidelines
🤖 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 `@web/packages/studio/src/components/CreateFilesetStart/templates.ts`:
- Around line 528-534: Update the product_price expression in the fileset
template so the subtraction is parenthesized before applying the round(2)
filter, ensuring the computed price rather than 0.01 is rounded.
---
Nitpick comments:
In `@web/packages/studio/src/components/CreateFilesetStart/types.ts`:
- Around line 54-65: Update the exported FilesetTemplate interface so its tags
property uses a readonly StartOptionTag[] type, preventing consumers of
FILESET_TEMPLATES from mutating the shared tag arrays while preserving the
existing tag values and behavior.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: a5e897f6-70b3-4363-8fa8-5c5f7d6a14eb
📒 Files selected for processing (5)
web/packages/studio/src/components/CreateFilesetStart/TemplateCard.tsxweb/packages/studio/src/components/CreateFilesetStart/templates.tsweb/packages/studio/src/components/CreateFilesetStart/types.tsweb/packages/studio/src/routes/DataDesignerJobBuildRoute/BuilderToolbar.tsxweb/packages/studio/src/routes/DataDesignerJobBuildRoute/index.tsx
💤 Files with no reviewable changes (1)
- web/packages/studio/src/routes/DataDesignerJobBuildRoute/index.tsx
| columnType: 'expression', | ||
| name: 'product_price', | ||
| values: { | ||
| expr: '{{ (price_tens_of_dollars * 10) - 0.01 | round(2) }}', | ||
| dtype: 'float', | ||
| }, | ||
| }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
sed -n '500,545p' web/packages/studio/src/components/CreateFilesetStart/templates.tsRepository: NVIDIA-NeMo/nemo-platform
Length of output: 1981
🏁 Script executed:
python3 - <<'PY'
from pathlib import Path
import re
path = Path('web/packages/studio/src/components/CreateFilesetStart/templates.ts')
text = path.read_text()
for name in ['price_tens_of_dollars', 'product_price']:
print(f'--- {name} ---')
for m in re.finditer(name, text):
start = max(0, m.start()-220)
end = min(len(text), m.end()+280)
print(text[start:end])
print()
break
PYRepository: NVIDIA-NeMo/nemo-platform
Length of output: 1253
🏁 Script executed:
python3 - <<'PY'
import sys
try:
import jinja2
from jinja2 import Environment
except Exception as e:
print(f'JINJA2_IMPORT_FAILED: {e}')
sys.exit(0)
env = Environment()
expr = '{{ (price_tens_of_dollars * 10) - 0.01 | round(2) }}'
ast = env.parse(expr)
print('JINJA2_OK')
print(ast)
PYRepository: NVIDIA-NeMo/nemo-platform
Length of output: 210
🏁 Script executed:
python3 - <<'PY'
from pathlib import Path
path = Path('web/packages/studio/src/components/CreateFilesetStart/templates.ts')
lines = path.read_text().splitlines()
for i in range(510, 540):
print(f'{i+1}: {lines[i]}')
PYRepository: NVIDIA-NeMo/nemo-platform
Length of output: 1390
Parenthesize the subtraction before round(2)
round(2) currently applies to 0.01, not the computed price. Wrap the subtraction so the whole value is rounded.
🐛 Proposed fix
- expr: '{{ (price_tens_of_dollars * 10) - 0.01 | round(2) }}',
+ expr: '{{ ((price_tens_of_dollars * 10) - 0.01) | round(2) }}',📝 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.
| columnType: 'expression', | |
| name: 'product_price', | |
| values: { | |
| expr: '{{ (price_tens_of_dollars * 10) - 0.01 | round(2) }}', | |
| dtype: 'float', | |
| }, | |
| }, | |
| columnType: 'expression', | |
| name: 'product_price', | |
| values: { | |
| expr: '{{ ((price_tens_of_dollars * 10) - 0.01) | round(2) }}', | |
| dtype: 'float', | |
| }, | |
| }, |
🤖 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 `@web/packages/studio/src/components/CreateFilesetStart/templates.ts` around
lines 528 - 534, Update the product_price expression in the fileset template so
the subtraction is parenthesized before applying the round(2) filter, ensuring
the computed price rather than 0.01 is rounded.
|
Signed-off-by: Sean Teramae [email protected]
Summary by CodeRabbit
New Features
UI Improvements