Skip to content

TEST: Run the Human Confidence source tests against the staging cloud - #277

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

Both tests are in pipeline/fiftyone_pipeline_cloudrequestengine/examples/tests/test_cloud_humanconfidence_web.py. They are now marked staging and call the cloud that CLOUD_STAGING_ENDPOINT names.

Test Why it moves
test_passive_source_and_level_come_from_the_cloud It expects HumanConfidenceSource Passive from the cloud, and the production cloud does not serve HumanConfidenceSource yet. Against production it fails with {'humanConfidence': 'Unknown', 'source': None}. It now uses the Bespoke key in RESOURCE_KEY_BESPOKE_STAGING.
test_a_basic_key_gets_no_source It expects a Basic key to get no HumanConfidenceSource. The production cloud gives the source to no key, so at the first commit it passed there without proving anything. It keeps _51DEGREES_RESOURCE_KEY_BASIC, which both clouds know, with the staging endpoint. It also requires the cloud's own answer to carry humanconfidencesource with no value and a humanconfidencesourcenullreason string, which the staging cloud gives a Basic key, because the example gives no source when the property is left out as well, and with that check it fails against production. The naming_the_properties fixture keeps the cloud's answers for this.

Each skips, naming the variable, when CLOUD_STAGING_ENDPOINT or its key is missing, as the live tests here already do. There is no default address, so a staging test never calls production. The passive step never uses the License Key, so the staging app is built without one.

The new workflow, .github/workflows/cloud-human-confidence.yml ("Cloud Human Confidence Tests"), runs python -m pytest -m staging with only the three names it needs set on the test step. It runs on workflow_dispatch, nightly, and on pull requests into main and rc that change the Human Confidence example, its live test file, the examples' conftest.py or the workflow. It has permissions: contents: read. It fails when a name is empty, when a test skipped, which it reads from the pytest junit report, and when no test ran, which pytest's own exit code of 5 shows. #278 makes the step say No staging test ran for that exit code. It installs the pipeline packages from this checkout after ci/write-package-versions.ps1, as the free-threaded workflow does.

The staging tests do not run against production in the shared flow. common-ci passes on only _51DEGREES_ names and its own CI secrets, and the examples' tox.ini passes only _51DEGREES_* and PYTEST_ADDOPTS, so there the staging tests skip. The shared flow already passes with skipped tests, for example nightly run 44859027232 ("137 passed, 2 skipped" and "60 passed, 13 skipped" in Ubuntu_Python_3.14).

What stays on _51DEGREES_CLOUD_ENDPOINT

  • test_page_is_served_and_never_kept checks the page is served with Cache-Control: no-store and carries the resource key. Production serves this.
  • test_licence_key_never_reaches_the_browser checks the License Key is in neither the page nor the passive answer. Production serves this, and the check holds whatever the passive answer holds.
  • The client fixture they share still checks the key carries HumanConfidence through accessibleproperties, which production lists for the Bespoke key.
  • test_cloud_humanconfidence_web_offline.py and test_cloud_humanconfidence_web_port.py call no cloud and are unchanged.
  • No test on rc reaches the example's /redeem route or hc/redeem against a live cloud, so nothing moves for the redeem.

Names

  • CLOUD_STAGING_ENDPOINT is an organization variable holding the staging cloud's API base, ending /api/v4/.
  • RESOURCE_KEY_BESPOKE_STAGING is an organization secret holding a Bespoke resource key the staging cloud knows.

Only CI uses these two names, so they have no _51DEGREES_ prefix. Both exist as an organization variable and an organization secret, and both are available to this repository. Only the new workflow sets them. ci/check-environment-variable-names.ps1 now allows them in $script:CiNames, and ci/key-names.Tests.ps1 checks that only the Cloud Human Confidence workflow sets them, from vars.CLOUD_STAGING_ENDPOINT and secrets.RESOURCE_KEY_BESPOKE_STAGING. AGENTS.md, pipeline/ci/README.md and pipeline/readme.md list them as CI only.

How it was checked

Run locally on Windows with Python 3.12 in a virtual environment, with the packages installed editable after ci/write-package-versions.ps1, from pipeline/fiftyone_pipeline_cloudrequestengine/examples. The names were set in the process environment only.

  1. Staging, with CLOUD_STAGING_ENDPOINT, RESOURCE_KEY_BESPOKE_STAGING and _51DEGREES_RESOURCE_KEY_BASIC set: python -m pytest -m staging -v -rs gave 2 passed, 112 deselected.
  2. Production, with _51DEGREES_CLOUD_ENDPOINT set to the production cloud, the production _51DEGREES_RESOURCE_KEY_BESPOKE and no staging names: python -m pytest tests/test_cloud_humanconfidence_web.py -v -rs gave 2 passed (the page and License Key tests) and 2 skipped, each naming CLOUD_STAGING_ENDPOINT.
  3. The two moved tests pointed at production with the production Bespoke key: the source test failed with {'humanConfidence': 'Unknown', 'source': None}. At the first commit the Basic test passed there, proving nothing. With the second commit it fails there with The cloud's answer leaves out humanconfidencesource, as production's derived holds only humanconfidence (null) and its null reason.
  4. The whole examples test folder, python -m pytest -q -rs: with production settings 99 passed, 15 skipped (the 2 staging tests and 13 License Key cases, as _51DEGREES_LICENSE_KEY_BESPOKE was not set), 0 failed. With only the staging names, 86 passed, 28 skipped, 0 failed.
  5. The workflow's test step script, run as written: with the three names set it ran the 2 staging tests and exited 0. With CLOUD_STAGING_ENDPOINT empty it exited 1 with CLOUD_STAGING_ENDPOINT is empty or missing before running pytest. Its skip check read a real pytest junit report with 2 skipped tests and named both.
  6. Every ci/*.Tests.ps1, as the CI script tests workflow runs them: 446 passed, 0 failed. The new cases cover the two names in the environment name check, the workflow being the only one to set them, and the step failing on each empty name, on a skipped test and when no test ran.
  7. ./ci/check-environment-variable-names.ps1 passed.
  8. On this pull request, Cloud Human Confidence Tests run 45278605370 took the organization variable and secrets and gave 2 passed, 112 deselected, with both staging tests passing, at the first commit. CI script tests (Ubuntu and Windows), Environment variable names, UTM link lint and Only rc into main also passed.
  9. After the second commit, which makes the Basic test check the cloud's own answer: the staging run python -m pytest -m staging -v -rs gave 2 passed, 112 deselected. python -m pytest tests/test_cloud_humanconfidence_web.py::test_a_basic_key_gets_no_source with CLOUD_STAGING_ENDPOINT set to the production cloud and the Basic key gave 1 failed, on the assertion above. With production settings the three Human Confidence test files gave 38 passed, 2 skipped (the staging tests), and the whole examples folder gave 99 passed, 15 skipped, 0 failed. With only the staging names the whole folder gave 86 passed, 28 skipped, 0 failed. ci/key-names.Tests.ps1 and ci/check-environment-variable-names.Tests.ps1 gave 226 passed, 0 failed, and ./ci/check-environment-variable-names.ps1 passed. On this pull request, Cloud Human Confidence Tests run 45283451212 gave 2 passed, 112 deselected, and the other four checks passed.

When production catches up

Once the production cloud serves HumanConfidenceSource, the two tests move back to _51DEGREES_CLOUD_ENDPOINT and _51DEGREES_RESOURCE_KEY_BESPOKE and the staging workflow goes.

Overlap with open pull requests

#271 and #274 also change test_cloud_humanconfidence_web.py, including the two tests moved here. This pull request merged first, and the steps they need when they are brought up to date with rc are in #278, which also adds the files the tests and the install use to the workflow's paths.

The production cloud does not serve HumanConfidenceSource yet. Against it,
test_passive_source_and_level_come_from_the_cloud fails, and
test_a_basic_key_gets_no_source passes without proving anything, because
production gives the source to no key.

Both tests are now marked staging. They call the cloud that
CLOUD_STAGING_ENDPOINT names, with the Bespoke key in
RESOURCE_KEY_BESPOKE_STAGING and the Basic key in
_51DEGREES_RESOURCE_KEY_BASIC, and skip naming the variable when one is
missing. There is no default address, so they never call production.

The new Cloud Human Confidence Tests workflow runs them with -m staging,
nightly, on demand and on pull requests that change the example or its
tests. It fails when a name is empty, and when a test skipped or none ran.
common-ci passes on only _51DEGREES_ names and its own CI secrets, so in
the shared integration tests the staging tests skip.

The page and License Key tests stay on _51DEGREES_CLOUD_ENDPOINT.

The environment name check allows the two names only CI uses, and the key
name tests check that only the new workflow sets them, from the
organization variable and secret of the same name, and that its test step
fails on an empty name, a skipped test or no test run. AGENTS.md and the
pipeline readmes list the two names as CI only.
… a reason

test_a_basic_key_gets_no_source checked only that the example gave no
source. The example gives no source when the cloud leaves the property out
as well, and the production cloud leaves humanconfidencesource out for
every key, so the test passed there without proving anything.

The naming_the_properties fixture now keeps the cloud's answers to the
requests it changes. The test requires the last answer's derived to carry
humanconfidencesource with no value and a humanconfidencesourcenullreason
string, which the staging cloud gives a Basic key. It still checks the
example's answer.
@jwrosewell
jwrosewell marked this pull request as ready for review November 23, 2026 23:06
@jwrosewell
jwrosewell merged commit ebfffba into rc Nov 23, 2026
6 checks passed
@jwrosewell
jwrosewell deleted the test/hc-staging-tests branch November 23, 2026 23:06
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