8000 fix(query): expression = / != equate a keyword with a ref to its entity (#744) — backport by adityamukho · Pull Request #749 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

fix(query): expression = / != equate a keyword with a ref to its entity (#744) — backport - #749

Merged
adityamukho merged 1 commit into
mainfrom
fix/744-expr-keyword-ref-main
Oct 24, 2026
Merged

adityamukho merged 1 commit into
mainfrom
fix/744-expr-keyword-ref-main

Conversation

@adityamukho
@adityamukho adityamukho commented Oct 24, 2026 •
Copy link
Copy Markdown
Collaborator

Backport of #748 (v3) for #744, a data-integrity issue under the support policy. #744 stays open until the v2.x patch with this fix is published.

Change

eval_binop (src/query/datalog/executor.rs) compares =/!= with expr_eq: structural equality, except that a keyword equals a ref to the entity edn_to_entity_id derives from it, as patterns and joins already compare them. With ?g bound to a ref to :bob's entity, [(= ?g :bob)] now keeps the row and [(!= ?g :bob)] drops it. Ordering comparisons on a keyword or a ref stay a type mismatch.

Tests

New tests/keyword_ref_expression_test.rs (4 tests): both operand orders, a keyword constant and value, !=, a binding expression, a bound Val(Ref), a rule body, not, an or branch, a UUID-named keyword; in memory, after a checkpoint and after reopen. They fail on main without the fix.

Full suite 1,325 passed (Windows CI hit the pre-existing flaky #750, passed on rerun) / 9 ignored; cargo fmt --check and cargo clippy --all-features -- -D warnings clean. CHANGELOG [Unreleased], docs/TEST_COVERAGE.md and the CLAUDE.md count updated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x

…ty (#744) — backport

Backport of the v3 fix. Patterns and joins treat a keyword as equal to a
ref to the entity it names; eval_binop compared the two Values as they
are, so [(= ?g :bob)] kept no row where [?x :ref/friend :bob] matched
one, and != kept it. Eq/Neq now use expr_eq: structural equality, except
that a keyword equals a ref to the entity edn_to_entity_id derives from
it. Ordering comparisons on keywords and refs stay a type mismatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x
@codecov
codecov Bot commented Oct 24, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit 0440705 into main Oct 24, 2026
20 of 21 checks passed
@adityamukho
adityamukho deleted the fix/744-expr-keyword-ref-main branch October 24, 2026 17:29
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

0