Repository navigation
Test the repeat rule in one session, and the values added beside the web request - #136
Merged
Merged
Conversation
…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
marked this pull request as ready for review
November 14, 2026 12:31
This was referenced Nov 14, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
ShareUsageElement_RepeatWithNewSequence_NotSharedtests 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.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-keyandfiftyone.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
rcalready meets both rules (EvidenceKeyFilterShareUsageTracker.includerefuses both keys, andShareUsageEvidence.findkeeps every Evidence value beside the web request's), so this draft adds tests only.What changed and why
ShareUsageElementTests.ShareUsageElement_OneSession_ChangedValueSharedWithItsSequencesends three requests in one session, the second differing from the first only in its sequence and the third with51D_ScreenPixelsWidthchanged. It expects two records, with the same SessionId, Sequence 1 and 3, and each record's own screen width.UsageSharingEvidenceTests.AddedEvidence_ReachesTheUsageSharingMessagesends a request through the web integration into a Pipeline whose Usage Sharing Element posts to a local HTTP endpoint, withserver.ja4,server.h2,fiftyone.resource-keyandfiftyone.license-keyadded to the Evidence beside the web request. It reads the message the endpoint receives and finds each of the four, and the request's ownX-Testheader, with its value.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 runsmvn -Pdev -pl pipeline/pipeline.engines.fiftyone,pipeline/pipeline.web.packages/pipeline.web -am testwith onlyShareUsageElementTestsandUsageSharingEvidenceTests, onubuntu-latestwith Java 17 as the full build'sUbuntu_Java_17entry does.tmp/java-usage-red, which holds 72bae53 and 2745b765, a throwaway commit that lets the sequence into the repeat comparison (EvidenceKeyFilterShareUsageTracker.includerefuses only the session id) and drops the Evidence given beside the web request (ShareUsageEvidence.findkeeps only the request's values).ShareUsageElement_OneSession_ChangedValueSharedWithItsSequencefailed with "Only the first request and the one with a changed value should be shared ==> expected: <2> but was: <3>", andAddedEvidence_ReachesTheUsageSharingMessagewith "server.ja4 was not shared. expected:<t13d1516h2_8daaf6152771_02713d6af862> but was:". Two existing tests failed with them,ShareUsageElement_RepeatWithNewSequence_NotShared(2 records, not 1) andShareUsageElement_WebRequest_SharesWhatNoOtherElementAccepts(the request's User-Agent in place of the Evidence's), andUnreadHeader_ReachesTheUsageSharingMessagepassed, as the request's own values were still shared.tmp/java-usage-green, which holds 72bae53 alone.ShareUsageElementTestsran 26 with 1 skipped, the test that is disabled onrc, andUsageSharingEvidenceTestspassed 7 of 7.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.ShareUsageElementTestsran 26 with 1 skipped andUsageSharingEvidenceTestspassed 7 of 7 in all nine jobs. Each of its tenSetting '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
rcat ceab088.rchas since taken #63, #83 and #115, and a trial merge withrcat 1c99b72 was clean on 14 November at 11:55 UTC.What remains