Skip to content

regression tests for PR #481 - #500

Closed
bigerl wants to merge 11 commits into
feature/json_remote_contextfrom
regression-tests/pr-481
Closed

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

Conversation

@bigerl

@bigerl bigerl commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

These tests fail on the head of #481 by design, so the CI of this PR is expected to be red until the findings of the review on #481 are fixed.

The context overflow check counts the distinct URLs of a cache that lives for the whole document, so remote contexts of sibling node objects add up. Test "remote contexts of sibling node objects do not add up to a context overflow" fails with CHECK( context overflow == ) and CHECK( 101 == 102 ). A self-including remote context (er02) overflows the stack on the PR head; it has no test here because doctest cannot catch that.

A relative context URL is a view into the thread_local buffer of the IRIFactory, and it is used as the base of the nested parse. Test "relative urls in a remote context resolve against the url of that context" fails because http://ex/ot/sub3.jsonld is requested instead of http://ex/dir/sub3.jsonld, with "loading remote context failed not found" and no quad.

With "@propagate": false in a remote context, previous_context points to a dead object. Test "@propagate false in a remote context does not reach nested node objects" throws std::bad_alloc in RelWithDebInfo, and ASan reports stack-use-after-return ... Context::find_term_position JsonLdParserTypes.cpp:17.

@base in a remote context is applied (spec 4.1 step 5.7 skips it). Test "@base in a remote context is ignored" fails with <http://other.example/s> <http://ex/p> "v" . instead of <http://doc.example/s> <http://ex/p> "v" ..

A term that iri_expansion defines on demand stores an empty base URL for its scoped context. Test "a term defined on demand loads its remote scoped context" fails with "invalid scoped context (loading document failed)".

A remote context document without @context reports a simdjson error. Test "a remote context document without @context is an invalid remote context" fails with CHECK( NO_SUCH_FIELD: The JSON field referenced does not exist in this object. == invalid remote context ).

An imported @context that is not a map reports a simdjson error. Test "an imported context that is not a map is an invalid remote context" fails with CHECK( INCORRECT_TYPE: The JSON element does not have the requested type. == invalid remote context ).

Loading remote contexts leaves the base of the shared parsing state at a context URL. Test "loading remote contexts does not change the base of the parsing state" fails with CHECK( http://ctx.example.com/c1.jsonld == http://example.com/doc ), and a later Turtle parse gives http://ctx.example.com/s.

An exception thrown by request_url escapes the iterator. Test "an exception from request_url becomes a parsing error" fails with CHECK_NOTHROW( parse_all() ) THREW exception: "timeout".

base_url is part of the protected term check, and the on-demand path stores an empty one, so an identical redefinition fails. Test "a protected term that is defined on demand may be redefined with the same definition" fails with "protected term redefinition" (develop parses this input).

parse_context clears the pending scoped context checks of the terms that handle_remote passes to it. Test "an invalid scoped context before a remote context is reported" fails because a quad is returned and no error.

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 @propagate 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 11 tests failing and all 24 old tests passing. The first commit adds a small helper that most of the later tests use.

(prepared with claude)

@bigerl bigerl closed this Sep 15, 2026
@bigerl
bigerl deleted the regression-tests/pr-481 branch September 15, 2026 07:01
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