Skip to content

Rust cannot query an EQL v4 type through the typed query chain: no EQL type implements op::Answers #1238

Open

Description

@coderdan

Background

Stack Encrypt (Rust) can store a field as an EQL v4 type, such as TextEq or TextMatch. The types are generated into eql_bindings::v4. A query names an operator, for example cipher.query(op::Eq, v).on(&plan) (ADR-0009), and on a plan built for a target type, the type says which operators it answers through an Answers impl.

Problem

No EQL type has an Answers impl. Neither eql-bindings nor stack-encrypt implements op::Answers for any eql_bindings::v4 type. The typed query on a target plan requires one (T: Answers<Op, In>, packages/stack-encrypt/src/plan/chain.rs:750). So in Rust:

  • cipher.query(op::Eq, "bob@example.com").on(&plan) on a plan targeting TextEq does not compile;
  • nor does op::Matches on TextMatch, so there is no typed MatchQuery with verify and target_limit for it.

Rust callers can query EQL types only through data plans (dynamic). The Go SDK, by contrast, gets a generated method per operator the engine answers, including Matches with Verify on TextMatch (#1216). The two SDKs disagree on what an EQL v4 field can do, and nothing tests the typed Rust path against EQL types.

Proposal

  1. Have eql-codegen emit op::Answers impls for each producible v4 type, from the same table that gives the data path its operators: Eq on the equality types, Matches on TextMatch (with the type's match options), and the orderings on the ordered types as they become producible.
  2. The query term is the type's query twin (for example TextEqQuery, TextMatchQuery). For Matches, a probabilistic query carries verify and target_limit under the type's options, as the data path's does.
  3. Tests: the typed query on a target plan gives the same bytes as the data path's query_term for the same field. Add a compile-fail test for an operator a type does not answer.

Relationship to other work

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    SDKenhancementNew feature or requestrustPull requests that update Rust code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions