Repository navigation
Add the derived property example the pipeline specification requires - #155
Merged
Merged
Conversation
…e, a configuration file and a missing source property
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 pipeline specification asks every language for one example of the Derived Property Element. The element arrived in #98 with its tests, but this repository had no example of it, so nothing showed a developer how to use it.
What the specification says
From
pipeline-specification/required-examples.mdlines 30 to 52 at 706de1f0:What changed
A new example in
pipeline/fiftyone.pipeline.derivedproperty/examples, made to match the .NET example.derivedProperty.jsbuilds the same Pipeline twice and processes two requests with each, one with every source Property and one withoutquery.pointermoved. It prints each source Property and each derived Property, or that there is no value and the message saying why.sessionElement.jsis a small element that gives three source Properties,PagesViewed,SecondsSincePageLoadandPointerMoved, from the query string, and no value when the request does not carry one. So the example needs no resource key, no data file and no network.ReaderEngagement.yamlis the script file, being the .NET example's script with its comments made to fit this example. It writesReaderEngagementas High, Medium or Low.derived-property-options.jsonis the configuration file. It names the session element andfiftyone.pipeline.derivedproperty/derivedPropertyElement, and passes the script file as thescriptFilessetting.Each of the four things the specification asks for is shown in these places.
EVERY_TEST_SCRIPT(lines 55 to 76), passed to the builder withaddScript(line 189). It writesReaderEngagementIsHighfrom the same three source Properties.addScriptFilein code (line 188) and through thescriptFilessetting in the configuration file.buildFromConfiguration(lines 157 to 177), and the second in code (lines 183 to 207).PointerMoved, so the derived Properties have no value, and the example prints the message, which namessession.PointerMovedand what the session element said about it.The example ends with a "Find out more" section, with its links tagged as
scripts/utm-lint.ps1in common-ci requires. The derived property package is not published, so no package is released for this.This is what the example printed in the green run below, for the configured Pipeline.
Tests
derivedProperty.test.jsruns the example as its own process from the system's temporary folder, with no settings, and checks that it ends with status 0 and no error output, that the configured Pipeline gives High for the first request, that the second gives no value with the message namingsession.PointerMovedand the session element's reason, that the Pipeline built in code gives both derived Properties for the first request and neither for the second, and that the output ends with Find out more.pipeline/fiftyone.pipeline.core/tests/findOutMore.test.jsnow lists the example, and the session element as a file that is not an example, so the check that every example ends with Find out more covers it.Run 43707810253 is the red run, on de100a7 (the tests alone) with only a throwaway workflow added. On Ubuntu and on Windows 7 of 76 fail, being the five tests of the example, which is not there, and the two Find out more checks, which find a listed example that is not there.
Run 43707816744 is the green run, on 68ec1e4, this head, with only the same throwaway workflow added. All 76 pass on Ubuntu and on Windows, lint of the core and derived property packages has no errors, and the example runs. The two lint warnings are in
pipeline/fiftyone.pipeline.core/pipeline.jsandpipeline/fiftyone.pipeline.core/tests/parametersWithoutEndpoint.test.js, which this change does not touch.Full build
Run 43709586324 on
tmp/pr-matrix-155, started bytools/pr-matrix.pywithout macOS. All 7Setting 'PullRequestSha'lines give this head, 68ec1e4, 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,871 unit tests with 2 skipped and 124 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
Nothing for this requirement. The specification lets an example also select a built in script by name (lines 54 to 57), which this one does not, as that part is optional.