Skip to content

docs: Add 'ancestors' field to CEL playground#820

Merged
russellhancox merged 1 commit intomainfrom
rah/ancestors-in-cel-playground
Feb 26, 2026
Merged

docs: Add 'ancestors' field to CEL playground#820
russellhancox merged 1 commit intomainfrom
rah/ancestors-in-cel-playground

Conversation

@russellhancox
Copy link
Member

No description provided.

@russellhancox russellhancox requested a review from a team as a code owner February 26, 2026 21:33
@github-actions github-actions bot added docs Improvements or additions to documentation size/m Size: medium labels Feb 26, 2026
Copy link
Member

@pmarkowsky pmarkowsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Autocompletion Enhancement
docs/src/components/CELPlayground/autocompletion.ts
Extended CELCompletionItem and CELVariable interfaces with v2Only, dynamic, and itemFields flags; enhanced dot-path regex to support bracket indexing; added comprehension-aware completion logic to detect patterns like ancestors.filter(a, a.) and provide item field completions.
Variable & Constant Metadata
docs/src/components/CELPlayground/constants.ts
Added dynamic: true metadata to envs, args, euid, cwd; introduced new ancestors variable with v2Only: true and itemFields describing signing_id, team_id, path, cdhash; removed exports for DYNAMIC_FIELDS, V2_ONLY_FUNCTIONS, FUNCTIONS, CONSTANT_NAMES, V2_ONLY_CONSTANTS.
Feature Detection & Evaluation
docs/src/components/CELPlayground/eval.ts, eval.test.ts
Refactored v2/v1 feature detection to use data-driven checks via VARIABLES instead of static guards; extended analysis to detect v2-only variables and workshop functions; added DEFAULT_YAML export with ancestors block; registered ancestors as a new environment variable; includes test verifying ancestors-based expressions are correctly identified as v2 expressions.
Output Generation
docs/src/components/CELPlayground/eslogger.ts, eslogger.test.ts
Added context.ancestors to eslogger output with fake ancestor object containing signing_id, team_id, path, and cdhash; updated output note to reflect fake signing times and ancestors; includes test asserting ancestors array structure in conversion result.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • docs: Add CEL Playground #769: Extends the same CEL Playground codebase with v2/ancestors/list-field support and feature detection refactoring using data-driven approaches.
🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to evaluate relatedness to the changeset. Add a description explaining the purpose and scope of adding the ancestors field to the CEL playground.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding an 'ancestors' field to the CEL playground documentation component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rah/ancestors-in-cel-playground

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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 like foo.bar.filter(x, x.). This is fine for ancestors and 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.

📥 Commits

Reviewing files that changed from the base of the PR and between a345be9 and 6d2eea9.

📒 Files selected for processing (6)
  • docs/src/components/CELPlayground/autocompletion.ts
  • docs/src/components/CELPlayground/constants.ts
  • docs/src/components/CELPlayground/eslogger.test.ts
  • docs/src/components/CELPlayground/eslogger.ts
  • docs/src/components/CELPlayground/eval.test.ts
  • docs/src/components/CELPlayground/eval.ts

@russellhancox russellhancox merged commit 0afb3e9 into main Feb 26, 2026
3 checks passed
@russellhancox russellhancox deleted the rah/ancestors-in-cel-playground branch February 26, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation size/m Size: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants