Skip to content

Numeric subtype leniency holds on novelty but not once indexed — the same constant-object query answers differently across an index publish #1737

Closed

Description

@aaj3f

The numeric leniency this engine deliberately provides — 1 ≡ "1"^^xsd:long ≡ 1.0 — holds on a novelty-only ledger and stops holding once the data is indexed. Same query, same data, different answer either side of an index publish.

Observed

With ?s ex:age 25 written as xsd:integer, "25"^^xsd:long, and 25.0:

  • novelty-only ledger — a constant-object query ?s ex:age 25 matches all three.
  • after indexing — it matches only the xsd:integer row.

The bound-object seek encodes the constant 25 as XSD_INTEGER and seeks that exact key, so the other subtypes are never visited.

Why it matters more than a normal lane divergence

The leniency is not incidental — it's pinned as a product decision by it_literal_identity.rs:189 bare_numeric_literals_stay_lenient_across_subtypes, and it's the reason #1723 was fixed by gating the sameTerm fold rather than by making the join key term-exact (see #1723's discussion: "the join is deliberately lenient across numeric subtypes … rooted in the index's normalized numeric key").

So the engine has a documented behaviour that only one of its two read lanes actually implements. Whichever way this is resolved, the two lanes should agree — and the answer determines whether the reasoning that closed #1723 rests on solid ground.

The pinning test only ever exercised novelty, which is why nothing caught it. That's worth fixing regardless of the outcome: a test that pins a product decision on one lane while the other silently disagrees is the shape this repo keeps getting caught by.

Notes

  • Measured before and after fix(query): keep every string-dictionary datatype's own term identity #1736 (fix/string-dict-datatype-identity) and identical in both — that PR fixes the string-dictionary half of the datatype-identity story and deliberately leaves numerics alone, so this is neither caused nor fixed by it.
  • The two candidate resolutions pull in opposite directions: make the indexed seek visit the other numeric subtypes (preserving the documented leniency, at some seek cost), or make novelty strict (simplifying the model, but reversing a decision that's currently pinned and relied upon). This wants a product call before code.
  • Per the surface-parity rule, whatever lands needs the JSON-LD twin.
  • Whichever way it goes, extend bare_numeric_literals_stay_lenient_across_subtypes to run on both lanes so this can't recur.

Found while fixing #1729; deliberately not folded into that PR, which is scoped to the string-dictionary lane.

Activity

  1. added
    bug
    P2
    triage:needs-decision
    area:query
    on Aug 28, 2026
  2. removed
    triage:needs-decision
    on Sep 29, 2026
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

    P2area:querybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions