From 9df41ce655a6acb1f43b9423c52c2fd0b9d66f65 Mon Sep 17 00:00:00 2001 From: Wes John-Alder Date: Sun, 15 Nov 2026 09:48:37 -0500 Subject: [PATCH 1/2] PNE-9649: Remove allowed_names from ProcessTemplate The Citrine Platform ignores allowed_names on process templates, and gemd-python drops the field in 4.0.0. Citrine Python no longer reads, writes, or passes the field to gemd. gemd 3 objects still carry the field, so five tests that compared a gemd object with a Citrine object now build both sides as Citrine objects. Removing the constructor argument changes the public API, so the version moves to 6.0.0. Co-Authored-By: Claude Opus 5.5 --- src/citrine/__version__.py | 2 +- src/citrine/resources/process_template.py | 3 --- tests/resources/test_dataset.py | 2 +- tests/resources/test_material_run.py | 5 +++-- tests/resources/test_templates.py | 5 +++-- tests/serialization/test_material_run.py | 2 +- tests/serialization/test_object_template.py | 1 - tests/serialization/test_process_spec.py | 2 -- 8 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/citrine/__version__.py b/src/citrine/__version__.py index 0419a93d2..0f607a5d2 100644 --- a/src/citrine/__version__.py +++ b/src/citrine/__version__.py @@ -1 +1 @@ -__version__ = "5.3.1" +__version__ = "6.0.0" diff --git a/src/citrine/resources/process_template.py b/src/citrine/resources/process_template.py index e5fc838fe..e3eb1fff0 100644 --- a/src/citrine/resources/process_template.py +++ b/src/citrine/resources/process_template.py @@ -65,7 +65,6 @@ class ProcessTemplate( parameters = Optional(List(_attr_tuple(GEMDParameterTemplate)), "parameters", override=True) allowed_labels = Optional(List(String()), "allowed_labels", override=True) - allowed_names = Optional(List(String()), "allowed_names", override=True) def __init__( self, @@ -85,7 +84,6 @@ def __init__( ] | None = None, allowed_labels: list[str] | None = None, - allowed_names: list[str] | None = None, description: str | None = None, tags: list[str] | None = None, ): @@ -101,7 +99,6 @@ def __init__( tags=tags, description=description, allowed_labels=allowed_labels, - allowed_names=allowed_names, ) def __str__(self): diff --git a/tests/resources/test_dataset.py b/tests/resources/test_dataset.py index a9e70b181..ed6afa665 100644 --- a/tests/resources/test_dataset.py +++ b/tests/resources/test_dataset.py @@ -399,7 +399,7 @@ def test_gemd_posts(dataset): def test_register_all_nested(dataset): cake = make_cake() after = dataset.register_all([cake], include_nested=True) - assert cake in after + assert MaterialRun.build(cake.dump()) in after assert len(after) == len(recursive_flatmap(cake, lambda o: [o], unidirectional=False)) diff --git a/tests/resources/test_material_run.py b/tests/resources/test_material_run.py index 9809521c1..5dfcdef23 100644 --- a/tests/resources/test_material_run.py +++ b/tests/resources/test_material_run.py @@ -151,7 +151,7 @@ def test_get_history(collection, session): }, ) assert expected_call == session.last_call - assert run == cake + assert run == CitrineRun.build(cake.dump()) def test_get_history_no_histories(collection, session): @@ -558,7 +558,8 @@ def test_deep_equals(collection): registered.remove(x) assert len(registered) == 0, "All registered objects are in the flat list" - assert cake == CitrineRun.build(cake.dump()), "Equality works in hydrated form" + citrine_cake = CitrineRun.build(cake.dump()) + assert citrine_cake == CitrineRun.build(citrine_cake.dump()), "Equality works in hydrated form" def test_nonmutating_dry_run(collection): diff --git a/tests/resources/test_templates.py b/tests/resources/test_templates.py index e85eeabb2..1d2cb0e59 100644 --- a/tests/resources/test_templates.py +++ b/tests/resources/test_templates.py @@ -91,9 +91,10 @@ def test_process_template_equals(): gemd_obj = GEMDProcessTemplate(name="My Name", tags=["tag!"]) citrine_obj = CitrineProcessTemplate(name="My Name", tags=["tag!"]) - assert gemd_obj == citrine_obj, "GEMD/Citrine equivalence" + built = CitrineProcessTemplate.build(gemd_obj.dump()) + assert built == citrine_obj, "GEMD/Citrine equivalence" citrine_obj.name = "Something else" - assert gemd_obj != citrine_obj, "GEMD/Citrine detects difference" + assert built != citrine_obj, "GEMD/Citrine detects difference" def test_material_template_equals(): diff --git a/tests/serialization/test_material_run.py b/tests/serialization/test_material_run.py index b15563389..e67ae95b0 100644 --- a/tests/serialization/test_material_run.py +++ b/tests/serialization/test_material_run.py @@ -178,7 +178,7 @@ def test_cake(): assert [ingred.labels for ingred in cake.process.ingredients] == [ ingred.labels for ingred in gemd_cake.process.ingredients ] - assert gemd_cake == cake + assert MaterialRun.build(gemd_cake.dump()) == cake def _by_name(start: MaterialRun, names: Iterable[str]) -> MaterialRun | None: if isinstance(names, str): diff --git a/tests/serialization/test_object_template.py b/tests/serialization/test_object_template.py index 6172e3215..5ea7a8df2 100644 --- a/tests/serialization/test_object_template.py +++ b/tests/serialization/test_object_template.py @@ -45,7 +45,6 @@ def test_object_template_serde(): parameters=[index_template], conditions=[pressure_template], allowed_labels=["Label"], - allowed_names=["first sample", "second sample"], ) assert ProcessTemplate.build(proc_template.dump()) == proc_template diff --git a/tests/serialization/test_process_spec.py b/tests/serialization/test_process_spec.py index 82c107d43..481caad04 100644 --- a/tests/serialization/test_process_spec.py +++ b/tests/serialization/test_process_spec.py @@ -68,7 +68,6 @@ def valid_data(): ] ], "allowed_labels": ["a", "b"], - "allowed_names": ["a name"], "description": "a long description", }, file_links=[{"type": "file_link", "filename": "cake_recipe.txt", "url": "www.baking.com"}], @@ -103,7 +102,6 @@ def test_simple_deserialization(valid_data): ], description="a long description", allowed_labels=["a", "b"], - allowed_names=["a name"], ) assert process_spec.name == "Process 1" assert process_spec.notes == "make sure to use oven mitts" From df9f1e4d7625854909a5e0d9dc1c0b07df0e07fd Mon Sep 17 00:00:00 2001 From: Wes John-Alder Date: Sun, 15 Nov 2026 09:57:30 -0500 Subject: [PATCH 2/2] Run the devkit e2e suite against development-e2e The workflow installs citrine from this checkout and runs the nextgen-devkit end-to-end suite against development-e2e. It mirrors nextgen-devkit's pr-development.yml. citrine-python cannot see the e2e secrets yet. Until it can, the job skips its steps and ends green. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/e2e-development-e2e.yml | 134 ++++++++++++++++++++++ scripts/check_e2e_secrets.sh | 19 +++ 2 files changed, 153 insertions(+) create mode 100644 .github/workflows/e2e-development-e2e.yml create mode 100755 scripts/check_e2e_secrets.sh diff --git a/.github/workflows/e2e-development-e2e.yml b/.github/workflows/e2e-development-e2e.yml new file mode 100644 index 000000000..88cab23c1 --- /dev/null +++ b/.github/workflows/e2e-development-e2e.yml @@ -0,0 +1,134 @@ +name: E2E Development-E2E + +# Runs the nextgen-devkit end-to-end suite against development-e2e, with +# citrine installed from this checkout instead of from PyPI or a git ref. +# Mirrors nextgen-devkit's pr-development.yml and test-e2e-aws.yml. + +on: + pull_request: + branches: + - main + workflow_dispatch: + inputs: + devkit_ref: + description: "nextgen-devkit ref to take the e2e suite from" + required: false + default: "main" + type: string + +permissions: + contents: read + checks: write + +# Shares the group name with nextgen-devkit's pr-development.yml. GitHub scopes +# concurrency groups to one repository, so this serializes runs here only. +concurrency: + group: e2e-development-e2e + cancel-in-progress: false + +jobs: + e2e: + name: "E2E Tests (development-e2e)" + # Fork PRs receive no secrets, so run only for same-repo PRs and manual runs. + if: github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository + timeout-minutes: 60 + # nextgen-devkit runs this suite on the self-hosted ccl-builder runner. + # citrine-python is public, so this job uses a GitHub-hosted runner. + # If GitHub-hosted runners cannot reach development-e2e, change the runner. + runs-on: ubuntu-latest + + steps: + - name: Checkout citrine-python + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + path: citrine-python + persist-credentials: false + + # citrine-python cannot see the e2e secrets yet. Without them, skip the + # remaining steps so the job ends green instead of failing the PR. + - name: Check e2e secrets + id: secrets + env: + DEV_E2E_API_KEY_FE_ADMIN: ${{ secrets.DEV_E2E_API_KEY_FE_ADMIN }} + DEV_E2E_API_KEY_OTHER_USER: ${{ secrets.DEV_E2E_API_KEY_OTHER_USER }} + DEVKIT_APP_ID: ${{ secrets.DEVKIT_APP_ID }} + DEVKIT_APP_PRIVATE_KEY: ${{ secrets.DEVKIT_APP_PRIVATE_KEY }} + run: ./citrine-python/scripts/check_e2e_secrets.sh + + - name: Generate GitHub App token + if: steps.secrets.outputs.available == 'true' + uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2 + id: generate_token + with: + app-id: ${{ secrets.DEVKIT_APP_ID }} + private-key: ${{ secrets.DEVKIT_APP_PRIVATE_KEY }} + owner: CitrineInformatics + repositories: | + nextgen-devkit + + - name: Checkout nextgen-devkit + if: steps.secrets.outputs.available == 'true' + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + repository: CitrineInformatics/nextgen-devkit + ref: ${{ inputs.devkit_ref || 'main' }} + token: ${{ steps.generate_token.outputs.token }} + path: nextgen-devkit + persist-credentials: false + + - name: Install Python + if: steps.secrets.outputs.available == 'true' + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + with: + python-version: "3.12" + + - name: Install uv + if: steps.secrets.outputs.available == 'true' + uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # 61cb8a9741eeb8a550a1b8544337180c0fc8476b + with: + version: "latest" + + # The suite's uv.lock pins citrine from PyPI. The --with layer takes + # precedence over the project environment; this step logs which citrine loads. + - name: Show citrine under test + if: steps.secrets.outputs.available == 'true' + working-directory: nextgen-devkit/end-to-end-tests + env: + CITRINE_PKG: "citrine @ file://${{ github.workspace }}/citrine-python" + run: uv run --with "$CITRINE_PKG" python -c "import citrine; print('citrine', citrine.__version__, citrine.__file__)" + + # Same pytest command as nextgen-devkit's test-e2e-aws.yml, with citrine + # from this checkout. pytest creates the results/ directory for --junitxml. + - name: Run E2E tests + if: steps.secrets.outputs.available == 'true' + working-directory: nextgen-devkit/end-to-end-tests + env: + CITRINE_DEPLOYMENT_TYPE: "aws" + CITRINE_API_HOST: "development-e2e.citrine-platform.com" + CITRINE_API_PORT: "443" + CITRINE_API_SCHEME: "https" + CITRINE_API_KEY: "${{ secrets.DEV_E2E_API_KEY_FE_ADMIN }}" + CITRINE_API_KEY_2: "${{ secrets.DEV_E2E_API_KEY_OTHER_USER }}" + CITRINE_NO_PRELOAD: "1" + CITRINE_PRELOAD_PREFIX: "PR" + CITRINE_PRELOAD_SHARE: "none" + CITRINE_PKG: "citrine @ file://${{ github.workspace }}/citrine-python" + run: >- + uv run --with "$CITRINE_PKG" + pytest -v -rfexs -s -p no:warnings --tb=short --capture=sys --durations=15 + -n "$(( $(getconf _NPROCESSORS_ONLN) / 2 ))" + --junitxml=results/TEST-e2e-aws.xml + tests/ + + - name: Publish Test Report + uses: mikepenz/action-junit-report@5b7ee5a21e8674b695313d769f3cbdfd5d4d53a4 # v6.0.0 + if: ${{ always() && steps.secrets.outputs.available == 'true' }} + with: + report_paths: "**/results/TEST-*.xml" + github_token: ${{ secrets.GITHUB_TOKEN }} + fail_on_failure: true + require_tests: true + fail_on_parse_error: true + annotate_only: true + include_passed: true diff --git a/scripts/check_e2e_secrets.sh b/scripts/check_e2e_secrets.sh new file mode 100755 index 000000000..c950f4fa3 --- /dev/null +++ b/scripts/check_e2e_secrets.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Report whether the development-e2e secrets are available. +# +# Required env vars (empty when the repo cannot see the secret): +# DEV_E2E_API_KEY_FE_ADMIN, DEV_E2E_API_KEY_OTHER_USER, +# DEVKIT_APP_ID, DEVKIT_APP_PRIVATE_KEY +# Optional: GITHUB_OUTPUT. When set, the script writes available=true|false to it. +# Always exits 0, so a missing secret skips the run instead of failing it. +set -uo pipefail + +available=true +for name in DEV_E2E_API_KEY_FE_ADMIN DEV_E2E_API_KEY_OTHER_USER DEVKIT_APP_ID DEVKIT_APP_PRIVATE_KEY; do + if [ -z "${!name:-}" ]; then + echo "::notice::${name} is not available to this repo; skipping the development-e2e run." + available=false + fi +done + +echo "available=${available}" >> "${GITHUB_OUTPUT:-/dev/stdout}"