Skip to content

fix(adr-025): inclusive acceptance (≤ τ) makes the LOD formula exact at the boundary#46

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/fix-adr025-boundary-case
Jun 9, 2026
Merged

fix(adr-025): inclusive acceptance (≤ τ) makes the LOD formula exact at the boundary#46
AdaWorldAPI merged 1 commit into
mainfrom
claude/fix-adr025-boundary-case

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Summary

Closes Codex P2 on PR #45 (now merged). Fresh PR rebased on current main (includes #45).

The edge case

ADR-025 §2 derived the level formula from a strict acceptance predicted_error_L < τ but stated the result as r* = ⌈2·log_b(C/τ)⌉. These disagree at the exact-power boundary C/τ = b^k:

  • strict < needs ⌊2·log_b(C/τ)⌋ + 1 = 2k + 1
  • the doc wrote ⌈2·log_b(C/τ)⌉ = 2k

At r* = 2k the predicted error is C·b^{-k} = τ exactly — equal to tolerance, not strictly below. So the ⌈⌉ formula selects one level too shallow at that boundary.

The fix

Change the acceptance to inclusive (≤ τ — error within tolerance), which is also Cesium SSE's own convention (sse ≤ maximumScreenSpaceError, already referenced by crates/cesium/src/sse.rs):

C·b^{-r/2} ≤ τ  ⟹  b^{r/2} ≥ C/τ  ⟹  r ≥ 2·log_b(C/τ)
⟹ r* = ⌈2·log_b(C/τ)⌉                                (now exact)

At C/τ = b^k: r* = 2k, predicted_error = τ, accepted by . The ⌈⌉ formula is the smallest integer r ≥ 2·log_b(C/τ), exactly right under inclusive acceptance.

For deployments needing strictly below tolerance, the doc now gives the alternative explicitly: r* = ⌊2·log_b(C/τ)⌋ + 1 (one level deeper at the boundary).

The decision diagram's predicted_error_L < tolerance≤ tolerance for consistency.

Review (numerically verified)

C/τ = b^k (b=16) inclusive r*=2k → err/τ strict r*=2k+1 → err/τ
k=2 (256) 4 → 1.0000 (accepted by ≤) 5 → 0.2500
k=3 (4096) 6 → 1.0000 7 → 0.2500
k=5 (1.05e6) 10 → 1.0000 11 → 0.2500

The canonical anchor r* = ⌈log₄(C/τ)⌉ (the b=16 reduction) and the "5-12 hop" range are unchanged — this only tightens the acceptance predicate so the existing ⌈⌉ is exact rather than off-by-one at powers of b.

PII abort-guard (word-boundary): CLEAN. cargo check: clean (docs-only).

https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY

…ct at the boundary

Closes Codex P2 on PR #45 (now merged).

# The edge case

ADR-025 §2 derived the level formula from a STRICT acceptance
`predicted_error_L < τ`, but stated the result as
`r* = ⌈2·log_b(C/τ)⌉`. Those disagree at the exact-power boundary
`C/τ = b^k`:

  - strict `<` requires the smallest integer strictly greater than
    2·log_b(C/τ), i.e. ⌊2·log_b(C/τ)⌋ + 1 = 2k + 1
  - the doc wrote ⌈2·log_b(C/τ)⌉ = ⌈2k⌉ = 2k

At r* = 2k the predicted error is C·b^{-k} = τ exactly — equal to
tolerance, not strictly below. So as written the ⌈⌉ formula selects
one level too shallow at that boundary (Codex's flag).

# The fix

Change the acceptance to INCLUSIVE (`≤ τ` — error within tolerance),
which is also Cesium SSE's own convention (`sse ≤
maximumScreenSpaceError`, already referenced by crates/cesium/src/
sse.rs). Then:

  C·b^{-r/2} ≤ τ  ⟹  b^{r/2} ≥ C/τ  ⟹  r ≥ 2·log_b(C/τ)
  ⟹ r* = ⌈2·log_b(C/τ)⌉                                  (now exact)

At the boundary C/τ = b^k: r* = 2k, predicted_error = τ, accepted by
≤. The ⌈⌉ formula is the smallest integer r ≥ 2·log_b(C/τ), exactly
right under inclusive acceptance.

For a deployment that needs STRICTLY below tolerance, the doc now
gives the alternative explicitly: r* = ⌊2·log_b(C/τ)⌋ + 1 (one level
deeper at the boundary).

# Also updated

The decision diagram's "smallest L where predicted_error_L < tolerance"
→ "≤ tolerance" for consistency.

# Review (numerically verified)

  C/tau = b^k (b=16):
    inclusive r* = 2k  -> err/tau = 1.0000  (accepted by ≤)
    strict   r* = 2k+1 -> err/tau = 0.2500  (< 1.0)
  Consistent at k ∈ {2,3,5}.

Canonical anchor r* = ⌈log₄(C/τ)⌉ (the b=16 reduction) and the
"5-12 hop" range are unchanged — this only tightens the acceptance
predicate so the existing ⌈⌉ is exact rather than off-by-one at
powers of b.

PII abort-guard (word-boundary): CLEAN. cargo check: clean (docs-only).

https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY
@AdaWorldAPI AdaWorldAPI merged commit eeb4527 into main Jun 9, 2026
1 check passed
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.

2 participants