Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1664eaf
Test that the server route passes the session id, sequence, browser t…
Jamesr51d Nov 26, 2026
5f1996e
Install Flask for the cloud request engine tests
Jamesr51d Nov 26, 2026
188da33
Send every page iteration and supplied connection to the cloud when a…
Jamesr51d Nov 26, 2026
a022acd
Test the examples against the packages published on PyPI
jwrosewell Dec 1, 2026
2aad47b
Merge rc into feature/cloud-request-engine-browser-test-pass-through
jwrosewell Dec 1, 2026
8e261c6
Give the examples' tests the TAC data file and run every test module
jwrosewell Dec 1, 2026
8c17f68
Start Node once before the object name tests, outside their time limit
jwrosewell Nov 18, 2026
fc120d6
Keep two blank lines before _declared_names in the object name tests
jwrosewell Dec 1, 2026
d7ff385
Keep every cloud response made for one visitor out of the response cache
jwrosewell Dec 1, 2026
8c5d400
Count Unknown as a HumanConfidence value, not a sealed result
jwrosewell Dec 1, 2026
a0502f0
Count Unknown as a sealed result, as HumanConfidence no longer has it
jwrosewell Dec 1, 2026
0a5dffd
Merge pull request #296 from 51Degrees/fix/node-start-outside-call-limit
jwrosewell Dec 1, 2026
0026dd6
Merge pull request #294 from 51Degrees/build/examples-vs-published-pa…
jwrosewell Dec 1, 2026
afb8a90
Read only High, Medium and Low as HumanConfidence values
jwrosewell Dec 1, 2026
015ad4b
Merge pull request #297 from 51Degrees/fix/human-confidence-no-unknow…
jwrosewell Dec 1, 2026
2805216
BUILD: Restore the free-threaded tests' data files from the shared copy
jwrosewell Dec 1, 2026
5de373f
TEST: Expect the free-threaded tests to restore the shared copy, with…
jwrosewell Dec 1, 2026
5234367
Merge pull request #295 from 51Degrees/feature/cloud-request-engine-b…
jwrosewell Dec 1, 2026
f08ed66
BUILD: Restore the published examples' data files from the shared copy
jwrosewell Dec 1, 2026
03ee294
BUILD: List CACHE_ENCRYPTION_KEY among the names only CI uses
jwrosewell Dec 1, 2026
df9a59c
Merge pull request #298 from 51Degrees/build/shared-assets
jwrosewell Dec 1, 2026
8f8bb72
Key the cloud engines' cache on the request's evidence through the Cl…
jwrosewell Dec 1, 2026
802efb1
Merge pull request #300 from 51Degrees/fix/cloud-engine-cache-key
jwrosewell Dec 1, 2026
8f18579
TEST: Prove each value made for one visitor keeps a request out of th…
jwrosewell Dec 1, 2026
96f6bb6
Key the Cloud Request Engine's cache on every 51D_ query and cookie v…
jwrosewell Dec 1, 2026
40f504f
TEST: Check the server route sends 51D_ values unchanged on the wire
jwrosewell Dec 1, 2026
7a018ec
Make LRUEngineCache safe to share between threads
jwrosewell Dec 1, 2026
d26c2c9
TEST: Restore LF line endings in the object name tests
jwrosewell Dec 1, 2026
b7fda59
BUILD: Wait for the version a publish released before testing the exa…
jwrosewell Dec 1, 2026
155cc98
Ignore a cache given to a cloud engine, with one warning, rather than…
jwrosewell Dec 1, 2026
c74459c
Merge pull request #301 from 51Degrees/fix/cloud-cache-rules-and-lru-…
jwrosewell Dec 1, 2026
71f274a
Let a subclass of LRUEngineCache that skips its constructor read and …
jwrosewell Dec 1, 2026
8a005b1
Merge pull request #303 from 51Degrees/fix/lru-cache-lock-without-con…
jwrosewell Dec 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
363 changes: 363 additions & 0 deletions .github/workflows/examples-published.yml

Large diffs are not rendered by default.

75 changes: 13 additions & 62 deletions .github/workflows/free-threaded-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: Free-threaded Python

# Builds the Device Detection and IP Intelligence on-premise packages on the
# free-threaded builds of Python and runs their tests there, with the free
# Lite data files. Those come from the assets common-ci fetches for each run,
# as every other workflow's tests do. The first job finds them in the asset
# cache, or fetches them into it with common-ci's prefetch_assets action when
# it misses, and the test jobs restore them from there. No job downloads
# them from the links in the data submodule.
# Lite data files. Those come from the one shared copy that common-ci's
# Nightly Shared Assets workflow downloads each day, as every other
# workflow's tests do, restored by common-ci's fetch-assets action. No job
# downloads them from the links in the data submodule.
# ci/free-threaded-python.Tests.ps1 checks this. The native modules do not declare that they run without
# the GIL, so Python turns the GIL back on when it loads them.
# tests/test_free_threaded.py in each package checks that it does, and is
Expand Down Expand Up @@ -45,55 +44,8 @@ env:
_51DEGREES_WARNINGS_AS_ERRORS: 'true'

jobs:
# The job is named Configure, as common-ci's is, because this repository's
# ci/fetch-assets.ps1 fetches the assets of every product only in a job of
# that name. The asset cache it fills is the one the other workflows that
# day restore, so it must never hold only some of them.
Configure:
name: Find or fetch the run's assets
runs-on: ubuntu-latest
outputs:
key: ${{ steps.prefetch-assets.outputs.cache-key }}
defaults:
run:
shell: pwsh
steps:
# common-ci's action and steps run from its checkout, with this
# repository below it, as in common-ci's own workflows.
- name: Checkout common-ci
uses: actions/checkout@v4
with:
repository: 51Degrees/common-ci
ref: main
persist-credentials: false

# The fetch links the assets into the data submodule, so it is
# checked out too.
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.event.repository.name }}
persist-credentials: false
submodules: recursive

# Restores nothing, and fetches the assets into the cache only when it
# has no copy under the day's key.
# The action is handed no secrets, because GitHub marks a workflow that
# hands every secret to a step as possibly malicious and holds each run
# for approval. The fetch reads only the data file license key, which
# goes as license-key.
- name: Find or fetch the assets
id: prefetch-assets
uses: ./.github/actions/prefetch_assets
with:
repo: ${{ github.event.repository.name }}
secrets: '{}'
vars: ${{ toJSON(vars) }}
license-key: ${{ secrets.LICENSE_KEY_V4TAC_IPIV4ENTERPRISE }}

free-threaded:
name: Python ${{ matrix.python }} on ${{ matrix.os }}
needs: Configure
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -167,17 +119,16 @@ jobs:
-e device-detection/fiftyone_devicedetection `
-e device-detection/fiftyone_devicedetection_examples

# The path and the cross-OS setting are those prefetch_assets saves
# with, so the key matches.
- name: Restore the run's assets
uses: actions/cache/restore@v5
# The free files need no key. A file the shared copy lacks fails the
# step, and nothing downloads it here.
- name: Restore the free data files
uses: 51Degrees/common-ci/actions/fetch-assets@main
with:
path: assets
key: ${{ needs.Configure.outputs.key }}
enableCrossOsArchive: true
# The first job fetched them, so a miss is a fault, never a reason
# to download them here.
fail-on-cache-miss: true
assets: |
51Degrees-LiteV4.1.hash
20000 Evidence Records.yml
51Degrees-IPIV4AsnIpiV41.ipi
51Degrees-LiteIpiV41.ipi

# Copies, not links, so the Windows job needs no right to make links.
- name: Put the free data files where the tests look for them
Expand Down
6 changes: 4 additions & 2 deletions ci/check-environment-variable-names.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ $script:PlatformNames = @(
$script:PlatformPrefixes = @('GITHUB_')

# The names only CI uses. No customer sets them, so they have no _51DEGREES_
# prefix, and each name says what it holds.
$script:CiNames = @('CLOUD_STAGING_ENDPOINT', 'RESOURCE_KEY_BESPOKE_STAGING')
# prefix, and each name says what it holds. CACHE_ENCRYPTION_KEY decrypts the
# licensed files of common-ci's shared copy of the data files, and a workflow
# gives it to common-ci's fetch-assets step in that step's environment.
$script:CiNames = @('CACHE_ENCRYPTION_KEY', 'CLOUD_STAGING_ENDPOINT', 'RESOURCE_KEY_BESPOKE_STAGING')

$name = '(?<name>[A-Za-z0-9_]+)'
$quoted = "['`"]$name['`"]"
Expand Down
78 changes: 19 additions & 59 deletions ci/free-threaded-python.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Tests that .github/workflows/free-threaded-python.yml takes the free Lite
# data files from the assets common-ci fetches for each run, in one job, and
# that the jobs that test restore them from that job's cache, rather than any
# job downloading them from the links in the data submodule.
# data files from the one shared copy that common-ci's Nightly Shared Assets
# workflow downloads each day, restored in each job that tests by common-ci's
# fetch-assets step, rather than any job downloading them from the links in
# the data submodule or keeping them in this repository's Actions cache.
# The workflow is read as text, as the runners have no YAML module.

BeforeAll {
Expand Down Expand Up @@ -52,84 +53,43 @@ BeforeAll {
}
}

$script:Fetching = @($script:Jobs.Keys | Where-Object {
($script:Jobs[$_] -join "`n") -match 'uses:\s*\S*prefetch_assets' })
$script:Testing = @($script:Jobs.Keys | Where-Object {
($script:Jobs[$_] -join "`n") -match 'pytest' })
$script:FreeFiles = @('51Degrees-LiteV4.1.hash', '20000 Evidence Records.yml',
'51Degrees-IPIV4AsnIpiV41.ipi', '51Degrees-LiteIpiV41.ipi')
}

Describe 'free-threaded-python.yml' {
It 'never downloads from the links in the data submodule' {
$script:Text | Should -Not -Match 'get-data-files'
}

It 'finds or fetches the assets in one job only' {
$script:Fetching.Count | Should -Be 1
}

It 'names that job Configure, so every product''s assets are fetched' {
# ci/fetch-assets.ps1 fetches every product's assets only in a job of
# that name, and the cache it fills is shared with the other
# workflows.
$script:Fetching[0] | Should -BeExactly 'Configure'
Get-Content -Raw (Join-Path $PSScriptRoot 'fetch-assets.ps1') |
Should -Match "GITHUB_JOB\s+-eq\s+'Configure'"
}

It 'fetches with common-ci''s action, run from common-ci''s checkout' {
$job = $script:Fetching[0]
$prefetch = @(Get-Step $job './.github/actions/prefetch_assets')
$prefetch.Count | Should -Be 1
Get-Value $prefetch[0] 'id' | Should -Not -BeNullOrEmpty
Get-Value $prefetch[0] 'license-key' | Should -Not -BeNullOrEmpty
$checkouts = @(Get-Step $job 'actions/checkout')
@($checkouts | Where-Object {
(Get-Value $_ 'repository') -eq '51Degrees/common-ci' -and
-not (Get-Value $_ 'path') }).Count | Should -Be 1
$own = @($checkouts | Where-Object { -not (Get-Value $_ 'repository') })
$own.Count | Should -Be 1
Get-Value $own[0] 'path' | Should -Be (Get-Value $prefetch[0] 'repo')
Get-Value $own[0] 'submodules' | Should -Be 'recursive'
It 'keeps nothing in the Actions cache and runs no prefetch' {
$script:Text | Should -Not -Match 'actions/cache|prefetch_assets'
}

It 'hands no step every secret, so GitHub does not hold its runs' {
# GitHub holds each run of a workflow that hands every secret to a
# step for approval, and the run never starts on its own.
$script:Text | Should -Not -Match 'toJSON\(\s*secrets\s*\)'
$prefetch = @(Get-Step $script:Fetching[0] './.github/actions/prefetch_assets')
Get-Value $prefetch[0] 'secrets' | Should -BeExactly "'{}'"
}

It 'gives the cache key to the jobs that test' {
$job = $script:Fetching[0]
$id = Get-Value (@(Get-Step $job './.github/actions/prefetch_assets')[0]) 'id'
($script:Jobs[$job] -join "`n") | Should -Match (
'\n outputs:\s*\n\s+key:\s*' +
[regex]::Escape('${{ steps.' + $id + '.outputs.cache-key }}'))
}

It 'never fetches in a job that runs the tests' {
It 'restores the free files from the shared copy in each job that runs the tests' {
$script:Testing.Count | Should -BeGreaterThan 0
foreach ($job in $script:Testing) {
$script:Fetching | Should -Not -Contain $job
}
}

It 'restores the assets in each job that runs the tests, as prefetch_assets saves them' {
$job = $script:Fetching[0]
foreach ($testing in $script:Testing) {
$text = $script:Jobs[$testing] -join "`n"
$text | Should -Match "\n needs:\s*\[?\s*$([regex]::Escape($job))\b"
$restore = @(Get-Step $testing 'actions/cache/restore')
$restore = @(Get-Step $testing '51Degrees/common-ci/actions/fetch-assets')
$restore.Count | Should -Be 1
Get-Value $restore[0] 'path' | Should -Be 'assets'
Get-Value $restore[0] 'key' |
Should -Be ('${{ needs.' + $job + '.outputs.key }}')
Get-Value $restore[0] 'fail-on-cache-miss' | Should -Be 'true'
Get-Value $restore[0] 'enableCrossOsArchive' | Should -Be 'true'
$text = $restore[0] -join "`n"
foreach ($file in $script:FreeFiles) {
$text | Should -Match "(?m)^\s+$([regex]::Escape($file))\s*$"
}
# The free files need no key, and nothing is downloaded or kept.
$text | Should -Not -Match 'encryption-key|cache:|lazy:'
$jobText = $script:Jobs[$testing] -join "`n"
$jobText.IndexOf('common-ci/actions/fetch-assets') |
Should -BeLessThan $jobText.IndexOf('- name: Put the free data files where the tests look for them')
}
}

It 'puts each free data file the tests use in place from the assets' {
foreach ($testing in $script:Testing) {
$text = $script:Jobs[$testing] -join "`n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ def __init__(self, settings = None, usage_sharing = True, **kwargs):
* enable_cookies - whether cookies should be enabled
* minify: Whether to minify the JavaScript
@type cache: Cache
@param cache: An instance of the fiftyone.pipeline.engines.cache, for the cloud engine only. The on-premise engine raises an exception if one is supplied
class
@param cache: An instance of the fiftyone.pipeline.engines.cache
class, for the cloud only. It is added to the Cloud Request Engine,
which keys it on the evidence it sends and applies its own cache
rules. One of them sends a request that carries a session id to the
cloud service every time, and every request carries one while the
JavaScript builder is on. The on-premise engine raises an exception
if one is supplied.

Cloud Engine Settings:

Expand Down Expand Up @@ -150,19 +155,22 @@ def __init__(self, settings = None, usage_sharing = True, **kwargs):
self._usage_sharing = None

if "data_file_path" in settings:
# The engine raises an exception if a cache is supplied.
del settings["settings"]
device = DeviceDetectionOnPremise(**settings)

if usage_sharing:
self._usage_sharing = ShareUsage()

else :
self.add(CloudRequestEngine(settings))
request_engine = CloudRequestEngine(settings)

if "cache" in settings:
request_engine.set_cache(settings["cache"])

self.add(request_engine)
device = DeviceDetectionCloud()

if "cache" in settings:
device.set_cache(settings["cache"])

self.add(device)

if self._usage_sharing is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ def __init__(self, settings = None, usage_sharing = True, **kwargs):
* minify: Whether to minify the JavaScript
@type cache: Cache
@param cache: An instance of the fiftyone.pipeline.engines.cache
class
class. It is added to the Cloud Request Engine, which keys it on
the evidence it sends and applies its own cache rules. One of them
sends a request that carries a session id to the cloud service
every time, and every request carries one while the JavaScript
builder is on.

Cloud Engine Settings:

Expand All @@ -81,11 +85,11 @@ def __init__(self, settings = None, usage_sharing = True, **kwargs):

# Add specific engines

self.add(CloudRequestEngine(settings))
device = DeviceDetectionCloud()
request_engine = CloudRequestEngine(settings)

if "cache" in settings:
device.set_cache(settings["cache"])

self.add(device)
request_engine.set_cache(settings["cache"])

self.add(request_engine)
self.add(DeviceDetectionCloud())

Loading
Loading