Skip to content

jsonforms-renderers(spreadsheet): separate spreadsheet matrix processing from parsing - #31

Merged
sthanikan2000 merged 1 commit into
mainfrom
feat/spreadsheet-parse-process-split
Sep 6, 2026
Merged

jsonforms-renderers(spreadsheet): separate spreadsheet matrix processing from parsing#31
sthanikan2000 merged 1 commit into
mainfrom
feat/spreadsheet-parse-process-split

Conversation

@sthanikan2000

@sthanikan2000 sthanikan2000 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Pure, behavior-preserving refactor: extracts the "evaluate formulas against an already-parsed matrix, then shape the persisted value" step out of SpreadsheetControl's processFile callback into a standalone, format-agnostic processMatrix() helper (new utils/spreadsheet/process.ts).

  • parseWorkbookToMatrix (xlsx/csv-specific) is untouched.
  • A future upload format that produces the same CellValue[][] matrix shape (e.g. XML) could reuse processMatrix without duplicating the evaluate-and-shape logic — no such format is added here, this PR only creates the reusable seam.
  • Relocates SpreadsheetValue out of SpreadsheetControl.tsx into the shared utils/spreadsheet types, since it's no longer private to one renderer.
  • derivations stays array-shaped here, unchanged from main — the next PR in the stack adds mandatory id and converts this to an id-keyed map, deliberately split out so this PR stays a genuine no-behavior-change refactor with no id concept involved at all.

(Replaces the original #25, which GitHub auto-flagged as "merged" after a stack-restructuring force-push made its old head commit reachable from its old base branch — no code ever reached main; this PR carries the same content rebased directly onto #23.)

Test plan

  • pnpm type-check and pnpm test pass (new process.test.ts covers persistSheet true/false, empty formulas, error-entry passthrough)
  • Manually verified in the dev playground: grid and "Computed values" panel render identically to before this PR

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added consistent spreadsheet processing for uploaded data and formula derivations.
    • Spreadsheet values can now preserve the original sheet alongside calculated results.
  • Bug Fixes

    • Improved handling of formula evaluation errors while retaining successful calculations.
  • Tests

    • Added coverage for default and configurable sheet persistence, empty formulas, successful calculations, and mixed evaluation results.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Review Change Stack

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: b514f8b0-b521-4f32-8352-102c934b1687

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 8bd66869-3602-49eb-ac56-79aee81be5ec

📥 Commits

Reviewing files that changed from the base of the PR and between cb76d53 and 9853559.

📒 Files selected for processing (5)
  • packages/jsonforms-renderers/src/renderers/SpreadsheetControl.tsx
  • packages/jsonforms-renderers/src/utils/spreadsheet/index.ts
  • packages/jsonforms-renderers/src/utils/spreadsheet/process.test.ts
  • packages/jsonforms-renderers/src/utils/spreadsheet/process.ts
  • packages/jsonforms-renderers/src/utils/spreadsheet/types.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Spreadsheet processing

Layer / File(s) Summary
Matrix processing contract and implementation
packages/jsonforms-renderers/src/utils/spreadsheet/types.ts, packages/jsonforms-renderers/src/utils/spreadsheet/process.ts, packages/jsonforms-renderers/src/utils/spreadsheet/process.test.ts, packages/jsonforms-renderers/src/utils/spreadsheet/index.ts
Adds the shared SpreadsheetValue contract and processMatrix helper. The helper evaluates formulas and optionally persists the source matrix. Tests cover persistence options, successful evaluations, empty results, and errors.
Spreadsheet upload integration
packages/jsonforms-renderers/src/renderers/SpreadsheetControl.tsx
Updates spreadsheet uploads to call processMatrix and pass its returned value to handleChange. Uses the shared SpreadsheetValue type.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 98535

This PR extracts existing spreadsheet matrix processing into a reusable helper without changing parsing or persisted data behavior. It is merge-ready after normal checks, with no actionable merge-blocking risk remaining.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 5 files.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: separating spreadsheet matrix processing from parsing. It is concise, specific, and consistent with the PR objectives.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/spreadsheet-parse-process-split

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@sthanikan2000
sthanikan2000 force-pushed the feat/spreadsheet-parse-process-split branch 2 times, most recently from a3a3a83 to f10285a Compare August 31, 2026 07:19
@sthanikan2000 sthanikan2000 reopened this Aug 31, 2026
@sthanikan2000
sthanikan2000 force-pushed the feat/spreadsheet-parse-process-split branch from f10285a to 9853559 Compare August 31, 2026 07:23
@sthanikan2000 sthanikan2000 self-assigned this Aug 31, 2026
@sthanikan2000 sthanikan2000 changed the title jsonforms-renderers: separate spreadsheet matrix processing from parsing jsonforms-renderers(spreadsheet): separate spreadsheet matrix processing from parsing Sep 2, 2026
@sthanikan2000
sthanikan2000 marked this pull request as ready for review September 2, 2026 01:30
@sthanikan2000
sthanikan2000 force-pushed the feat/spreadsheet-parse-process-split branch from 9853559 to 2904386 Compare September 3, 2026 09:19

@ginaxu1 ginaxu1 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Lgtm

Base automatically changed from feat/spreadsheet-upload-ui to main September 6, 2026 06:05
Extracts the "evaluate formulas against an already-parsed matrix, then
shape the persisted value" step out of SpreadsheetControl's processFile
callback into a standalone, format-agnostic processMatrix() helper.
parseWorkbookToMatrix (xlsx/csv-specific) is untouched; a future
XML-upload path that produces the same CellValue[][] matrix shape can
reuse processMatrix without duplicating the evaluate-and-shape logic.
Also relocates the SpreadsheetValue type out of SpreadsheetControl.tsx
into the shared utils/spreadsheet types, since it's no longer private
to one renderer.

Pure, behavior-preserving refactor — derivations stay array-shaped
here, unchanged from main; see the next PR for the id-keyed map change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sthanikan2000
sthanikan2000 force-pushed the feat/spreadsheet-parse-process-split branch from 2904386 to 742ff1c Compare September 6, 2026 06:05
@sthanikan2000
sthanikan2000 merged commit eb9dd93 into main Sep 6, 2026
3 checks passed
@sthanikan2000
sthanikan2000 deleted the feat/spreadsheet-parse-process-split branch September 6, 2026 17:42
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.

2 participants