Skip to content

Make JSON depth limits and experiment verification deterministic - #9

Merged
KIM3310 merged 1 commit into
mainfrom
codex/portfolio-polish-20260907
Sep 7, 2026
Merged

Make JSON depth limits and experiment verification deterministic#9
KIM3310 merged 1 commit into
mainfrom
codex/portfolio-polish-20260907

Conversation

@KIM3310

@KIM3310 KIM3310 commented Sep 7, 2026

Copy link
Copy Markdown
Owner

JSON depth rejection depended on Python recursion behavior, and chained Makefile commands could hide comparison failures. Enforce a string-aware depth limit before decoding and propagate verification failures.

Add boundary regression tests and engineering notes; regenerate synthetic simulation evidence from the changed source. Existing MPS measurements were checked, not re-measured.

Validation: make verify — 189 tests, 96.58% coverage, lint/type checks, deterministic reproduction, measurement artifact checks, site checks, and wheel/sdist validation.

@KIM3310
KIM3310 marked this pull request as ready for review September 7, 2026 08:18
Copilot AI lite review requested due to automatic review settings September 7, 2026 08:18
@KIM3310
KIM3310 merged commit 80f6e64 into main Sep 7, 2026
9 checks passed
@KIM3310
KIM3310 deleted the codex/portfolio-polish-20260907 branch September 7, 2026 08:18

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.

🟢 Approval recommended

The changes are cohesive, low-risk, and include targeted regression tests that enforce the intended deterministic behavior and failure propagation.

Pull request overview

This PR makes JSON depth rejection deterministic across Python versions by enforcing a fixed container-nesting limit before calling json.loads, and ensures Make-based verification fails fast so deterministic artifact comparisons can’t be accidentally masked.

Changes:

  • Add a string-aware, pre-decode JSON nesting validator with a fixed limit (MAX_JSON_NESTING = 64) and ensure excessive depth is rejected before decoding.
  • Add regression tests covering the exact depth boundary, string/escape handling (quoted braces), and “reject-before-decode” behavior.
  • Update verification/evidence artifacts and add engineering notes documenting the rationale and reproducibility implications.
File summaries
File Description
tests/test_json_depth_contract.py Adds contract tests for exact nesting boundary, quoted brace handling, and pre-decode rejection.
src/memoryflow/io.py Introduces MAX_JSON_NESTING and a pre-decode nesting scan to make depth limits deterministic.
site/results.json Updates recorded source hash for regenerated evidence inputs.
README.md Adds quick links to engineering notes, core model, and reproduction section.
Makefile Sets shell flags to fail fast (-eu) so verification comparisons can’t be masked.
evidence/benchmark-summary.md Updates model-source hash to match regenerated evidence.
docs/engineering-notes.md Documents the new deterministic JSON boundary and verification/evidence expectations.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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