Repository navigation
Give the specification's JSON Builder error text with no sequence number, and test the behaviour - #104
Merged
Conversation
The JSON Builder specification says the element MUST fail with an error and MUST NOT set its JSON value when no Sequence Element has produced a sequence number. JsonBuilderElement already does that, and nothing tested it, so the regression audit for this release read it as missing. This commit adds the tests and takes the check out, so the build shows them failing. The next commit puts the check back, unchanged, and the tests pass. What reaches rc is the tests alone.
The check is restored exactly as it is on rc, so what this draft adds to rc is the tests alone. The previous commit took it out only to show the build failing without it.
The JSON Builder specification says the error SHOULD say that a Sequence Element needs to be placed before the JSON Builder Element in the Pipeline. The exception the pipeline records says so, and the cause it carries does not, reading "Sequence number not present in evidence. this is mandatory." This test pins the cause's wording, and fails until the message changes.
…builder The cause read "Sequence number not present in evidence. this is mandatory.", which neither says what to do nor reads as one sentence. It now carries the wording 51degrees-go and 51degrees-rust use, so the same misconfiguration reads the same whichever language a deployment uses. The exception the pipeline records is unchanged.
specifications#139 turns the SHOULD into a MUST and gives the exact text, so that the message reads the same in every language. It also says that where an implementation wraps the error in another, the one the caller reads carries the message, which in Java is the PipelineConfigurationException rather than its cause. The constant holds the text and the tests assert it word for word on both the recorded error and the cause. They fail until the element uses it.
The PipelineConfigurationException the caller reads said "Make sure there is a SequenceElement placed before this JsonBuilderElement in the pipeline" and its cause said something else again. Both now carry the text the specification gives, which every language carries. One more test writes that text out beside the constant, so that changing the constant fails rather than moving the other assertions with it.
This was referenced Nov 11, 2026
Merged
Merged
specifications#139 merged at 13:19 as d72eb074, with one more commit saying that the message is the whole text of the error and that a prefix a language's error type writes is not part of it. The links moved from the draft head and from 67ead698, which predates the message. No code changes.
The helper checked that the message named a sequence element and now checks the whole message, so its note says so.
jwrosewell
marked this pull request as ready for review
November 11, 2026 17:37
This was referenced Nov 11, 2026
Move cxx to the 51degrees-cxx release 4.5.105 and read by index on an engine built with no names
#82
Merged
Draft
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
The JSON Builder Element needs a sequence number, and this repository had no
test at all for what happens when there is none. The element did fail, and it
has done so since long before this release, but the message a caller read named
neither the element nor what to do about it, and it was not the message any
other language gave. The release is about every language behaving the same way
and saying the same thing, so the message moves onto the one the specification
now gives and eight tests hold the whole behaviour in place.
What the specification says
json-builder.md at d72eb074, lines 120 to 142,
which is the commit where
specifications#139
merged:
Lines 150 to 153
add that a
query.sequencevalue taken from a query string is text and not aninteger, so it does not count as a sequence number, and that an integer a
caller added to
query.sequencewithout a Sequence Element does count in Java,because the Element reads the integer in Evidence whoever added it.
What changed
Three files, two of them production and one new test class.
Constants.javalines 28 to 39gains
NO_SEQUENCE_NUMBER_MESSAGE, holding the page's sentence once so thatthe two throws and the tests cannot drift apart, and so another class can
reach the same words. Its Javadoc links the page at the commit the words
came from.
JsonBuilderElement.javalines 206 to 209.buildJsoncaught the failure and threw aPipelineConfigurationExceptionreading "Make sure there is a SequenceElement placed before this
JsonBuilderElement in the pipeline". That is the error a caller reads, so
under the page's wrapping sentence it now carries the specification's
message and nothing else.
JsonBuilderElement.javaline 229.getSequenceNumberthrew "Sequence number not present in evidence. this ismandatory.", which becomes the cause and is the line at the top of a stack
trace, so it carries the same sentence now.
JsonBuilderSequenceTests.java,a new class of eight tests, described below.
Nothing else about the element moved. It already failed without a sequence
number, already set no JSON when it failed, because
line 165
calls
setJsononly afterbuildJsonhas returned, already took an integerfrom Evidence whoever put it there, and already refused query string text,
because
FlowDataDefault.tryGetEvidencelines 140 to 150casts with
type.cast(obj)and catches theClassCastException. The tests pinall of that, so none of it can be lost quietly later.
The eight tests
JsonBuilder_TheMessage_IsTheOneTheSpecificationGivesJsonBuilder_NoSequenceElement_FailsJsonBuilder_SequenceFromQueryString_Failsquery.sequenceof"4"is text, so it fails the same wayJsonBuilder_SequenceThatIsNotANumber_Failsquery.sequenceof"abc"fails the same wayJsonBuilder_NoSequenceElement_ThrowsWhenNotSuppressedAggregateException, carrying the same message, and still no JSONJsonBuilder_NoSequenceElement_TheCauseSaysWhatIsNeededJsonBuilder_IntegerFromTheCaller_BuildsTheJson3added by the caller is a sequence number even with no sequence element, so the JSON is built and no error is recordedJsonBuilder_WithSequenceElement_BuildsTheJsonThe four failure tests go through one helper, which asserts three things each
time, being that exactly one error was recorded, that its message equals the
constant word for word, and that
getJson()was never set.Tests first, red then green
Three red runs on a runner, each one failing only on the thing the next commit
then fixed.
on
dfb2a64e, which takes the element's sequence number check out so thenew tests have something to fail against.
Tests run: 6, Failures: 4inJsonBuilderSequenceTests, the four beingJsonBuilder_NoSequenceElement_Fails,JsonBuilder_SequenceFromQueryString_Fails,JsonBuilder_SequenceThatIsNotANumber_FailsandJsonBuilder_NoSequenceElement_ThrowsWhenNotSuppressed.6563209cputs thecheck back and
run 42998105846
is green on it.
on
68b399bf, which adds the test for what the cause says.Tests run: 7, Failures: 1, reading "Expected the cause to say that aSequence Element needs to be placed before the JSON Builder Element in the
Pipeline. Complete message: Sequence number not present in evidence. this is
mandatory."
on
38900cbc, which moves every assertion onto the specification's exactsentence before the element gives it.
Tests run: 7, Failures: 5, the fivebeing every test that reads a message.
66bedcbdthen puts the sentenceinto both throws and
run 43020802655
is green on it.
The full build
Run 43034325507,
completed/success, on this draft's headfd7573c7. EverySetting 'PullRequestSha'line in the Configure job and in all nine Build andTest jobs reads
fd7573c7b4e53512d864f3c405c515440305f571, which is the head. Configureprinted
Left out 6 macOS entries. Eleven jobs succeeded and the twoperformance comparison jobs were skipped, with none failing.
JsonBuilderSequenceTestsreadsTests run: 8, Failures: 0, Errors: 0, Skipped: 0on every one of the nine platform and Java version combinations.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.
Why that build still stands, although rc has moved since
The build ran at 14:00 and
rchas taken eight commits since, so it is fair toask whether the result still describes the merged tree. The draft is still
MERGEABLE/CLEAN, being eight commits behind and none in front, and I read theeight rather than assuming they were harmless.
rcasserts the old text. The two throws used to read "Makesure there is a SequenceElement placed before this JsonBuilderElement in the
pipeline" and "Sequence number not present in evidence. this is mandatory.".
Neither string appears anywhere in
JsonBuilderTests.java,FiftyOneInterceptorTests.java,FiftyOneJSServiceCoreTests.javaorPipelineFilterTests.javaatbf66e3d1, which are the four test classes theeight commits touched that could have held it.
SequenceElement.javaline 106 atbf66e3d1still calls
data.addEvidence(Constants.EVIDENCE_SEQUENCE, sequence),whatever else
#80 now puts in Element
Data, and
SequenceElementBuilderkeeps the constructor andbuild()the newtest class calls.
51degrees-java#102
changes
SequenceElement.java,JavaScriptBuilderElement.javaand theJavaScript Builder's tests. The lines it takes out are the JavaScript
Builder's own
tryGetEvidencecalls, not the Sequence Element'saddEvidence, so the route the JSON Builder reads is untouched.catches a draft holding an older native library does not apply.
I have not merged
rcin, because moving the head would mean another full buildand a rewritten description for no change in what the draft does.
What remains
anywhere in this description.
which replaced the same two throws without the tests, is closed, so there is
no longer a second draft of this work to reconcile.
nothing in this one waits on them.
51degrees-rust#383 and
51degrees-go#100 have
merged, and
51degrees-dotnet#135
is still open at the time of writing.
if the page is ever reworded this repository is two lines and one build.