Skip to content

Count nesting depth over open containers, and record suiteRevision 5 at 149/149 - #3

Merged
Rul1an merged 2 commits into
mainfrom
depth-counting-rule
Jul 28, 2026
Merged

Count nesting depth over open containers, and record suiteRevision 5 at 149/149#3
Rul1an merged 2 commits into
mainfrom
depth-counting-rule

Conversation

@Rul1an

@Rul1an Rul1an commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Revision 5 of the conformance corpus pins the two things the v0.6 text had left open, encoding and nesting depth. The unchanged revision-3 build scored 148/149 against it, missing only bad-741.

The bound was the visible half of that miss. The revision also states the counting rule, and this parser was incrementing in parse_value, so every value including a scalar leaf moved the counter. Measured on the raw bytes of every document in the corpus, which needs no parser and so covers the deliberately ill-formed vectors too, that read exactly one level deeper than the spec rule on all 149 statements and on every record payload inside them, because every deepest path in the corpus ends in a scalar.

So changing only the constant to 128 would reject a statement at depth 128, which the spec calls valid. The corpus cannot see the difference: the constant-only edit scores 149/149 as well. Not because the corpus is shallow, since bad-741's payload sits at depth 130, but because nothing in it sits at 128, the one depth where the two readings disagree. A scalar leaf inside 128 open containers reads as 129 to a per-value counter and 128 to a per-container one; at 129 both reject, and at 128 with an empty-container leaf both accept. depth_bound_is_counted_over_open_containers carries that boundary instead.

The encoding half needed no change. This checker rejected ill-formed UTF-8, CESU-8, overlong forms and unpaired surrogate escapes from the first build.

Also here

  • reports/suite-revision-5.json, and revision 3 retired from continuous verification.
  • The workflow moves with it: suite pin, spec pin, the report the fresh run is compared against, and the parity string the corpus step asserts. That last one is a grep inside set -euo pipefail, so leaving it on 105/105 would have failed the step rather than failing quietly.
  • INDEX.json's revision-3 entry gains its checkerCommit. It was the one record whose provenance nothing could check, and 0cf46c1 hashes to exactly the digest that entry already recorded.
  • Revision 4 is listed in NOTES.md as not run here, rather than left as a silent gap in the sequence.

Verification

  • 149/149 (35/35 accepts, 114/114 rejects) against astrogilda/aee-conformance@ea25a1e, whose vendored spec is byte-identical to the head blob of Add Adversarial Execution Evidence predicate (v0.7) in-toto/attestation#570.
  • Exactly one verdict moved between the before and after runs: bad-741, comparing all per-vector fields.
  • Revision 3 still reproduces reports/suite-revision-3.json exactly with the fixed build.
  • Four independent adversarial reviews. The parser change survived a boundary probe at 127/128/129/130 across object chains, array chains, and scalar, empty-object and empty-array leaves, plus confirmation that the bound reaches base64 record payloads and that payload depth restarts rather than accumulating. Three defects the reviews found in the first draft of this branch, the stale CI grep, a wrong vector count and a false claim about the corpus's maximum depth, are fixed here.

Refs in-toto/attestation#570.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Corrected JSON nesting-depth handling so scalar values no longer consume nesting limits.
    • Enforced a maximum depth of 128 open arrays or objects.
  • Conformance

    • Updated conformance verification to cover the complete 149-case corpus, with all expected accept and reject results.
    • Added refreshed parity evidence and verification records.
  • Documentation

    • Updated README and project notes with the latest suite revision, verification details, and reproduction instructions.

Copilot AI review requested due to automatic review settings July 28, 2026 08:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The JSON parser now counts only open containers toward a depth limit of 128. Suite revision 5 evidence, parity metadata, CI pins, reproduction instructions, and revision notes are updated for a 149/149 conformance run.

Changes

Conformance revision 5

Layer / File(s) Summary
Container-based JSON depth semantics
src/json.rs
Depth tracking now applies only to nested arrays and objects, with tests for boundary depth and scalar members.
Suite revision 5 evidence
reports/INDEX.json, reports/suite-revision-5.json
Revision 5 records its pins, parity counts, verification status, and individual vector outcomes.
CI pins and conformance documentation
.github/workflows/conformance.yml, README.md, NOTES.md
CI and documentation reference the updated suite/spec pins, 149/149 parity, and revision 5 evidence.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • Rul1an/aee-checker#1: Updates conformance workflow pins, parity assertions, and checked-in evidence across an earlier suite revision.

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures both the depth-counting fix and the suiteRevision 5 conformance update.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch depth-counting-rule

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/json.rs`:
- Around line 582-589: Update the scalars_do_not_consume_depth test to wrap the
wide object in 127 additional containers before parsing, then assert parsing
succeeds. Keep the 2,000 scalar members and ensure the resulting object is
evaluated at open-container depth 128.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ef57b7ec-81bc-4ae0-a7ce-60dc476d4d07

📥 Commits

Reviewing files that changed from the base of the PR and between 0cf46c1 and 5ad04a3.

📒 Files selected for processing (6)
  • .github/workflows/conformance.yml
  • NOTES.md
  • README.md
  • reports/INDEX.json
  • reports/suite-revision-5.json
  • src/json.rs

Comment thread src/json.rs
Rul1an and others added 2 commits July 28, 2026 11:01
The spec pins both halves of the depth rule at v0.6+: a statement or record
payload deeper than 128 is malformed, and depth is the number of arrays and
objects open at a point, with the outermost brace at depth 1 and scalars not
counting. This parser had neither. It incremented in parse_value, so every
value including a scalar leaf moved the counter, and the bound was 256.

The constant was the visible half and the counting rule was the load-bearing
one. Measured on the raw bytes of every document in suiteRevision 5, which
needs no parser and so covers the deliberately ill-formed vectors too, this
parser read exactly one level deeper than the spec rule on all 149 statements
and on every record payload inside them, because every deepest path in the
corpus ends in a scalar. Changing only the constant to 128 therefore rejects a
statement at depth 128, which the spec calls valid.

The corpus cannot see the difference: both the constant-only edit and this one
score 149/149 on it. Not because it is shallow -- bad-741's payload sits at
depth 130 -- but because nothing in it sits at 128, the one depth where the two
readings disagree. A scalar leaf inside 128 open containers reads as 129 to a
per-value counter and 128 to a per-container one; at 129 both reject, and at
128 with an empty-container leaf both accept. The tests carry that boundary
instead.

Refs in-toto/attestation#570.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The unchanged revision-3 checker scored 148/149 against revision 5. The record
for the fixed build is added, revision 3 is retired from continuous
verification, and the workflow moves with it: suite pin, spec pin, the report
the fresh run is compared against, and the parity string the corpus step
asserts. That last one is a grep, so leaving it on 105/105 would have failed
the step against the newly pinned suite rather than failing quietly.

INDEX.json's entry for revision 3 gains its checkerCommit at the same time. It
was the one record whose provenance nothing could check, and 0cf46c1 hashes to
exactly the digest that entry already recorded, so the field becomes a
verifiable binding rather than a label. It names a source tree rather than a
commit, so 47dbaf1 satisfies it equally; that is the digest working as
intended, not a weaker claim than it looks. Revision 4 is listed in NOTES.md as
not run here rather than left as a silent gap in the sequence.

Refs in-toto/attestation#570.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Rul1an
Rul1an force-pushed the depth-counting-rule branch from 5ad04a3 to 8953588 Compare July 28, 2026 09:01
@Rul1an
Rul1an merged commit 88c37d1 into main Jul 28, 2026
3 checks passed
@Rul1an
Rul1an deleted the depth-counting-rule branch July 28, 2026 09:23
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