Repository navigation
Give the IP Intelligence cloud engine's weighted and WKT values in the on-premise form - #124
Merged
Merged
Conversation
…WKT values in the on-premise form
…ght and rawWeight, and a WKT value as its text, as the on-premise engine does
… keeps the form the service writes
…ervice writes, so a patch release removes nothing a caller reads
jwrosewell
marked this pull request as ready for review
November 15, 2026 00:33
jwrosewell
added a commit
that referenced
this pull request
Nov 15, 2026
…ight and rawWeight for this release (#139) The JSON Builder writes a Property's value as the Element Data gives it ([`pipeline/fiftyone.pipeline.core/jsonbundler.js` line 271 at 7c99e78](https://github.com/51Degrees/51degrees-node/blob/7c99e7802ea3fa564c360d13af94332511ffdda1/pipeline/fiftyone.pipeline.core/jsonbundler.js#L271)), with only a list of Element Data rewritten ([lines 242 to 246](https://github.com/51Degrees/51degrees-node/blob/7c99e7802ea3fa564c360d13af94332511ffdda1/pipeline/fiftyone.pipeline.core/jsonbundler.js#L242-L246)). So each item of a weighted value in the JSON sent to the browser has the members the Element Data uses, `value`, `weight` and `rawWeight` ([`ip-intelligence/fiftyone.ipintelligence.onpremise/swigHelpers.js` line 59](https://github.com/51Degrees/51degrees-node/blob/7c99e7802ea3fa564c360d13af94332511ffdda1/ip-intelligence/fiftyone.ipintelligence.onpremise/swigHelpers.js#L59)), where the specification writes `rawweighting` and `value`, in lower case. A cloud weighted value carries `rawweighting` as well since [#124](#124), and an on-premise one does not.
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.
Problem
The IP Intelligence cloud engine keeps every value as the cloud service sends it.
CloudEnginestores each one unchanged,result[key].value = value;(pipeline/fiftyone.pipeline.cloudrequestengine/cloudEngine.jslines 152 to 159 at 6d5d4fef), andIpIntelligenceCloudadds nothing (ip-intelligence/fiftyone.ipintelligence.cloud/ipIntelligenceCloud.jslines 24 to 42). So for the same address:{ rawweighting, value }, where the on-premise engine gives{ value, weight, rawWeight }(ip-intelligence/fiftyone.ipintelligence.onpremise/swigHelpers.jslines 41 to 61). The class comment says weighted values come withvalueandweight, which they did not, and the shareddataExtension.jsreads no weight from a cloud value (lines 36 to 40).{ value: 'POLYGON(...)' }, where the on-premise engine gives the WKT text (swigData.jslines 123 to 126).What the specification says
From
ip-intelligence-specification/pipeline-elements/ip-intelligence-cloud.mdlines 55 to 61 at 706de1f0:From
pipeline-specification/features/value-types.mdlines 123 to 130 at 706de1f0:weighted-values.mdlines 60 to 62 says the raw weighting is a 16-bit unsigned integer, with 65535 standing for a weighting of 1.0..NET, Java and Python each parse the cloud's weighted values and test it, for example .NET's
APVValueConversionTests.cslines 285 to 319 at f0ba9653 and Python'sweighted_cloud_engine.pyat 6ad5ae2d.What changed
IpIntelligenceCloud.processInternalreads the response asCloudEnginedoes, then gives each weighted value in the form the on-premise engine gives it.rawweightingmember and avaluemember becomes a list of{ value, weight, rawWeight, rawweighting }, withweightthe raw weighting divided by 65535 andrawWeightthe raw weighting. Each item keepsrawweighting, the member every earlier release gave, deprecated in favour ofrawWeight, because a patch release removes no name a caller reads.value, holding the WKT text, where the on-premise engine gives the text itself. Giving the text would change the type a caller reads, so that change, and removingrawweighting, wait for a release that may change public names.The class comment says what the values are, and that
rawweightingis deprecated, in the code and intypes/ipIntelligenceCloud.d.ts.Before you upgrade
Nothing to do. A weighted IP Intelligence value from the cloud engine now also carries
weight, a number from 0 to 1, andrawWeight, as the on-premise engine's values do.rawweightingis still there, deprecated, so readrawWeightin new code.Tests
ip-intelligence/fiftyone.ipintelligence.cloud/tests/cloudValues.test.jsbuilds a Pipeline with the realCloudRequestEngineand a request client that answers as the cloud service does, so it needs no key or network. It checks that weighted values come out withvalue,weight,rawWeightandrawweighting, that an area given as a weighted{"value": "POLYGON(...)"}and a location given as{"value": "POINT(2 4)"}keep that form, and that a plain value, a number and a property with no value are unchanged.Red, run 43637335532 on 593c7ee, the first test commit on
rc's code, with only a throwaway workflow added. On Ubuntu and on Windows exactly the two tests of that first design failed, the test of weighted values, asrcgives noweightorrawWeight, and the test of WKT values, which then expected the text.The first fix, c542429, also dropped
rawweightingand gave a WKT value as its text, which a patch release may not do, so the tests were changed at 4c6b1ed to expectrawweightingkept and the WKT form unchanged.Red, run 43654002716 on 4c6b1ed, those tests on c542429's code, with only a throwaway workflow added. On Ubuntu and on Windows the two tests fail, as c542429 drops
rawweightingand changes the WKT form, and the test of other values passes.Green, run 43654009988 on 7a1811a, the fix that keeps both, with only the same throwaway workflow added. All 3 pass on Ubuntu and on Windows. Its lint step failed on the indentation that a test name split over two lines gave the first test, which 5a37d1f puts back on one line, and the full build below lints it.
Types, run 43654071569 ran
npm run tscon 4d9277e, the merge ofrcinto this draft, and found no difference in the committed types butpipeline/fiftyone.pipeline.did/types/owid-js/v1.d.ts, which #127 decides.Full build
Run 43654584127 on
tmp/pr-matrix-124-c, started bytools/pr-matrix.pywithout macOS. All 7Setting 'PullRequestSha'lines give this head, 5a37d1f, and Configure printed "Left out 2 macOS entries". Each of the six Build and Test jobs, Ubuntu, Ubuntu ARM and Windows on Node.js 22 and 24, passed 1,515 unit tests with 2 skipped and 96 integration tests 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.
What remains
Giving a WKT value as its text, as the on-premise engine does, and removing
rawweightingwait for a release that may change public names, #138. The cloud engines for Device Detection and for location are unchanged, as their values are not weighted.