Send the whole evidence name to the cloud service, so id.usage arrives and a 51Did is created - #142
Conversation
…rrives and a 51Did is created The cloud request engine split each evidence key at every dot and sent only the second part, so query.id.usage was posted as id and query.id.email as id. The cloud service creates no 51Did unless id.usage is sent, so a server using the engine never received one. The key is now split at the first dot only, which matches the .NET engine.
Proven in CIFull build and test run on this branch: https://github.com/51Degrees/pipeline-java/actions/runs/35186425062 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. "BUILD SUCCESS" appears 44 times and 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 cloud request engine turns each piece of evidence into a form field by
cutting the evidence key at its dots and keeping only the second part
(
CloudRequestEngineDefault.javaline 301).An evidence name that holds a dot of its own therefore loses everything after
it, so
query.id.usageis posted asidandheader.id.emailasidtoo.The cloud service creates no 51Did unless
id.usageis sent. A server thatuses this engine and adds
query.id.usagetherefore never gets a 51Did, withno error to say why. The .NET engine keeps everything after the first dot.
What was checked
Against production (cloud release 4.4.38), with a 51Did resource key and
licence, the end user's browser User-Agent sent as
header.user-agentevidence and
query.id.usage=non-marketing:fodid.idprobglobalfodidelement)The same check with the paid resource key and no licence gave no
fodidelement before and
idprobglobalandidrandglobalafter. A direct POSTconfirmed the cause, because
id=non-marketingreturns nofodidelement andid.usage=non-marketingreturns one.The engine's HTTP
User-Agentheader is the Java runtime default(
Java/21.0.11here), captured from a request made byHttpClientDefault.The end user's User-Agent only travels as the
user-agentform field, whichis what cloud release 4.4.38 needs for a server to get a 51Did on its first
call.
What changed
CloudRequestEngineDefault.addFormDatasplits the evidence key at thefirst separator only.
CloudRequestEngineTests.getFormData_KeepsDotsInEvidenceNamechecks the form data holdsid.usageandid.emailand noid, andprocess_PostsWholeEvidenceNamechecks the posted body carriesid.usage=non-marketing.Verification
Without the fix, both new tests fail.
With the fix,
mvn test -pl pipeline.cloudrequestenginepasses.Outstanding
An evidence key with no separator at all still fails at
evidenceKeyParts[1], as it did before this change. This change leaves thatcase alone.
The same change in the other ports
pipeline-node#204
makes the same fix in the Node cloud request engine. The two ports differ in
the case left alone above: Java keeps throwing for an evidence key with no
separator at all, whereas Node now sends the whole key as the name.