Skip to content

[bugfix] Find processing instructions on the sibling axes of stored documents - #6767

Merged
duncdrum merged 1 commit into
eXist-db:developfrom
joewiz:bugfix/sibling-axis-pi-test
Sep 29, 2026
Merged

duncdrum merged 1 commit into
eXist-db:developfrom
joewiz:bugfix/sibling-axis-pi-test

Conversation

@joewiz

@joewiz joewiz commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

[This PR was prompted by Joe, drafted by Claude Code, and reviewed by Joe.]

Summary

On a stored document, a processing-instruction test on the preceding-sibling or following-sibling axis never matches anything:

(: stored:  <root><?x 1?><b/><?y 2?><c/><?x 3?></root>  :)
doc("/db/test.xml")/root/c/preceding-sibling::processing-instruction()    (: empty, should be <?x 1?>, <?y 2?> :)
doc("/db/test.xml")/root/b/following-sibling::processing-instruction(x)   (: empty, should be <?x 3?> :)
doc("/db/test.xml")/root/*[preceding-sibling::processing-instruction(y)]  (: empty, should be <c/> :)

preceding-sibling::node() on the same document does return the processing instructions, and constructed documents are unaffected.

Cause

LocationStep.getSiblings handed processing-instruction tests to a VirtualNodeSet, which does not produce siblings for them. A wildcard test on the same axes is matched while streaming the siblings, and both TypeTest and NameTest already match processing instructions on the stream, target name included. So processing-instruction tests now take that path too.

This is the sibling-axis counterpart of 61702d1, which fixed the same VirtualNodeSet hand-off on the self axis.

What Changed

file change
LocationStep.getSiblings processing-instruction tests are matched while streaming the siblings, like wildcard tests
sibling-axis-processing-instructions.xqm (new XQSuite) preceding and following siblings, named and unnamed, in a predicate and around the document element, on a stored document, with the in-memory equivalent

Related issues and PRs

How this was found

Running the W3C XQuery Update tests against stored documents, which the XQTS runner can now do (eXist-db/exist-xqts-runner#82), showed complex-renames-q1 and complex-replacevalues-q3 failing only on stored documents. Neither failure was in the update: the verification query's preceding-sibling::processing-instruction() found nothing even before any update. The context is summarized on #6214. BaseX 12.4 gives the expected result for each case above against a stored database.

Test Plan

  • sibling-axis-processing-instructions.xqm: all pass with the fix; the stored-document tests fail without it
  • xquery.CoreTests
  • full exist-core test suite
  • qt3tests HEAD, with all five of these stored-document fixes applied together, against current develop: no regressions (27,613 tests compared; the only three changes are tests that also vary between develop runs)

🤖 Generated with Claude Code

…ocuments

LocationStep.getSiblings handed processing-instruction tests to a
VirtualNodeSet, which found no sibling processing instructions at all, so
preceding-sibling::processing-instruction() and
following-sibling::processing-instruction() never matched on stored documents.
They are now matched while streaming the siblings, as wildcard tests are; both
TypeTest and NameTest already match processing instructions on the stream.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@joewiz
joewiz requested a review from a team as a code owner September 25, 2026 14:50
@github-actions

Copy link
Copy Markdown
Contributor

📊 XQTS result comparison

Comparison of this run against develop.

Metric develop this run Change
🟢 Passed 28,864 (90.72%) 28,866 (90.73%) +2 (+0.01 pp)
🟢 Failures 1,550 1,548 -2
➖ Errors 134 134 0
➖ Skipped 1,267 1,267 0
🧪 Total tests 31,815 31,815 0

Relative to develop: 3 newly passing, 1 newly failing, 0 new errors, 0 newly skipped — counting only tests recorded in both runs whose outcome changed.

🔴 Newly failing tests (1)
  • Constr-inscope-2 (was passing)
🟢 Newly passing tests (3)
  • Constr-inscope-3 (was failing)
  • Constr-inscope-1 (was failing)
  • Constr-inscope-4 (was failing)

Runtime: 410.6s (-39.38s vs develop).

@duncdrum duncdrum added the xquery issue is related to xquery implementation label Sep 25, 2026
@duncdrum duncdrum added this to v7.0.0 Sep 25, 2026
@duncdrum duncdrum added this to the eXist-7.0.0 milestone Sep 25, 2026
@duncdrum duncdrum moved this to In review in v7.0.0 Sep 25, 2026
@dizzzz
dizzzz requested review from a team, duncdrum, line-o and reinhapa September 28, 2026 20:37
@duncdrum
duncdrum merged commit 151a451 into eXist-db:develop Sep 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

xquery issue is related to xquery implementation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants