Skip to content

fix(bkn): align LIKE validation and Cypher CONTAINS pushdown with Vega SQL LIKE #3079

Open

Description

@kenlee1988

Description

Adapt BKN structured like / not_like handling and Cypher string-predicate pushdown to Vega's complete SQL LIKE pattern contract from #3018 and #3074.

Vega now treats foo as a complete pattern and %foo% as containment. BKN still validates LIKE inputs as literal substrings and rejects an unescaped %; its Cypher adapter lowers CONTAINS 'foo' to like: "foo" without surrounding wildcards. When paired with the new Vega implementation, containment silently becomes an exact match. BKN local evaluation and Vega pushdown can therefore disagree.

This is the independent BKN follow-up explicitly split from #3018. Its completion is a prerequisite for rolling out the new Vega LIKE contract to BKN consumers; creating this issue does not resolve that compatibility risk.

Steps to reproduce

  1. Bind an existing Table string field to a BKN object property, with values foo, prefixfoo, foosuffix, and prefixfoosuffix.
  2. Use Vega with the SQL LIKE behavior in feat(vega): add connector-aware field filterability #3074 and the current BKN adapter.
  3. Execute a Cypher predicate such as MATCH (n:Person) WHERE n.name CONTAINS 'foo' RETURN n with Vega filter pushdown enabled.
  4. Inspect the outgoing condition: it is like with value foo. Vega matches only the complete value instead of all four values.
  5. Submit a BKN structured LIKE condition with %foo%; the old BKN literal-substring validator rejects the wildcard before it reaches Vega.

Expected behavior

  • BKN structured like / not_like share Vega's complete SQL LIKE contract: % matches any string, _ matches one character, backslash escapes the following character, and an incomplete trailing escape is rejected. foo is not automatically wrapped as %foo%.
  • Cypher CONTAINS retains literal-substring semantics, including literal %, _, backslash, quotes, and Unicode. Lowering it must produce an equivalent Vega condition rather than forwarding the literal as a complete LIKE pattern. The implementation may use correctly escaped SQL LIKE patterns or an equivalent supported operator without changing the public Cypher meaning.
  • Pushdown and local execution agree, including negation and NULL/missing-value behavior.

Actual behavior

  • adp/bkn/bkn-backend/server/common/condition/condition_like.go still implements the old literal-substring contract and rejects bare %.
  • adp/bkn/bkn-backend/server/logics/cypher/filter_dsl.go lowers CONTAINS to like, and its escaper neither adds containment wildcards nor handles underscore as a LIKE metacharacter.
  • Upgrading Vega alone can silently narrow BKN query results.

Environment

  • OS: platform-independent backend query translation.
  • Browser: not applicable.
  • Version: Vega behavior in Foundry PR feat(vega): add connector-aware field filterability #3074, reviewed at commit 4a1a52113a609bfa379432e73ae53ecb1f7eaf82; BKN consumer code in that same tree. This report is based on code-path verification, not live-service acceptance.

Acceptance Criteria (Definition of Done)

  • Audit BKN object-query validation, local SQL/DSL evaluation, Vega forwarding, and Cypher lowering so structured LIKE uses one complete-pattern contract.
  • foo, %foo%, foo%, %foo, _, escaped % / _ / backslash, empty text, Unicode, and dangling-escape cases have focused regression coverage.
  • Cypher CONTAINS and its negation preserve literal meaning and agree between pushed and local execution, including values containing LIKE or regex metacharacters and NULL/missing values.
  • Existing STARTS WITH, ENDS WITH, regex, and unrelated predicates retain their intended behavior; no condition is silently dropped.
  • Tests verify the actual generated Vega condition and exercise the paired Vega SQL LIKE conversion, with source and managed-index routes covered where supported.
  • Document the behavior of existing saved LIKE conditions and caller inputs, the required BKN/Vega version pairing, and coordinated rollout guidance. Do not silently rewrite persisted conditions.
  • Relevant BKN and Vega checks and remote CI pass, with real-service acceptance recorded separately.

Boundaries / Risk

  • Keep Vega's SQL LIKE contract; do not restore literal-substring semantics or add legacy/trusted execution flags to Vega.
  • This issue owns BKN adaptation. Vega field filterability, IP activation, new query operators, and unrelated Cypher optimizations are outside scope.
  • No deployment or production-data rewrite is authorized by this issue. Any proposed migration must describe affected data and rollback and obtain the existing required approval.
  • Complete this follow-up before a coordinated release enables the new Vega behavior for BKN callers.

Additional context

Activity

  1. added
    bugSomething isn't working
    by-agentIssue or pull request produced by an agent
    on Nov 11, 2026
  2. rongwei-liu commented on Nov 12, 2026

    @rongwei-liu
    Collaborator

    Development tracking

    Item Value
    Branch fix/3079-bkn-like
    Status In Review
    Foundry PR #3122
    Paired Studio PR openbkn-ai/bkn-studio#1322

    The implementation and local tests are complete. The rollout still requires reviewing saved bare like patterns and deploying compatible BKN, Vega, and Studio versions together. No test environment was modified.

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

Metadata

Metadata

Labels

bknbugSomething isn't workingby-agentIssue or pull request produced by an agent

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions