8000 fix(query): float constants match equal floats only (#706) by adityamukho · Pull Request #710 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

fix(query): float constants match equal floats only (#706) - #710

Merged
adityamukho merged 3 commits into
v3from
fix/706-float-exact-v3
Oct 23, 2026
Merged

adityamukho merged 3 commits into
v3from
fix/706-float-exact-v3

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Issue #706 (data-integrity; stays open until v2.0.10 is published).

Summary

A float constant in a pattern, whether written out or bound to a $slot, matched every stored float within an absolute f64::EPSILON. As a result, [?e :m/x 0.0] returned an entity whose value is 1e-17, while [(= ?v 0.0)] did not. Every site now compares with IEEE ==, as joins, predicates and the indexes already do:

  • executor: src/query/datalog/matcher.rs (patterns in queries, rule bodies, and not/or bodies)
  • engine: ValueConst::matches (plan.rs), and KeyTest::matches and cell_matches (scan.rs)

0.0 still matches -0.0. A float constant still reads the whole float kind of the AVET range before filtering, so both zeros are found.

Tests

  • join_rules_test: the old float_constant_keeps_epsilon_match is replaced by float_constant_matches_equal_floats_only (plus an _after_checkpoint variant: file, checkpoint, reopen). It covers a literal, -0.0, an = predicate, a rule body and a prepared $v bound to 0.0 and to 1e-17.
  • negation_equality_test: the body literal test now checks that 0.0 excludes 0.0 only, not 1e-17.
  • The full suite with --features test-oracle passes. cargo clippy --all-features -- -D warnings and cargo fmt --check are clean. Codex review found no issues.

CHANGELOG (Fixed), TEST_COVERAGE.md and the test count are synced. The docs-site PR and the main backport follow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WvnzWaNkVaLTTAMBM4jAaq

adityamukho and others added 2 commits October 23, 2026 11:42
A float constant in a pattern, written or bound with `$slot`, matched
every stored float within an absolute `f64::EPSILON`, so `0.0` matched
`1e-17` while `[(= ?v 0.0)]` did not. Compare with IEEE `==` in the
executor's matcher and in the engine's plan and scan, as joins and
predicates already do: `0.0` matches `-0.0`, nothing else changes.

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

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

A rule call's float argument reaches the derived-cell match in the
engine's scan, which no test covered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WvnzWaNkVaLTTAMBM4jAaq
@adityamukho
adityamukho merged commit 3327315 into v3 Oct 23, 2026
24 of 25 checks passed
@adityamukho
adityamukho deleted the fix/706-float-exact-v3 branch October 23, 2026 06:39
adityamukho added a commit that referenced this pull request Oct 23, 2026
Each PR raised the count from 1,771 to 1,772; merged together they add two.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169pNQsLcCEn48te9X9WuZW
adityamukho added a commit that referenced this pull request Oct 23, 2026
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