Skip to content

fix(core): strengthen verify() invariants - #37

Merged
nikbott merged 1 commit into
devfrom
fix/verify-invariants
Aug 14, 2026
Merged

nikbott merged 1 commit into
devfrom
fix/verify-invariants

Conversation

@nikbott

@nikbott nikbott commented Aug 14, 2026

Copy link
Copy Markdown
Owner

From the parallel adversarial audit (agent 1, core). verify() checked sortedness + non-overlap + volume-sum==1, but a misaligned or out-of-domain leaf set can satisfy all three (sorted, disjoint, summing to 1) while lying off-grid — so the oracle the whole test suite trusts would accept a malformed tree. Adds per-leaf checks: level in [0, max_level], code aligned to its level (low DIM*(max_level-lvl) bits zero), and code inside the domain. Not reachable via refine/coarsen (they preserve these), so this strengthens the test oracle rather than fixing an active bug. All 19 omp cases still pass (no false positives); clang-format + pre-commit clean.

verify() checked sortedness, non-overlap, and volume-sum == 1, but a leaf set
that is misaligned or extends past the domain can satisfy all three (sorted,
disjoint, summing to 1) while lying off-grid. Add per-leaf checks that the level
is in range, the code is aligned to its level (low DIM*(max_level-lvl) bits
zero), and the code is inside the domain, so the oracle the tests rely on
actually rejects those states.
@nikbott
nikbott merged commit 6af0113 into dev Aug 14, 2026
9 checks passed
@nikbott
nikbott deleted the fix/verify-invariants branch August 14, 2026 14:07
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