jsonforms-renderers(spreadsheet)!: require id on formula config/result entries, persist derivations as an id-keyed map - #32
Open
sthanikan2000 wants to merge 2 commits into
Conversation
Every x-evaluate FormulaConfigEntry and the FormulaResult it produces must now carry an id, so consumers can key off a stable identifier instead of array index. This is a breaking change: entries without an id are rejected the same way a missing label/expression is today. evaluateExpressions now threads id through on both the success and error/catch paths, and the catch-block error-code lookup is extracted into an exported describeFormulaError() helper. Updates the dev fixture, docs example, and SpreadsheetControl's list key accordingly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Derivations were an array (FormulaResult[]); now they're persisted as
Record<id, {label, value, error?}>, keyed by each x-evaluate entry's
mandatory id. This is the actual purpose id-required serves: a sibling
field can now address one specific derivation's value directly via a
plain data-tree path (e.g. sales.derivations.total_sales.value), with
no "find by id in an array" step needed anywhere.
Written once, directly in processMatrix (introduced by the previous
PR) — SpreadsheetControl.tsx's processFile calls processMatrix
opaquely and needs no changes; only its "Computed values" panel
rendering (Object.entries/Object.keys instead of array methods) is
touched.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 59 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (9)
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. Comment |
This was referenced Aug 31, 2026
sthanikan2000
force-pushed
the
feat/derivation-id-required
branch
from
August 31, 2026 07:06
bc05d26 to
38eda65
Compare
sthanikan2000
force-pushed
the
feat/derivation-id-required
branch
from
August 31, 2026 07:23
38eda65 to
bc05d26
Compare
sthanikan2000
marked this pull request as ready for review
September 2, 2026 01:30
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Breaking change to
x-evaluate/derivation results, done as one cohesive change now that the parse/process split (#31) has landed underneath it:idis now a requiredstringon bothFormulaConfigEntry(thex-evaluateconfig) andFormulaResult(whatevaluateExpressionsreturns per entry) — previously entries were matched only by array index/label.evaluateExpressionsitself (inexpression.ts) is untouched in behavior — it still returns an array, in authored order; only its per-entry shape now guarantees anid.x-evaluateentries in thespreadsheetdev fixture now carry an id.describeFormulaErroras a reusable export (pure refactor, no behavior change) — used by later PRs in this stack.SpreadsheetControl's persistedderivationschanges fromFormulaResult[]toRecord<id, DerivationResult>, written directly intoprocessMatrix(the seam jsonforms-renderers(spreadsheet): separate spreadsheet matrix processing from parsing #31 introduced). This is the actual purpose id-required serves: a sibling field can address one specific derivation's value directly via a plain data-tree path (e.g.sales.derivations.total_sales.value), with no "find by id in an array" step needed anywhere.Object.entries(derivations)instead of the array, keyed by id.These two changes are combined into a single PR (rather than split, as in an earlier iteration of this stack) because requiring
idhas no purpose in this codebase other than serving as this map's key — splitting them meant a followup PR would delete/replace code the first PR had just introduced. Combining them, on top of the already-extractedprocessMatrix, means the map-building logic is written exactly once, directly in its final home.Test plan
pnpm type-checkandpnpm testpasspnpm run format:checkpasses🤖 Generated with Claude Code