Skip to content

Conversation

@joewiz
Copy link
Member

@joewiz joewiz commented Jun 4, 2021

In preparation for release of eXist 5.3.0 - see eXist-db/exist#3914.

@joewiz
Copy link
Member Author

joewiz commented Jun 4, 2021

As is with this PR, loading http://localhost:8080/exist/apps/doc/ returns a 400 error:

err:XPTY0004 Invalid cardinality for parameter $field. Expected exactly one, got 0 [at line 24, column 22, source: /db/apps/doc/modules/docbook.xql]
In function:
	docbook:load(node(), map(*), xs:string?, xs:string?, xs:string) [-1:-1:/db/apps/doc/modules/docbook.xql]
	templates:process-output(element(), map(*), item()*, element(function)) [211:9:/Users/joe/Library/Application Support/org.exist/expathrepo/shared-0.9.1/content/templates.xql]
	templates:call-by-introspection(element(), map(*), map(*), function(*)) [189:28:/Users/joe/Library/Application Support/org.exist/expathrepo/shared-0.9.1/content/templates.xql]
	templates:call(item(), element(), map(*)) [137:36:/Users/joe/Library/Application Support/org.exist/expathrepo/shared-0.9.1/content/templates.xql]
	templates:process(node()*, map(*)) [148:81:/Users/joe/Library/Application Support/org.exist/expathrepo/shared-0.9.1/content/templates.xql]
	templates:process(node()*, map(*)) [148:81:/Users/joe/Library/Application Support/org.exist/expathrepo/shared-0.9.1/content/templates.xql]
	templates:process(node()*, map(*)) [148:81:/Users/joe/Library/Application Support/org.exist/expathrepo/shared-0.9.1/content/templates.xql]
	templates:process(node()*, map(*)) [20:23:/Users/joe/Library/Application Support/org.exist/expathrepo/shared-0.9.1/content/templates.xql]
	site:expand-links(node(), map(*), xs:string?) [-1:-1:/Users/joe/Library/Application Support/org.exist/expathrepo/shared-0.9.1/content/siteutils.xql]
	templates:process-output(element(), map(*), item()*, element(function)) [210:9:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]
	templates:call-by-introspection(element(), map(*), map(*), function(*)) [188:28:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]
	templates:call(item(), element(), map(*)) [144:37:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]
	templates:process(node()*, map(*)) [147:81:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]
	templates:process(node()*, map(*)) [430:17:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]
	templates:process-output(element(), map(*), item()*) [229:9:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]
	templates:process-output(element(), map(*), item()*, element(function)) [210:9:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]
	templates:call-by-introspection(element(), map(*), map(*), function(*)) [188:28:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]
	templates:call(item(), element(), map(*)) [136:36:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]
	templates:process(node()*, map(*)) [132:51:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]
	templates:process(node()*, map(*)) [89:9:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]
	templates:apply(node()+, function(*), map(*)?, map(*)?) [29:5:/Users/joe/Library/Application Support/org.exist/expathrepo/templating-1.0.0/content/templates.xqm]

This error message points to docbook:load() in modules/docbook.xql, which has a $field as xs:string parameter and a %templates:default("field", "all") annotation: https://github.com/eXist-db/documentation/blob/master/src/main/xar-resources/modules/docbook.xql#L22-L24.

For some reason, with the new templating library, the function's annotation %templates:default("field", "all") is failing to inject the default value for the $field parameter (which isn't otherwise supplied on the landing page) into the function.

Looking at templates.xql in the new templating library, I can see there has been no change to the function that processes %templates:default annotations: https://github.com/eXist-db/templating/blob/master/content/templates.xqm#L282-L290.

I tried changing the function signature for docbook:load() to $field as xs:string? to make this parameter optional, which worked, but I wanted to raise this issue in case there is some larger problem with the new templating library regarding parameter injection or some undocumented workaround applications need to know about.

@wolfgangmm I'm stuck. Do you have any pointers on overcoming this issue?

Other than this, the app's styling seems to have gone wrong:

Screen Shot 2021-06-04 at 3 49 36 PM

@joewiz
Copy link
Member Author

joewiz commented Jun 6, 2021

We may want to pause on merging this PR until eXist-db/exist#3918 is resolved. The lib:parse-params templating function is affected by this issue.

Copy link
Member

@line-o line-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That all looks good to me.

@line-o
Copy link
Member

line-o commented Jun 7, 2021

What do we do about the failing tests? From what I understand they cannot be found.

@joewiz
Copy link
Member Author

joewiz commented Jun 7, 2021

@line-o I should've mentioned that I ran the tests locally, and mvn validate and mvn test succeeded. Cypress failed, but for a very strange reason:

  1 failing

  1) Documentation
       landing article
         "before each" hook for "should have content prose":
     CypressError: `cy.visit()` failed trying to load:

http://localhost:8080/exist/apps/doc/.

The `content-type` of the response we received from your web server was:

  > `application/xml`

This was considered a failure because responses must have `content-type: 'text/html'`

However, you can likely use `cy.request()` instead of `cy.visit()`.

`cy.request()` will automatically get and set cookies and enable you to parse responses.

Because this error occurred during a `before each` hook we are skipping the remaining tests in the current suite: `Documentation`

This is odd because in Chrome, Developer Tools shows that the request to http://localhost:8080/exist/apps/doc/ returns a content type of test/html. Indeed, the query that handles all requests sets this content type: https://github.com/eXist-db/documentation/blob/master/src/main/xar-resources/modules/view.xql#L14. Curl confirms this:

% curl -v http://localhost:8080/exist/apps/doc/
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /exist/apps/doc/ HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Mon, 07 Jun 2021 14:47:51 GMT
< Last-Modified: Mon, 07 Jun 2021 13:54:21 GMT
< Created: Mon, 07 Jun 2021 13:54:21 GMT
< X-XQuery-Cached: true
< Content-Type: text/html;charset=utf-8
< Vary: Accept-Encoding, User-Agent
< Transfer-Encoding: chunked
< Server: Jetty(9.4.41.v20210516)

As to the CI failures, they long predate this PR and are completely opaque to me. As far as I can tell, they should be running mvn test, but the results in CI are completely different than what I see when I run that command locally. Here's my console output for comparison, should it be of any use:

joe@choskimac-iii documentation % mvn test
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< org.exist-db:exist-documentation >------------------
[INFO] Building eXist-db Documentation 5.2.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:1.2:enforce (enforce-maven) @ exist-documentation ---
[INFO] 
[INFO] --- buildversion-plugin:1.0.3:set-properties (default) @ exist-documentation ---
[INFO] 
[INFO] --- xml-maven-plugin:1.0.2:validate (default) @ exist-documentation ---
[INFO] 
[INFO] --- ph-schematron-maven-plugin:6.1.0:validate (default) @ exist-documentation ---
[INFO] Successfully parsed Schematron file '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch'
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/xsl-transform/xsl-transform.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/xinclude/xinclude.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/incompatibilities/incompatibilities.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/contentextraction/contentextraction.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/configuration/configuration.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/documentation/documentation.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/oxygen/oxygen.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/xmldb/xmldb.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/docker/docker.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/lucene/lucene.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/getting-help/getting-help.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_rest/devguide_rest.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/production_web_proxying/production_web_proxying.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/xquery/xquery.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/xqsuite/xqsuite.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/security/security.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_xmldb/devguide_xmldb.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/triggers/triggers.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/exist-building/exist-building.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/jmx/jmx.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/http-request-session/http-request-session.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/faq_performance/faq_performance.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/author-reference/author-reference.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_manifesto/devguide_manifesto.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/xqdoc/xqdoc.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/scheduler/scheduler.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/development-starter/development-starter.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/using-collections/using-collections.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/troubleshooting/troubleshooting.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/templating/templating.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/integration-testing/integration-testing.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_indexes/devguide_indexes.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/ngram/ngram.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/extensions/extensions.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/dashboard/dashboard.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/testing/testing.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_log4j/devguide_log4j.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/uploading-files/uploading-files.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/java-admin-client/java-admin-client.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/urlrewrite/urlrewrite.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/kwic/kwic.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/deployment/deployment.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/tuning/tuning.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/webdav/webdav.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_soap/devguide_soap.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/oldrangeindex/oldrangeindex.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/upgrading/upgrading.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/update_ext/update_ext.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/xforms/xforms.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/indexing/indexing.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_codereview/devguide_codereview.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/getting-help-how-to-report/getting-help-how-to-report.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/versioning/versioning.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/devguide_xmlrpc/devguide_xmlrpc.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/backup/backup.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/legal/legal.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/newrangeindex/newrangeindex.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/learning-xquery/learning-xquery.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/repo/repo.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/beginners-guide-to-xrx-v4/beginners-guide-to-xrx-v4.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/basic-installation/basic-installation.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/validation/validation.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/advanced-installation/advanced-installation.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/production_good_practice/production_good_practice.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] Validating XML file '/Users/joe/workspace/documentation/src/main/xar-resources/data/ant-tasks/ant-tasks.xml' against Schematron rules from '/Users/joe/workspace/documentation/src/main/schematron/docbook.sch' expecting success
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ exist-documentation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 572 resources
[INFO] Copying 59 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ exist-documentation ---
[INFO] No sources to compile
[INFO] 
[INFO] --- frontend-maven-plugin:1.11.3:install-node-and-npm (install node and npm) @ exist-documentation ---
[INFO] Node v10.22.1 is already installed.
[INFO] NPM 6.14.6 is already installed.
[INFO] 
[INFO] --- frontend-maven-plugin:1.11.3:npm (npm version bump) @ exist-documentation ---
[INFO] Running 'npm version --no-git-tag-version --allow-same-version=true 5.2.1-SNAPSHOT' in /Users/joe/workspace/documentation
[INFO] v5.2.1-SNAPSHOT
[INFO] 
[INFO] --- frontend-maven-plugin:1.11.3:npm (npm install) @ exist-documentation ---
[INFO] Running 'npm ci' in /Users/joe/workspace/documentation
[INFO] npm WARN prepare removing existing node_modules/ before installation
[INFO] 
[INFO] > [email protected] install /Users/joe/workspace/documentation/node_modules/node-sass
[INFO] > node scripts/install.js
[INFO] 
[INFO] Cached binary found at /Users/joe/.npm/_cacache/node-sass/4.14.1/darwin-x64-64_binding.node
[INFO] 
[INFO] > [email protected] postinstall /Users/joe/workspace/documentation/node_modules/node-sass
[INFO] > node scripts/build.js
[INFO] 
[INFO] Binary found at /Users/joe/workspace/documentation/node_modules/node-sass/vendor/darwin-x64-64/binding.node
[INFO] Testing binary
[INFO] Binary is fine
[INFO] 
[INFO] > [email protected] install /Users/joe/workspace/documentation/node_modules/fsevents
[INFO] > node install.js
[INFO] 
[INFO]   SOLINK_MODULE(target) Release/.node
[INFO]   CXX(target) Release/obj.target/fse/fsevents.o
[INFO]   SOLINK_MODULE(target) Release/fse.node
[INFO] 
[INFO] > [email protected] postinstall /Users/joe/workspace/documentation/node_modules/cypress
[INFO] > node index.js --exec install
[INFO] 
[INFO] 
[INFO] Cypress 5.6.0 is installed in /Users/joe/Library/Caches/Cypress/5.6.0
[INFO] 
[INFO] added 1469 packages in 11.459s
[INFO] 
[INFO] --- frontend-maven-plugin:1.11.3:gulp (gulp build) @ exist-documentation ---
[INFO] Running 'gulp.js ' in /Users/joe/workspace/documentation
[INFO] [10:32:40] Using gulpfile ~/workspace/documentation/gulpfile.js
[INFO] [10:32:40] Starting 'default'...
[INFO] [10:32:40] Starting 'cleanDist'...
[INFO] [10:32:40] Finished 'cleanDist' after 12 ms
[INFO] [10:32:40] Starting 'vendorFiles'...
[INFO] [10:32:40] Finished 'vendorFiles' after 6.67 ms
[INFO] [10:32:40] Starting 'buildScripts'...
[INFO] [10:32:40] Starting 'lintScripts'...
[INFO] [10:32:40] Starting 'buildStyles'...
[INFO] [10:32:40] Starting 'buildSVGs'...
[INFO] [10:32:40] Starting 'copyFiles'...
[INFO] [10:32:40] Starting 'buildPack'...
[INFO] [10:32:40] Starting 'prettyXml'...
[INFO] [10:32:40] Finished 'buildScripts' after 928 μs
[INFO] [10:32:40] Finished 'lintScripts' after 1.6 ms
[INFO] [10:32:40] Finished 'buildStyles' after 4.53 ms
[INFO] [10:32:41] Finished 'buildSVGs' after 119 ms
[INFO] [10:32:41] Finished 'copyFiles' after 120 ms
[INFO] [10:32:41] Finished 'buildPack' after 121 ms
[INFO] [10:32:41] Finished 'prettyXml' after 124 ms
[INFO] [10:32:41] Finished 'default' after 147 ms
[INFO] Standard linter results: ✔ All OK!
[INFO] 
[INFO]   Replace Autoprefixer browsers option to Browserslist config.
[INFO]   Use browserslist key in package.json or .browserslistrc file.
[INFO] 
[INFO]   Using browsers option can cause errors. Browserslist config 
[INFO]   can be used for Babel, Autoprefixer, postcss-normalize and other tools.
[INFO] 
[INFO]   If you really need to use option, rename it to overrideBrowserslist.
[INFO] 
[INFO]   Learn more at:
[INFO]   https://github.com/browserslist/browserslist#readme
[INFO]   https://twitter.com/browserslist
[INFO] 
[INFO] 
[INFO] 
[INFO]   Replace Autoprefixer browsers option to Browserslist config.
[INFO]   Use browserslist key in package.json or .browserslistrc file.
[INFO] 
[INFO]   Using browsers option can cause errors. Browserslist config 
[INFO]   can be used for Babel, Autoprefixer, postcss-normalize and other tools.
[INFO] 
[INFO]   If you really need to use option, rename it to overrideBrowserslist.
[INFO] 
[INFO]   Learn more at:
[INFO]   https://github.com/browserslist/browserslist#readme
[INFO]   https://twitter.com/browserslist
[INFO] 
[INFO] 
[INFO] 
[INFO]   Replace Autoprefixer browsers option to Browserslist config.
[INFO]   Use browserslist key in package.json or .browserslistrc file.
[INFO] 
[INFO]   Using browsers option can cause errors. Browserslist config 
[INFO]   can be used for Babel, Autoprefixer, postcss-normalize and other tools.
[INFO] 
[INFO]   If you really need to use option, rename it to overrideBrowserslist.
[INFO] 
[INFO]   Learn more at:
[INFO]   https://github.com/browserslist/browserslist#readme
[INFO]   https://twitter.com/browserslist
[INFO] 
[INFO] 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ exist-documentation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/joe/workspace/documentation/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ exist-documentation ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ exist-documentation ---
[INFO] No tests to run.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  21.576 s
[INFO] Finished at: 2021-06-07T10:32:41-04:00
[INFO] ------------------------------------------------------------------------

@duncdrum
Copy link
Contributor

duncdrum commented Jun 7, 2021

@joewiz can you rebase this?

@joewiz
Copy link
Member Author

joewiz commented Jun 8, 2021

@duncdrum Sure, I've rebased it. Tests (i.e., mvn test) pass locally.

@line-o
Copy link
Member

line-o commented Jun 8, 2021

I just checked out the PR and packaged the app. Running npm test with the newly built package installed succeeds. That means that cypress tests are green. It is some issue with the CI settings perhaps.

Side note: In the job details it states frontend-maven-plugin:1.12.0:npm but when I run a maven command I only get frontend-maven-plugin:1.11.3:npm. How can that be?

@duncdrum
Copy link
Contributor

duncdrum commented Jun 8, 2021

@line-o this does not look like a config problem with the CI. Dependabot and my PR are working fine, the response from the exist container is not what the test result parser expects. This is now all configured via maven as for how you have a differet version on a clean checkout i have no idea….mvn

@joewiz
Copy link
Member Author

joewiz commented Jun 8, 2021

@duncdrum Is there a problem with this PR causing the CI failure, or is getting these CI checks to pass simply a matter of getting your PR (#632) merged and rebasing this one with your CI fixes?

@line-o
Copy link
Member

line-o commented Jun 8, 2021

Ah! of course!

@line-o
Copy link
Member

line-o commented Jun 8, 2021

@joewiz that would totally explain a failure, but the messages are telling a different story.
I am happy to merge this PR as I have tested the changes myself and tests run green on two different machines.

@joewiz
Copy link
Member Author

joewiz commented Jun 8, 2021

With #632 merged, I rebased again, and CI tests on this branch appear to still be failing when executing the mocha test that calls the XQsuite test suite:

[INFO]   running XQsuite test …
[INFO]             1) returns 0 errors or failures
[INFO]           
[INFO]           
[INFO]             0 passing (105ms)
[INFO]             1 failing
[INFO]           
[INFO]             1) running XQsuite test …
[INFO]                  returns 0 errors or failures:
[INFO]                TypeError: Cannot read property 'tests' of undefined
[INFO]                 at Test.<anonymous> (src/test/mocha/xqSuite.js:22:43)
[INFO]                 at Test.assert (node_modules/supertest/lib/test.js:209:6)
[INFO]                 at localAssert (node_modules/supertest/lib/test.js:159:12)
[INFO]                 at /home/runner/work/documentation/documentation/node_modules/supertest/lib/test.js:156:5
[INFO]                 at Test.Request.callback (node_modules/superagent/lib/node/index.js:905:3)
[INFO]                 at /home/runner/work/documentation/documentation/node_modules/superagent/lib/node/index.js:1127:20
[INFO]                 at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/parsers/json.js:22:7)
[INFO]                 at endReadableNT (_stream_readable.js:1145:12)
[INFO]                 at process._tickCallback (internal/process/next_tick.js:63:19)

This is strange, because on my local system, xqSuite.js's call to http://localhost:8080/exist/rest/db/apps/doc/modules/test-runner.xql returns with the following application/json data that clearly has the testsuite.tests object:

{
    "testsuite": {
        "package": "http://exist-db.org/xquery/documentation/tests",
        "timestamp": "2021-06-08T13:00:44.146-04:00",
        "tests": "6",
        "failures": "0",
        "errors": "0",
        "pending": "1",
        "time": "PT1.419S",
        "testcase": [
            {
                "name": "Listing consistency",
                "class": "tests:equal-listing"
            },
            {
                "name": "section-headings",
                "class": "tests:missing-id"
            },
            {
                "name": "Pro angular brackets",
                "class": "tests:no-ecaped-listings"
            },
            {
                "name": "wellformed xml",
                "class": "tests:no-txt-xmls",
                "pending": null
            },
            {
                "name": "diagnose listings",
                "class": "tests:orphan-listing"
            },
            {
                "name": "ToC rendering",
                "class": "tests:toc-inline"
            }
        ]
    }
}

Why is CI not able to see this? Perhaps the test-runner.xql query isn't running at all?

@duncdrum
Copy link
Contributor

duncdrum commented Jun 8, 2021

My guess is that #597 introduced a new timing issue, we're now calling the db much earlier then we used to Travis. Unlike, e.g. #632 if the new templating adds startup delay to exist, we probably asking the test to run, before exist is ready.

@joewiz
Copy link
Member Author

joewiz commented Jun 8, 2021

@duncdrum Interesting. I tried extending this.timeout from 95s to 5m, and tests still failed. Then I realized you meant the problem is that the tests might be starting too early (not taking too long), so that was the wrong approach. I don't know how to force mocha to wait longer before starting.

That said, templates v1.0.2 is only 9k, is a library module that installs basically instantly, and with my PR the documentation app is faster than before - loading in 230-250ms. (The current stable version loads in 240-260ms.)

Is there any way to add some logging to have a better idea of what mocha actually receives when it requests test-runner.xql? All it tells us now is that it doesn't see the tests object. We don't know what it does receive. Seeing if it's a mis-serialized object, an error code, or something else could help us try various fixes.

@joewiz joewiz changed the title Switch to the new templating module Switch to the new templating module, remove shared-resources dependency Jun 8, 2021
@joewiz
Copy link
Member Author

joewiz commented Jun 8, 2021

@duncdrum Thanks for pointing out that you had long ago removed dependencies on shared-resources. I just cleared up a couple of lingering references to it.

@line-o
Copy link
Member

line-o commented Jun 9, 2021

The tests still run on node 10 also a possible source of problems.

@joewiz
Copy link
Member Author

joewiz commented Jun 9, 2021

Oops! Not sure how I managed to close it.

@joewiz joewiz reopened this Jun 9, 2021
@joewiz
Copy link
Member Author

joewiz commented Jun 9, 2021

@line-o I rebased and bumped node.version to 14 in my latest commit, but, alas, the error seems to be unchanged - "Cannot read property 'tests' of undefined":

[INFO] --- frontend-maven-plugin:1.12.0:npm (mocha tests) @ exist-documentation ---
[INFO] Running 'npm test' in /home/runner/work/documentation/documentation
[INFO] 
[INFO] > [email protected] test /home/runner/work/documentation/documentation
[INFO] > mocha src/test/mocha/ --recursive --exit
[INFO] 
[INFO] 
[INFO] 
[INFO]   running XQsuite test …
[INFO]             1) returns 0 errors or failures
[INFO]           
[INFO]           
[INFO]             0 passing (125ms)
[INFO]             1 failing
[INFO]           
[INFO]             1) running XQsuite test …
[INFO]                  returns 0 errors or failures:
[INFO]                TypeError: Cannot read property 'tests' of undefined
[INFO]                 at Test.<anonymous> (src/test/mocha/xqSuite.js:22:43)
[INFO]                 at Test.assert (node_modules/supertest/lib/test.js:209:6)
[INFO]                 at localAssert (node_modules/supertest/lib/test.js:159:12)
[INFO]                 at /home/runner/work/documentation/documentation/node_modules/supertest/lib/test.js:156:5
[INFO]                 at Test.Request.callback (node_modules/superagent/lib/node/index.js:905:3)
[INFO]                 at /home/runner/work/documentation/documentation/node_modules/superagent/lib/node/index.js:1127:20
[INFO]                 at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/parsers/json.js:22:7)
[INFO]                 at endReadableNT (internal/streams/readable.js:1336:12)
[INFO]                 at processTicksAndRejections (internal/process/task_queues.js:82:21)

@line-o line-o mentioned this pull request Jun 10, 2021
@line-o
Copy link
Member

line-o commented Jun 10, 2021

@joewiz since you bumped the node version would you please add the updated package-lock.json to version control.

@line-o
Copy link
Member

line-o commented Jun 10, 2021

Why did you choose npm version 6.14.13, is that the recommended version for long term support?

@line-o
Copy link
Member

line-o commented Jun 10, 2021

I think it is safe to use npm v7.16.0 (the current stable release).

@line-o line-o mentioned this pull request Jun 10, 2021
@joewiz
Copy link
Member Author

joewiz commented Jun 10, 2021

@line-o I went with 6.4.13 because https://nodejs.org/en/download/ says:

Latest LTS Version: 14.17.0 (includes npm 6.14.13)

I think I'll wait for progress on #638 before taking further action here - to avoid crossing streams.

@joewiz
Copy link
Member Author

joewiz commented Jun 11, 2021

Since node/npm issues are being pursued through #638, I removed the node/npm commit and force-pushed the branch.

This branch still fails CI checks, though of course they still pass locally.

Fingers crossed we can resolve the CI issue through #638.

Worst case scenario, so as not to hold up eXist 5.3.0: we can publish a new release of the documentation from master, despite its continued dependency on shared-resources (namely, the templates call to site:expand-links here, the templates calls here, and expath-pkg.xml—dependencies which this PR removed by switching to the new templating library). Master is passing CI, so publishing from master would at least give us up-to-date documentation and a stable basis to continue to pursue CI issues.

@joewiz joewiz force-pushed the templating branch 5 times, most recently from 5b37ada to a76bdce Compare June 11, 2021 22:48
@joewiz
Copy link
Member Author

joewiz commented Jun 11, 2021

With master reliably passing CI, I rebased this PR against master and hoped this branch would now pass. Alas, it still failed with the same missing tests object. Earlier, when staring at similar results, I mused:

Is there any way to add some logging to have a better idea of what mocha actually receives when it requests test-runner.xql? All it tells us now is that it doesn't see the tests object. We don't know what it does receive. Seeing if it's a mis-serialized object, an error code, or something else could help us try various fixes.

So in my latest commit I added logging to the mocha/xqSuite.js file. Now, (a) the actual error is returned, and (b) the body of eXist's response to the request for modules/test-runner.xql is serialized.

Here's what we can now see in the CI logs:

[INFO] DOCKER> [existdb/existdb:latest] "existdb-docs-tests": Waited on log out 'Server has started, listening on' 5033 ms
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.0:npm (mocha tests) @ exist-documentation ---
[INFO] Running 'npm test' in /home/runner/work/documentation/documentation
[INFO] 
[INFO] > [email protected] test /home/runner/work/documentation/documentation
[INFO] > mocha src/test/mocha/ --recursive --exit
[INFO] 
[INFO] 
[INFO] 
[INFO]   running XQsuite test …
[INFO] response body: {"servlet":"EXistServlet","message":"Document /db/apps/doc/modules/test-runner.xql not found","url":"/exist/rest/db/apps/doc/modules/test-runner.xql","status":"404"}
[INFO]     1) returns 0 errors or failures
[INFO] 
[INFO] 
[INFO]   0 passing (129ms)
[INFO]   1 failing
[INFO] 
[INFO]   1) running XQsuite test …
[INFO]        returns 0 errors or failures:
[INFO]      Error: expected 200 "OK", got 404 "Not Found"

This tells me that even though eXist has started (meaning the doc xar MUST be running since in CI, the xar is deposited into the autodeploy directory, and eXist always installs autodeploy xars before it reports "Server has started, listening on"), the request to modules/test-runner.xql is failing with a 404 not found error. The response body explains the earlier "Cannot read property 'tests' of undefined", because eXist returned the 404 error, and the JSON body didn't have a "tests" object.

The identical tests pass with no problem on my local system.

Why would a request to http://localhost:8080/exist/rest/db/apps/doc/modules/test-runner.xql fail in the CI context if eXist had already installed the doc app?

Is it possible the app hasn't actually been installed yet even though eXist has started?

Has the CI somehow cached some stale assets from before we solved the CI problems with master?

@line-o
Copy link
Member

line-o commented Jun 12, 2021

I was also not able to reproduce the issue on my local machine.
xqSuite.js uses the rest server. So we could try if switching to a request that goes through XQueryURLrewrite and see if that changes something. On my local machine the tests passed this way as well. And it is also a good reminder that the controller could be a little more restrictive.

diff --git a/src/test/mocha/xqSuite.js b/src/test/mocha/xqSuite.js
index 8859130..5b7f286 100644
--- a/src/test/mocha/xqSuite.js
+++ b/src/test/mocha/xqSuite.js
@@ -6,7 +6,7 @@ var client = supertest.agent('http://localhost:8080')
 describe('running XQsuite test …', function () {
   this.timeout(95000)
   this.slow(60000)
-  const runner = '/exist/rest/db/apps/doc/modules/test-runner.xql'
+  const runner = '/exist/apps/doc/modules/test-runner.xql'

   it('returns 0 errors or failures', function (done) {
     client

But as already established the problem seems to be that the test-runner.xql is missing.
So here is my current hypothesis:

  • the build process adds a documentation XAR package to auto deploy
  • this one has a higher version than the one that is currently bundled with exist and is therefore installed
  • the new dependency on templating 1.0.2 cannot be met
  • installation fails
  • test-runner.xql cannot be found

@line-o
Copy link
Member

line-o commented Jun 12, 2021

If we find the above thesis to be true, then the installation process needs to either:

  • retrieve the templating package manually until it comes bundled with the docker image (there are examples how to do that in maven)
  • use a newer docker image where templating is already part of
  • be installed using the normal package installation process which is able to retrieve missing dependencies

@line-o
Copy link
Member

line-o commented Jun 12, 2021

@joewiz @adamretter @duncdrum Does one of you remember where the example for getting a specific dependency with maven is?

@line-o
Copy link
Member

line-o commented Jun 12, 2021

Hmm I had a look around but could not find a maven task nor a GitHub Workflow. No I start to doubt my memory on this.
If we do not have a solution in place we need to pick one of the above.

@adamretter
Copy link
Contributor

@line-o The facility was already part of the build, it was still pointing at the old shared-resources, I just updated it to fetch templating.

@line-o line-o merged commit 4d06731 into eXist-db:master Jun 12, 2021
@joewiz joewiz deleted the templating branch June 12, 2021 16:07
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.

4 participants