Skip to content

feat: add expression playground tooling - #175

Open
moshloop wants to merge 7 commits into
mainfrom
playground
Open

feat: add expression playground tooling#175
moshloop wants to merge 7 commits into
mainfrom
playground

Conversation

@moshloop

Copy link
Copy Markdown
Member

What

  • Generate grammar-driven Monarch definitions with conformance validation.
  • Add an embeddable evaluation and metadata API for CEL, Go templates, JSONPath, and JavaScript.
  • Add a Monaco-powered browser playground with generated definitions and CI coverage.
  • Preserve CEL native values and cap regex programs at 10,000 instructions.

Why

  • Keep editor tooling aligned with gomplate evaluator grammars and registries.

Generate Monaco tokenizers and configurations from CEL, Go template, and JSONPath vocabularies. Keep editor highlighting aligned with evaluator grammars and registered functions, with deterministic output and lexer-backed conformance validation.
Expose reusable evaluation and metadata endpoints for hosts embedding gomplate's language playground.
Support CEL, Go templates, JSONPath, and JavaScript with source-positioned errors, typed results, host-provided functions, examples, and bounded responses.
Adds generated Monaco language support and an interactive playground for gomplate expressions and templates. Keeps editor catalogues aligned with evaluator registries while providing completion, hover, theming, object-graph exploration, and live evaluation. Includes generated specs, conformance coverage, package documentation, and playground tests.
Provide a browser playground that evaluates against the real gomplate engine and stays aligned with its language registries.
Add generated Monaco definitions with drift detection, plus CI coverage for web typechecking, tests, and builds.
Add concurrency-safe native type registration so CEL preserves registered Go values and JSON field mappings. Upgrade cel-go to v0.31, support optimized execution decorators, and enforce a 10,000-instruction regex limit. Rework benchmark CI to interleave base/head samples and report metric-level CSV regressions with tests. Document the new CEL behavior and upcoming collection helpers.

Claude-Session-Id: 019fef64-038b-7471-9962-6019a7d08109
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 108 files, which is 8 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c074f08-350f-47ff-b293-9a6348560a20

📥 Commits

Reviewing files that changed from the base of the PR and between 31a8cb1 and 50c1799.

⛔ Files ignored due to path filters (6)
  • go.sum is excluded by !**/*.sum
  • web/packages/lang/src/generated/conformance.json is excluded by !**/generated/**
  • web/packages/lang/src/generated/index.ts is excluded by !**/generated/**
  • web/packages/lang/src/generated/languages.json is excluded by !**/generated/**
  • web/packages/lang/src/generated/spec.json is excluded by !**/generated/**
  • web/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (108)
  • .github/scripts/benchstat-summary.py
  • .github/scripts/benchstat-summary_test.py
  • .github/workflows/benchmark.yml
  • .github/workflows/web.yml
  • .gitignore
  • CEL.md
  • Makefile
  • README.md
  • cel.go
  • cel_expression.go
  • cel_native.go
  • cel_native_test.go
  • cel_tracker_test.go
  • cel_v031_bench_test.go
  • cmd/genmonarch/main.go
  • cmd/playground/main.go
  • genmonarch/build.go
  • genmonarch/conformance.go
  • genmonarch/conformance_validate.go
  • genmonarch/grammar/CEL.g4
  • genmonarch/grammar/antlr_parse.go
  • genmonarch/grammar/antlr_regex.go
  • genmonarch/grammar/antlr_test.go
  • genmonarch/grammar/cel.go
  • genmonarch/grammar/cel_test.go
  • genmonarch/grammar/gotemplate.go
  • genmonarch/grammar/gotemplate_test.go
  • genmonarch/grammar/suite_test.go
  • genmonarch/lang_cel.go
  • genmonarch/lang_embedded.go
  • genmonarch/lang_gotemplate.go
  • genmonarch/lang_jsonpath.go
  • genmonarch/monarch.go
  • genmonarch/render.go
  • genmonarch/spec.go
  • genmonarch/suite_test.go
  • genmonarch/vocab_cel.go
  • genmonarch/vocab_cel_test.go
  • genmonarch/vocab_gotemplate.go
  • genmonarch/vocab_gotemplate_test.go
  • go.mod
  • hack/hostplayground/main.go
  • nilsafe/nilsafe.go
  • nilsafe/zeroval.go
  • playground/README.md
  • playground/eval.go
  • playground/eval_test.go
  • playground/server.go
  • run_expression_bench_test.go
  • serialize.go
  • serialize_bench_test.go
  • specs/REQUIREMENTS-coalesce.md
  • specs/REQUIREMENTS-first-last.md
  • template.go
  • template_test.go
  • web/.gitignore
  • web/apps/playground/index.html
  • web/apps/playground/package.json
  • web/apps/playground/plugins/eval-server.ts
  • web/apps/playground/src/App.tsx
  • web/apps/playground/src/RunControls.tsx
  • web/apps/playground/src/VerticalSplit.tsx
  • web/apps/playground/src/api.ts
  • web/apps/playground/src/examples.ts
  • web/apps/playground/src/functionCatalogue.test.ts
  • web/apps/playground/src/functionCatalogue.ts
  • web/apps/playground/src/hashRouter.ts
  • web/apps/playground/src/languages.ts
  • web/apps/playground/src/main.tsx
  • web/apps/playground/src/monaco-setup.ts
  • web/apps/playground/src/panels/GraphPanel.tsx
  • web/apps/playground/src/panels/ResultPanel.tsx
  • web/apps/playground/src/panels/SpecPanel.tsx
  • web/apps/playground/src/panels/TokensPanel.tsx
  • web/apps/playground/src/panels/graphNodes.ts
  • web/apps/playground/src/runAction.ts
  • web/apps/playground/src/styles.css
  • web/apps/playground/src/useEditorTheme.ts
  • web/apps/playground/src/useEvaluator.ts
  • web/apps/playground/src/useParsedInput.ts
  • web/apps/playground/src/useUrlState.ts
  • web/apps/playground/test/examples.test.ts
  • web/apps/playground/test/graphNodes.test.ts
  • web/apps/playground/tsconfig.json
  • web/apps/playground/vite.config.ts
  • web/package.json
  • web/packages/lang/README.md
  • web/packages/lang/package.json
  • web/packages/lang/src/attributes.ts
  • web/packages/lang/src/completion.ts
  • web/packages/lang/src/environment.ts
  • web/packages/lang/src/hover.ts
  • web/packages/lang/src/index.ts
  • web/packages/lang/src/merge.ts
  • web/packages/lang/src/prefix.ts
  • web/packages/lang/src/spec.ts
  • web/packages/lang/src/theme.ts
  • web/packages/lang/src/types.ts
  • web/packages/lang/test/completion.test.ts
  • web/packages/lang/test/conformance.test.ts
  • web/packages/lang/test/hostSpec.test.ts
  • web/packages/lang/test/registration.test.ts
  • web/packages/lang/test/setup.ts
  • web/packages/lang/test/tokenize.test.ts
  • web/packages/lang/tsconfig.build.json
  • web/packages/lang/tsconfig.json
  • web/packages/lang/vite.config.ts
  • web/pnpm-workspace.yaml

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown

Benchstat

Base: 31a8cb108062431a578f5bcc41d30d5946f1abd2
Head: 50c1799c741fecff4fe11d965d57f60be97c9bfe

5 minor regression(s) (all within 5% threshold)

Benchmark Metric Base Head Change p-value
RunExpressionContextCompile/cache=miss/environment=large-4 B/op 2.01e+05 B/op 2.09e+05 B/op +4.16% 0.000
RunExpressionContextCompile/cache=miss/environment=small-4 B/op 1.99e+05 B/op 2.07e+05 B/op +4.13% 0.000
RunExpressionContext/cache=hit/environment=small-4 sec/op 1.7 us/op 1.76 us/op +3.11% 0.000
Serialize_NoNativeTypes/items=100/native_values=false-4 sec/op 87.7 us/op 88.1 us/op +0.50% 0.043
Serialize/items=1000/native_values=true-4 B/op 9.75e+05 B/op 9.75e+05 B/op +0.01% 0.013
13 improvement(s)
Benchmark Metric Base Head Change p-value
CELEnvExtend/variables=1/functions=0-4 sec/op 91.7 us/op 4.65 us/op -94.93% 0.000
CELEnvExtend/variables=10/functions=0-4 sec/op 93.9 us/op 6.39 us/op -93.20% 0.000
CELEnvExtend/variables=1/functions=0-4 B/op 3.77e+04 B/op 3.43e+03 B/op -90.89% 0.000
CELEnvExtend/variables=10/functions=0-4 B/op 3.94e+04 B/op 5.15e+03 B/op -86.93% 0.000
CELEnvExtend/variables=100/functions=0-4 sec/op 111 us/op 22 us/op -80.10% 0.000
CELEnvExtend/variables=100/functions=0-4 B/op 5.73e+04 B/op 2.3e+04 B/op -59.78% 0.000
CELEnvExtend/variables=1/functions=0-4 allocs/op 132 allocs/op 60 allocs/op -54.55% 0.000
CELEnvExtend/variables=10/functions=0-4 allocs/op 151 allocs/op 79 allocs/op -47.68% 0.000
CELEnvExtend/variables=100/functions=0-4 allocs/op 253 allocs/op 181 allocs/op -28.46% 0.000
RunExpressionContextCompile/cache=miss/environment=small-4 sec/op 319 us/op 298 us/op -6.37% 0.000
RunExpressionContextCompile/cache=miss/environment=large-4 sec/op 326 us/op 309 us/op -5.45% 0.000
RunExpressionContextCompile/cache=miss/environment=small-4 allocs/op 2.25e+03 allocs/op 2.23e+03 allocs/op -1.15% 0.000
RunExpressionContextCompile/cache=miss/environment=large-4 allocs/op 2.34e+03 allocs/op 2.31e+03 allocs/op -1.11% 0.000
Full benchstat output
goos: linux
goarch: amd64
pkg: github.com/flanksource/gomplate/v3
cpu: AMD EPYC 9V74 80-Core Processor                
                                                                      │ bench-base.txt │           bench-head.txt            │
                                                                      │     sec/op     │   sec/op     vs base                │
RunExpressionContext/cache=hit/environment=small-4                         1.703µ ± 1%   1.756µ ± 1%   +3.11% (p=0.000 n=10)
RunExpressionContext/cache=hit/environment=large-4                         10.51µ ± 2%   10.64µ ± 1%        ~ (p=0.052 n=10)
RunExpressionContextCompile/cache=miss/environment=small-4                 318.5µ ± 1%   298.2µ ± 2%   -6.37% (p=0.000 n=10)
RunExpressionContextCompile/cache=miss/environment=large-4                 326.5µ ± 1%   308.7µ ± 1%   -5.45% (p=0.000 n=10)
CELEnvExtend/variables=1/functions=0-4                                    91.711µ ± 0%   4.650µ ± 0%  -94.93% (p=0.000 n=10)
CELEnvExtend/variables=10/functions=0-4                                   93.906µ ± 1%   6.386µ ± 1%  -93.20% (p=0.000 n=10)
CELEnvExtend/variables=100/functions=0-4                                  110.71µ ± 2%   22.03µ ± 1%  -80.10% (p=0.000 n=10)
Serialize/items=10/native_values=true-4                                    34.22µ ± 1%   34.28µ ± 1%        ~ (p=0.382 n=10)
Serialize/items=100/native_values=true-4                                   325.4µ ± 1%   326.3µ ± 0%        ~ (p=0.089 n=10)
Serialize/items=1000/native_values=true-4                                  3.319m ± 0%   3.327m ± 2%        ~ (p=0.190 n=10)
Serialize/items=10000/native_values=true-4                                 39.96m ± 2%   40.33m ± 3%        ~ (p=0.190 n=10)
Serialize_NoNativeTypes/items=100/native_values=false-4                    87.65µ ± 1%   88.08µ ± 2%   +0.50% (p=0.043 n=10)
Serialize_NoNativeTypes/items=1000/native_values=false-4                   886.9µ ± 2%   894.4µ ± 1%        ~ (p=0.218 n=10)
Serialize_NoNativeTypes/items=10000/native_values=false-4                  8.854m ± 1%   8.904m ± 1%        ~ (p=0.165 n=10)
CELEnvExtendCustomFunction-4                                                             71.77µ ± 1%
CELProgramEvaluation/expression=scalar/optimized=false-4                                 207.8n ± 1%
CELProgramEvaluation/expression=scalar/optimized=true-4                                  209.4n ± 4%
CELProgramEvaluation/expression=list_optional_regex/optimized=false-4                    5.581µ ± 4%
CELProgramEvaluation/expression=list_optional_regex/optimized=true-4                     1.437µ ± 1%
CELProgramEvaluation/expression=comprehension/optimized=false-4                          7.034µ ± 1%
CELProgramEvaluation/expression=comprehension/optimized=true-4                           6.587µ ± 1%
RunExpressionNativeInput/input=map-4                                                     2.642µ ± 0%
RunExpressionNativeInput/input=native_struct-4                                           2.828µ ± 1%
geomean                                                                    237.4µ        30.11µ       -40.75%

                                                                      │ bench-base.txt │             bench-head.txt             │
                                                                      │      B/op      │     B/op      vs base                  │
RunExpressionContext/cache=hit/environment=small-4                          664.0 ± 0%     664.0 ± 0%        ~ (p=1.000 n=10) ¹
RunExpressionContext/cache=hit/environment=large-4                        2.445Ki ± 0%   2.445Ki ± 0%        ~ (p=1.000 n=10) ¹
RunExpressionContextCompile/cache=miss/environment=small-4                194.4Ki ± 0%   202.4Ki ± 0%   +4.13% (p=0.000 n=10)
RunExpressionContextCompile/cache=miss/environment=large-4                196.2Ki ± 0%   204.4Ki ± 0%   +4.16% (p=0.000 n=10)
CELEnvExtend/variables=1/functions=0-4                                   36.803Ki ± 0%   3.352Ki ± 0%  -90.89% (p=0.000 n=10)
CELEnvExtend/variables=10/functions=0-4                                  38.483Ki ± 0%   5.031Ki ± 0%  -86.93% (p=0.000 n=10)
CELEnvExtend/variables=100/functions=0-4                                  55.96Ki ± 0%   22.50Ki ± 0%  -59.78% (p=0.000 n=10)
Serialize/items=10/native_values=true-4                                   11.06Ki ± 0%   11.06Ki ± 0%        ~ (p=1.000 n=10) ¹
Serialize/items=100/native_values=true-4                                  95.51Ki ± 0%   95.51Ki ± 0%        ~ (p=0.680 n=10)
Serialize/items=1000/native_values=true-4                                 952.2Ki ± 0%   952.3Ki ± 0%   +0.01% (p=0.013 n=10)
Serialize/items=10000/native_values=true-4                                10.04Mi ± 0%   10.04Mi ± 1%        ~ (p=0.529 n=10)
Serialize_NoNativeTypes/items=100/native_values=false-4                   36.33Ki ± 0%   36.33Ki ± 0%        ~ (p=0.628 n=10)
Serialize_NoNativeTypes/items=1000/native_values=false-4                  365.6Ki ± 0%   365.6Ki ± 0%        ~ (p=1.000 n=10) ¹
Serialize_NoNativeTypes/items=10000/native_values=false-4                 3.584Mi ± 0%   3.584Mi ± 0%        ~ (p=0.342 n=10)
CELEnvExtendCustomFunction-4                                                             45.19Ki ± 0%
CELProgramEvaluation/expression=scalar/optimized=false-4                                   64.00 ± 0%
CELProgramEvaluation/expression=scalar/optimized=true-4                                    64.00 ± 0%
CELProgramEvaluation/expression=list_optional_regex/optimized=false-4                    4.464Ki ± 0%
CELProgramEvaluation/expression=list_optional_regex/optimized=true-4                       741.0 ± 0%
CELProgramEvaluation/expression=comprehension/optimized=false-4                          2.822Ki ± 0%
CELProgramEvaluation/expression=comprehension/optimized=true-4                           2.438Ki ± 0%
RunExpressionNativeInput/input=map-4                                                       808.0 ± 0%
RunExpressionNativeInput/input=native_struct-4                                            1000.0 ± 0%
geomean                                                                   90.35Ki        12.95Ki       -31.32%
¹ all samples are equal

                                                                      │ bench-base.txt │            bench-head.txt             │
                                                                      │   allocs/op    │  allocs/op   vs base                  │
RunExpressionContext/cache=hit/environment=small-4                          20.00 ± 0%    20.00 ± 0%        ~ (p=1.000 n=10) ¹
RunExpressionContext/cache=hit/environment=large-4                          101.0 ± 0%    101.0 ± 0%        ~ (p=1.000 n=10) ¹
RunExpressionContextCompile/cache=miss/environment=small-4                 2.253k ± 0%   2.227k ± 0%   -1.15% (p=0.000 n=10)
RunExpressionContextCompile/cache=miss/environment=large-4                 2.336k ± 0%   2.310k ± 0%   -1.11% (p=0.000 n=10)
CELEnvExtend/variables=1/functions=0-4                                     132.00 ± 0%    60.00 ± 0%  -54.55% (p=0.000 n=10)
CELEnvExtend/variables=10/functions=0-4                                    151.00 ± 0%    79.00 ± 0%  -47.68% (p=0.000 n=10)
CELEnvExtend/variables=100/functions=0-4                                    253.0 ± 0%    181.0 ± 0%  -28.46% (p=0.000 n=10)
Serialize/items=10/native_values=true-4                                     268.0 ± 0%    268.0 ± 0%        ~ (p=1.000 n=10) ¹
Serialize/items=100/native_values=true-4                                   2.518k ± 0%   2.518k ± 0%        ~ (p=1.000 n=10) ¹
Serialize/items=1000/native_values=true-4                                  25.80k ± 0%   25.80k ± 0%        ~ (p=1.000 n=10)
Serialize/items=10000/native_values=true-4                                 265.0k ± 0%   265.0k ± 0%        ~ (p=0.385 n=10)
Serialize_NoNativeTypes/items=100/native_values=false-4                     911.0 ± 0%    911.0 ± 0%        ~ (p=1.000 n=10) ¹
Serialize_NoNativeTypes/items=1000/native_values=false-4                   9.757k ± 0%   9.758k ± 0%        ~ (p=0.370 n=10)
Serialize_NoNativeTypes/items=10000/native_values=false-4                  100.1k ± 0%   100.1k ± 0%        ~ (p=0.366 n=10)
CELEnvExtendCustomFunction-4                                                              100.0 ± 0%
CELProgramEvaluation/expression=scalar/optimized=false-4                                  3.000 ± 0%
CELProgramEvaluation/expression=scalar/optimized=true-4                                   3.000 ± 0%
CELProgramEvaluation/expression=list_optional_regex/optimized=false-4                     105.0 ± 0%
CELProgramEvaluation/expression=list_optional_regex/optimized=true-4                      23.00 ± 0%
CELProgramEvaluation/expression=comprehension/optimized=false-4                           92.00 ± 0%
CELProgramEvaluation/expression=comprehension/optimized=true-4                            82.00 ± 0%
RunExpressionNativeInput/input=map-4                                                      27.00 ± 0%
RunExpressionNativeInput/input=native_struct-4                                            26.00 ± 0%
geomean                                                                    1.470k         289.7       -12.03%
¹ all samples are equal

@socket-security

socket-security Bot commented Aug 15, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm data-urls is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: web/pnpm-lock.yamlnpm/jsdom@26.1.0npm/data-urls@5.0.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/data-urls@5.0.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm jotai is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: web/pnpm-lock.yamlnpm/@flanksource/clicky-ui@0.3.20npm/jotai@2.20.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/jotai@2.20.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm rrweb-cssom is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: web/pnpm-lock.yamlnpm/jsdom@26.1.0npm/rrweb-cssom@0.8.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/rrweb-cssom@0.8.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

… one JSON artifact

Keep tokenizer and configuration data together in one stable generated artifact while preserving the definitions export.
BREAKING CHANGE: Remove per-language *.monarch.json and *.config.json artifacts; consumers must use languages.json or the generated definitions export

Claude-Session-Id: 36467ebc-f368-4040-bc75-e28248497b4c
Keep generated Monarch and editor configuration metadata in one catalog so the language package has a single import surface while preserving all existing definitions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant