From fd9dff4639aeb454a85f991b86fb9c25a477bd65 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 12:07:46 -0700 Subject: [PATCH 01/13] ci: share the api-simulator build across test jobs --- .github/AGENTS.md | 31 +++- .github/workflows/tests.yml | 103 +++++++------ tests/infra/test_ci_workflow.py | 252 ++++++++++++++++---------------- 3 files changed, 200 insertions(+), 186 deletions(-) diff --git a/.github/AGENTS.md b/.github/AGENTS.md index c1e4c4ba46..1c0c16ea57 100644 --- a/.github/AGENTS.md +++ b/.github/AGENTS.md @@ -38,11 +38,25 @@ wheel cache consumed by downstream jobs: ``` Jobs that run `uv sync --locked` may normally omit `enable-cache` (defaults to `auto`, -enabled on GitHub-hosted runners). In `.github/workflows/tests.yml`, however, the `test` -and `cache_prime` jobs deliberately set `enable-cache: false` despite syncing because -explicit `actions/cache` owns their uv-cache I/O. That workflow's matrix jobs restore only; -its schedule-or-`main`-push default-branch primer is the sole saver for the uv dependency -cache. This single-saver rule does not apply to unrelated workflows or non-uv caches. +enabled on GitHub-hosted runners). In `.github/workflows/tests.yml`, however, the +`api_simulator_cache` and `test` jobs deliberately set `enable-cache: false` despite syncing +because explicit `actions/cache` owns their uv-cache I/O. `api_simulator_cache` runs on +every event and is the sole saver: its key is the runner OS, architecture and image, the uv +version, `.python-version` and `api-simulator.rev`, and never `uv.lock`; the +regenerated `uv.lock` changes its version line on every bump. It builds api-simulator only +on a lookup miss. The test +matrix jobs restore only, with `fail-on-cache-miss`, and configure no private-dependency git +credentials, and install no Rust toolchain. The `test` job runs even when the producer fails, +so the required `Test (*)` contexts report the failure through an explicit Linux +producer-status check before restore, instead of waiting out the merge-queue timeout. +Keep `preflight` independent, with no `needs`, so a producer failure cannot skip preflight +and suppress those contexts. Set `cache-mode: write` on the producer and `cache-mode: read` +on `test`. After syncing, Linux legs must import the api-simulator submodules that load +its native extension; importing the top-level package alone does not check compatibility. +If a saved entry is unusable, delete it with `gh cache delete ` and rerun. The entry contains +api-simulator's source and is readable by pull requests into this public repository; the +owner of both repositories accepted that. This single-saver rule does not apply to +unrelated workflows or non-uv caches. ## Branch-targeted test policy @@ -61,9 +75,10 @@ shallow without providing a coordinated fallback for merge-base computation. ## Rust toolchain scope -`dtolnay/rust-toolchain` is only needed in jobs that compile native Python extensions -(i.e., jobs that run `uv sync`). Do not add it to preflight, lint, or other utility jobs -that only run `uv lock --check` or similar commands. +`dtolnay/rust-toolchain` is only needed in jobs that compile native Python extensions. In +`.github/workflows/tests.yml` only `api_simulator_cache` compiles, and only on a cache miss; +the test matrix restores that build and must not install Rust. Do not add it to preflight, +lint, or other utility jobs that only run `uv lock --check` or similar commands. ## Lockfile verification diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c4dfd1af0c..6a8285ad6f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,8 +6,6 @@ on: pull_request: branches: [main, develop, stable] merge_group: - schedule: - - cron: "17 3 * * *" permissions: contents: read @@ -15,7 +13,6 @@ permissions: jobs: preflight: name: Preflight checks - if: github.event_name != 'schedule' runs-on: ubuntu-latest outputs: os-matrix: ${{ steps.ci-policy.outputs.os-matrix }} @@ -42,20 +39,30 @@ jobs: echo "uv: $(uv --version)" uv run python --version - cache_metadata: - name: Resolve uv cache identity + api_simulator_cache: + name: Provide api-simulator build runs-on: ubuntu-latest + cache-mode: write outputs: - python_cache_tag: ${{ steps.cache-identity.outputs.python_cache_tag }} - api_simulator_rev: ${{ steps.cache-identity.outputs.api_simulator_rev }} + cache-key: ${{ steps.cache-identity.outputs.key }} steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - name: Install uv + id: setup-uv + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 + with: + version: "0.9.21" + enable-cache: false + - name: Resolve cache identity id: cache-identity shell: bash + env: + UV_VERSION: ${{ steps.setup-uv.outputs.uv-version }} run: | python3 <<'PY' >> "$GITHUB_OUTPUT" + import os import re import tomllib from pathlib import Path @@ -70,24 +77,12 @@ jobs: if not isinstance(revision, str) or re.fullmatch(r"[0-9a-fA-F]{40}", revision) is None: raise SystemExit(f"invalid api-simulator revision: {revision!r}") - print(f"python_cache_tag={python_selector.replace('.', '')}") - print(f"api_simulator_rev={revision}") + # Label the producer's image family; consumers separately verify native imports. + runner = f"{os.environ['RUNNER_OS']}-{os.environ['RUNNER_ARCH']}-{os.environ['ImageOS']}" + python_tag = python_selector.replace(".", "") + print(f"key=uv-api-simulator-{runner}-uv{os.environ['UV_VERSION']}-py{python_tag}-{revision}") PY - cache_prime: - name: Prime uv cache - if: github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main') - needs: cache_metadata - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - - name: Install uv - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 - with: - version: "0.9.21" - enable-cache: false - - name: Resolve uv cache directory id: uv-cache-dir shell: bash @@ -96,39 +91,46 @@ jobs: echo "UV_CACHE_DIR=$UV_CACHE_DIR" >> "$GITHUB_ENV" echo "path=$UV_CACHE_DIR" >> "$GITHUB_OUTPUT" - - name: Restore uv cache - id: uv-cache-restore + - name: Look up api-simulator build + id: cache-lookup uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: ${{ steps.uv-cache-dir.outputs.path }} - key: uv-${{ runner.os }}-py${{ needs.cache_metadata.outputs.python_cache_tag }}-${{ needs.cache_metadata.outputs.api_simulator_rev }}-${{ hashFiles('uv.lock') }} - restore-keys: uv-${{ runner.os }}-py${{ needs.cache_metadata.outputs.python_cache_tag }}-${{ needs.cache_metadata.outputs.api_simulator_rev }}- + key: ${{ steps.cache-identity.outputs.key }} + lookup-only: true - name: Configure git auth for private deps + if: steps.cache-lookup.outputs.cache-hit != 'true' run: git config --global url."https://${{ secrets.GH_USER }}:${{ secrets.GH_PAT }}@github.com/TalonT-Org/".insteadOf "https://github.com/TalonT-Org/" - name: Install Rust toolchain + if: steps.cache-lookup.outputs.cache-hit != 'true' uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable with: toolchain: "1.98.1" - - name: Install dependencies - run: uv sync --locked --extra dev - - - name: Prune uv cache - run: uv cache prune --ci + - name: Build api-simulator into the uv cache + if: steps.cache-lookup.outputs.cache-hit != 'true' + env: + # Keeps cargo's build output out of uv's Git checkout, which the cached entry includes. + CARGO_TARGET_DIR: ${{ runner.temp }}/api-simulator-target + run: | + uv sync --locked --extra dev + uv cache prune --ci - - name: Save uv cache - if: steps.uv-cache-restore.outputs.cache-hit != 'true' + - name: Save api-simulator build + if: steps.cache-lookup.outputs.cache-hit != 'true' uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: ${{ steps.uv-cache-dir.outputs.path }} - key: ${{ steps.uv-cache-restore.outputs.cache-primary-key }} + key: ${{ steps.cache-identity.outputs.key }} test: name: Test (${{ matrix.shard }}) on ${{ matrix.os }} - if: github.event_name != 'schedule' - needs: [preflight, cache_metadata] + cache-mode: read + # Keep required matrix contexts reporting failure when the cache producer fails. + if: ${{ !cancelled() && needs.preflight.result == 'success' }} + needs: [preflight, api_simulator_cache] runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -155,13 +157,21 @@ jobs: echo "UV_CACHE_DIR=$UV_CACHE_DIR" >> "$GITHUB_ENV" echo "path=$UV_CACHE_DIR" >> "$GITHUB_OUTPUT" - - name: Restore uv cache + - name: Require api-simulator build + id: require-api-simulator-cache + if: ${{ !cancelled() && runner.os == 'Linux' && needs.api_simulator_cache.result != 'success' }} + run: | + echo 'api-simulator cache producer did not succeed' >&2 + exit 1 + + - name: Restore api-simulator build id: uv-cache-restore + if: runner.os == 'Linux' uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: ${{ steps.uv-cache-dir.outputs.path }} - key: uv-${{ runner.os }}-py${{ needs.cache_metadata.outputs.python_cache_tag }}-${{ needs.cache_metadata.outputs.api_simulator_rev }}-${{ hashFiles('uv.lock') }} - restore-keys: uv-${{ runner.os }}-py${{ needs.cache_metadata.outputs.python_cache_tag }}-${{ needs.cache_metadata.outputs.api_simulator_rev }}- + key: ${{ needs.api_simulator_cache.outputs.cache-key }} + fail-on-cache-miss: true - name: Install go-task uses: arduino/setup-task@24c5e13bce349197642746563945fcdf9355e8f4 # v2 @@ -176,14 +186,6 @@ jobs: echo "task: $(task --version)" uv run python --version - - name: Configure git auth for private deps - run: git config --global url."https://${{ secrets.GH_USER }}:${{ secrets.GH_PAT }}@github.com/TalonT-Org/".insteadOf "https://github.com/TalonT-Org/" - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable - with: - toolchain: "1.98.1" - - name: Install ripgrep shell: bash env: @@ -224,6 +226,11 @@ jobs: - name: Install dependencies run: uv sync --locked --extra dev + - name: Verify api-simulator imports + id: verify-api-simulator + if: runner.os == 'Linux' + run: uv run --no-sync python -B -c "import api_simulator.claude, api_simulator.http, api_simulator.mcp" + - name: Generate recipe diagrams run: uv run autoskillit recipes render diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index 37fda68479..89213538d0 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -21,6 +21,9 @@ _BASE_SHA = "0123456789abcdef0123456789abcdef01234567" _POLICY_MODULE_NAME = "_autoskillit_ci_target_policy" +_PRODUCER_MISS = "steps.cache-lookup.outputs.cache-hit != 'true'" +_PRODUCER_KEY = "${{ steps.cache-identity.outputs.key }}" +_CONSUMER_KEY = "${{ needs.api_simulator_cache.outputs.cache-key }}" def _repo_root() -> Path: @@ -648,110 +651,96 @@ def test_complexity_gate_follows_policy_gate() -> None: assert complexity_index == relaxation_index + 1 -def test_workflow_uses_one_explicit_uv_cache_writer() -> None: - workflow = load_yaml(_repo_root() / ".github" / "workflows" / "tests.yml") - triggers = workflow.get("on", workflow.get(True)) - assert {"push", "pull_request", "merge_group", "schedule"} <= set(triggers) - cron = triggers["schedule"][0]["cron"] - assert cron == "17 3 * * *" - assert int(cron.split()[0]) != 0 - - jobs = workflow["jobs"] - preflight = jobs["preflight"] - test_job = jobs["test"] - metadata = jobs["cache_metadata"] - primer = jobs["cache_prime"] - - assert preflight["if"] == "github.event_name != 'schedule'" - assert test_job["if"] == "github.event_name != 'schedule'" - assert test_job["needs"] == ["preflight", "cache_metadata"] - assert "if" not in metadata - assert metadata["runs-on"] == "ubuntu-latest" - assert primer["if"] == ( - "github.event_name == 'schedule' || " - "(github.event_name == 'push' && github.ref == 'refs/heads/main')" - ) - assert primer["needs"] == "cache_metadata" - assert primer["runs-on"] == "ubuntu-latest" - assert "strategy" not in primer - - metadata_step = next(step for step in metadata["steps"] if step.get("id") == "cache-identity") - metadata_script = metadata_step["run"] - project = tomllib.loads((_repo_root() / "pyproject.toml").read_text(encoding="utf-8")) - expected_revision = project["tool"]["uv"]["sources"]["api-simulator"]["rev"] - expected_python_tag = ( - (_repo_root() / ".python-version").read_text(encoding="utf-8").strip().replace(".", "") +def test_api_simulator_cache_key_is_the_build_identity_not_the_lockfile() -> None: + workflow_path = _repo_root() / ".github" / "workflows" / "tests.yml" + producer = load_yaml(workflow_path)["jobs"]["api_simulator_cache"] + identity = next(step for step in producer["steps"] if step.get("id") == "cache-identity") + lines = identity["run"].splitlines() + assert lines[0] == "python3 <<'PY' >> \"$GITHUB_OUTPUT\"" + assert lines[-1] == "PY" + setup_uv = next( + step + for step in producer["steps"] + if step.get("uses", "").startswith("astral-sh/setup-uv@") ) - assert ".python-version" in metadata_script - assert '["tool"]["uv"]["sources"]["api-simulator"]["rev"]' in metadata_script - assert "[0-9a-fA-F]{40}" in metadata_script - assert r"\d+\.\d+" in metadata_script - metadata_lines = metadata_script.splitlines() - assert metadata_lines[0] == "python3 <<'PY' >> \"$GITHUB_OUTPUT\"" - assert metadata_lines[-1] == "PY" - metadata_result = subprocess.run( - [sys.executable, "-B", "-c", "\n".join(metadata_lines[1:-1])], + uv_version = setup_uv["with"]["version"] + result = subprocess.run( + [sys.executable, "-B", "-c", "\n".join(lines[1:-1])], cwd=_repo_root(), capture_output=True, text=True, - env=production_interpreter_env(), + env=production_interpreter_env() + | { + "RUNNER_OS": "Linux", + "RUNNER_ARCH": "X64", + "ImageOS": "ubuntu24", + "UV_VERSION": uv_version, + }, check=False, ) - assert metadata_result.returncode == 0, metadata_result.stderr - assert metadata_result.stdout.splitlines() == [ - f"python_cache_tag={expected_python_tag}", - f"api_simulator_rev={expected_revision}", + project = tomllib.loads((_repo_root() / "pyproject.toml").read_text(encoding="utf-8")) + revision = project["tool"]["uv"]["sources"]["api-simulator"]["rev"] + python_tag = ( + (_repo_root() / ".python-version").read_text(encoding="utf-8").strip().replace(".", "") + ) + assert result.returncode == 0, result.stderr + assert result.stdout.splitlines() == [ + f"key=uv-api-simulator-Linux-X64-ubuntu24-uv{uv_version}-py{python_tag}-{revision}" ] - assert metadata["outputs"] == { - "python_cache_tag": "${{ steps.cache-identity.outputs.python_cache_tag }}", - "api_simulator_rev": "${{ steps.cache-identity.outputs.api_simulator_rev }}", - } + assert identity["env"] == {"UV_VERSION": "${{ steps.setup-uv.outputs.uv-version }}"} + assert "hashFiles('uv.lock')" not in workflow_path.read_text(encoding="utf-8") - setup_uv_steps = { - job_name: next( - step for step in job["steps"] if "astral-sh/setup-uv@" in step.get("uses", "") - ) - for job_name, job in jobs.items() - if any("astral-sh/setup-uv@" in step.get("uses", "") for step in job.get("steps", [])) - } - assert set(setup_uv_steps) == {"preflight", "test", "cache_prime"} - assert all(step["with"]["version"] == "0.9.21" for step in setup_uv_steps.values()) - assert setup_uv_steps["test"]["with"]["enable-cache"] is False - assert setup_uv_steps["cache_prime"]["with"]["enable-cache"] is False - - restore_pin = "actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830" - save_pin = "actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830" - primary_key = ( - "uv-${{ runner.os }}-py${{ needs.cache_metadata.outputs.python_cache_tag }}-" - "${{ needs.cache_metadata.outputs.api_simulator_rev }}-${{ hashFiles('uv.lock') }}" + +def test_one_producer_builds_api_simulator_and_test_jobs_only_restore_it() -> None: + workflow = load_yaml(_repo_root() / ".github" / "workflows" / "tests.yml") + assert set(workflow.get("on", workflow.get(True))) == {"push", "pull_request", "merge_group"} + jobs = workflow["jobs"] + producer = jobs["api_simulator_cache"] + producer_steps = producer["steps"] + assert "if" not in producer + assert producer["runs-on"] == "ubuntu-latest" + assert "strategy" not in producer + assert producer["cache-mode"] == "write" + assert producer["outputs"] == {"cache-key": _PRODUCER_KEY} + producer_uv = next( + step for step in producer_steps if step.get("uses", "").startswith("astral-sh/setup-uv@") ) - restore_prefix = ( - "uv-${{ runner.os }}-py${{ needs.cache_metadata.outputs.python_cache_tag }}-" - "${{ needs.cache_metadata.outputs.api_simulator_rev }}-" + test_job = jobs["test"] + test_steps = test_job["steps"] + test_uv = next( + step for step in test_steps if step.get("uses", "").startswith("astral-sh/setup-uv@") ) - for job in (test_job, primer): - cache_dir = next(step for step in job["steps"] if step.get("id") == "uv-cache-dir") - restore = next(step for step in job["steps"] if step.get("id") == "uv-cache-restore") - assert "uv cache dir" in cache_dir["run"] - assert "UV_CACHE_DIR=" in cache_dir["run"] - assert '"$GITHUB_ENV"' in cache_dir["run"] - assert "path=" in cache_dir["run"] - assert '"$GITHUB_OUTPUT"' in cache_dir["run"] - assert restore["uses"] == restore_pin - assert restore["with"] == { - "path": "${{ steps.uv-cache-dir.outputs.path }}", - "key": primary_key, - "restore-keys": restore_prefix, - } - - test_restore = next(step for step in test_job["steps"] if step.get("id") == "uv-cache-restore") - test_sync = next(step for step in test_job["steps"] if "uv sync" in step.get("run", "")) - assert test_job["steps"].index(test_restore) < test_job["steps"].index(test_sync) - assert not any( - step.get("uses", "").startswith("actions/cache/save@") for step in test_job["steps"] + assert producer_uv["id"] == "setup-uv" + assert producer_uv["with"]["enable-cache"] is False + assert test_uv["with"]["enable-cache"] is False + assert producer_uv["with"]["version"] == test_uv["with"]["version"] + lookup = next(step for step in producer_steps if step.get("id") == "cache-lookup") + assert lookup["uses"].startswith("actions/cache/restore@") + assert lookup["with"] == { + "lookup-only": True, + "key": _PRODUCER_KEY, + "path": "${{ steps.uv-cache-dir.outputs.path }}", + } + auth = [step for step in producer_steps if "git config --global" in step.get("run", "")] + rust = [ + step + for step in producer_steps + if step.get("uses", "").startswith("dtolnay/rust-toolchain@") + ] + builds = [step for step in producer_steps if "uv sync" in step.get("run", "")] + saves = [ + step for step in producer_steps if step.get("uses", "").startswith("actions/cache/save@") + ] + assert auth and rust and builds and saves + assert all(step["if"] == _PRODUCER_MISS for step in auth + rust + builds + saves) + assert all( + producer_steps.index(lookup) < producer_steps.index(step) + for step in auth + rust + builds + saves ) - assert not any(step.get("uses", "").startswith("actions/cache@") for step in test_job["steps"]) - + build = builds[0] + assert "uv sync --locked --extra dev" in build["run"] + assert "uv cache prune --ci" in build["run"] + assert "CARGO_TARGET_DIR" in build["env"] save_steps = [ (job_name, step) for job_name, job in jobs.items() @@ -760,50 +749,51 @@ def test_workflow_uses_one_explicit_uv_cache_writer() -> None: ] assert len(save_steps) == 1 save_owner, save = save_steps[0] - assert save_owner == "cache_prime" - assert save["uses"] == save_pin - assert save["if"] == "steps.uv-cache-restore.outputs.cache-hit != 'true'" + assert save_owner == "api_simulator_cache" assert save["with"] == { + "key": _PRODUCER_KEY, "path": "${{ steps.uv-cache-dir.outputs.path }}", - "key": "${{ steps.uv-cache-restore.outputs.cache-primary-key }}", } - - primer_steps = primer["steps"] - primer_restore = next(step for step in primer_steps if step.get("id") == "uv-cache-restore") - primer_auth = next( - step for step in primer_steps if "git config --global" in step.get("run", "") - ) - primer_rust = next( - step for step in primer_steps if "dtolnay/rust-toolchain@" in step.get("uses", "") - ) - primer_sync = next(step for step in primer_steps if "uv sync" in step.get("run", "")) - primer_prune = next( - step for step in primer_steps if "uv cache prune --ci" in step.get("run", "") + assert producer_steps.index(build) < producer_steps.index(save) + assert not any( + step.get("uses", "").startswith("actions/cache@") + for job in jobs.values() + for step in job.get("steps", []) ) - assert primer_steps.index(primer_restore) < primer_steps.index(primer_sync) - assert primer_steps.index(primer_auth) < primer_steps.index(primer_sync) - assert primer_steps.index(primer_rust) < primer_steps.index(primer_sync) - assert primer_steps.index(primer_sync) < primer_steps.index(primer_prune) - assert primer_steps.index(primer_prune) < primer_steps.index(save) - - preflight_runs = [step.get("run", "") for step in preflight["steps"]] - assert any(run == "uv lock --check" for run in preflight_runs) - assert not any("uv sync" in run for run in preflight_runs) - test_checkout = next( - step for step in test_job["steps"] if step.get("uses", "").startswith("actions/checkout@") + assert not jobs["preflight"].get("needs") + assert test_job["cache-mode"] == "read" + assert {"preflight", "api_simulator_cache"} <= set(test_job["needs"]) + assert test_job["if"] == "${{ !cancelled() && needs.preflight.result == 'success' }}" + require = next(step for step in test_steps if step.get("id") == "require-api-simulator-cache") + assert require["if"] == ( + "${{ !cancelled() && runner.os == 'Linux' && " + "needs.api_simulator_cache.result != 'success' }}" ) - assert test_checkout["with"]["fetch-depth"] == 0 - sync_jobs = { - job_name - for job_name, job in jobs.items() - if any("uv sync" in step.get("run", "") for step in job.get("steps", [])) + assert "exit 1" in require["run"] + restore = next(step for step in test_steps if step.get("id") == "uv-cache-restore") + assert restore["uses"].startswith("actions/cache/restore@") + assert restore["if"] == "runner.os == 'Linux'" + assert restore["with"] == { + "path": "${{ steps.uv-cache-dir.outputs.path }}", + "key": _CONSUMER_KEY, + "fail-on-cache-miss": True, } - rust_jobs = { - job_name + install = next(step for step in test_steps if step.get("name") == "Install dependencies") + verify = next(step for step in test_steps if step.get("id") == "verify-api-simulator") + assert test_steps.index(require) < test_steps.index(restore) < test_steps.index(install) + assert verify["if"] == "runner.os == 'Linux'" + assert verify["run"] == ( + 'uv run --no-sync python -B -c "import api_simulator.claude, ' + 'api_simulator.http, api_simulator.mcp"' + ) + assert test_steps.index(verify) == test_steps.index(install) + 1 + assert not any( + step.get("uses", "").startswith("dtolnay/rust-toolchain@") + or "git config --global" in step.get("run", "") for job_name, job in jobs.items() - if any("dtolnay/rust-toolchain@" in step.get("uses", "") for step in job.get("steps", [])) - } - assert rust_jobs == sync_jobs == {"test", "cache_prime"} + if job_name != "api_simulator_cache" + for step in job.get("steps", []) + ) def test_ci_policy_is_recorded_in_durable_contributor_instructions() -> None: @@ -847,6 +837,8 @@ def test_ci_policy_is_recorded_in_durable_contributor_instructions() -> None: assert "explicit `actions/cache` owns their uv-cache I/O" in agent_rules assert "matrix jobs restore only" in agent_rules assert "sole saver" in agent_rules + assert "never `uv.lock`" in agent_rules + assert "`gh cache delete `" in agent_rules assert "`api-simulator.rev`" in agent_rules assert "regenerated `uv.lock`" in agent_rules assert "`fetch-depth: 0`" in agent_rules From ab6f7f11e9d16132869cb5f27b31e0155f70ce70 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:21:39 -0700 Subject: [PATCH 02/13] fix(review): include the authoritative Rust pin in cache identity --- .github/workflows/tests.yml | 11 ++++++++++- tests/infra/test_ci_workflow.py | 8 +++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6a8285ad6f..0556e79c10 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -77,10 +77,19 @@ jobs: if not isinstance(revision, str) or re.fullmatch(r"[0-9a-fA-F]{40}", revision) is None: raise SystemExit(f"invalid api-simulator revision: {revision!r}") + rust_pin = re.search( + r"^ARG RUST_VERSION=(\S+)$", + Path("scripts/docker/Dockerfile").read_text(encoding="utf-8"), + re.MULTILINE, + ) + if rust_pin is None: + raise SystemExit("missing Dockerfile RUST_VERSION pin") + rust_version = rust_pin.group(1) + # Label the producer's image family; consumers separately verify native imports. runner = f"{os.environ['RUNNER_OS']}-{os.environ['RUNNER_ARCH']}-{os.environ['ImageOS']}" python_tag = python_selector.replace(".", "") - print(f"key=uv-api-simulator-{runner}-uv{os.environ['UV_VERSION']}-py{python_tag}-{revision}") + print(f"key=uv-api-simulator-{runner}-uv{os.environ['UV_VERSION']}-rust{rust_version}-py{python_tag}-{revision}") PY - name: Resolve uv cache directory diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index 89213538d0..c879a6ce99 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -664,6 +664,12 @@ def test_api_simulator_cache_key_is_the_build_identity_not_the_lockfile() -> Non if step.get("uses", "").startswith("astral-sh/setup-uv@") ) uv_version = setup_uv["with"]["version"] + rust = next( + step + for step in producer["steps"] + if step.get("uses", "").startswith("dtolnay/rust-toolchain@") + ) + rust_version = rust["with"]["toolchain"] result = subprocess.run( [sys.executable, "-B", "-c", "\n".join(lines[1:-1])], cwd=_repo_root(), @@ -685,7 +691,7 @@ def test_api_simulator_cache_key_is_the_build_identity_not_the_lockfile() -> Non ) assert result.returncode == 0, result.stderr assert result.stdout.splitlines() == [ - f"key=uv-api-simulator-Linux-X64-ubuntu24-uv{uv_version}-py{python_tag}-{revision}" + f"key=uv-api-simulator-Linux-X64-ubuntu24-uv{uv_version}-rust{rust_version}-py{python_tag}-{revision}" ] assert identity["env"] == {"UV_VERSION": "${{ steps.setup-uv.outputs.uv-version }}"} assert "hashFiles('uv.lock')" not in workflow_path.read_text(encoding="utf-8") From f5eb553ed02669188f797bc0957e5e36d09ea7dc Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:22:30 -0700 Subject: [PATCH 03/13] fix(review): report unavailable private build credentials before git setup --- .github/workflows/tests.yml | 8 +++++++- tests/infra/test_ci_workflow.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0556e79c10..0a7963ffe9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -110,7 +110,13 @@ jobs: - name: Configure git auth for private deps if: steps.cache-lookup.outputs.cache-hit != 'true' - run: git config --global url."https://${{ secrets.GH_USER }}:${{ secrets.GH_PAT }}@github.com/TalonT-Org/".insteadOf "https://github.com/TalonT-Org/" + env: + GH_USER: ${{ secrets.GH_USER }} + GH_PAT: ${{ secrets.GH_PAT }} + run: | + : "${GH_USER:?private-dependency credentials unavailable: GH_USER}" + : "${GH_PAT:?private-dependency credentials unavailable: GH_PAT}" + git config --global url."https://${GH_USER}:${GH_PAT}@github.com/TalonT-Org/".insteadOf "https://github.com/TalonT-Org/" - name: Install Rust toolchain if: steps.cache-lookup.outputs.cache-hit != 'true' diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index c879a6ce99..fc997f2a9b 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -697,6 +697,37 @@ def test_api_simulator_cache_key_is_the_build_identity_not_the_lockfile() -> Non assert "hashFiles('uv.lock')" not in workflow_path.read_text(encoding="utf-8") +@pytest.mark.parametrize("missing_secret", ["GH_USER", "GH_PAT"]) +def test_cache_build_reports_missing_credentials(tmp_path: Path, missing_secret: str) -> None: + workflow = load_yaml(_repo_root() / ".github" / "workflows" / "tests.yml") + auth = next( + step + for step in workflow["jobs"]["api_simulator_cache"]["steps"] + if "git config --global" in step.get("run", "") + ) + assert auth["env"] == { + "GH_USER": "${{ secrets.GH_USER }}", + "GH_PAT": "${{ secrets.GH_PAT }}", + } + config = tmp_path / "gitconfig" + result = subprocess.run( + ["bash", "-c", auth["run"]], + capture_output=True, + text=True, + check=False, + env=production_interpreter_env() + | { + "GH_USER": "test-user", + "GH_PAT": "test-token", + missing_secret: "", + "GIT_CONFIG_GLOBAL": str(config), + }, + ) + assert result.returncode != 0 + assert f"private-dependency credentials unavailable: {missing_secret}" in result.stderr + assert not config.exists() + + def test_one_producer_builds_api_simulator_and_test_jobs_only_restore_it() -> None: workflow = load_yaml(_repo_root() / ".github" / "workflows" / "tests.yml") assert set(workflow.get("on", workflow.get(True))) == {"push", "pull_request", "merge_group"} From 5098de0f9c2a5634320b8753f0da44246d248da5 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:23:15 -0700 Subject: [PATCH 04/13] fix(review): reject empty or invalid resolved uv cache versions --- .github/workflows/tests.yml | 6 +++++- tests/infra/test_ci_workflow.py | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0a7963ffe9..966f3abfe0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -86,10 +86,14 @@ jobs: raise SystemExit("missing Dockerfile RUST_VERSION pin") rust_version = rust_pin.group(1) + uv_version = os.environ["UV_VERSION"] + if re.fullmatch(r"\d+\.\d+\.\d+", uv_version) is None: + raise SystemExit("invalid resolved uv version") + # Label the producer's image family; consumers separately verify native imports. runner = f"{os.environ['RUNNER_OS']}-{os.environ['RUNNER_ARCH']}-{os.environ['ImageOS']}" python_tag = python_selector.replace(".", "") - print(f"key=uv-api-simulator-{runner}-uv{os.environ['UV_VERSION']}-rust{rust_version}-py{python_tag}-{revision}") + print(f"key=uv-api-simulator-{runner}-uv{uv_version}-rust{rust_version}-py{python_tag}-{revision}") PY - name: Resolve uv cache directory diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index fc997f2a9b..53c2dc7b22 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -651,7 +651,10 @@ def test_complexity_gate_follows_policy_gate() -> None: assert complexity_index == relaxation_index + 1 -def test_api_simulator_cache_key_is_the_build_identity_not_the_lockfile() -> None: +@pytest.mark.parametrize("empty_uv_version", [False, True]) +def test_api_simulator_cache_key_is_the_build_identity_not_the_lockfile( + empty_uv_version: bool, +) -> None: workflow_path = _repo_root() / ".github" / "workflows" / "tests.yml" producer = load_yaml(workflow_path)["jobs"]["api_simulator_cache"] identity = next(step for step in producer["steps"] if step.get("id") == "cache-identity") @@ -680,7 +683,7 @@ def test_api_simulator_cache_key_is_the_build_identity_not_the_lockfile() -> Non "RUNNER_OS": "Linux", "RUNNER_ARCH": "X64", "ImageOS": "ubuntu24", - "UV_VERSION": uv_version, + "UV_VERSION": "" if empty_uv_version else uv_version, }, check=False, ) @@ -689,6 +692,11 @@ def test_api_simulator_cache_key_is_the_build_identity_not_the_lockfile() -> Non python_tag = ( (_repo_root() / ".python-version").read_text(encoding="utf-8").strip().replace(".", "") ) + if empty_uv_version: + assert result.returncode != 0 + assert "invalid resolved uv version" in result.stderr + assert not result.stdout + return assert result.returncode == 0, result.stderr assert result.stdout.splitlines() == [ f"key=uv-api-simulator-Linux-X64-ubuntu24-uv{uv_version}-rust{rust_version}-py{python_tag}-{revision}" From 723c58f313abd8fc2e2b4e5a729e4aefa5330fdb Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:23:54 -0700 Subject: [PATCH 05/13] fix(review): guard Linux-only simulator dependency in the CI contract --- tests/infra/test_ci_workflow.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index 53c2dc7b22..a97164cdd5 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -832,6 +832,11 @@ def test_one_producer_builds_api_simulator_and_test_jobs_only_restore_it() -> No 'api_simulator.http, api_simulator.mcp"' ) assert test_steps.index(verify) == test_steps.index(install) + 1 + project = tomllib.loads((_repo_root() / "pyproject.toml").read_text(encoding="utf-8")) + assert ( + "api-simulator; sys_platform == 'linux'" + in project["project"]["optional-dependencies"]["dev"] + ) assert not any( step.get("uses", "").startswith("dtolnay/rust-toolchain@") or "git config --global" in step.get("run", "") From bb806dff6455a35258412213ef4c362e95a5723e Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:24:40 -0700 Subject: [PATCH 06/13] fix(review): exercise producer failure reporting instead of matching a substring --- tests/infra/test_ci_workflow.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index a97164cdd5..157d632aef 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -814,7 +814,11 @@ def test_one_producer_builds_api_simulator_and_test_jobs_only_restore_it() -> No "${{ !cancelled() && runner.os == 'Linux' && " "needs.api_simulator_cache.result != 'success' }}" ) - assert "exit 1" in require["run"] + failure = subprocess.run( + ["bash", "-c", require["run"]], capture_output=True, text=True, check=False + ) + assert failure.returncode == 1 + assert failure.stderr.strip() == "api-simulator cache producer did not succeed" restore = next(step for step in test_steps if step.get("id") == "uv-cache-restore") assert restore["uses"].startswith("actions/cache/restore@") assert restore["if"] == "runner.os == 'Linux'" From 1c9f31d206aeb29780eeecf19f7c248ba7ec4ed1 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:25:21 -0700 Subject: [PATCH 07/13] fix(review): restore preflight utility-job and uv version contracts --- tests/infra/test_ci_workflow.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index 157d632aef..9a69a86108 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -805,7 +805,15 @@ def test_one_producer_builds_api_simulator_and_test_jobs_only_restore_it() -> No for job in jobs.values() for step in job.get("steps", []) ) - assert not jobs["preflight"].get("needs") + preflight = jobs["preflight"] + preflight_steps = preflight["steps"] + assert not preflight.get("needs") + assert any(step.get("run") == "uv lock --check" for step in preflight_steps) + assert not any("uv sync" in step.get("run", "") for step in preflight_steps) + preflight_uv = next( + step for step in preflight_steps if step.get("uses", "").startswith("astral-sh/setup-uv@") + ) + assert preflight_uv["with"]["version"] == producer_uv["with"]["version"] assert test_job["cache-mode"] == "read" assert {"preflight", "api_simulator_cache"} <= set(test_job["needs"]) assert test_job["if"] == "${{ !cancelled() && needs.preflight.result == 'success' }}" From 051452a79e4c38df2be487246ee5ba002d43827b Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:26:03 -0700 Subject: [PATCH 08/13] fix(review): require Cargo build output outside the cached checkout --- tests/infra/test_ci_workflow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index 9a69a86108..47718114e1 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -785,7 +785,7 @@ def test_one_producer_builds_api_simulator_and_test_jobs_only_restore_it() -> No build = builds[0] assert "uv sync --locked --extra dev" in build["run"] assert "uv cache prune --ci" in build["run"] - assert "CARGO_TARGET_DIR" in build["env"] + assert build["env"]["CARGO_TARGET_DIR"] == "${{ runner.temp }}/api-simulator-target" save_steps = [ (job_name, step) for job_name, job in jobs.items() From 0fa96739aae56ee89cb0d95d6f05e915beac1b09 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:26:44 -0700 Subject: [PATCH 09/13] fix(review): verify producer and consumer cache directory exports --- tests/infra/test_ci_workflow.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index 47718114e1..20f470333e 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -755,6 +755,14 @@ def test_one_producer_builds_api_simulator_and_test_jobs_only_restore_it() -> No test_uv = next( step for step in test_steps if step.get("uses", "").startswith("astral-sh/setup-uv@") ) + for steps in (producer_steps, test_steps): + cache_dir = next(step for step in steps if step.get("id") == "uv-cache-dir") + assert cache_dir["shell"] == "bash" + assert cache_dir["run"].splitlines() == [ + 'UV_CACHE_DIR="$(uv cache dir)"', + 'echo "UV_CACHE_DIR=$UV_CACHE_DIR" >> "$GITHUB_ENV"', + 'echo "path=$UV_CACHE_DIR" >> "$GITHUB_OUTPUT"', + ] assert producer_uv["id"] == "setup-uv" assert producer_uv["with"]["enable-cache"] is False assert test_uv["with"]["enable-cache"] is False From 5621f8c51990f8948c0f89e60c0f63b1c21f67a0 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:27:26 -0700 Subject: [PATCH 10/13] fix(review): enforce exact cache action SHA pins --- tests/infra/test_ci_workflow.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index 20f470333e..a76dd1b042 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -768,7 +768,7 @@ def test_one_producer_builds_api_simulator_and_test_jobs_only_restore_it() -> No assert test_uv["with"]["enable-cache"] is False assert producer_uv["with"]["version"] == test_uv["with"]["version"] lookup = next(step for step in producer_steps if step.get("id") == "cache-lookup") - assert lookup["uses"].startswith("actions/cache/restore@") + assert lookup["uses"] == "actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830" assert lookup["with"] == { "lookup-only": True, "key": _PRODUCER_KEY, @@ -803,6 +803,7 @@ def test_one_producer_builds_api_simulator_and_test_jobs_only_restore_it() -> No assert len(save_steps) == 1 save_owner, save = save_steps[0] assert save_owner == "api_simulator_cache" + assert save["uses"] == "actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830" assert save["with"] == { "key": _PRODUCER_KEY, "path": "${{ steps.uv-cache-dir.outputs.path }}", @@ -836,7 +837,7 @@ def test_one_producer_builds_api_simulator_and_test_jobs_only_restore_it() -> No assert failure.returncode == 1 assert failure.stderr.strip() == "api-simulator cache producer did not succeed" restore = next(step for step in test_steps if step.get("id") == "uv-cache-restore") - assert restore["uses"].startswith("actions/cache/restore@") + assert restore["uses"] == "actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830" assert restore["if"] == "runner.os == 'Linux'" assert restore["with"] == { "path": "${{ steps.uv-cache-dir.outputs.path }}", From 929518408379b19328feb537063c341e2fe4f45a Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:28:05 -0700 Subject: [PATCH 11/13] fix(review): guard explicit cache ownership for every setup-uv job --- tests/infra/test_ci_workflow.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index a76dd1b042..a6767e19ee 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -764,8 +764,10 @@ def test_one_producer_builds_api_simulator_and_test_jobs_only_restore_it() -> No 'echo "path=$UV_CACHE_DIR" >> "$GITHUB_OUTPUT"', ] assert producer_uv["id"] == "setup-uv" - assert producer_uv["with"]["enable-cache"] is False - assert test_uv["with"]["enable-cache"] is False + for job in jobs.values(): + for step in job.get("steps", []): + if step.get("uses", "").startswith("astral-sh/setup-uv@"): + assert step["with"]["enable-cache"] is False assert producer_uv["with"]["version"] == test_uv["with"]["version"] lookup = next(step for step in producer_steps if step.get("id") == "cache-lookup") assert lookup["uses"] == "actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830" From 0d907a78f4665c367f104767ac8f3f7d275c3723 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:28:43 -0700 Subject: [PATCH 12/13] fix(review): scope cache identity coverage to its key rather than the whole workflow --- tests/infra/test_ci_workflow.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/infra/test_ci_workflow.py b/tests/infra/test_ci_workflow.py index a6767e19ee..11f3abb1d4 100644 --- a/tests/infra/test_ci_workflow.py +++ b/tests/infra/test_ci_workflow.py @@ -702,7 +702,6 @@ def test_api_simulator_cache_key_is_the_build_identity_not_the_lockfile( f"key=uv-api-simulator-Linux-X64-ubuntu24-uv{uv_version}-rust{rust_version}-py{python_tag}-{revision}" ] assert identity["env"] == {"UV_VERSION": "${{ steps.setup-uv.outputs.uv-version }}"} - assert "hashFiles('uv.lock')" not in workflow_path.read_text(encoding="utf-8") @pytest.mark.parametrize("missing_secret", ["GH_USER", "GH_PAT"]) From 0122a63c1c3893aeaced1ea4e423170d444cdc34 Mon Sep 17 00:00:00 2001 From: Trecek Date: Sun, 25 Oct 2026 14:29:17 -0700 Subject: [PATCH 13/13] docs(review): condense cache policy and clarify Linux restore scope --- .github/AGENTS.md | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/.github/AGENTS.md b/.github/AGENTS.md index 1c0c16ea57..93bd671609 100644 --- a/.github/AGENTS.md +++ b/.github/AGENTS.md @@ -37,26 +37,20 @@ wheel cache consumed by downstream jobs: enable-cache: false # required for jobs that skip uv sync ``` -Jobs that run `uv sync --locked` may normally omit `enable-cache` (defaults to `auto`, -enabled on GitHub-hosted runners). In `.github/workflows/tests.yml`, however, the -`api_simulator_cache` and `test` jobs deliberately set `enable-cache: false` despite syncing -because explicit `actions/cache` owns their uv-cache I/O. `api_simulator_cache` runs on -every event and is the sole saver: its key is the runner OS, architecture and image, the uv -version, `.python-version` and `api-simulator.rev`, and never `uv.lock`; the -regenerated `uv.lock` changes its version line on every bump. It builds api-simulator only -on a lookup miss. The test -matrix jobs restore only, with `fail-on-cache-miss`, and configure no private-dependency git -credentials, and install no Rust toolchain. The `test` job runs even when the producer fails, -so the required `Test (*)` contexts report the failure through an explicit Linux -producer-status check before restore, instead of waiting out the merge-queue timeout. -Keep `preflight` independent, with no `needs`, so a producer failure cannot skip preflight -and suppress those contexts. Set `cache-mode: write` on the producer and `cache-mode: read` -on `test`. After syncing, Linux legs must import the api-simulator submodules that load -its native extension; importing the top-level package alone does not check compatibility. -If a saved entry is unusable, delete it with `gh cache delete ` and rerun. The entry contains -api-simulator's source and is readable by pull requests into this public repository; the -owner of both repositories accepted that. This single-saver rule does not apply to -unrelated workflows or non-uv caches. +Jobs that run `uv sync --locked` may normally omit `enable-cache`. In +`.github/workflows/tests.yml`, explicit `actions/cache` owns their uv-cache I/O, +so setup-uv caching stays disabled. `api_simulator_cache` is the sole saver; Linux +matrix jobs restore only and verify imports of the native api-simulator submodules. +The build identity uses the runner image family and toolchain pins, never `uv.lock`, +so package-only version bumps reuse the build. Keep `preflight` independent and +the required `Test (*)` contexts reporting producer failures instead of leaving +the merge queue waiting for missing checks. + +If an entry is unusable, delete it with `gh cache delete ` and rerun. Cached +api-simulator source is readable by pull requests into this public repository; +the owner of both repositories accepted that visibility. + +This single-saver rule applies only to this workflow's uv cache. ## Branch-targeted test policy