Skip to content

Send the whole evidence name to the cloud service, so id.usage arrives and a 51Did is created - #142

Merged
Automation51D merged 1 commit into
mainfrom
fix/cloud-evidence-name-dots
Sep 17, 2026
Merged

Automation51D merged 1 commit into
mainfrom
fix/cloud-evidence-name-dots

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

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.java line 301).
An evidence name that holds a dot of its own therefore loses everything after
it, so query.id.usage is posted as id and header.id.email as id too.

The cloud service creates no 51Did unless id.usage is sent. A server that
uses this engine and adds query.id.usage therefore never gets a 51Did, with
no 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-agent
evidence and query.id.usage=non-marketing:

Top level elements in the response fodid.idprobglobal
Before this change ip, javascriptProperties, location, device, derived absent (no fodid element)
After this change fodid, ip, javascriptProperties, location, device, derived present, 196 characters

The same check with the paid resource key and no licence gave no fodid
element before and idprobglobal and idrandglobal after. A direct POST
confirmed the cause, because id=non-marketing returns no fodid element and
id.usage=non-marketing returns one.

The engine's HTTP User-Agent header is the Java runtime default
(Java/21.0.11 here), captured from a request made by HttpClientDefault.
The end user's User-Agent only travels as the user-agent form field, which
is what cloud release 4.4.38 needs for a server to get a 51Did on its first
call.

What changed

  1. CloudRequestEngineDefault.addFormData splits the evidence key at the
    first separator only.
  2. Two tests in CloudRequestEngineTests.
    getFormData_KeepsDotsInEvidenceName checks the form data holds
    id.usage and id.email and no id, and
    process_PostsWholeEvidenceName checks the posted body carries
    id.usage=non-marketing.

Verification

Without the fix, both new tests fail.

CloudRequestEngineTests.getFormData_KeepsDotsInEvidenceName:491 expected: <non-marketing> but was: <null>
CloudRequestEngineTests.process_PostsWholeEvidenceName:521 The posted body does not carry id.usage: [resource=resourcekey, id=non-marketing] ==> expected: <true> but was: <false>
Tests run: 27, Failures: 2, Errors: 0, Skipped: 0

With the fix, mvn test -pl pipeline.cloudrequestengine passes.

Tests run: 8, Failures: 0, Errors: 0, Skipped: 0 - in CloudAspectEngineBaseTests
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0 - in CloudRequestEngineBuilderTests
Tests run: 27, Failures: 0, Errors: 0, Skipped: 0 - in CloudRequestEngineTests
Tests run: 39, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS

Outstanding

An evidence key with no separator at all still fails at
evidenceKeyParts[1], as it did before this change. This change leaves that
case 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.

…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.
@jwrosewell

Copy link
Copy Markdown
Contributor Author

Proven in CI

Full 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.

@Automation51D
Automation51D merged commit 16b3b46 into main Sep 17, 2026
31 checks passed
@Automation51D
Automation51D deleted the fix/cloud-evidence-name-dots branch September 17, 2026 15:44
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.

3 participants