Skip to content

Conversation

@theory
Copy link
Contributor

@theory theory commented Sep 6, 2025

I could not figure out how to run the full suite, so started adding tests in theory/jsonpath#22. However, it's not clear to me what the behavior should be when there is no consensus field in a query object. Should it expect a compile error? Selection error? Empty result?

@theory theory force-pushed the add-theory-jsonpath branch from 2664d7c to c257097 Compare September 6, 2025 22:47
@cburgmer
Copy link
Owner

cburgmer commented Oct 6, 2025

Looks good! Manually merged in 66589d6

It should be clear that the consensus does not respect RFC9535, it only reflects the status quo of (often antiquated) implementations. Hopefully there is a huge overlap, eventually fully converging once more and more implementations follow the still newish spec.
I believe the reference implementation was to address the full alignment with the RFC, but so far that work has not been completed.

So for me it's less a question about the lack of consensus but rather about the behaviour of queries (syntax) not defined within the RFC. Here the consensus might penalise a lenient implementation if the others are strict (e.g. via compile errors) or vice versa.

@theory
Copy link
Contributor Author

theory commented Oct 6, 2025

Thanks. I get all that, but I still have questions what to do about some situations:

  • Here and here I simply ignore errors when there is no consensus.
  • Here I simply ignore unexpected errors. Should I?

@cburgmer
Copy link
Owner

cburgmer commented Oct 6, 2025

Ah, if the consensus field is missing (e.g. https://github.com/cburgmer/json-path-comparison/blob/master/regression_suite/regression_suite.yaml#L50), then no consensus was reached and only a certain tendency might be derived (https://cburgmer.github.io/json-path-comparison/#array_slice_with_large_number_for_end_and_negative_step). I believe doing nothing is the only option from that perspective.

As for errors, the consensus does track agreement for not supported queries, e.g. https://github.com/cburgmer/json-path-comparison/blob/master/regression_suite/regression_suite.yaml#L50 so I wouldn't skip those in the test, I would check that your implementation doesn't return surprise answers unless intended. Mostly your implementation might actually be returning errors.

theory added a commit to theory/jsonpath that referenced this pull request Oct 9, 2025
Simplify `compare/compare_test.go` by skipping tests with no consensus,
which were the source of the previous unknowns in the test. Based on
advice from cburgmer/json-path-comparison#153#issuecomment-3374075044.

While at it, upgrade `golangci-lint` to v2.5.0 and tweak its
configuration to scan `compare/compare_test.go` and fix the long lines
it complains about. Also have the `test-compare` target run the tests
verbosely, and run the CI tests on Go 1.25.
theory added a commit to theory/jsonpath that referenced this pull request Oct 9, 2025
Simplify `compare/compare_test.go` by skipping tests with no consensus,
which were the source of the previous unknowns in the test. Based on
advice from cburgmer/json-path-comparison#153#issuecomment-3374075044.

While at it, upgrade `golangci-lint` to v2.5.0 and tweak its
configuration to scan `compare/compare_test.go` and fix the long lines
it complains about. Also have the `test-compare` target run the tests
verbosely.
theory added a commit to theory/jsonpath that referenced this pull request Oct 9, 2025
Simplify `compare/compare_test.go` by skipping tests with no consensus,
which were the source of the previous unknowns in the test. Based on
advice from cburgmer/json-path-comparison#153#issuecomment-3374075044.

While at it, upgrade `golangci-lint` to v2.5.0 and tweak its
configuration to scan `compare/compare_test.go` and fix the long lines
it complains about. Also have the `test-compare` target run the tests
verbosely, and run the CI tests on Go 1.25.
theory added a commit to theory/jsonpath that referenced this pull request Oct 10, 2025
Simplify `compare/compare_test.go` by skipping tests with no consensus,
which were the source of the previous unknowns in the test. Based on
advice from cburgmer/json-path-comparison#153#issuecomment-3374075044.

While at it, upgrade `golangci-lint` to v2.5.0 and tweak its
configuration to scan `compare/compare_test.go` and fix the long lines
it complains about. Also have the `test-compare` target run the tests
verbosely, and run the CI tests on Go 1.25.
@theory
Copy link
Contributor Author

theory commented Oct 10, 2025

Great, that's what I needed to know. I updated my tests to skip cases with no consensus. That eliminates all the unknowns in the tests themselves (I was already tracking errors for those with consensus).

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