WarUI

Canonical form and stable query hash

GRID-A05-F12P1beyond-baselinePlanned

Defines a canonicalization pass (sorted 'in' lists, flattened nested ands, collapsed single-child groups, explicit defaults) and a stable hash of the result. Semantically identical queries then share cache keys and compare equal.

Planned. This page shows the specification from issue #182. The live example, source for every framework and the API reference replace it when the feature ships.

Live example

Two side-by-side builders, each with a different but equivalent query, and their hashes shown below.

Expected behavior

With canonicalization on, both hashes match and shuffling does not change them. With it off, the hashes differ.

Planned API surface

canonicalize()queryHash()isEquivalent()hashAlgorithm

Acceptance criteria

  • canonicalize is idempotent (pending)
  • The hash is identical across JS and .NET reference implementations for shared fixtures (pending)
  • Sort order is never reordered by canonicalization because it is significant (pending)
  • Canonicalization never changes query results (verified by evaluator tests) (pending)