Skip to content

docs(tasks): file the check character overflowing a 32-bit sum - #1

Merged
adammharris merged 1 commit into
masterfrom
agent/backlog-check-char-overflows-on-32-bit
Oct 29, 2026
Merged

adammharris merged 1 commit into
masterfrom
agent/backlog-check-char-overflows-on-32-bit

Conversation

@adammharris

Copy link
Copy Markdown
Member

What

Files moid's first task, docs/tasks/check-char-overflows-a-32-bit-sum.md, and the docs/tasks/tasks.md index for it. The index follows the shape fig-css's uses. No code changes.

Why

Alphabet::check_char adds ordinal × position into a usize and reduces modulo the radix only at the end. On wasm32, usize is 32 bits. Over noid_xdigit, a body made entirely of the last symbol passes u32::MAX at about 17,500 symbols, and over a 255-symbol alphabet at about 5,800. moid-ts's checkChar takes the remainder at every step for exactly this reason, so at those lengths the two implementations disagree.

Reproduced with a scratch binary built for wasm32-wasip1 and run under Node's node:wasi, using a 20,000-symbol body:

  • x86_64: 'f', the same as the step-by-step reduction.
  • wasm32 debug: panics with an add overflow at moid/src/alphabet.rs:123.
  • wasm32 release: 'w'.

At 17,000 symbols all three give '8'.

The fix itself (reduce as it goes) is left to the task. The task's done-when also says the pinning test has to be run on a 32-bit target, because on x86_64 it passes either way.

Verified

The change is docs only. At this commit, cargo fmt --all --check, cargo clippy --workspace --all-targets --all-features -- -D warnings, cargo test --workspace --all-features, cargo test -p moid --no-default-features, npm run check and npm test (49 pass) are all green. prov meta and prov links read both new documents, and their links resolve.

@adammharris
adammharris merged commit dbb4aa6 into master Oct 29, 2026
7 checks passed
@adammharris
adammharris deleted the agent/backlog-check-char-overflows-on-32-bit branch October 30, 2026 01:24
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