Skip to content

feat(studio): Transform File Modal with preview schema output - #1032

Merged
steramae-nvidia merged 4 commits into
mainfrom
steramae/transform-preview
Aug 7, 2026
Merged

feat(studio): Transform File Modal with preview schema output#1032
steramae-nvidia merged 4 commits into
mainfrom
steramae/transform-preview

Conversation

@steramae-nvidia

@steramae-nvidia steramae-nvidia commented Jul 31, 2026

Copy link
Copy Markdown
Contributor
Screenshot 2026-08-03 at 7 56 02 PM

Signed-off-by: Sean Teramae steramae@nvidia.com

Summary by CodeRabbit

New Features

  • Added live before-and-after previews for file transformations, with row navigation and collapsible, copyable output.
  • Added flexible mapping fields with text inputs, selectable options, customization, disabled states, validation feedback, and row removal.
  • File actions now consistently target the selected dataset when renaming, creating splits, or transforming files.

Bug Fixes

  • Improved dataset and filepath handling in rename and transformation workflows.
  • Added safer handling for nested mappings, transformed values, and unavailable preview data.

@steramae-nvidia
steramae-nvidia requested review from a team as code owners July 31, 2026 22:29
@steramae-nvidia

steramae-nvidia commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR extracts reusable mapping rows, adds dataset-aware file actions, and replaces transform schema output with generated source-to-transformed previews.

Changes

Studio mapping and transform workflow

Layer / File(s) Summary
Mapping row extraction
web/packages/common/src/components/form/MappingFields/*
MappingRow owns controlled field rendering, passthrough props, labels, disabled state, and removal behavior. MappingFields delegates row rendering to it.
Dataset-aware file actions
web/packages/studio/src/components/FilesTable/FileQuickActions/index.tsx, web/packages/studio/src/components/FilesTable/RenameFileModal/index.tsx
File action modals receive datasetId. Rename submission resolves the dataset and passes its workspace to the mutation.
Preview output rendering
web/packages/studio/src/components/PreviewOutputPanel/index.tsx
PreviewOutputPanel renders collapsible, copyable source and modified values with optional pagination and syntax highlighting.
Transform preview integration
web/packages/studio/src/components/FilesTable/TransformFileModal/*
useTransformPreview parses rows, applies Handlebars mappings, and exposes navigation state. TransformFileModal uses resolved filepath metadata and renders TransformPreview. Tests cover nested mappings and primitive-to-object replacement.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant TransformFileModal
  participant useTransformPreview
  participant PreviewOutputPanel
  User->>TransformFileModal: open transform modal
  TransformFileModal->>useTransformPreview: pass file content and mappings
  useTransformPreview->>PreviewOutputPanel: provide source and transformed row
  TransformFileModal->>PreviewOutputPanel: render preview values
  User->>PreviewOutputPanel: navigate rows or copy output
Loading

Possibly related PRs

Suggested reviewers: htolentino-nvidia, marcusds

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: adding preview schema output to the Transform File Modal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch steramae/transform-preview

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
web/packages/common/src/components/form/MappingFields/types.ts (1)

13-14: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Type-only imports use value import syntax in both new files. Both files import symbols that appear only in type positions.

  • web/packages/common/src/components/form/MappingFields/types.ts#L13-L14: convert the ControlledCombobox and ControlledTextInput imports to import type.
  • web/packages/common/src/components/form/MappingFields/MappingRow.tsx#L23-L23: convert the Control and FieldValues import to import type.

As per coding guidelines: "Use import type for type-only imports in TypeScript".

🤖 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/common/src/components/form/MappingFields/types.ts` around lines
13 - 14, Update web/packages/common/src/components/form/MappingFields/types.ts
lines 13-14 to use type-only imports for ControlledCombobox and
ControlledTextInput, and update
web/packages/common/src/components/form/MappingFields/MappingRow.tsx line 23 to
use a type-only import for Control and FieldValues; no other changes are needed.

Source: Coding guidelines

web/packages/common/src/components/form/MappingFields/index.tsx (1)

194-201: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Drop the four assertions.

{} is already assignable to Partial<...>, so ?? infers the correct type. Type NO_OVERRIDES once instead.

♻️ Proposed change
-  const keyComboboxProps = (attributes?.keyCombobox ??
-    NO_OVERRIDES) as Partial<KeyValueComboboxPassthrough>;
-  const valueComboboxProps = (attributes?.valueCombobox ??
-    NO_OVERRIDES) as Partial<KeyValueComboboxPassthrough>;
-  const keyTextInputProps = (attributes?.keyTextInput ??
-    NO_OVERRIDES) as Partial<KeyValueTextInputPassthrough>;
-  const valueTextInputProps = (attributes?.valueTextInput ??
-    NO_OVERRIDES) as Partial<KeyValueTextInputPassthrough>;
+  const keyComboboxProps = attributes?.keyCombobox ?? NO_OVERRIDES;
+  const valueComboboxProps = attributes?.valueCombobox ?? NO_OVERRIDES;
+  const keyTextInputProps = attributes?.keyTextInput ?? NO_OVERRIDES;
+  const valueTextInputProps = attributes?.valueTextInput ?? NO_OVERRIDES;

With line 67:

const NO_OVERRIDES: Readonly<Record<string, never>> = {};

As per coding guidelines: "Use type assertions sparingly. Prefer type guards and narrowing in TypeScript".

🤖 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/common/src/components/form/MappingFields/index.tsx` around lines
194 - 201, Remove the four type assertions from the keyComboboxProps,
valueComboboxProps, keyTextInputProps, and valueTextInputProps initializations.
Type NO_OVERRIDES once as Readonly<Record<string, never>> near its declaration,
allowing each nullish-coalescing expression to infer the appropriate Partial
passthrough type.

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/FilesTable/TransformFileModal/index.tsx`:
- Around line 64-65: Update the fileType derivation near resolvedFilepath so
filenames without a dot produce an empty file type instead of the full filename;
preserve extracting the final suffix for paths with extensions, ensuring
parseFileContent does not misclassify extensionless names based on substring
matches.

In
`@web/packages/studio/src/components/FilesTable/TransformFileModal/TransformPreview.tsx`:
- Around line 4-8: Use type-only imports for the specified symbols: in
web/packages/studio/src/components/FilesTable/TransformFileModal/TransformPreview.tsx
lines 4-8, import TransformFileFormFields, FC, and Control with import type; in
web/packages/studio/src/components/FilesTable/TransformFileModal/index.tsx lines
15-18, mark TransformFileFormFields as type while keeping transformFileSchema a
value import; and on line 25, mark ComponentProps and FC as type while keeping
useMemo as a value import.

In
`@web/packages/studio/src/components/FilesTable/TransformFileModal/useTransformPreview.ts`:
- Around line 21-46: Update the nested-path construction in the mapping loop so
each intermediate segment is verified to be a non-null object before assigning
into it; replace any existing primitive or null value with a fresh object before
reassigning current. Preserve existing object branches and ensure conflicting
mappings such as “user” followed by “user.name” complete without throwing.

In `@web/packages/studio/src/components/PreviewOutputPanel/index.tsx`:
- Around line 51-60: Add an aria-expanded attribute to the collapse toggle
Button, deriving its boolean value from the existing collapsed state so expanded
and collapsed states are accurately exposed to screen readers. Keep the current
onClick handler, icons, and aria-label unchanged.

---

Nitpick comments:
In `@web/packages/common/src/components/form/MappingFields/index.tsx`:
- Around line 194-201: Remove the four type assertions from the
keyComboboxProps, valueComboboxProps, keyTextInputProps, and valueTextInputProps
initializations. Type NO_OVERRIDES once as Readonly<Record<string, never>> near
its declaration, allowing each nullish-coalescing expression to infer the
appropriate Partial passthrough type.

In `@web/packages/common/src/components/form/MappingFields/types.ts`:
- Around line 13-14: Update
web/packages/common/src/components/form/MappingFields/types.ts lines 13-14 to
use type-only imports for ControlledCombobox and ControlledTextInput, and update
web/packages/common/src/components/form/MappingFields/MappingRow.tsx line 23 to
use a type-only import for Control and FieldValues; no other changes are needed.
🪄 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: 9791b903-8fcb-4256-bc16-d8344b32b4a4

📥 Commits

Reviewing files that changed from the base of the PR and between 8da2cd4 and 2cec860.

📒 Files selected for processing (9)
  • web/packages/common/src/components/form/MappingFields/MappingRow.tsx
  • web/packages/common/src/components/form/MappingFields/index.tsx
  • web/packages/common/src/components/form/MappingFields/types.ts
  • web/packages/studio/src/components/FilesTable/FileQuickActions/index.tsx
  • web/packages/studio/src/components/FilesTable/RenameFileModal/index.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/TransformPreview.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/index.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/useTransformPreview.ts
  • web/packages/studio/src/components/PreviewOutputPanel/index.tsx

Comment thread web/packages/studio/src/components/FilesTable/TransformFileModal/index.tsx Outdated
Comment thread web/packages/studio/src/components/PreviewOutputPanel/index.tsx
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 31635/40258 78.6% 63.2%
Integration Tests 18387/38193 48.1% 20.8%

@steramae-nvidia
steramae-nvidia force-pushed the steramae/transform-preview branch from 2cec860 to 723c181 Compare August 3, 2026 22:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
`@web/packages/studio/src/components/FilesTable/TransformFileModal/useTransformPreview.test.ts`:
- Around line 4-5: Reorder the imports in the useTransformPreview test so the
external `@testing-library/react` import appears before the internal
`@studio/components/`... alias import, preserving both imports unchanged.
🪄 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: b2ac7d8e-65c5-45c5-8b25-dd6efaf44b72

📥 Commits

Reviewing files that changed from the base of the PR and between 723c181 and 74dc94d.

📒 Files selected for processing (5)
  • web/packages/studio/src/components/FilesTable/TransformFileModal/TransformPreview.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/index.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/useTransformPreview.test.ts
  • web/packages/studio/src/components/FilesTable/TransformFileModal/useTransformPreview.ts
  • web/packages/studio/src/components/PreviewOutputPanel/index.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
  • web/packages/studio/src/components/PreviewOutputPanel/index.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/TransformPreview.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/useTransformPreview.ts
  • web/packages/studio/src/components/FilesTable/TransformFileModal/index.tsx

@steramae-nvidia
steramae-nvidia force-pushed the steramae/transform-preview branch from 74dc94d to 900aa57 Compare August 4, 2026 23:35
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@steramae-nvidia
steramae-nvidia added this pull request to the merge queue Aug 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 6, 2026
@steramae-nvidia
steramae-nvidia added this pull request to the merge queue Aug 6, 2026
@marcusds
marcusds removed this pull request from the merge queue due to a manual request Aug 6, 2026
@marcusds
marcusds added this pull request to the merge queue Aug 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 6, 2026
Signed-off-by: Sean Teramae <steramae@nvidia.com>
Signed-off-by: Sean Teramae <steramae@nvidia.com>
Signed-off-by: Sean Teramae <steramae@nvidia.com>
@steramae-nvidia
steramae-nvidia force-pushed the steramae/transform-preview branch from 900aa57 to d68ab14 Compare August 7, 2026 16:53
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
web/packages/studio/src/components/FilesTable/TransformFileModal/useTransformPreview.ts (1)

60-93: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add an explicit return type for useTransformPreview.

This exported hook is a complex public API. Define its return interface and annotate the function return type.

As per coding guidelines, “specify return types for public APIs and complex functions.”

🤖 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/FilesTable/TransformFileModal/useTransformPreview.ts`
around lines 60 - 93, Define an explicit return interface for the exported
useTransformPreview hook, including the types of currentRow, totalRows,
sourceRow, afterRow, and onRowChange, then annotate the hook with that return
type while preserving its existing 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/FilesTable/TransformFileModal/useTransformPreview.ts`:
- Around line 21-34: Update the mapping traversal in the transform preview logic
to trim the mapping key before splitting it, then reject mappings with empty
path segments or segments named __proto__, constructor, or prototype. Apply
validation before accessing or assigning through current in the keyParts loop,
while preserving normal nested-object construction for valid paths.
- Around line 74-84: Clamp the displayed row in the transform preview when
rows.length changes so currentRow cannot exceed the available rows. Update the
row-selection logic around rowIndex, sourceRow, and totalRows, or reset
currentRow in response to row-count changes, ensuring PreviewOutputPanel
displays a valid “Row N of totalRows” value.
- Around line 24-38: Update the mapping-processing logic in useTransformPreview
so both Handlebars.compile and the compiled template invocation are inside
per-mapping error handling. When either fails, retain a recoverable value for
that mapping and continue processing remaining mappings instead of aborting
useMemo or TransformPreview rendering. Add coverage for invalid/incomplete
Handlebars templates.

---

Nitpick comments:
In
`@web/packages/studio/src/components/FilesTable/TransformFileModal/useTransformPreview.ts`:
- Around line 60-93: Define an explicit return interface for the exported
useTransformPreview hook, including the types of currentRow, totalRows,
sourceRow, afterRow, and onRowChange, then annotate the hook with that return
type while preserving its existing behavior.
🪄 Autofix

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: 287dd698-4e9f-4d6a-9027-ef5e9fbc655c

📥 Commits

Reviewing files that changed from the base of the PR and between af733af and d68ab14.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • web/packages/common/src/components/form/MappingFields/MappingRow.tsx
  • web/packages/common/src/components/form/MappingFields/index.tsx
  • web/packages/common/src/components/form/MappingFields/types.ts
  • web/packages/studio/src/components/FilesTable/FileQuickActions/index.tsx
  • web/packages/studio/src/components/FilesTable/RenameFileModal/index.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/TransformPreview.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/index.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/useTransformPreview.test.ts
  • web/packages/studio/src/components/FilesTable/TransformFileModal/useTransformPreview.ts
  • web/packages/studio/src/components/PreviewOutputPanel/index.tsx
🚧 Files skipped from review as they are similar to previous changes (9)
  • web/packages/studio/src/components/FilesTable/FileQuickActions/index.tsx
  • web/packages/common/src/components/form/MappingFields/types.ts
  • web/packages/studio/src/components/PreviewOutputPanel/index.tsx
  • web/packages/common/src/components/form/MappingFields/index.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/index.tsx
  • web/packages/studio/src/components/FilesTable/TransformFileModal/useTransformPreview.test.ts
  • web/packages/studio/src/components/FilesTable/TransformFileModal/TransformPreview.tsx
  • web/packages/common/src/components/form/MappingFields/MappingRow.tsx
  • web/packages/studio/src/components/FilesTable/RenameFileModal/index.tsx

Signed-off-by: Sean Teramae <steramae@nvidia.com>
@steramae-nvidia
steramae-nvidia added this pull request to the merge queue Aug 7, 2026
Merged via the queue into main with commit 09d392a Aug 7, 2026
52 checks passed
@steramae-nvidia
steramae-nvidia deleted the steramae/transform-preview branch August 7, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants