Skip to content

Test the repeat rule in one session, and the values added beside the web request - #136

Merged
jwrosewell merged 1 commit into
rcfrom
test/usage-sharing-session-and-values
Nov 14, 2026
Merged

jwrosewell merged 1 commit into
rcfrom
test/usage-sharing-session-and-values

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Two of James Rosewell's usage sharing rules of 13 and 14 November had no test in Java, found in the cross-language check of usage sharing on 14 November.

  1. The session id and the sequence never enter the repeat comparison, and are always written to the record. ShareUsageElement_RepeatWithNewSequence_NotShared tests the first half in a broader form, changing the session id as well as the sequence, but nothing tests that within one session a request with a changed value is shared again, with the same SessionId and its own Sequence.
  2. Usage sharing shares all the Evidence given to the Pipeline. Nothing tests that values an application adds to the Evidence beside the web request, such as the JA4 and HTTP/2 fingerprints and the billing keys, reach the usage sharing message.

The specification says, in usage-sharing-element.md lines 76 to 79 at c8128ca4, "A Pipeline that authenticates the requests it serves with a Resource Key or a License Key MUST hold them as the Evidence fiftyone.resource-key and fiftyone.license-key, and the filter function MUST return true for both, whatever the configuration, because usage is counted against them." Lines 296 to 299 say "certain Evidence values MUST NOT be included in the generation of this hash code as they are designed to make a request unique. For example, the sequence number generated by the Sequence Element."

The code on rc already meets both rules (EvidenceKeyFilterShareUsageTracker.include refuses both keys, and ShareUsageEvidence.find keeps every Evidence value beside the web request's), so this draft adds tests only.

What changed and why

  • ShareUsageElementTests.ShareUsageElement_OneSession_ChangedValueSharedWithItsSequence sends three requests in one session, the second differing from the first only in its sequence and the third with 51D_ScreenPixelsWidth changed. It expects two records, with the same SessionId, Sequence 1 and 3, and each record's own screen width.
  • UsageSharingEvidenceTests.AddedEvidence_ReachesTheUsageSharingMessage sends a request through the web integration into a Pipeline whose Usage Sharing Element posts to a local HTTP endpoint, with server.ja4, server.h2, fiftyone.resource-key and fiftyone.license-key added to the Evidence beside the web request. It reads the message the endpoint receives and finds each of the four, and the request's own X-Test header, with its value.
  • The end-to-end test that #127 added, UnreadHeader_ReachesTheUsageSharingMessage, now starts the endpoint, builds the Pipeline and reads the message through three helpers the new test shares. Its assertions are unchanged.

Tests only, so no package is released for them.

Tests

Both tests pass on rc, so each red is a throwaway change to the code that breaks the rule the test covers. The throwaway branches hold 72bae537 and a temporary workflow that runs mvn -Pdev -pl pipeline/pipeline.engines.fiftyone,pipeline/pipeline.web.packages/pipeline.web -am test with only ShareUsageElementTests and UsageSharingEvidenceTests, on ubuntu-latest with Java 17 as the full build's Ubuntu_Java_17 entry does.

  • Red, run 43582656027 on tmp/java-usage-red, which holds 72bae53 and 2745b765, a throwaway commit that lets the sequence into the repeat comparison (EvidenceKeyFilterShareUsageTracker.include refuses only the session id) and drops the Evidence given beside the web request (ShareUsageEvidence.find keeps only the request's values). ShareUsageElement_OneSession_ChangedValueSharedWithItsSequence failed with "Only the first request and the one with a changed value should be shared ==> expected: <2> but was: <3>", and AddedEvidence_ReachesTheUsageSharingMessage with "server.ja4 was not shared. expected:<t13d1516h2_8daaf6152771_02713d6af862> but was:". Two existing tests failed with them, ShareUsageElement_RepeatWithNewSequence_NotShared (2 records, not 1) and ShareUsageElement_WebRequest_SharesWhatNoOtherElementAccepts (the request's User-Agent in place of the Evidence's), and UnreadHeader_ReachesTheUsageSharingMessage passed, as the request's own values were still shared.
  • Green, run 43582663269 on tmp/java-usage-green, which holds 72bae53 alone. ShareUsageElementTests ran 26 with 1 skipped, the test that is disabled on rc, and UsageSharingEvidenceTests passed 7 of 7.
  • Two earlier runs on the runner's default JDK, 25.0.5, stopped in PMD before any test ran, so they were cancelled and the throwaway workflow was moved to Java 17.

Full build

Run 43583344095 built 72bae53 merged with rc (ceab088) on nine configurations, Ubuntu x64 with Java 8, 11, 17 and 21, Ubuntu arm64 with Java 17, and Windows with Java 8, 11, 17 and 21, and every job passed. ShareUsageElementTests ran 26 with 1 skipped and UsageSharingEvidenceTests passed 7 of 7 in all nine jobs. Each of its ten Setting 'PullRequestSha' lines names 72bae53, and its Configure job printed "Left out 6 macOS entries".

macOS was left out of this draft's full build under the 9 November decision. The rc head is built with macOS before it merges into main.

Base branch

rc at ceab088. rc has since taken #63, #83 and #115, and a trial merge with rc at 1c99b72 was clean on 14 November at 11:55 UTC.

What remains

  • Platform still gives the operating system's name with no version, which point 7 of #28 covers with the rest of the record's form.

…web request

In one session, a request that differs only in its sequence is not
shared again, and a later one with a 51D_ value changed is, with the
same SessionId and its own Sequence. Through the web integration, JA4,
the HTTP/2 fingerprint and both billing keys added to the Evidence reach
the usage sharing message with the request's own values. The end-to-end
test's server, Pipeline and message reading become helpers both tests
use.
@jwrosewell
jwrosewell marked this pull request as ready for review November 14, 2026 12:31
@jwrosewell
jwrosewell merged commit 23e0fc6 into rc Nov 14, 2026
3 checks passed
@jwrosewell
jwrosewell deleted the test/usage-sharing-session-and-values branch November 14, 2026 12:31
jwrosewell added a commit that referenced this pull request Nov 15, 2026
… 9110 ask (#67)

Closes #11. This brings the client-side JavaScript and JSON endpoints of the web integration, served by both the servlet filter and the Spring interceptor, in line with the [Cache header detail](https://github.com/51Degrees/specifications/blob/6570727d2af6967390d3c4fbec77b9cf0540d3f3/pipeline-specification/features/web-integration.md#cache-header-detail) section of the web integration specification, quoted below at [6570727d](51Degrees/specifications@6570727), the head of the specifications `main` branch. That section was written by [51Degrees/specifications#53](51Degrees/specifications#53), [#81](51Degrees/specifications#81), [#115](51Degrees/specifications#115), [#121](51Degrees/specifications#121) and [#136](51Degrees/specifications#136), all merged.
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.

1 participant