Uh oh!
There was an error while loading. Please reload this page.
feat(studio): CEL formula editor with inferred result type; structured summary roll-up editor (#1582) - #2609
Merged
Merged
Conversation
…d summary roll-up editor (#1582) The field inspector's formula editor was an unvalidated textarea writing def.formula — a key the engine never reads (ObjectQL computes formula fields from def.expression only) — so a Studio-authored formula silently never computed. Reuse the #2571 CEL infrastructure for formula fields: - celAuthoring: CelSchemaHint.role ('predicate' | 'value') threaded to validateExpression/introspectScope; new inferCelValueType() over the engine's inferExpressionType — the same verdict dataset derivation keys measure eligibility off. - CelPredicateField role="value": lints the value role and shows the inferred result type (Number/Text/Boolean/Date; Unknown carries the double()/int()/string() pinning hint), reported up via onInferredTypeChange. - ObjectFieldInspector: formula fields edit the spec `expression` key (both wire shapes, envelope extras preserved; the legacy `formula` key seeds the editor and migrates on first edit), scope='record', autocomplete roots ['record'] (formulas see neither previous nor parent), sibling catalog minus self (circular); the proven type is stamped onto Field.returnType (cleared when unprovable), and only after a real edit this session so selection never dirties the draft. - summary fields have NO expression (spec: summaryOperations) — the dead formula textarea is replaced by a structured roll-up editor (child object / aggregation / child field / relationship field; the field picker stays visible for count since the spec requires the key). - clientValidation: validateMetadataDraft('object') lints every formula expression draft-wide under fields.<field>.expression. - ObjectFormCanvas: the canvas ƒ stub now reads `expression` (either wire shape) with the legacy `formula` fallback. Verified in the preview gallery (?only=object): bare-ref error with the record.<field> fix, self-reference did-you-mean, Result type Number/Text/Unknown affordances, roll-up editor. 755 metadata-admin tests green; tsc --noEmit clean. Refs #1582, #2571. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Follow-up to #2571 (issue #1582): the field inspector's FORMULA editor was still an unvalidated
<textarea>— and it wrotedef.formula, a key the engine never reads (ObjectQL.planFormulaProjectioncomputes fromdef.expressiononly), so a Studio-authored formula silently never computed.What changed
celAuthoring.ts— role option + type inferenceCelSchemaHint.role?: 'predicate' | 'value'threads throughlintCelPredicate/introspectCelScopetovalidateExpression(default'predicate'— RLS/rules behavior unchanged).inferCelValueType(source, hint)→'number' | 'text' | 'boolean' | 'date' | 'unknown' | null, feature-detecting the engine'sinferExpressionType— the same verdict dataset derivation keys measure eligibility off.null= engine unavailable/empty (no affordance), never an exception.CelPredicateField.tsx—role="value"modeΣ Result type: Number); an unprovable type reads Unknown with thedouble()/int()/string()pinning hint.onInferredTypeChangereports the verdict up so the host can stamp metadata from it.ObjectFieldInspector.tsx— formula + summaryformulafields: the CEL editor inrole="value",scope="record", autocomplete roots['record'](formulas see neitherpreviousnorparent), sibling-field catalog (self excluded — circular). Values round-trip both wire shapes on the spec'sexpressionkey; the legacyformulakey seeds the editor and migrates on first edit. The proven type is stamped ontoField.returnType(spec: "authoring stamps it from the inferred CEL type"), cleared when unprovable — and only after a real edit this session, so selecting a field never dirties the draft.summaryfields: the spec models roll-ups assummaryOperations(no CEL expression), so the dead formula textarea is replaced by a structured editor — child object, aggregation (count/sum/min/max/avg), child field (kept visible forcount: the spec requires the key, documented as ignored), optional relationship field.clientValidation.ts—validateMetadataDraft('object')now lints every formulaexpressiondraft-wide (rolevalue, errors only) underfields.<field>.expression, alongside the #2571 conditional-rule lint.i18n — en/zh keys for the result-type affordance and the roll-up editor; README + metadata-diagnostics guide updated; feature changeset for
@object-ui/app-shell.Verification
celAuthoring.test.tsruns the REAL@objectstack/formulaengine: value-role record-scope lint (bare-ref error withrecord.<field>fix, member did-you-mean) and inference verdicts (record.amount * 0.2→ number,upper(…)→ text, comparison → boolean, dyn+dyn → unknown, unavailable engine → null).ObjectFieldInspector.test.tsxstubs via__setCelFormulaLoader: expression seeding/migration/envelope preservation, asyncreturnTypestamping (stateful harness), no stamping on mere selection, roll-up editor commits.tsc --noEmitgreen; preview-gallery browser check of the object designer.Closes nothing (follow-up); refs #1582, #2571.
🤖 Generated with Claude Code