Repository navigation
feat(launchpad): build widget-calculated-fields - #1261
Open
rubenvdlinde wants to merge 9 commits into
Open
rubenvdlinde wants to merge 9 commits into
rubenvdlinde wants to merge 9 commits into
Conversation
Server-side save-time validation of calculated fields (tasks 23-25, 37): CalculatedFieldService checks each stored AST (shape, allowlisted functions, argument counts), detects cycles across the dashboard and type-checks in dependency order, setting returnType; the placement update answers 400 with the editor's error envelope before anything is saved. Assisted-by: ClaudeCode:claude-opus-5-5
rubenvdlinde
requested review from
Rem-Dam,
SudoThijn,
WilcoLouwerse,
bbrands02,
remko48 and
rjzondervan
as code owners
November 17, 2026 07:19
Task 29: a server-mode calculated field that reads a widget of another register or schema, or whose widget has no OpenRegister source, is saved in client mode and the placement update answers with a downgraded_evaluation_mode warning. Assisted-by: ClaudeCode:claude-opus-5-5
Materialise server-mode calculated fields on the widget's OpenRegister source schema as read-only calculated properties, keep them in step on save and source change, and remove them when the widget is removed (tasks 26-28, 32, 39). Assisted-by: ClaudeCode:claude-opus-5-5
…es [skip ci] Assisted-by: ClaudeCode:claude-opus-5-5
Parser case table: 183 Vitest cases over operators, literals, references, every built-in function and its arity bounds, and malformed input (task 41). Assisted-by: ClaudeCode:claude-opus-5-5
Document calculated fields in openapi.json, the Postman collection, the widgets feature page and the change's design notes (tasks 48, 52). Assisted-by: ClaudeCode:claude-opus-5-5
Move the server-field save flow into CalculatedFieldServerFields to keep the service under the complexity thresholds, and clear the psalm and jsdoc findings in the change's files (task 47). Assisted-by: ClaudeCode:claude-opus-5-5
…ly [skip ci] The materialiser read and wrote the widget's source schema through OpenRegister's SchemaMapper with its default access flags. Pass RBAC and multitenancy explicitly on find() so a change of those defaults cannot turn them off, document that update() verifies the caller's schema update permission and organisation access, and lock both in tests: the schema is read with access checks on, and a schema the caller may not read is never written while the field stays client-side. Assisted-by: ClaudeCode:claude-opus-5-5
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.
Continues the build of
openspec/changes/widget-calculated-fieldsafter #1254.Tasks done in this PR
CalculatedFieldService(validateAndCompile,detectCycles,evaluateExpression). Following design D3, the server does not re-parse the source text. It checks the storedcompiledExpressionwith the newCalculatedFieldAstChecker(node shapes asisAstNode(), built-in and allowlisted functions, argument counts) and the newCalculatedFieldTypeChecker, which followstypeChecker.jsrule for rule. Each field gets itsreturnType, typed in dependency order across the dashboard.WidgetApiController::updatePlacementvalidatescalculatedFieldsagainst the placement's dashboard before saving.addWidgettakes no calculated fields.{error, message, ...details, field}(invalidExpression,unknownFunction,functionNotAllowed,arityMismatch,functionSignature,typeError,duplicateField,cycleDetected). Nothing is persisted.server/bothfield that reads a widget of another register or schema, or whose widget has no OpenRegister source, is saved asclient. The update response then carrieswarnings: [{warning: 'downgraded_evaluation_mode', field, reason}].Tasks left
x-openregister-calculationson the source schema, cleanup on delete, the server error log) are next on this branch. They need the widget AST translated into OpenRegister's calculation dialect.Tests
tests/fixtures/calculated-fields/type-check-cases.jsonholds 60 ASTs generated from the client parser and type checker. For each one, the PHP checker must give the same type or the same error envelope, and it does for all 60.CalculatedFieldAstCheckerTest,CalculatedFieldTypeCheckerTest,CalculatedFieldServiceTest,WidgetApiControllerCalculatedFieldsTest(110 tests).Generated by Claude Code