Skip to content

regression tests for PR #481 (second review) - #502

Draft
bigerl wants to merge 8 commits into
feature/json_remote_contextfrom
regression-tests/pr-481-2
Draft

bigerl wants to merge 8 commits into
feature/json_remote_contextfrom
regression-tests/pr-481-2

Conversation

@bigerl

@bigerl bigerl commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

These tests fail on the head of #481 (444b304) by design, so the CI of this PR is expected to be red until the findings of the second review on #481 are fixed. The eleven tests of the first review are part of #481 now, this branch replaces them with the tests of the second review.

The on-demand term definition on the compact IRI prefix path of iri_expansion still passes an empty base URL (only the step 3 path was fixed). Test "a prefix term defined on demand is parsed with the base url of the document" fails with CHECK( == http://ex/ctx.jsonld ) (the scoped context is never requested), "invalid scoped context (loading document failed)", and in the second subcase "protected term redefinition".

After a remote context with "@propagate": false, previous_context is set to the context from before the whole @context array instead of the context built by the earlier entries. Test "@propagate false in a remote context falls back to the earlier entries of the context array" fails with CHECK( 1 == 2 ), the quad <http://ex/o> <http://ex/a> "v" is missing.

The @import branch keeps the URL as a view into the thread_local buffer of IRIFactory and uses it as cache key after request_url returned. Test "two node objects that import the same context request it only once" fails with CHECK( 2 == 1 ); under ASan it reports heap-use-after-free ... RemoteContextCache::resolve JsonLdContextParser.cpp:22.

The @import branch calls set_resolution_base for absolute URLs too, so an absolute @import inside a scoped context with an empty base URL fails. Test "an absolute @import url is loaded without a base url" fails with CHECK( == http://ex/imp.jsonld ) and "invalid scoped context (loading remote context failed)".

The nested parse_context started by handle_remote validates the scoped contexts of the earlier array entries against the half-built context and clears their needs_context_check. Test "a scoped context before a remote context is validated against the complete context" fails with "invalid scoped context (invalid type mapping (not IRI or keyword))" and no quads.

handle_null returns a context without previous_context, so a type scoped context of null never reverts for nested node objects. Test "a null scoped context that does not propagate keeps the previous context" fails with CHECK( 2 == 3 ) (the quad <http://ex/o> <http://ex/p> "v" is missing) and, in the array subcase, with a quad that must not appear. This one exists on develop as well, the PR only moves the code.

The is_relative guard in handle_remote removed the validation of absolute context URLs. Test "an absolute remote context url that is no valid iri is rejected" fails with CHECK( http://ex ample/ctx.jsonld == ), the invalid URL reaches request_url and a quad is produced.

A remote context body that is not valid JSON throws simdjson_error out of parse_local_context, which is only caught at the top of the parser, so the remaining node objects of the document are lost. Test "a remote context that is no valid json only fails its own node object" fails with CHECK( EMPTY: no JSON found == invalid remote context ) and the third node object missing, in three subcases (empty body, truncated body, empty body behind @import).

Pass condition: for each test, a small local fix of the library (not part of this PR) was applied, the test passed (test cases: 1 | 1 passed), and the fix was reverted. The @import cache key test was also run under ASan with the fix. With the library of the PR head, the full tests_JSON_LD_Parser run shows exactly these 8 tests failing and all 35 other tests passing.

(prepared with claude)

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