Give the script its callback URL without a query string, as the .NET builder does - #143
Conversation
….NET builder does The Java builder appended every query evidence value to the URL the rendered script requests, so the same request gave a different script in Java than in .NET. The URL is now protocol, host, context root and endpoint only, and the query evidence reaches the script through the serialized parameters object as before. getQueryParams had no other caller and is removed.
Proven in CIFull build and test run on this branch: https://github.com/51Degrees/pipeline-java/actions/runs/35189330497 A draft pull request only runs the link lint, so the Pull Requests workflow was dispatched against this branch as a dry run to get real evidence. Nothing was merged, and the log shows why: with no pull request based on this branch the run builds the branch on its own as pull request 0, and the checkout and completion steps both print "Not running for a PR". All 15 jobs finished green, being 11 build and test jobs (Java 8, 11, 17 and 21 on Ubuntu and Windows, and Java 11, 17 and 21 on macOS), the pull request lookup, the configure step, the performance comparison and the completion step. Reading the job logs rather than the conclusions, each job reports 23 Maven module summaries, and on Java 11 and later they add up to 627 tests run with 0 failures, 0 errors and 0 skipped. Java 8 runs 612, the difference being the tests that need a later Java. The log contains no "BUILD FAILURE", no "FAILURES!", no "ERRORS!" and no summary line with a non-zero failure or error count. The pull request has not been marked ready and no review has been requested. |
Problem
Every builder must render the same script for the same request. The .NET
JavaScript builder gives the script a callback URL made of protocol, host and
endpoint only (
urlString = $"{protocol}://{host}{endpoint}"inJavaScriptBuilderElement.cs),and passes the query evidence separately as the serialized parameters object.
The Java builder also appended every query evidence value to the URL
(
JavaScriptBuilderElement.javalines 158 to 161).A script rendered with
query.user-agent=iPhoneandquery.id.usage=non-marketingrequestedhttps://example.com/json?id.usage=non-marketing&user-agent=iPhone, where.NET renders
https://example.com/json. The Python builder had the samefault and was fixed in
pipeline-python pull request 87.
What changed
JavaScriptBuilderElement.getUrlbuilds protocol, host, context root andendpoint, with no query string. The query evidence still reaches the script
through the serialized parameters object, which is unchanged.
getQueryParamshad no other caller, so it is removed.JavaScriptUrlTests, renders the script without abrowser.
Url_CarriesNoQueryEvidencechecks that every URL the script requestsis
https://example.com/jsonand that the parameters object still holdsuser-agentandid.usage.Url_KeepsContextRootchecks that a context root of/app/giveshttps://example.com/app/json.Verification
Without the change, both new tests fail.
With the change, the module's tests that need no browser pass, both with the
template this repository records and with
javascript-templates
mainatede377ccswapped in locally.Outstanding
JavaScriptBuilderTestsstarts Chrome and was not run locally, so it will runin CI. Its URL test (
JavaScriptBuilderElement_VerifyUrl) expectshttps://localhost/jsonand its parameter tests read the values from thescript body, so neither depends on the query string that this change removes.
Overlap with other work
Three drafts change
pipeline.javascriptbuilder/.../JavaScriptBuilderElement.java, being thisone, the object name draft
#144 and the session
id and sequence draft
#145. Every pair was
merged locally, in both directions, and all six merges are clean. Merging
all three together is clean too, and the result keeps one
import java.util.regex.Pattern, onegetUrl(protocol, host)with nocaller left passing a query string, and the
int sequencefrom #145.That three way merge was then built and tested with
mvn -o -pl pipeline.javascriptbuilder -am test -Dtest='!JavaScriptBuilderTests',leaving out the test that starts a browser:
So the three can land in any order without a merge.
The same change in the other ports
CI on this branch, 17 September 2026
The "Pull Requests" workflow was dispatched on this branch with
dryrun=true,which builds the branch and merges nothing. Run
35189330497
ran on
157cb4c, the head of this branch, and concluded success with all15 jobs green across the 11 Java and operating system configurations. In the
Ubuntu_Java_21job the Maven totals are 627 tests run, 0 failures, 0 errorsand 6 skipped, with no error lines in the log, and the new
fiftyone.pipeline.javascriptbuilder.JavaScriptUrlTestsruns 2 tests andpasses both.
This branch is three commits behind
mainand merges into it cleanly.The nightly checks out the pull request, merges
maininto it and buildsthat before it merges anything, so the combination is tested there.