Skip to content

[fix] reject trailing JSON delimiters (LET-33) - #185

Merged
vt128 merged 1 commit into
masterfrom
codex/let33-json-single-document
Nov 10, 2026
Merged

vt128 merged 1 commit into
masterfrom
codex/let33-json-single-document

Conversation

@vt128

@vt128 vt128 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

JSON entry points used Decoder.More() as an end-of-document check, allowing malformed inputs such as 1], 1} and [1]]. Check the original input after InputOffset and allow only the four JSON whitespace bytes. Apply this to UnmarshalStarlarkJSON, serial.loads/try_loads, and the data argument of json.validate/try_validate; schema-source validation remains a separate follow-up.

The implementation keeps the existing three checks without a second decode, new parser, cache or API. Preserve exact integers, TypeConvert, error messages and try-return shapes. Update the usage notes to describe the corrected boundary while retaining the schema limitation.

Validation: fresh baseline/candidate build, race tests twice, vet and coverage checks pass on Go 1.27.3 and Go 1.19.13. The complete 80-leg consumer matrix passes on host and each declared floor; all 40 paired profiles and 16,012 blocks match. Four fresh CLI binaries pass eight public examples and the expected old-error/new-success JSON boundary checks. Regression cases cover malformed suffixes, second documents, JSON whitespace, String/Bytes inputs, large integers and try-return contracts. Public test fixtures and minimal module preparation are symmetric; this is source compatibility validation, not release adoption or live-service proof.

Accept the limited input-validation cost rather than adding specialized optimizations. Retained representative measurements have unchanged allocations and about +3.33% paired median time at the Go floor with a wide interval; timings depend on the input and toolchain and do not establish equivalence. The three function ASTs match that measured implementation; no new timing samples were taken. No Go-floor, interpreter, dependency or workflow changes. Refs LET-33.

@codacy-production

codacy-production Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 1 minor

Results:
1 new issue

Category Results
CodeStyle 1 minor

View in Codacy

🟢 Metrics 68 complexity · 5 duplication

Metric Results
Complexity 68
Duplication 5

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.00% coverage variation

Metric Results
Coverage variation ✅ +0.00% coverage variation (-1.00%)
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (317e5a6) 8437 8024 95.10%
Head commit (4371a25) 8437 (+0) 8024 (+0) 95.10% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#185) 3 3 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.98%. Comparing base (317e5a6) to head (4371a25).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #185   +/-   ##
=======================================
  Coverage   93.98%   93.98%           
=======================================
  Files          53       53           
  Lines        6752     6752           
=======================================
  Hits         6346     6346           
  Misses        258      258           
  Partials      148      148           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Require only JSON whitespace after each decoded value while preserving integer precision and existing try/error results. Update current usage documentation and retain the separate schema limitation.
@vt128
vt128 force-pushed the codex/let33-json-single-document branch from 3d799f3 to 4371a25 Compare November 10, 2026 03:29
@vt128
vt128 marked this pull request as ready for review November 10, 2026 04:14
@vt128
vt128 merged commit b8e0c8f into master Nov 10, 2026
24 checks passed
@vt128
vt128 deleted the codex/let33-json-single-document branch November 10, 2026 04:18
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