Repository navigation
[fix] reject trailing JSON delimiters (LET-33) - #185
Conversation
Up to standards ✅🟢 Issues
|
| Category | Results |
|---|---|
| CodeStyle | 1 minor |
🟢 Metrics 68 complexity · 5 duplication
Metric Results Complexity 68 Duplication 5
🟢 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 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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.
3d799f3 to
4371a25
Compare
JSON entry points used
Decoder.More()as an end-of-document check, allowing malformed inputs such as1],1}and[1]]. Check the original input afterInputOffsetand allow only the four JSON whitespace bytes. Apply this toUnmarshalStarlarkJSON,serial.loads/try_loads, and the data argument ofjson.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.