Repository navigation
fix(console): evaluate a setting's visible predicate with the expression interpreter, and hide it when it does not evaluate - #13432
Merged
Conversation
…rpreter, hiding it on error The settings page evaluated a manifest's `visible` predicate by compiling it into a JavaScript function, and showed the setting whenever that failed. It now goes through `@object-ui/core`'s `ExpressionEvaluator` (the CSP-safe `SafeExpressionParser` the renderer uses for every other `visible`), with the values bound as `data`, and a predicate that does not evaluate hides the setting, matching the server, which refuses a save whose `visible` it cannot parse. Claude-Session: https://claude.ai/code/session_01SNJgKweepTFKCrYgaKeFZK Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SNJgKweepTFKCrYgaKeFZK Co-authored-by: Claude <noreply@anthropic.com>
Contributor
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
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.
Requested by Tesla · project thread
What changes
SettingsView'sevalVisibilitycompiled a manifest'svisiblestring into a JavaScript function (new Functionwith awith (data)scope) and showed the setting whenever that failed. It now evaluates the string withExpressionEvaluatorfrom@object-ui/core, the CSP-safe interpreter (SafeExpressionParser) the renderer already uses for every othervisiblepredicate, with the namespace's values bound asdata. Called withthrowOnError: true; a predicate that does not evaluate hides the setting.Why hide on error
The server evaluates the same string with its own closed grammar (
evaluateVisibilityin@objectstack/service-settings) and refuses a save whosevisibleit cannot parse. Showing a field the server treats as broken was the console disagreeing with the server in the open direction.Every predicate the shipped manifests use (comparisons,
&&,||,!overdata.<key>, for example${data.lockout_threshold > 0}) evaluates as before. A bare identifier without thedata.prefix no longer resolves, which matches the server grammar.Tests
New
SettingsView.visibleExpression.test.tsx, four cases: a predicate that holds and one that does not, the relational and logical operators, a predicate that does not parse (hidden), and an expression reaching outside thedatascope (hidden, and it has no side effect).Red on
main, green here: with the fix committed andSettingsView.tsxalone restored frommain(2958f17), the file answers 2 failed / 2 passed (the two failures are the hide-on-error cases); with the fix, 4 passed.Local verification
pnpm exec vitest run apps/console/src/pages/settings/: 30 files, 243 passednode scripts/check-changeset-presence.mjs,node scripts/check-changeset-no-major.mjs,pnpm check:new-line-citations,pnpm check:control-bytes: exit 0pnpm exec eslinton the two touched files: exit 0 (3 pre-existing warnings inSettingsView.tsx, none on the changed lines)@object-ui/consoletype-check, which needs the whole workspace built; left to CI's type-check job.Changeset:
@object-ui/consolepatch. No issue is linked: this work was dispatched directly.Generated by Claude Code