Skip to content

fix: post-mortem follow-ups for TOON 4.4 and jsonx fast path - #231

Merged
Oaklight merged 6 commits into
masterfrom
fix/postmortem-followups
Oct 22, 2026
Merged

Oaklight merged 6 commits into
masterfrom
fix/postmortem-followups

Conversation

@Oaklight

Copy link
Copy Markdown
Owner

What

Follow-ups from the post-mortem review of a37e656 (TOON 4.4, #227) and 5afde23 (#225), requested from elena, clementine and milo in #dev-zerodep.

  • jsonx (v1.0.2): loads_lines() now opts out of the batch fast-path when a custom decoder or hook is supplied — previously a hook ran up to three times on a value in a JSONC line, and a hook's JSONDecodeError rejection was retried. loads() rejects bytes with an explicit TypeError instead of leaking the scanner's internal error. The fast path is now pinned structurally (plain JSON never reaches _preprocess) instead of by the dropped timing assertion.
  • toon (v0.6.1): unknown option keys raise TypeError (a porting typo such as the reference's indent_size no longer silently changes the document); decode() accepts str/bytes/bytearray (UTF-8, invalid input → ToonDecodeError); the ToonDecodeError docstring states the non-ValueError contract.
  • CI: the benchmark workflow installs the TOON reference from the bench-toon pin in a required step and asserts toon/ rows in the artifact, instead of an unpinned git+ install with || true. AGENTS wording corrected.
  • Makefile: test-jsonx / test-toon pass -rs so a missing reference library is visible as a reasoned skip rather than a short green run.
  • manifest: refreshed for jsonx 1.0.2 / toon 0.6.1.

Not changed

  • ToonDecodeError stays a plain Exception (not ValueError): deliberate contract, now documented in the class docstring and the docs.
  • The benchmark docs numbers are measured on Python 3.10; the page states the environment, and the release benchmark workflow republishes 3.12 numbers.
  • The full-tree httpserver unix-socket failures (long TMPDIR) and tabulate Unicode failures seen in the reviewers' runs are environment-specific, not attributable to these merges.

Verification

  • pytest jsonx toon config --ignore-glob="*/test_*_benchmark.py": 336 passed, 2 skipped.
  • make test-jsonx: 88 passed; make test-toon: 152 passed (conformance included).
  • pre-commit run --all-files: ruff, ruff-format, ty, complexipy pass.
  • zerodep version-check: all modules up-to-date.

Docs (module pages + changelog, EN and ZH) are committed on docs_en / docs_zh.

AI was used to assist with this change.

The JSONL batch path passed caller hooks to the speculative joined parse,
and the per-line retry passed them again, so a hook ran up to three times on
a value that failed.  Skip both speculative attempts when a custom decoder
or hook is supplied, matching loads(); a rejected value is now reported
once.  Also reject bytes with an explicit TypeError instead of leaking the
preprocessing scanner's internal error, and pin the fast path structurally
(plain JSON never reaches _preprocess) rather than by timing.

Bump jsonx to 1.0.2.
Unknown encode/decode option keys were silently ignored, so a porting
typo such as the reference's indent_size produced a different document with
no error.  Reject them with TypeError, keep the explicit lengthMarker
migration error, accept str/bytes/bytearray on decode (UTF-8, with invalid
input reported as ToonDecodeError), and state the non-ValueError contract in
the ToonDecodeError docstring.

Bump toon to 0.6.1.
The benchmark workflow filtered bench-toon out of the extras and installed
toon_format from an unpinned git+ URL with '|| true', so a failed or drifted
reference silently removed the toon rows from the artifact.  Install the
bench-toon extra in a required step (matching lint-test) and assert toon rows
exist, the same guard s3 already has.  Correct the AGENTS note: the pin is a
git commit, not a PyPI availability claim.
Pass -rs to the jsonx and toon targets so a missing reference library is
reported as a skip with its reason instead of looking like a short green run.
@Oaklight
Oaklight force-pushed the fix/postmortem-followups branch from a2e894c to 9c0ed9b Compare October 22, 2026 22:18
The class reports jsonx and stdlib side by side; the fast path itself is
pinned structurally in test_jsonx_fastpath.py, so these rows are a visible
measurement rather than a timing assertion.
@Oaklight
Oaklight merged commit 2dc8720 into master Oct 22, 2026
6 checks passed
@Oaklight
Oaklight deleted the fix/postmortem-followups branch October 22, 2026 22:21
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