Repository navigation
TEST: Check the Bespoke key's Human Confidence property and source first - #236
Merged
Merged
Conversation
HumanConfidenceLiveTest had one test that read _51DEGREES_RESOURCE_KEY and took the source it expected from a system property, and the workflow ran it once for each key. It skipped when the cloud service did not list HumanConfidenceSource for the key. There are now two tests. The Bespoke test reads _51DEGREES_RESOURCE_KEY_BESPOKE and expects the source Passive and a level of High, Medium or Low. The Basic test reads _51DEGREES_RESOURCE_KEY_BASIC and expects no source. Each starts the example with the key it checks. A test skips only when its own key is not set, and fails when the answer lacks what it checks. cloud-human-confidence.yml runs Maven once with both keys under their own names. It fails when a key is empty, when no test ran, when Maven fails or when a test was skipped. New Pester tests in ci/workflow-keys.Tests.ps1 cover that step.
# Conflicts: # .github/workflows/cloud-human-confidence.yml # ci/README.md # ci/workflow-keys.Tests.ps1 # examples/device-detection/web/human-confidence/README.md # examples/device-detection/web/human-confidence/src/test/java/fiftyone/devicedetection/examples/web/HumanConfidenceLiveTest.java
…first The Bespoke live test now asks the staging cloud which properties the key in RESOURCE_KEY_BESPOKE_STAGING includes before it calls the example. If HumanConfidence or HumanConfidenceSource is not listed, the test fails and names the variable and the property, so it is clear which key to change. The source and level messages name the variable as well. A test that needs no network checks how the list of properties is read.
The Bespoke test asked the list of accessible properties for both HumanConfidence and HumanConfidenceSource. The staging cloud serves the source to a request that names it without listing it there, so the test failed for a key the cloud does serve. The list is now asked for HumanConfidence only, as in .NET and PHP. The test then asks the service for HumanConfidenceSource with the key and fails, naming the variable, when the answer is not Passive. The list check also names every missing property in one failure, matches names ignoring case, and fails naming the variable when the list is not JSON. The README and the class comment say the same.
jwrosewell
marked this pull request as ready for review
November 24, 2026 06:24
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.
Why
Running each Human Confidence live test with its own key is now on rc (#237). Before it calls the example, the Bespoke live test now checks that the staging cloud lists HumanConfidence for its key, and answers HumanConfidenceSource as
Passivewhen asked for it. A key that lacks either fails with a message naming the variable.What changes
HumanConfidenceLiveTest.java:accessiblepropertiesforHumanConfidenceonly, matching names ignoring case. It fails namingRESOURCE_KEY_BESPOKE_STAGINGand every missing property in one message, and a property list that isn't JSON fails naming the variable.HumanConfidenceSourcewith the key, and fails naming the variable when the answer is notPassive. The list isn't asked about the source, as the staging cloud serves the source to a request that names it without listing it.missingPropertiesNamesOnlyThePropertiesNoProductLists,missingPropertiesIgnoresTheCaseOfTheNamesandmissingMessageNamesEveryMissingPropertyAndTheVariable.examples/device-detection/web/human-confidence/README.mdand the class comment say what the test checks first.Tests
HumanConfidenceTestandHumanConfidenceLiveTest, compiled with JDK 1.8 javac (no warnings with-Xlint:all) and run with JUnit 4.13.2: 15 run, 0 failed, the two live tests skipped as no key was set.