Skip to content

docs(eql): say the JSON GIN index does not serve col <@ needle, and name the v4 ORE operator class - #1969

Open
auxesis wants to merge 2 commits into
nextfrom
docs/eql-v4-index-docs
Open

auxesis wants to merge 2 commits into
nextfrom
docs/eql-v4-index-docs

Conversation

@auxesis

@auxesis auxesis commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two sentences in the EQL v4 reference docs were wrong, and a user who followed either got an unexpected result with no error. EQL (Encrypt Query Language) is the SQL library CipherStash installs into PostgreSQL; version 4 installs the eql_v4 schema the Go SDK uses. The errors were found in #1931, while writing the Go SDK's index guide.

  1. The JSON tree page said a GIN index on eql_v4.json_tree_query(col) with jsonb_path_ops serves both containment operators. It serves col @> $1. It also serves $1 <@ col, the same test written the other way round. It does not serve col <@ $1: that query reads every row.
  2. The between notes named the ORE btree operator class eql_v4_internal.ore_block_256. The v4 bundle installs it as eql_v4_internal.ore_block_v2_operator_class.

Changes

  • packages/eql/docs/reference/json-tree.md: say which containment forms the GIN index serves, and that col <@ $1 reads every row, with the reason.
  • packages/eql/docs/reference/eql-functions.md: name the v4 operator class correctly. The rest of that bullet is split into shorter sentences; its meaning is unchanged.

Verification

  • Source. The operator class is created at packages/eql/src/v3/sem/ore_block_256/operator_class.sql:31 as {{prefix}}_internal.{{ore_block}}_operator_class. The renderer sets {{ore_block}} to ore_block_v2 for v4 (packages/eql/crates/eql-codegen/src/render.rs:159). col <@ needle is defined at packages/eql/src/v3/json_tree/operators.sql:110 and calls json_tree_contained_by, whose body is (b::jsonb - 'alt') @> json_tree_query(a) (packages/eql/src/v3/json_tree/functions.sql:438-443): the projection is on the right of @>. needle <@ col (operators.sql:128) calls json_tree_contains(b, a), the same body as col @> needle.
  • PostgreSQL 17, v4 bundle built from this branch, no credentials. pg_opclass lists eql_v4_internal.ore_block_v2_operator_class and no ore_block_256 class. With enable_seqscan = off and EXPLAIN (GENERIC_PLAN): profile @> $1 and $1 <@ profile use a bitmap index scan on the jsonb_path_ops index; profile <@ $1 is a sequential scan, with the filter (($1)::jsonb - 'alt') @> eql_v4.json_tree_query(profile). A jsonb_ops GIN index on the same expression is not used for profile <@ $1 either.
  • Other pages. No other eql_v4 page names ore_block_256 for v4, or says the GIN index serves <@. The eql_v3 pages that name ore_block_256 are correct for v3. They are unchanged.
  • Doc checks, from packages/eql: tasks/test/doc-anchors.sh passed (142 links resolve). tasks/test/docs_v3_grep.sh passed (17 files). I ran both scripts directly because mise run failed to install sqlx-cli on this machine.
  • No changeset. Earlier docs-only EQL changes carried none. Two examples are 86edfb6c3 and 19b8ea1e1.

Related

Closes #1968

#1968

Part of #1906.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CtEQzxj55RUn35dkbhdwQk

Summary by CodeRabbit

  • Documentation
    • Clarified the required operator class for EQL v4 ORE range scans, availability limits for installs without superuser privileges, and the OPE fallback.
    • Updated JSON-tree containment index guidance to distinguish which query directions can use a GIN index and which require scanning all rows.

…ame the v4 ORE operator class

The v4 JSON tree page said a GIN index with jsonb_path_ops on
eql_v4.json_tree_query(col) serves both containment operators. In
PostgreSQL 17 with the v4 bundle, `col @> $1` and `$1 <@ col` use the
index, because both inline to jsonb @> with the projection on the left.
`col <@ $1` inlines to `$1 @> json_tree_query(col)`, with the projection
on the right, and no jsonb GIN operator class serves that, so the query
reads every row. The page now says so.

The between notes named the ORE btree operator class
eql_v4_internal.ore_block_256. The v4 bundle renders the class as
eql_v4_internal.ore_block_v2_operator_class, so a user who checks
pg_opclass for the old name does not find it.

Refs #1968

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CtEQzxj55RUn35dkbhdwQk
@auxesis auxesis added bug Something isn't working documentation Improvements or additions to documentation EQL labels Nov 27, 2026
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI; Enforced overrides: Organization
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1860b411-af17-46bf-8fbf-7510d0ecbfe6

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

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The EQL reference documentation names the v4 ORE operator class and clarifies which JSON containment operators use the documented GIN index. It also states that the unsupported query form reads every row.

Changes: EQL reference documentation

Layer / File(s) Summary
Document the ORE operator class
packages/eql/docs/reference/eql-functions.md
The ORE range-query documentation replaces ore_block_256 with ore_block_v2_operator_class. Existing notes on install requirements, disabled domains, cast errors, and the OPE fallback remain.
Clarify JSON index coverage
packages/eql/docs/reference/json-tree.md
The documentation states that the GIN index serves profile @> $1 and $1 <@ profile, but not profile <@ $1. It explains that the latter reads every row.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other · Severity of issue fixed: Low

Suggested reviewers: coderdan

Merge Risk: Minimal · previous review 737d6

This change corrects two statements in the EQL reference docs and does not alter runtime behavior. No merge-blocking risk remains.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Out of Scope Changes check Inconclusive The core edits are in scope. The operator class rename in eql-functions.md and the json-tree.md containment correction both implement #1968. Two points remain unverified. First, the text diff could no… Provide the text diff of packages/eql/docs/reference/eql-functions.md and json-tree.md between the merge base f7166c3 and head 737d682, or readable base blobs for these files. With that diff, confirm whether the superuser and feature_not_…
Passed Passed checks: 3 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two concrete changes in the docs: the JSON GIN index does not serve col <@ $1, and the v4 ORE operator class is renamed. The raw summary confirms both changes in json-tree.md and…
Linked Issues check Passed Issue #1968 asks for two corrections in the EQL v4 reference docs. (1) json-tree.md: the GIN index with jsonb_path_ops serves containment forms only as the PR describes (col @> $1 and $1 <@ col), and …
Full details: Title check

Explanation

The title names the two concrete changes in the docs: the JSON GIN index does not serve col &lt;@ $1, and the v4 ORE operator class is renamed. The raw summary confirms both changes in json-tree.md and eql-functions.md. The title is specific and matches the main content, though it is long (98 characters).

Full details: Linked Issues check

Explanation

Issue #1968 asks for two corrections in the EQL v4 reference docs. (1) json-tree.md: the GIN index with jsonb_path_ops serves containment forms only as the PR describes (col @> $1 and $1 <@ col), and col <@ $1 reads every row. The PR reports PostgreSQL 17 EXPLAIN results from a v4 bundle built from this branch that match this. The raw summary of json-tree.md at head describes the same change. (2) eql-functions.md: the ORE btree operator class is named eql_v4_internal.ore_block_v2_operator_class. The head file confirms this name in the 'Range queries in EQL v4' section. The PR also reports checking other eql_v4 pages for ore_block_256 and finding none. Limits: the json-tree.md head text was not read directly, and the cited source line numbers were not checked. The issue's requirements are documentation corrections, so no runtime code requirement applies.

Full details: Out of Scope Changes check

Explanation

The core edits are in scope. The operator class rename in eql-functions.md and the json-tree.md containment correction both implement #1968. Two points remain unverified. First, the text diff could not be read: the repository inspection reported that changed blobs are missing from the checkout, and reading the base revision of eql-functions.md failed. Second, the eql-functions.md head text includes a sentence on superuser installs, which skip the ore_block_v2_operator_class and disable ORE domains, plus feature_not_supported and the OPE alternatives. The PR says the bullet was only split and its meaning is unchanged. The raw summary calls this a clarification, so the sentence may be new text. Its topic is close to the ORE class named in #1968, so it may be related scope, but this cannot be confirmed without the base text.

Resolution

Provide the text diff of packages/eql/docs/reference/eql-functions.md and json-tree.md between the merge base f7166c3 and head 737d682, or readable base blobs for these files. With that diff, confirm whether the superuser and feature_not_supported sentences are new. If they are new, state why they belong to #1968, or move them to a separate change.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI; Enforced overrides: Organization
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0cc7b361-eb48-4208-93b4-d19abae875c9
Commits

Reviewing files that changed from the base of the PR and between f7166c3 and 737d682.

Files selected for processing: 2

  • packages/eql/docs/reference/eql-functions.md
  • packages/eql/docs/reference/json-tree.md

Limit details: You’ve used all 2 included reviews currently available.

@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9adcb0f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@auxesis
auxesis marked this pull request as ready for review November 27, 2026 05:18
@auxesis
auxesis requested a review from a team as a code owner November 27, 2026 05:18
@auxesis

auxesis commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@auxesis
auxesis requested a review from coderdan November 27, 2026 05:19

@cipherstash-agent cipherstash-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review attestation

Reviewed 737d682e · posted from Claude Code · claude-opus-5-5 · effort medium
Sources: code-review · claude-opus-5-5; mattpocock-skills:code-review · claude-opus-5-5
Skills: code-review, mattpocock-skills:code-review, company-skills:rust-security (no Rust in the diff, nothing to apply), company-skills:review-cross-check

Findings (3): 3 minor — 3 inline.

Both corrections hold against source: the v4 class renders as eql_v4_internal.ore_block_v2_operator_class (src/v3/sem/ore_block_256/operator_class.sql:31, crates/eql-codegen/src/render.rs), and col <@ q puts the projection on the right of @> (src/v3/json_tree/functions.sql, json_tree_contained_by). No changeset is needed: docs/ is not in the @cipherstash/eql tarball (files: ["dist", "README.md"]).


Generated by Claude Code

… note

Write every containment operand in the new json-tree prose with its
eql_v4.query_json cast, as the page's own rule requires, and show the
index-served $1 <@ col form in the example block. An untyped $1 would
resolve to another <@ overload and miss the index.

Say that Supabase-like platforms, whose install role cannot create an
operator class, skip the ORE class. RDS and Aurora can create it.

Refs #1968

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CtEQzxj55RUn35dkbhdwQk

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation EQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EQL v4 docs: the JSON GIN index does not serve <@, and the ORE operator class has a new name

2 participants