Skip to content

Make the integer-token scan total: bounds-check the string loop - #56

Draft
hyperpolymath wants to merge 1 commit into
claude/beta-holes-firstfrom
claude/beta-total-token-scan
Draft

hyperpolymath wants to merge 1 commit into
claude/beta-holes-firstfrom
claude/beta-total-token-scan

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Owner ruling of 2026-12-01 (hardening b): make check_integer_tokens bounds-checked so panic-freedom needs no precondition. Stacked on #50 (base claude/beta-holes-first) because both change src/strict.rs and the same exclusion row.

Change

While skipping a string, the scan indexed bytes[i] until it met a closing quote, relying on the caller having parsed the text first. That held at both call sites, so this was not a reachable hole, but the function panicked on any text with an unterminated string. The loop now stops at the end of the text, and the object key is taken with input.get(..). Behaviour on text that parsed is unchanged.

Evidence (rustc 1.99.1)

Check Before After
cargo test --locked --lib integer_token_scan integer_token_scan_never_panics FAILED: index out of bounds: the len is 1 but the index is 1 2 passed
cargo test --locked --all-features 164 passed, 0 failed
clippy -D warnings, cargo fmt --check clean
scripts/proven-coverage.sh no new uncovered line; one exclusion re-bound to its moved line

The new test runs the scan on six malformed texts and on every string of up to five symbols over nine characters (66,430 inputs). That is TESTED with those bounds, not a proof.

Ledger

verification/PROOF-STATUS.adoc, row "No panic on any input": status unchanged (OPEN); the reason now records that the precondition is gone and names the test. No verifier has been run. Row census unchanged: 0 of 7 rows of the parse_jcs plan table change status.


Generated by Claude Code

Owner ruling of 2026-12-01. check_integer_tokens indexed bytes[i] while
skipping a string, relying on the caller having parsed the text first.
The loop now stops at the end of the text, so the function cannot panic
on any input and panic-freedom needs no precondition. Behaviour on text
that parsed is unchanged.

Must-fail test: integer_token_scan_never_panics panics with an index out
of bounds against the unchecked loop.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDfneftEg71bUadt3v3
@gitnotebooks

gitnotebooks Bot commented Dec 2, 2026

Copy link
Copy Markdown

Review these changes at https://app.gitnotebooks.com/hyperpolymath/ijson-jcs/pull/56

@coderabbitai

coderabbitai Bot commented Dec 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 45ee2698-0fa6-4a66-a368-3b14f480fab6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

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