Skip to content

fix(query): preserve bound constraints in same-entity plans - #47

Merged
tiensonqin merged 1 commit into
mainfrom
fix/same-entity-bound-constraints-20261104
Nov 4, 2026
Merged

tiensonqin merged 1 commit into
mainfrom
fix/same-entity-bound-constraints-20261104

Conversation

@tiensonqin

Copy link
Copy Markdown
Contributor

Summary

Reject the same-entity relation fast path whenever a positive pattern contains a value term the plan cannot enforce. Previously, binding a singleton Arg_collection [Result_entity 200] replaced ?t with QEntity 200, which this plan silently discarded. A query such as [:where [?b :block/tags ?t] [?b :block/uuid]] consequently returned untagged entities as well as matching entities. Declining that plan preserves the constraints through the existing evaluator; no public API or worker-specific filtering changes.

Add one public q_string table regression covering matching, absent, multiple, ref-value, and empty collection inputs.

Validation

  • Confirmed native and Melange red → green on the exact production baseline 7acb4e8c324f9aee81e9feb936da75b49ee4c0ab using this same patch.
  • Native test_query_engine_fixes, test_query_bound_constants, and existing test_perf pass on current main; the query regression suite also passes when compiled with Melange.
  • Upstream DataScript 1.8.1 returns the expected matching IDs for the equivalent queries.
  • Full local dune runtest is blocked during upstream fixture compilation by Maven Central HTTP 429, including a retry against its alternate official domain. Optional @all additionally requires the unavailable lg.edn-backend library. No test gates or expectations were weakened; CI must finish full cross-runtime validation.

A production-baseline-only release of the identical patch is available at 0dd20de9c2640924dcc261cc20dfc3eeb68b9b33, avoiding unrelated main changes. This PR itself contains only the fix and its regression relative to main.

Link to Devin session: https://app.devin.ai/sessions/0deab4d81eb24545b9d705374171afc1
Open in Devin Desktop: https://app.devin.ai/desktop/session/0deab4d81eb24545b9d705374171afc1?variant=devin
Requested by: @tiensonqin

@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@tiensonqin
tiensonqin merged commit 9f2e87f into main Nov 4, 2026
2 checks passed
@tiensonqin
tiensonqin deleted the fix/same-entity-bound-constraints-20261104 branch November 4, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant