Repository navigation
Conversation
This was referenced Oct 7, 2026
dizzzz
reviewed
Oct 7, 2026
| final DocumentSet docs = result.getDocumentSet(); | ||
| if (docs != null && DocumentSet.EMPTY_DOCUMENT_SET != docs) { | ||
| // only cache node sets (which have a non-empty document set) | ||
| registerUpdateListener(); |
dizzzz
approved these changes
Oct 7, 2026
Contributor
📊 XQTS result comparisonComparison of this run against
Relative to 🟢 Newly passing tests (2)
Runtime: 354.6s (-156.06s vs |
Convert.ToSaxon.of(Item) cast every node item to org.w3c.dom.Node, which fails with a ClassCastException for a NodeProxy, e.g. a stored document passed as "global-context-item". of(Sequence) already unwrapped a NodeProxy; do the same for single items. The named-template-document test in doc-as-parameter.xqm should have caught this, but built the document path without a "/" separator, so fn:doc silently returned the empty sequence and no node was converted. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…etrieval The XQuery and XPath Functions 3.1 specification requires fn:doc and fn:collection to raise err:FODC0002 when the resource cannot be retrieved. eXist-db returned the empty sequence unless raise-error-on-failed-retrieval was enabled, and even then fn:doc rewrapped the error as err:FODC0005. - default raise-error-on-failed-retrieval to "yes" (conf.xml, conf.xsd and XQueryContext); "no" remains as an opt-out while applications migrate existence checks to fn:doc-available and xmldb:collection-available. This also applies to xmldb:xcollection. - fn:doc: raise err:FODC0005 only for an invalid URI; raise err:FODC0002 for a missing, unreadable, binary or unparseable resource - fn:collection: raise err:FODC0002 instead of err:FODC0003 for a relative URI without a base URI - document the error behaviour and that results are not stable (err:FODC0003 is never raised) - bump conf.xsd to 2.8.0 for the changed default Tests that relied on the empty sequence for missing resources now use fn:doc-available / xmldb:collection-available, expect err:FODC0002, or no longer race against their own setup (DOMIndexerTest, DeadlockIT). Closes eXist-db#3898 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…nusable An invalid static base URI (e.g. declare base-uri "c:\windows") made fn:doc leak err:FORG0001 from the XmldbURI conversion. Previously the catch-all in FunDoc masked this as err:FODC0005; report that code explicitly so the relative URI resolution failure keeps a fn:doc error. Fixes W3C XQTS K2-BaseURIProlog-3. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
line-o
force-pushed
the
fix/3898-fn-doc-errors
branch
from
October 9, 2026 11:44
e74aca3 to
c4d41bc
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
fn:docandfn:collectionnow raiseerr:FODC0002when a resource or collection cannot be retrieved, instead of returning the empty sequence. This is what the specification requires.Warning
Breaking change. Code that tests for existence with
doc(…)orcollection(…)(for exampleif (doc($uri)) …orexists(collection($c)/*)) now raises an error when the resource is missing. Migrate such checks tofn:doc-available()/xmldb:collection-available(), or catcherr:FODC0002. Installations that need time to migrate can setraise-error-on-failed-retrieval="no"on<xquery>inconf.xml.What changed
Default of
raise-error-on-failed-retrievalis nowyes. The existing switch is enabled by default inconf.xml,conf.xsd(bumped to 2.8.0) andXQueryContext, which until now read the property with a hard-codedfalsefallback. The switch coversfn:doc,fn:collectionandxmldb:xcollection. The documentation no longer mentionsxmldb:document(), which no longer exists.fn:docerror mapping (FunDoc). Before this change, every exception was rewrapped asFODC0005, including theFODC0002raised when the switch was on. Now:$uriis not a valid URIFODC0005FODC0005()FODC0002FODC0005FODC0002FODC0005FODC0002fn:doc-availableis unchanged: it returnsfalsein all of the "after:FODC0002" cases.fn:collection(ExtCollection). A relative URI with no base URI now raisesFODC0002, as the spec requires, instead ofFODC0003. A missing collection raisesFODC0002through the switch.FODC0003(determinism) is documented rather than implemented. Both function descriptions now state that results are not stable, because resources can be changed by other transactions while a query runs.The F&O 3.1 error conditions for
fn:collection, compared with develop, are written up in #3898 (comment).fn:transformfix (separate commit).named-template-documentindoc-as-parameter.xqmbuilt its path without a/, so it had always passed the empty sequence (found by @joewiz). With the path fixed, aClassCastExceptionappeared:Convert.ToSaxon.of(Item)cast a stored document (NodeProxy) toorg.w3c.dom.Node. The fix unwrapsNodeProxyin the same wayof(Sequence)already did.Tests that relied on the empty sequence:
DOMIndexerTest: the query ran concurrently with, and independently of, the test that stores its document, so it queried a missing collection and asserted nothing. The store now runs in@BeforeAll, and the query asserts its result.DeadlockIT: query tasks race against tasks that remove documents and collections, so a missing resource is an expected outcome. The queries now catcherr:FODC0002.expathrepo/deployment.xql: existence checks now usedoc-available/xmldb:collection-available.lucene/ft-query-forms.xqm:index-keys-nonexistent-collectionnow expectserr:FODC0002.range/range.xql:remove-documentre-read the removed document withdoc(), which never exercised the index. It now queries the collection index and filters for the removed document.Reference:
Closes #3898
Per @joewiz's analysis in the issue, this should also make qt3tests
fn-doc-3andK2-SeqDocFunc-3,-4,-6,-10and-11pass. I have not run them through the XQTS runner locally.Type of tests:
fn.xql):fn:docon a missing document, a binary resource, an invalid URI,(), and a document guest cannot read (withfn:doc-availablereturningfalsefor it);fn:collectionon a missing and an existing collection.exist-coretest suite (7409 tests),DeadlockIT, allextensionsmodules,mvn -N validate, and schema governance.ft-query-forms.xqmandrange.xql, but in different tests. Cherry-picked onto [test] Isolate XQSuite test files, run CoreTests and XQuery3Tests in parallel #6796 (366ccfa), they apply without conflicts, and these suites are green, the XQSuites running files in parallel:CoreTests,XQuery3Tests,OptimizerTests,RangeTests,LuceneTests,ExpathRepoTests,FileTestsandXmlDiffTests.🤖 Generated with Claude Code