Repository navigation
Mark delayexecution in the JSON Builder only on a property with a value - #66
Merged
Merged
Conversation
…th a value The JSON Builder page says delayexecution is added for each property that has a value and whose delay execution flag is true. A property with no value, and one whose raw value is null, must not be marked.
The JSON Builder page says delayexecution is added for each property that has a value and whose delay execution flag is true, as the .NET, Java and Go builders do. Node wrote it for every delayed property before the value was read, so a property with no value, or a null one, was marked too. The value is now read first, and the meta-properties keep their order.
This was referenced Nov 12, 2026
Merged
The cache was keyed on flowElement.dataKey, but flowElement is the key itself, so every element was stored under 'undefined'. From the second request every element read the last element's delayed properties, and the others lost delayexecution and evidenceproperties.
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
The JSON Builder wrote
delayexecutionfor every property whose metadata sets the delay execution flag, before it read the value (jsonbundler.jsline 168 at 24592acb). So a property with no value, and one that could not be read at all, were marked too. The cross-language audit found this, and PHP (51degrees-php#61), Go (51degrees-go#91) and Python (51degrees-python#92) have already merged the same change.The bundler also kept each element's delayed properties under the wrong key.
jsonbundler.jslines 157 and 163 at c1dd5683 stored and read them asthis.propertyCache[flowElement.dataKey], butflowElementis the key itself, a string frompipeline.flowElements(pipeline.jsline 85), so every element was stored underundefined. The first request was right, because each element wrote its list and read it straight back. From the second request every element read the last element's list, so every other element lostdelayexecutionandevidenceproperties.What the specification says
JSON Builder, line 71 at 77dc1f62:
What changed
In
jsonbundler.jslines 165 to 213 the value is read first, anddelayexecutionis written only when the property was read and its value is not null or undefined. The meta-properties are written in the same order as before (delayexecution, thenevidenceproperties, then the value), so the JSON of a property that keepsdelayexecutionis unchanged.evidencepropertiesis still written for a property whose value could not be read. Line 72 says only when it MUST be added, being when the JSON includes delayed Properties from this Property's Evidence Properties list, and does not ask for it to be left out otherwise. Go writes it either way, "as the .NET and Java JSON Builders do, so the page can still run the JavaScript" (jsonbuilder.golines 141 to 160 at 88a98b77), so Node keeps doing the same.3cb500e2 keys the cache on the element's key,
this.propertyCache[flowElement], in both places. c1dd5683 mergesrcat 24592ac with no conflict.Tests
tests/javascriptbuilder.test.js, "JSON bundler - delayexecution only for a property with a value". Three delayed properties are given a value, no value with a reason, and a null raw value. Only the first is marked, and the second keeps itsnullreason. The existing delayed execution tests, which compare the JSON text in order, pass unchanged."JSON bundler - each element keeps its own delayed properties on later requests" builds one Pipeline with two elements, each with a delayed property and a property whose Evidence Properties name it, both named after the element's key, and processes two requests. Each request must mark each element's own delayed property and list its own evidence property.
rccode at the time, 1 of 398 failed (twodelayexecutionwastrue): run 42897495445.rcat 24592ac without either fix: run 43489758674, 2 of 1,144 failed. "each element keeps its own delayed properties on later requests" failed on request 2 forfirst, whosefirstscriptdelayexecutionwasundefined, and "delayexecution only for a property with a value" failed as before.npm run tsc, which regenerates the types and compares them with the committed ones. That comparison fails onrcwithout this change too, because the committed types are older than the code (run 43485072238 found 23 type files thattscwrites differently onrcat 24592ac), so it is not a test of this change.Setting 'PullRequestSha'lines are 3cb500e, and each of the six Ubuntu, Ubuntu ARM and Windows jobs on Node 22 and 24 ran 1,358 unit tests passed with 2 skipped, and 132 integration tests passed with 4 skipped. 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.Setting 'PullRequestSha'lines are c1dd568, and each of the six Ubuntu, Ubuntu ARM and Windows jobs on Node 22 and 24 ran 1,356 unit tests passed with 2 skipped, and 132 integration tests passed with 4 skipped.What remains
Nothing in this change. No other language's JSON Builder has the same cache fault.
jsonbundler.pylines 124 and 163 at 32ffdcf1) and PHP (JsonBundlerElement.phplines 122 and 164 at a074012f) loop over the element objects and key the cache on each one's own data key, as the review of 13 November at 22:55 UTC found.JsonBuilderElement.cslines 779 to 791 at d202a66a) and Java (JsonBuilderElement.javalines 334 to 344 at 30e48867) keep one configuration for each Pipeline, holding each delayed Property under its complete name, such asdevice.ismobile.jsonbuilder.golines 113 to 130 at 88a98b77) builds its index of the metadata on each request, under each Property's complete name.