Repository navigation
TEST: Run the Human Confidence live tests against the staging cloud, each with its own key - #237
Merged
Merged
Conversation
The production cloud does not serve HumanConfidenceSource yet. Asked for it, production answers HumanConfidence alone, as Unknown, so the live test skips there and the workflow fails on the skip. The staging cloud serves the source, Passive for a Bespoke key and none for the Basic key. The live test now reads the cloud from CLOUD_STAGING_ENDPOINT and skips, naming it, when it is not set. cloud-human-confidence.yml sets it from the organization variable of that name, and runs the Bespoke pass with RESOURCE_KEY_BESPOKE_STAGING, a Bespoke key the staging cloud resolves. The Basic pass keeps _51DEGREES_RESOURCE_KEY_BASIC, which resolves on both clouds. Every other cloud test stays on _51DEGREES_CLOUD_ENDPOINT. Both names are used only by CI, so they have no _51DEGREES_ prefix. The environment name check allows them, and the workflow key test checks that each comes from the organization secret or variable of its own name.
The live test had one test, run once per key by the workflow copying each key into _51DEGREES_RESOURCE_KEY and naming the expected source in a system property. It now has two tests, as the other languages do, and each reads its own key under its own name. The Bespoke test reads RESOURCE_KEY_BESPOKE_STAGING and needs the source Passive and a plain level. The Basic test reads _51DEGREES_RESOURCE_KEY_BASIC and needs the cloud to answer the source as null with its reason, which the staging cloud does and the production cloud does not, as production leaves the source out. Both read the cloud from CLOUD_STAGING_ENDPOINT and skip, naming the variable, without it or their key. cloud-human-confidence.yml runs Maven once with the three names under their own names, names every one that is missing at once, and fails when Maven fails, no test ran or a test was skipped. The workflow key test runs the step with Maven replaced, to check each of those. The restructuring follows the one proposed on the branch test/human-confidence-real-value, moved to the staging names. AGENTS.md, README.md and ci/README.md now say that names only CI uses have no prefix and that common-ci exports only the _51DEGREES_ names and its own list.
jwrosewell
marked this pull request as ready for review
November 23, 2026 23:16
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.
What moves to the staging cloud, and why
The Human Confidence web example's live tests,
HumanConfidenceLiveTestin examples/device-detection/web/human-confidence, run by cloud-human-confidence.yml:bespokeKeysPassiveAnswerCarriesTheSourcePassiveneedsHumanConfidenceSourceto bePassiveand a level of High, Medium or Low. The production cloud does not serveHumanConfidenceSourceyet, and answers the passive call with the levelUnknown.basicKeysPassiveAnswerCarriesNoSourceneeds the cloud to answer a key outside Bespoke with the source as null, with the reason, and the example's answer to carry no source. Production gives no key a source and leaves the property out, so only a cloud that serves the source can show it is withheld.Both now ask the staging cloud, which serves the source (
Passivefor a Bespoke key, and null with a reason for the Basic key).The test had one test, run once per key by the workflow, which copied each key into
_51DEGREES_RESOURCE_KEYand named the expected source in thehumanConfidenceSourcesystem property. It now has two tests, as the other languages do, and each reads its own key under its own name. This follows the restructuring proposed on the branchtest/human-confidence-real-value(#236), moved to the staging names, so the two pull requests edit the same five files and only one of them should go ahead.What stays on
_51DEGREES_CLOUD_ENDPOINTEvery other cloud test and example, including the 51Did tests, the device detection, IP Intelligence and hardware lookup examples, and the Selenium contract. This pull request does not change them.
Names
Two names that only CI uses, so they have no
_51DEGREES_prefix:CLOUD_STAGING_ENDPOINT, an organization variable naming the staging cloud's API base, including/api/v4/. Both tests read the cloud from it and skip, naming it, when it is not set. There is no default address.RESOURCE_KEY_BESPOKE_STAGING, an organization secret holding a Bespoke resource key the staging cloud resolves, which the Bespoke test reads.The Basic test reads
_51DEGREES_RESOURCE_KEY_BASIC, which resolves on both clouds. The workflow runs Maven once with the three names under their own names, names every one that is missing at once, and fails when Maven fails, when no test ran and when a test was skipped. The shared CI flow does not pass on the two names, so both tests skip there before calling any cloud.ci/check-environment-variable-names.ps1 now allows a short list of names only CI uses, with these two on it. ci/workflow-keys.Tests.ps1 checks that each name comes from the organization secret or variable of its own name, and runs the workflow step with Maven replaced to check each way it fails. ci/README.md and the example's README describe both names, and ci/README.md now says that common-ci exports only the
_51DEGREES_names and its own CI list. AGENTS.md and README.md now say that a name only CI uses has no prefix. The second commit message puts these together, and should read this way in a squash.How it was checked
From
examples/device-detection, with the names set in the shell only:RESOURCE_KEY_BESPOKE_STAGINGand_51DEGREES_RESOURCE_KEY_BASIC: 2 tests, 0 failures, 0 skipped.{"humanConfidence":"Unknown"}and no source, and the Basic test found the source left out rather than null, which is why they cannot run on production today._51DEGREES_CLOUD_ENDPOINTand_51DEGREES_RESOURCE_KEY_BESPOKE, no staging names): 2 tests, both skipped naming the missing variable.Invoke-Pester -Path ci(Pester 6.2.0): 206 passed, 0 failed, 4 skipped (CMake tests that need the cxx submodule)../ci/check-environment-variable-names.ps1passes, and failed on the two names before this change.The workflow job "Every variable name is a 51Degrees or platform name", and two test names in the check's tests, keep their wording, although the check now also allows CI names.
When production catches up
Once the production cloud serves
HumanConfidenceSourceand a passive level, the tests move back to_51DEGREES_CLOUD_ENDPOINTand_51DEGREES_RESOURCE_KEY_BESPOKE, and the two names can go.