Ultimate

X_INDEX_ORDER_UNGUARDED

Means

an ordering assertion built on indexOf with nothing asserting the needle is present

Typical cause

indexOf answers -1 for a needle it never found, and -1 is less than every real index — so the assertion holds when the thing it orders is not emitted at all. Measured 2026-08-26: deleting a drop constraint emission from moveKeysAside left packages/db/src/retype-keys.test.ts GREEN, and a sweep then found 24 more across 11 packages. Which operand is at risk is not symmetric and that is the whole rule — X.toBeLessThan(Y) is passed by a phantom -1 in X, X.toBeGreaterThan(Y) by one in Y; a -1 on the safe side fails loudly and is never reported

Fix

bun run index-of-order --json — assert presence first (expect(<haystack>).toContain(<needle>), or expect(<index>).toBeGreaterThanOrEqual(0)), then compare. Prove it by deleting what the assertion orders and watching the test go red

Listed under CLI and verify

This page as markdown