Skip to content

serde/json/test: add JSONTestSuite parsing conformance suite#30211

Merged
nvartolomei merged 2 commits intoredpanda-data:devfrom
nvartolomei:nv/json-compliance
Apr 21, 2026
Merged

serde/json/test: add JSONTestSuite parsing conformance suite#30211
nvartolomei merged 2 commits intoredpanda-data:devfrom
nvartolomei:nv/json-compliance

Conversation

@nvartolomei
Copy link
Copy Markdown
Contributor

Vendor the test_parsing corpus from https://github.com/nst/JSONTestSuite
(MIT, Nicolas Seriot) and run it as a parameterized gtest. File-name
prefixes encode the expected parser behavior per RFC 8259: y_ must be
accepted, n_ must be rejected, i_ is implementation-defined (the parser
just must not crash).

The current parser passes all 318 cases with default config.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v26.1.x
  • v25.3.x
  • v25.2.x

Release Notes

  • none

@rockwotj
Copy link
Copy Markdown
Contributor

Can we instead pull it in via bazel instead of vendoring in a bunch of files?

@nvartolomei
Copy link
Copy Markdown
Contributor Author

nvartolomei commented Apr 17, 2026

@rockwotj didn't want to add extra (flaky) dependency in test run.

@rockwotj
Copy link
Copy Markdown
Contributor

@rockwotj didn't want to add extra (flaky) dependency in test run.

You could vendor into our s3 bucket. There are already lots of things in github we depend on and we really need to have some ability to automatically mirror

@nvartolomei
Copy link
Copy Markdown
Contributor Author

nvartolomei commented Apr 17, 2026

Why not vendor (source control) a bunch of files instead? 300 KB of blobs.

@rockwotj
Copy link
Copy Markdown
Contributor

Why not vendor everything 😄

Personally I think not vendoring is more consistent, and practically speaking these will never get updated if we vendor, where I think if all you have to do is bump a sha it's much less work to update

@vbotbuildovich
Copy link
Copy Markdown
Collaborator

CI test results

test results on build#83310
test_status test_class test_method test_arguments test_kind job_url passed reason test_history
FLAKY(PASS) ConsumerGroupBalancingTest test_coordinator_nodes_balance null integration https://buildkite.com/redpanda/redpanda/builds/83310#019d9bb6-aa58-4f81-b968-46557b06b92a 10/11 Test PASSES after retries.No significant increase in flaky rate(baseline=0.0000, p0=1.0000, reject_threshold=0.0100. adj_baseline=0.1000, p1=0.3487, trust_threshold=0.5000) https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=ConsumerGroupBalancingTest&test_method=test_coordinator_nodes_balance
FLAKY(PASS) DataMigrationsApiTest test_creating_and_listing_migrations null integration https://buildkite.com/redpanda/redpanda/builds/83310#019d9bb6-aa56-460e-b09c-a02720e1614e 10/11 Test PASSES after retries.No significant increase in flaky rate(baseline=0.0000, p0=1.0000, reject_threshold=0.0100. adj_baseline=0.1000, p1=0.3487, trust_threshold=0.5000) https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=DataMigrationsApiTest&test_method=test_creating_and_listing_migrations

Copilot AI review requested due to automatic review settings April 20, 2026 10:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds automated JSON parsing conformance coverage by integrating the upstream JSONTestSuite corpus into the existing serde/json gtest-based test suite, and refactors local jsonchecker test-case discovery into a reusable helper.

Changes:

  • Extend test_utils::get_runfile_path to support locating runfiles from external Bazel repositories via a repo parameter.
  • Add a shared helper to enumerate .json test vectors and use it from existing/new parameterized tests.
  • Add a new parameterized gtest that runs the nst/JSONTestSuite test_parsing corpus via a new http_archive.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/v/test_utils/runfiles.h Update runfiles helper API to accept an optional repo name and document external repo usage.
src/v/test_utils/runfiles.cc Implement repo-aware Rlocation path construction.
src/v/serde/json/tests/test_cases.h New helper to collect and sort .json test cases from a directory.
src/v/serde/json/tests/json_test_suite_test.cc New parameterized test running JSONTestSuite test_parsing corpus.
src/v/serde/json/tests/json_checker_test.cc Refactor to use shared test-case collection helper and path-based params.
src/v/serde/json/tests/BUILD Add test_cases test library and new json_test_suite_test target; wire data/deps.
MODULE.bazel Add nst_json_test_suite http_archive with a filegroup exposing test_parsing JSON corpus.

Comment thread src/v/serde/json/tests/json_test_suite_test.cc
Comment thread src/v/serde/json/tests/json_checker_test.cc
Comment thread src/v/test_utils/runfiles.h Outdated
Split the testdata directory scan out of json_checker_test.cc so that
future parameterized JSON parser test suites can reuse it. The helper
returns full file paths — callers derive the filename locally rather
than re-joining the test data directory.
Fetch the test_parsing corpus from https://github.com/nst/JSONTestSuite
(MIT, Nicolas Seriot) via a pinned http_archive and run it as a
parameterized gtest. File-name prefixes encode the expected parser
behavior per RFC 8259: y_ must be accepted, n_ must be rejected, i_ is
implementation-defined (the parser just must not crash).

The current parser passes all 318 cases with default config.

get_runfile_path gains an optional repo parameter (default _main) so
callers can resolve data from external Bazel repositories.
@nvartolomei nvartolomei requested a review from dotnwat April 20, 2026 11:23
Copy link
Copy Markdown
Member

@dotnwat dotnwat left a comment

Choose a reason for hiding this comment

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

nice!

@nvartolomei nvartolomei merged commit 4d67e78 into redpanda-data:dev Apr 21, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants