Repository navigation
Migrate gomplate v4 and fix eval ports - #181
Conversation
|
Important Review skippedToo many files! This PR contains 174 files, which is 74 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.
|
BenchstatBase: 50 regression(s) detected (threshold: >5%)
19 improvement(s)
Full benchstat output |
Select an available loopback port when the preferred evaluation-server port is occupied, while keeping Vite's proxy aligned with the selected port. Force dependency re-optimization when serving from the sibling clicky-ui source to prevent stale package paths.
…atest releases Bumps the Go toolchain to 1.26.1 and refreshes direct and indirect modules (flanksource commons and is-healthy, ginkgo, gomega, otel, golang.org/x packages, and others) to newer releases. Removes indirect requirements no longer in the build graph, such as cert-manager, gateway-api, and apiextensions-apiserver. Upgrades @flanksource/clicky-ui in the playground to 0.3.54, which adds @tanstack/react-virtual and country-flag-icons, moves tailwind-merge to v3, and drops tailwindcss v3 from its peer range.
BREAKING CHANGE: import gomplate through github.com/flanksource/gomplate/v4 and CEL types through cel.dev/cel-go. Upgrade CEL to v0.32.0 and update generator templates and language fixtures. Configure separate main/v4 and 3.x/security release lines and guard downstream v3 updates. Apply verified Go and DOMPurify security fixes and document migration. Validation: full Go tests, lint, ceval build and smoke, generated-language checks, web typechecks/tests, release analyzer and workflow syntax checks passed. Post-update govulncheck and production pnpm audit are clean. Known limitation: inherited clicky-ui v0.3.54 exports chat code importing a missing optional ai peer, which blocks the playground production build. Keep this PR as a draft. Claude-Session-Id: 01a19670-c76b-7953-a4da-f9c1568eb9a2
Serialize previously used alt.Alter, which rewrites the input map in place, so reused environment values (e.g. a *time.Time) were replaced by their decomposed map form after a single expression evaluation. Switching to alt.Decompose keeps the caller's data intact, and adding a ref.Val case ensures CEL values are converted rather than passed through unchanged.
…val mode Expression results were routed through structpb, so every number widened to float64 and integers beyond 2^53, native typed values and CEL values nested in caller maps lost fidelity. CELValue now unwraps CEL aggregates directly. The new celvalues package lets Date and Money values compare against strings, timestamps and numbers in either operand position, evaluating each operand once while keeping stock CEL error and unknown semantics intact. Add groupBy/distinctBy/latestBy/joinBy/one macros plus an exact decimal sum() for string lists to support aggregate checks without JSON round trips, and a Strict template mode whose cached env stays separate from the nil-safe environment. BREAKING CHANGE: Strict templates no longer get nil-safe operators, environment variables are declared as dyn instead of any, and sum() over a string list returns a decimal string rather than a JSON number.
Money previously supported only comparisons, so templates had to fall back to numbers and lose exactness. bigdecimal.Money now supports +, -, *, / with numbers and same-currency Money, plus unary negation, keeping the result as Money in the operand's currency; doubles are read via their shortest decimal form so decimal results stay exact. Multiplying or dividing two Money values, dividing a number by Money, mixing currencies, and any arithmetic on decimal.Money remain errors at evaluation time. Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
… v1.64.0 Pull in latest upstream fixes and transitive decimal dependencies required by the updated commons module. Refreshes go.sum, dropping stale indirect version entries left over from prior resolution. Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
b268838 to
d2d24e0
Compare
gojq cannot traverse []byte, so byte slices passed to JQ failed to be queried as JSON documents. Converting bytes to a string before type conversion lets callers pass raw JSON payloads directly instead of pre-converting them. Adds a test covering querying a field from a byte-encoded JSON document. Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
Captured CEL bytes were dropped when reused as inputs, breaking byte equality checks. Keep []byte values only on the CEL serialization path while preserving existing public Serialize behavior. Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
Bump the go directive to 1.27.1 and rebuild the build and integration images on golang:1.27-alpine (digest-pinned). Go 1.27 renamed the text/template/parse delimiter constants from leftDelim/rightDelim to defaultLeftDelim/defaultRightDelim, so the template grammar generator now extracts and reads the new names to keep Monarch's Go template delimiters correct. Also lets the hairyhenderson/yaml requirement be folded into the main require block. No behavior change expected beyond the toolchain update. Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
Aligns go.mod and both Docker build images on Go 1.27.4, refreshing the pinned image digest so builds and CI use the same patched toolchain. Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
…l, and collection helpers Refresh the generated languages/spec artifacts so tooling and editors surface the new language surface: yaml.encode/parse, json.parse, base64 URL-safe codecs, list hasAll/hasAny/hasExactly/hasOnly, one(), and the distinctBy/groupBy/joinBy/latestBy macros. Also adds string conversions for Money/Date types and sum over decimal strings. These files are build output, so no hand-written logic changed. Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
Expressions now read structs, maps, lists, UUIDs and unsigned integers on demand instead of eagerly serializing the whole environment, so only the fields an expression touches are converted. Structs are keyed the way encoding/json names them (tags, omitempty, promoted embedded fields, unexported fields absent), and callers' values are left untouched. Registered native types still use cel-go's own type handling. Adds celvalues.Plain for obtaining the plain Go form of an adapted value, and removes the internal serializeForCEL helper. Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
cel-go v0.33 recompiles every registered overload cost model on each Env.configure, so every Env.Extend paid ~16us and ~350 allocations for ext.Strings/Encoders/Lists/Math/Sets cost models that gomplate never uses. celext is generated from cel-go's ext package by celext/internal/sync (go generate / make celext) with a gopatch rewrite that routes each library's cel.CostModel through a per-library opt-out. By default it behaves exactly like upstream; a parity spec checks declarations, evaluation and cost estimates against upstream ext, and SourceVersion fails the build when cel-go is bumped without regenerating. Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
Templates carrying Functions were never cached because a function value cannot be keyed on, so every call recompiled (~600us, ~2700 allocs). Add Template.CelFunctions: functions declared with late bindings whose implementation is supplied per evaluation via cel.FunctionVars, so no closure lives in the compiled program. Functions are converted to the same form. The extended environment is cached by its declarations and the auto program-cache key includes them; CelEnvs stay uncached. A declared function without an implementation is an error. Cache hits for function templates drop to ~4us / 44 allocs. The base environment now uses celext with cost models disabled. Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
Backs the canary-checker docs' Equivalent functions table: each pair (lowerAscii/toLower, distinct/uniq, math.abs/math.Abs, lists.range/ math.Seq, json/yaml encode and parse, ...) is evaluated on inputs that show where the two spellings agree or differ. Claude-Session-Id: 5b22303b-86d9-4d5a-969f-fb488a34dccd
Moves BenchmarkRunExpressionContextFunctions into its own head-only file because CelFunction does not exist on the benchmark base. The benchmark workflow copies only run_expression_bench_test.go into the base worktree, so this keeps base comparisons from failing to compile. No runtime behavior changes. Gavel-Issue-Id: 1f3832aa-df27-4d44-a135-b404cd7ab226 Claude-Session-Id: e7d00810-447c-45c7-822f-8b1c786c4389
…rovider and nil-safe access Vendor the Go text/template execution engine as texttemplate, taken from go1.27.4, so gomplate can run templates with a per-execution ValuesProvider and nil-safe field access without changing text/template behavior for callers using Execute or zero ExecuteOptions. Parsing still uses text/template/parse and internal/fmtsort is vendored. Deviations from upstream are tagged gomplate: for future syncs; the additions live in values.go. Claude-Session-Id: 9cbaec31-655b-4670-a331-adddc1c8c5d2
Go templates previously serialized the whole environment before execution. Now they read values lazily through a ValuesProvider, and only values the template prints, ranges over, tests, or passes to a function are serialized, matching the previous output. Templates can set a custom ValuesProvider, and nil-safe evaluation applies unless Strict is set. Claude-Session-Id: 9cbaec31-655b-4670-a331-adddc1c8c5d2
Go templates need to read struct fields using the same keys CEL exposes, so the lookup rules live in one place. Field follows encoding/json naming but keeps zero omitempty fields present, and returns false when a promoted field sits behind a nil embedded pointer. The README documents the template behavior. Claude-Session-Id: 9cbaec31-655b-4670-a331-adddc1c8c5d2
…stom values providers Document lazy environment access, nil-safe field and index semantics with the Strict option, and how to supply a custom ValuesProvider. Documentation only; no behaviour changes. Claude-Session-Id: 9cbaec31-655b-4670-a331-adddc1c8c5d2
Claude-Session-Id: 9cbaec31-655b-4670-a331-adddc1c8c5d2
…r iteration Serialize rewrites its input in place, so the benchmarks now build fresh input untimed each iteration to avoid timing a no-op walk on older bases. The new RunTemplate benchmark reuses one input so it measures lazy template reads, and the benchmark workflow runs it against base and head. Claude-Session-Id: 9cbaec31-655b-4670-a331-adddc1c8c5d2
What
Notes
aipeer, which blocks the playground production build