Repository navigation
Fix each Property's position when the Engine is created, and read every Property by position - #137
Merged
Merged
Conversation
…e C++ Results classes In C, each property's index is its own place when no names are given (src/common/properties.c lines 479 to 491 in 51degrees-cxx at cfad8978), so an implementation that calls C may read such an Engine by position. The C++ ResultsHash and ResultsIpi classes refuse every position without names (ResultsBase.cpp lines 481 to 484), so the MUST read by name stays for them. The native code still gives each position. Also point the Cloud Request Engine's JSON Builder link at #process, the heading json-builder.md has.
C resolves a position against the data set the results were populated from (51degrees-cxx cfad8978 src/dd/hash/hash.c lines 5896 to 5901, src/ipi/ipi.c line 3342), so a position taken from the current data set after a refresh can name a different Property.
James Rosewell decided on 10 November that a property's index is its place in the list of names the engine was built with, fixed at build. An engine configured with no names takes every property name in the data set at build as that list, every read uses the index, and a read by name uses a table built once from the build-time names, never from the data set. This replaces the earlier text that let C read an engine with no names by its data set position. The C quote, the C++ scoping and the json-builder anchor fix stay.
This was referenced Nov 10, 2026
…reated with no names
…, and that getProperties can list one with no position
…data reports a Property with no position as not available
… Engine's configuration
jwrosewell
marked this pull request as ready for review
November 11, 2026 10:02
This was referenced Nov 11, 2026
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
device-detection-on-premise.md and ip-intelligence-on-premise.md, under Finding Properties on
rcat 67ead69, let an Engine be created "with none to have every Property of the data file". They say such an Engine has no positions, so an implementation "MUST read the Properties of such an Engine by name". They also let an implementation read an Engine created with names "by its position ... or by its name".That leaves two ways to read a Property. A read by name looks the name up in the native code on every read. An Engine with no names had no position that stayed the same across a data refresh, because C gave each Property its place in the data set loaded, sorted by name, and a refresh to a file with other Properties moved those places.
The decisions
James Rosewell, 10 November 2026:
At f8f7482 this draft met that rule by having a language configured with no names pass every Property name of the data set when it created the Engine. Measured in the Go, Rust, PHP and Python libraries, that made processing 3 to 7 times slower, because an Engine created with names walks every component's graph during
process. Later on 10 November James decided that C changes instead, so that an Engine created with no names keeps the first load's names, in their order, across every reload, and processing stays as fast as today. That C change is 51degrees-cxx#148, and this draft now describes it.What changed
properties.clines 473 to 484 sort them, andproperties.hlines 40 to 42 define that list as in "ascending order of name"), keeps them across every data refresh, and so has fixed positions too. The native code does this. An implementation configured with no names MUST create the Engine with no names and MUST NOT pass the data set's names itself, because a named Engine walks graphs duringprocess, where one with no names walks a graph only at the first read of one of its Properties.Availablefalse, because cxx#148 at 9871e355 makes the metadata's availability ask for the required property index (hash.cline 6124 andipi.cline 4257), and every language exposes that flag. WithAvailablefalse, step 3.1 of Deciding the reason givesPropertyExcludedFromEngineConfiguration. Both pages now say that an Engine created with no names has the names of its first data file as its configuration, so such a Property counts as excluded from that configuration and building the Engine again includes it. No new reason is added, because every language already has this one.getRequiredProperties), and MUST NOT be built again from a later data set.ResultsHashorResultsIpiclass, the methods that take a position read by it whether or not the Engine was created with names,getPropertyNamegives the name at a position, and the methods that take a name find its position first. The bullet that said such an Engine "has no positions at all", with its link toallowedRequiredPropertyIndex, is gone, because cxx#148 removes that method.getPropertiesnow "need not be" the order of the positions, rather than "is not", because for an Engine with no names on its first data file the two orders are the same. After a data refresh it can list a Property only the new data file has, which has no position and reads as invalid, as cxx#148 documents (properties.hlines 76 to 81 and point 2 of its body).process"before or after a data refresh", which cxx#148 keeps (fiftyoneDegreesResultsWalkWhenPopulatedinsrc/common/results.h).json-builder.md#processing, but the heading in json-builder.md is## Process, so the link is now#process. No other page linksjson-builder.md#processing.The performance guidance on both pages ("Positions need no such store, as each is the index of a Property in the names the Engine was created with") and the IP page's
copyValueAsUTF8Stringbullet are as onrc, as both are true under the rule.Checked in the native code
At 51degrees-cxx 1a92d51e, the commit that merged cxx#148 into the cxx
rc. Every linked line range is the same there as at 9a535a49, the head when these links were first made.The comment on the Required Property Index (src/common/properties.h lines 31 to 38) reads as follows, and both pages quote it.
fiftyoneDegreesPropertiesCreate(src/common/properties.c lines 553 to 572) carries the comment "Existing properties that name nothing give the names of their data set, in its order, so a reload keeps each index on its property", and copies those names withcopyNamesFromAvailable.setRequiredPropertyIndexes(lines 508 to 536) then finds each name in the new data set and gives it index i.ResultsBase::getValues(int)passes its index straight on (src/common/ResultsBase.cpp lines 436 to 439), as do the other reads by index, andallowedRequiredPropertyIndexis gone.getPropertyName(int)gives the name at an index (lines 85 to 95), andgetPropertiesstill lists the data set's Properties in the order of its list of available properties (lines 75 to 83).cxx#148's body gives process times for an Engine with no names before and after the change, and finds it no slower. Its tests reload from the Lite file to the TAC file, and from the ASN file to the Enterprise file, and check that every index is kept.
Checked here
rcat e89679e, which has Say that the Cloud Request Engine sends every Evidence value apart from the reserved names #138 and Say what happens when a data file refresh fails #60, is merged into the branch, and the diff againstrcis only the change above.cloud-request-engine.md, in other lines.#reading-graphs,#refresh-dataandjson-builder.md#process).Outstanding
rcas 1a92d51e, and the links in both pages and here point at that commit.No version directive is carried.