Skip to content

TEST: Run the Human Confidence live tests against the staging cloud, each with its own key - #237

Merged
jwrosewell merged 2 commits into
rcfrom
test/hc-staging-tests
Nov 23, 2026
Merged

jwrosewell merged 2 commits into
rcfrom
test/hc-staging-tests

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What moves to the staging cloud, and why

The Human Confidence web example's live tests, HumanConfidenceLiveTest in examples/device-detection/web/human-confidence, run by cloud-human-confidence.yml:

  1. bespokeKeysPassiveAnswerCarriesTheSourcePassive needs HumanConfidenceSource to be Passive and a level of High, Medium or Low. The production cloud does not serve HumanConfidenceSource yet, and answers the passive call with the level Unknown.
  2. basicKeysPassiveAnswerCarriesNoSource needs 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 (Passive for 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_KEY and named the expected source in the humanConfidenceSource system 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 branch test/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_ENDPOINT

Every 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:

  1. Staging, with RESOURCE_KEY_BESPOKE_STAGING and _51DEGREES_RESOURCE_KEY_BASIC: 2 tests, 0 failures, 0 skipped.
  2. Both tests pointed at production with the production Bespoke key: 2 failures. The Bespoke test got {"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.
  3. Production settings only (_51DEGREES_CLOUD_ENDPOINT and _51DEGREES_RESOURCE_KEY_BESPOKE, no staging names): 2 tests, both skipped naming the missing variable.
  4. 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.ps1 passes, and failed on the two names before this change.
  5. At the first commit, e78e0da, the Cloud Human Confidence run (run 45274762302) first failed with "The organization variable CLOUD_STAGING_ENDPOINT is empty or missing", because it started before the variable existed, and the rerun passed both keys against the staging cloud.

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 HumanConfidenceSource and a passive level, the tests move back to _51DEGREES_CLOUD_ENDPOINT and _51DEGREES_RESOURCE_KEY_BESPOKE, and the two names can go.

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 jwrosewell changed the title TEST: Run the Human Confidence live test against the staging cloud TEST: Run the Human Confidence live tests against the staging cloud, each with its own key Nov 23, 2026
@jwrosewell
jwrosewell marked this pull request as ready for review November 23, 2026 23:16
@jwrosewell
jwrosewell merged commit fe159eb into rc Nov 23, 2026
11 checks passed
@jwrosewell
jwrosewell deleted the test/hc-staging-tests branch November 23, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant