docs: Add 'ancestors' field to CEL playground#820
Conversation
📝 WalkthroughWalkthroughThe changes extend CEL Playground with v2-only and dynamic variable metadata support, introduce a new "ancestors" list variable with field introspection capabilities, enhance autocompletion to handle bracket indexing and comprehension patterns, and refactor v2/v1 feature detection from static constant lists to data-driven approaches. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/src/components/CELPlayground/autocompletion.ts (1)
1010-1028: Comprehension detection works but has a minor limitation.The comprehension regex
/([\w]+)\.(?:all|exists|...)only matches single-word list names, not dotted paths likefoo.bar.filter(x, x.). This is fine forancestorsand other top-level list variables in the current schema, but worth noting if nested list variables are added later.🔧 Optional: Support dotted list paths in comprehension detection
const comprehensionMatch = textUntilPosition.match( - /([\w]+)\.(?:all|exists|exists_one|filter|map|sortBy)\(\s*(\w+)\s*,/, + /([\w]+(?:\.[\w]+)*)\.(?:all|exists|exists_one|filter|map|sortBy)\(\s*(\w+)\s*,/, );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/src/components/CELPlayground/autocompletion.ts` around lines 1010 - 1028, The comprehension detection regex in the block using textUntilPosition, varPath and comprehensionMatch only matches single-word list names and fails for dotted paths like "foo.bar.filter"; update the regex used in the comprehensionMatch check to allow dotted identifiers (e.g. permit sequences of \w separated by dots) and adjust extraction so listName corresponds to the full dotted path before looking it up in listItemFields (or normalize listItemFields keys accordingly); ensure the rest of the logic (itemFields lookup, itemFieldCompletions creation) in this function remains unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/src/components/CELPlayground/autocompletion.ts`:
- Around line 1010-1028: The comprehension detection regex in the block using
textUntilPosition, varPath and comprehensionMatch only matches single-word list
names and fails for dotted paths like "foo.bar.filter"; update the regex used in
the comprehensionMatch check to allow dotted identifiers (e.g. permit sequences
of \w separated by dots) and adjust extraction so listName corresponds to the
full dotted path before looking it up in listItemFields (or normalize
listItemFields keys accordingly); ensure the rest of the logic (itemFields
lookup, itemFieldCompletions creation) in this function remains unchanged.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
docs/src/components/CELPlayground/autocompletion.tsdocs/src/components/CELPlayground/constants.tsdocs/src/components/CELPlayground/eslogger.test.tsdocs/src/components/CELPlayground/eslogger.tsdocs/src/components/CELPlayground/eval.test.tsdocs/src/components/CELPlayground/eval.ts
No description provided.