FIX: Create the creator context demo's 51Did through the client script - #146
Conversation
The demo page created its 51Did with a call of its own to the json endpoint. The cloud release now in production issues an identifier only once the page has run the snippets the service asks for and sent what they collected, so that call comes back with every identifier null and a reason in the matching nullreason field, and the first row of the demo failed. The page now loads the 51Degrees client script for its resource key, carrying the usage and the email address on the script's own address, and takes the identifier from what the script reports through its complete function. It also sends every cookie whose name begins 51D_ with the verify-full call, because the service compares this browser's device and browser against the creator's from those values and answers that the page has not sent them yet rather than giving a verdict. A Node harness runs the page's script against a small stand in for a browser, and CreatorContextPageTests pins what the page does. The page also ends with a Find out more section.
Proven in CIFull build and test run on this branch: https://github.com/51Degrees/pipeline-java/actions/runs/35186948063 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 632 tests run with 0 failures, 0 errors and 0 skipped. Java 8 runs 617, 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
The creator context demo page created its 51Did with a call of its own to
the
jsonendpoint. The cloud release now in production issues anidentifier only once the page has run the snippets the service asks for
and sent what they collected, so that call comes back with every
identifier null and a reason in the matching
nullreasonfield.Asked with a browser User-Agent and the same parameters the page used,
against
https://cloud.51degrees.comon 17 September 2026, every one ofthe six identifiers came back null, each with a reason of this shape.
The page then read
json.fodid.idproblic || json.fodid.idprobglobal,which is null, and the first row of the demo failed.
There is a second fault on the same page. The verification call is made
from the browser and the service compares this browser's device and
browser against the creator's from the snippet values. Where a browser
needs those values and the request does not carry them, the service does
not give a verdict and says that the page has not sent them yet.
What changed
pipeline.developer-examples/pipeline.developer-examples.fodid/src/main/resources/fodid/creator-context/page.htmlcarrying
id.usageandid.emailon the script's own address, andtakes the identifier from what the script reports through its
completefunction. The service puts both parameters into therequest the script makes, which was checked against the live service
by fetching the script with them and reading the evidence it builds,
where they appear as
{"id.usage":"non-marketing","id.email":...}.that checks an identifier pasted in from another browser, because the
comparison needs this browser's values either way.
51D_, which is how the client scriptstores what the snippets collected, is sent with the
verify-fullcall. Forwarding by prefix rather than by a list means the page does
not fall behind the script when the set of snippets changes.
before, giving the reader the 51Degrees documentation and a way to
get in touch, plus the repositories the demo is built from.
CreatorContextDemoServer.javaand the module'sREADME.mdsay whatsteps one and two now do.
src/test/resources/fodid/creator-context/creator-context-page-harness.jsruns the page's script in Node against a small stand in for a browser, with a stand in client script
that reports six identifiers and writes two
51D_cookies, and printswhat the page asked for as one line of JSON. Nothing in it reaches a
network.
src/test/java/pipeline/developerexamples/fodid/CreatorContextPageTests.javachecks that the page loads the client script once with the usage on
its address, that it makes no
request of its own for an identifier, that the identifier the script
reported is the one verified and is made safe for a URL, that the
snippet values go with the verification and unrelated cookies do not,
that the sealed result is redeemed on the demo's own server, that the
page ends with the Find out more section, and that the page's script
parses under
node --check.the build output and the tests find both on the class path.
Verification
mvn -pl pipeline.developer-examples/pipeline.developer-examples.fodid test, Maven 3.9.16 with JDK 21 on Windows:Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, being the sevennew page tests and the nine that were already there.
page.htmlput back to the version onmainand nothing else changed, the seven new tests giveTests run: 7, Failures: 6, the one that still passes being the parsecheck, which the old page also passes. One of the failures names the
call the old page made,
https://cloud.51degrees.com/api/v4/json?resource=.... Putting thefixed page back returns
Tests run: 7, Failures: 0.entitled to the 51Did properties. The call the old page made returns
all six identifiers null with the reason above. The same call carrying
the five snippet values returns all six identifiers.
id.usage=non-marketingandid.email=...on its address. It parsesunder
node --check, it carries both parameters in the evidence itsends, and it leaves an object named
fodwith acompletefunction,which is what the page reads.
Outstanding
language packages, which are handled separately.
The same change in the other ports
The Node port of this change is
pipeline-node#208.
Overlap with other work in this repository
#140 changes the same
demo server. The two were merged locally in both directions and both merges
are clean.
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
35186948063
ran on
e90b52b, the head of this branch, and concluded success with all 15jobs green. In the
Ubuntu_Java_21job the Maven totals are 632 tests run, 0failures, 0 errors and 6 skipped, with no error lines in the log.
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.