Repository navigation
Add switches and paths to the web integration, and Element Data to the Sequence Element - #80
Draft
jwrosewell wants to merge 19 commits into
Draft
jwrosewell wants to merge 19 commits into
jwrosewell wants to merge 19 commits into
Conversation
…e sharing characters The tests cover the init parameters that set the JavaScript and JSON paths and switch the Sequence Element and the Set Headers Element, the Element Data the Sequence Element writes, how the JSON Builder Element shows that data, and the characters XML 1.0 allows in a shared Evidence value.
…e Sequence Element The filter takes init parameters for the JavaScript path, the JSON path, and whether the Sequence Element and the Set Headers Element are added. The defaults keep today's paths and today's behaviour. The Sequence Element writes session-id and sequence as Element Data as well as Evidence. Usage sharing keeps every character XML 1.0 allows instead of replacing everything above U+00FF.
… say what the Lite file lacks The MVC configuration takes the JavaScript path, the JSON path and the two element switches the filter takes, with defaults that keep today's behaviour. The example comments about the Lite data file say it has a small number of Properties, as the specification does.
Java 21 warns about it, and the build treats warnings as errors.
…th as well The specification's JSON path becomes the default in the filter and the MVC integration, and the JavaScript they serve calls it. The path 51Degrees.core.json is still answered, and json-path still sets the path.
…tion says A session id that is not a non-empty string, and a sequence that is not a whole number or text of decimal digits that fits in an int with room to add one, count as absent. The Evidence and the Element Data are written from the same values.
# Conflicts: # pipeline/pipeline.engines.fiftyone/src/main/java/fiftyone/pipeline/engines/fiftyone/flowelements/SequenceElement.java
# Conflicts: # pipeline/pipeline.engines.fiftyone/src/main/java/fiftyone/pipeline/engines/fiftyone/flowelements/ShareUsageElement.java # pipeline/pipeline.engines.fiftyone/src/test/java/fiftyone/pipeline/engines/fiftyone/flowelements/ReplacedStringTest.java
…nt is refused The json-path test uses a path that is not the default.
The JSON Builder Element fails on every request without the sequence number, so the build says which option to change.
… properties are off
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.
The problem
pipeline/Gaps-vs-spec.mdlists where the Java pipeline differed from the specification. Checked against the code onrcand against the web integration page, these are still true:PipelineFilterreads one init parameter (clientside-properties-enabled). The JavaScript path (51Degrees.core.js) and JSON path (51Degrees.core.json) are constants.SequenceElementwrites Evidence only and declares no properties. The specification lists Element Data as well.Item 10 (Drift as a sum) is already fixed by the open draft #60, so it is not repeated here.
What changes
javascript-pathandjson-path. Intercepted Urls: "These SHOULD be configurable, but the default values are:/51Degrees.core.js.../51dpipeline/json". The JavaScript path default stays51Degrees.core.js. The JSON path default becomes the specification's/51dpipeline/json, as .NET and Go use, and the JavaScript the filter serves calls it. The old path51Degrees.core.jsonis still answered, whateverjson-pathsays, so a site or a cached script that calls it keeps working.FiftyOneJSServiceCore.Defaultgains a constructor that takes the two paths, and the existing constructor uses the defaults.Constants.CORE_JSON_NAMEstays, for the old path, andConstants.DEFAULT_JSON_PATHis new.sequence-element-enabledandset-headers-element-enabled, both true by default. Pipeline configuration: "For all of these elements, there MUST be configuration options to allow users to prevent them being added (or disable them) if they wish to do so." A false value stops the element being added when the configuration lacks it, and an element named in the configuration stays. With client-side properties on and the Sequence Element left out the build is refused, naming the option, as .NET does, because the JSON Builder Element fails on every request without the sequence number (json-builder.md).clientside-properties-enabledworks as before and still controls only the JSON Builder Element and the JavaScript Builder Element.StartupHelpers.buildFromConfigurationgains an overload with the JSON path and the two switches, and the existing overloads call it with the defaults.SequenceElementalso writes the Element Datasession-idandsequence, under the keysequence, as .NET, Go and Python do (the page names no key), and declares them as properties. Sequence Element: the Element Data table lists both, and "Add both output values to Evidence as well" keeps the Evidence writes, which are unchanged. New classSequenceData. Process treats the two values on their own, so a session id that is not a non-empty string counts as absent and gets a new id, and a sequence counts only if it is a whole number or text of decimal digits that fits in an int with room to add one, and otherwise gives 1, with no error and no overflow. An empty session id counts as absent, which the page does not say outright and a specifications sentence is coming to state. An id of "0" is kept, a sequence with no session id counts up with a new id, and a session id with no sequence gives 1. The Evidence and the Element Data are written from the same values. Java used to cast the sequence with(int), which failed on text.FiftyOneInterceptorConfiggainsgetJavaScriptPath,getJsonPath,getSequenceElementEnabledandgetSetHeadersElementEnabled, as default methods so existing implementations keep working, andFiftyOneInterceptorConfigDefaultgains the setters. The interceptor passes them toStartupHelpersand to the newFiftyOneJSService.setPaths, andFiftyOneInterceptor.enableClientsidePropertieshas an overload that maps the configured paths. The JSON default is the same new default as the filter's, the old path is answered and mapped too, and both elements are on.GettingStartedOnPrem.java,MetadataOnPrem.javaandOfflineProcessing.javathat said the Lite file has "limited accuracy" now say it has a small number of Properties, as required-examples.md says ("the Lite data file has a small number of Properties"), and so does the one inUpdateDataFile.java. These are comments only, so there is no test. A search found no other comment with that wording.EvidenceKeyFilterShareUsage.includereturns false forserver.http-requestbefore any other rule, as .NET's filter does, so the whole web request that draft Accept no Evidence for usage sharing, and give it the whole web request #68 added is never a value to share. The review of Accept no Evidence for usage sharing, and give it the whole web request #68 asked for this.Does 5b add a section to the JSON sent to browsers?
Yes. The JSON Builder Element skips only the element data keys
cloud-response,json-builderandset-headers, so the Sequence Element's data now appears:JsonBuilder_SequenceElementData_InJsoninJsonBuilderTestsruns a Sequence Element and a JSON Builder Element in one Pipeline and reads that section. The specification's exclusion list names the Set Headers Element, the Cloud Request Engine and the Usage Sharing Element, not the Sequence Element. Whether to exclude it, because the session id then reaches the page, is a decision for the maintainers, and the test records what happens today.Release note
The JSON that 51Degrees client-side properties read is now served from
/51dpipeline/json, the path the specification names. The old path/51Degrees.core.jsonstill works, so no change is needed to a page, a cached script or a proxy rule. A site that wants another path setsjson-pathin the filter, orgetJsonPathin the MVC configuration. The Sequence Element's data now appears in that JSON undersequence, and the filter and the MVC integration can leave the Sequence Element and the Set Headers Element out.Behaviour that changes for callers
/51dpipeline/json, and the script the filter and the MVC integration serve calls that path.51Degrees.core.jsonis still answered. A site that setsjson-pathkeeps its choice.sequencesection above.SequenceData, the extraStartupHelpers.buildFromConfigurationoverload, the extraFiftyOneJSServiceCore.Defaultconstructor, the init parameter names inConstants, and the two properties onSequenceElement.Other open drafts
SequenceElementis kept, and this draft'stoSequencereplaces itsgetSequence. Cache the client-side endpoints' answers as the specification and RFC 9110 ask #67 also editsPipelineFilter,ConstantsandFiftyOneInterceptorConfig, so whichever merges second does the text merge.How it was checked
Tests were written first and fail on
rc.PipelineFilterTestschecks the elements the filter adds with each init parameter, and the callback endpoint.FiftyOneJSServiceCoreTestsis new. It checks the default and configured paths. It does not compile onrcbecause it uses the new constructor, so the web module's tests fail to build there.SequenceElementTestsis new, andJsonBuilderTestsgains the JSON test above.FiftyOneInterceptorTestshas four new tests for the MVC elements and paths, andNoSequence.xmlis a configuration without a Sequence Element.SequenceElementTests, the newJsonBuilderTeststest, and 3 of 9PipelineFilterTestsfail. In the first run the web module does not compile because of the new constructor, which the second run avoids by leavingFiftyOneJSServiceCoreTestsoutFiftyOneInterceptorTests(7),FiftyOneJSServiceCoreTests(4) andPipelineFilterTests(9) pass on Ubuntu and WindowssequenceSequenceElementTestsand theJsonBuilderTeststest fail looking for the keysequenceSequenceElementTestsfailJsonBuilderTestsandShareUsageElementTestswebRequestIsNeverIncludedfailsSequenceElementTests(11) andShareUsageElementTests(22)SessionIdAndSequenceTestsexpected an empty session id to be kept, and the Sequence Element now creates a new one. The test expects that nowa6303a4cSetting 'PullRequestSha'line matches. The Ubuntu Java 11 job passes the unit tests and the example tests, then fails at the Selenium contract tests against the cloud and on-premise examples ("the first page must call the json endpoint at least once"), which stopped the other jobs. See "What remains"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.
Every exit path of
SequenceElement.processInternalwas read after the change.What remains
/51Degrees.core.jsonin theirjavadescriptor (Examples/ExampleApps.csin selenium-api-tests, read frommain). With the new default the Java examples call/51dpipeline/json, so those tests fail in the full build ("the first page must call the json endpoint at least once") until the descriptor uses the default path. That change is in the other repository.main).sequenceneeds a decision.