Skip to content

fix(data): correct TOON escape decoding and double-hashing step for MIN_VALUE - #369

Merged
adamw7 merged 1 commit into
mainfrom
claude/issue-discovery-ugv4mq
Jul 10, 2026
Merged

fix(data): correct TOON escape decoding and double-hashing step for MIN_VALUE#369
adamw7 merged 1 commit into
mainfrom
claude/issue-discovery-ugv4mq

Conversation

@adamw7

@adamw7 adamw7 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Two latent correctness bugs in the data module:

  • ToonSyntax.processEscapeSequences decoded escapes with a chain of
    String.replace calls whose order let an already-unescaped backslash be
    reinterpreted: a value such as "a\nb" (escaped backslash + literal n)
    wrongly became a newline instead of a backslash followed by n. Replace
    the chained substitutions with a single left-to-right pass that consumes
    each escape exactly once and leaves unknown escapes untouched.

  • DoubleHashing.probe derived the probe step from Math.abs(hashCode), which
    stays negative for Integer.MIN_VALUE and produced a non-positive step that
    folded the probe sequence onto a subset of slots (e.g. 12 of 13 on a
    prime-sized table). Use Math.abs(hashCode % (length - 1)), which is
    identical for every other hashCode but overflow-safe for MIN_VALUE.

Add regression tests for both.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01PUdwoDrPdkLATaTkPcnpm3

…IN_VALUE

Two latent correctness bugs in the data module:

- ToonSyntax.processEscapeSequences decoded escapes with a chain of
  String.replace calls whose order let an already-unescaped backslash be
  reinterpreted: a value such as "a\\nb" (escaped backslash + literal n)
  wrongly became a newline instead of a backslash followed by n. Replace
  the chained substitutions with a single left-to-right pass that consumes
  each escape exactly once and leaves unknown escapes untouched.

- DoubleHashing.probe derived the probe step from Math.abs(hashCode), which
  stays negative for Integer.MIN_VALUE and produced a non-positive step that
  folded the probe sequence onto a subset of slots (e.g. 12 of 13 on a
  prime-sized table). Use Math.abs(hashCode % (length - 1)), which is
  identical for every other hashCode but overflow-safe for MIN_VALUE.

Add regression tests for both.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PUdwoDrPdkLATaTkPcnpm3
@adamw7
adamw7 merged commit 2b3dc67 into main Jul 10, 2026
2 checks passed
@adamw7
adamw7 deleted the claude/issue-discovery-ugv4mq branch July 10, 2026 16:28
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