Repository navigation
TEST: Run the Human Confidence source tests against the staging cloud - #277
Merged
Merged
Conversation
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
marked this pull request as ready for review
November 23, 2026 23:06
This was referenced Nov 23, 2026
Draft
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
Both tests are in
pipeline/fiftyone_pipeline_cloudrequestengine/examples/tests/test_cloud_humanconfidence_web.py. They are now markedstagingand call the cloud thatCLOUD_STAGING_ENDPOINTnames.test_passive_source_and_level_come_from_the_cloud{'humanConfidence': 'Unknown', 'source': None}. It now uses the Bespoke key inRESOURCE_KEY_BESPOKE_STAGING.test_a_basic_key_gets_no_source_51DEGREES_RESOURCE_KEY_BASIC, which both clouds know, with the staging endpoint. It also requires the cloud's own answer to carryhumanconfidencesourcewith no value and ahumanconfidencesourcenullreasonstring, 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. Thenaming_the_propertiesfixture keeps the cloud's answers for this.Each skips, naming the variable, when
CLOUD_STAGING_ENDPOINTor 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"), runspython -m pytest -m stagingwith only the three names it needs set on the test step. It runs onworkflow_dispatch, nightly, and on pull requests into main and rc that change the Human Confidence example, its live test file, the examples'conftest.pyor the workflow. It haspermissions: 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 sayNo staging test ranfor that exit code. It installs the pipeline packages from this checkout afterci/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.inipasses only_51DEGREES_*andPYTEST_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_keptchecks the page is served withCache-Control: no-storeand carries the resource key. Production serves this.test_licence_key_never_reaches_the_browserchecks the License Key is in neither the page nor the passive answer. Production serves this, and the check holds whatever the passive answer holds.clientfixture they share still checks the key carries HumanConfidence throughaccessibleproperties, which production lists for the Bespoke key.test_cloud_humanconfidence_web_offline.pyandtest_cloud_humanconfidence_web_port.pycall no cloud and are unchanged./redeemroute orhc/redeemagainst a live cloud, so nothing moves for the redeem.Names
CLOUD_STAGING_ENDPOINTis an organization variable holding the staging cloud's API base, ending/api/v4/.RESOURCE_KEY_BESPOKE_STAGINGis 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.ps1now allows them in$script:CiNames, andci/key-names.Tests.ps1checks that only the Cloud Human Confidence workflow sets them, fromvars.CLOUD_STAGING_ENDPOINTandsecrets.RESOURCE_KEY_BESPOKE_STAGING.AGENTS.md,pipeline/ci/README.mdandpipeline/readme.mdlist 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, frompipeline/fiftyone_pipeline_cloudrequestengine/examples. The names were set in the process environment only.CLOUD_STAGING_ENDPOINT,RESOURCE_KEY_BESPOKE_STAGINGand_51DEGREES_RESOURCE_KEY_BASICset:python -m pytest -m staging -v -rsgave 2 passed, 112 deselected._51DEGREES_CLOUD_ENDPOINTset to the production cloud, the production_51DEGREES_RESOURCE_KEY_BESPOKEand no staging names:python -m pytest tests/test_cloud_humanconfidence_web.py -v -rsgave 2 passed (the page and License Key tests) and 2 skipped, each namingCLOUD_STAGING_ENDPOINT.{'humanConfidence': 'Unknown', 'source': None}. At the first commit the Basic test passed there, proving nothing. With the second commit it fails there withThe cloud's answer leaves out humanconfidencesource, as production'sderivedholds onlyhumanconfidence(null) and its null reason.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_BESPOKEwas not set), 0 failed. With only the staging names, 86 passed, 28 skipped, 0 failed.CLOUD_STAGING_ENDPOINTempty it exited 1 withCLOUD_STAGING_ENDPOINT is empty or missingbefore running pytest. Its skip check read a real pytest junit report with 2 skipped tests and named both.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../ci/check-environment-variable-names.ps1passed.python -m pytest -m staging -v -rsgave 2 passed, 112 deselected.python -m pytest tests/test_cloud_humanconfidence_web.py::test_a_basic_key_gets_no_sourcewithCLOUD_STAGING_ENDPOINTset 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.ps1andci/check-environment-variable-names.Tests.ps1gave 226 passed, 0 failed, and./ci/check-environment-variable-names.ps1passed. 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_ENDPOINTand_51DEGREES_RESOURCE_KEY_BESPOKEand 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.