Skip to content

ci: reuse test fixtures, native builds, and package images - #23291

Merged
OrcaWin merged 1 commit into
mainfrom
ci/followup-fixtures-and-caches
Sep 27, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
ci/followup-fixtures-and-caches

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

CI repeats work that does not change what is tested: empty oracle queries scan tombstones, some SSH fixtures launch extra PowerShell processes, unrelated changes re-extract every translation, Windows rebuilds an already validated native addon, and package checks reinstall Docker fixture dependencies. This reuses that work while retaining the existing tests.

What Changed

  • Short-circuit empty alias queries in the test oracle and reuse existing isolated PowerShell batching for recovery fixtures. All seeds, iterations, scenarios, assertions and timeouts remain.
  • Run localization extraction only when source/catalogs, extractor scripts/configuration, TypeScript configuration or dependency/toolchain inputs change. Deleted/renamed inputs are retained; detection errors run the full check.
  • Let the Bun build stage the installed Windows process-reader addon already validated by native runtime preparation; cover both x64 and ARM64 staging.
  • Restore exact-input Linux Docker fixture caches in PR packaging jobs. The main warmer builds and saves them; missing or unusable caches fall back to the original build. Docker still builds against the current context, and every test gets fresh containers and the current package artifact.

Why

These changes remove repeated setup instead of reducing test coverage or adding competing workers. Native reuse follows existing ABI, patch and architecture validation. Docker cache keys include fixture contents, action code and platform; PRs restore shared caches without creating redundant copies.

Linked Issue

None; requested directly. No issue created.

Visual Proof

N/A — CI and test fixtures only.

Testing

  • 91 integrated contract tests passed locally; changed-code quality and formatting passed.
  • 28 unit fixture tests passed with actual PowerShell and no skips. Agent-status test time fell 17.08s to 15.24s; SSH upload-stage time fell 16.79s to 15.63s in local before/after runs.
  • Full localization extraction passed. Actual workflow shell verified unrelated-change skip, source changes, renames and invalid-ref fallback.
  • Cache fallback tests cover misses, failed loads and missing image tags. Existing shutdown matrix still executes all cases with a cache supplied.
  • All PR checks passed, including all eight unit shards, typecheck, static analysis, packaging and compatibility checks. Mobile also passed.
  • Windows x64 and ARM64 persistence each passed 924 tests with the installed native addon; existing platform skips are unchanged.
  • Isolated cache-hit validation copied the exact candidate's warmer and package steps onto fresh runners, both checking out immutable head 497d341. Both caches restored, Docker reported cached dependency layers, and all packaging checks passed. Including restore/load overhead, shutdown and CLI checks totaled 60s versus 95s on the same candidate's cold PR run (35s lower).

Review

No product behavior changed. Local Electron windows were not launched. Linux glibc floors, platform coverage, test retries and worker counts are unchanged. The cold PR run also verified that cache misses preserve all checks. An unusable immutable entry falls back to a normal build; replacing such an entry requires eviction or a cache-key change.

Agent skill upstream boundary

  • Not applicable; no upstream skill content.

Checklist

  • Explained before/after, mechanism and rationale.
  • Cross-platform and SSH behavior considered.
  • No UI changes; visual proof is N/A.
  • Self-reviewed for missing coverage and cache invalidation.
  • Applicable build, typecheck, lint and test checks passed in CI before merge.

Cache timing evidence

Same candidate Shutdown cache setup + check CLI cache setup + check Combined
Cold PR job 1s + 62s 1s + 31s 95s
Fresh runner restoring seeded cache 10s + 33s 8s + 9s 60s

The temporary validation workflow was kept off the PR branch and checks out the exact candidate SHA. It was necessary because GitHub did not expose manually seeded feature-branch caches to the PR merge-ref scope. Main-branch warming supplies the shared cache after merge. These are one-run observations, not guaranteed savings for every runner.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Cached Linux package fixtures. New prepare-linux-package-fixture composite action restores a fixture tar, docker loads it and emits the local tag the package jobs consume as --cache-from; the main-branch warmer is the only writer. A miss leaves the output empty, so the existing build path runs unchanged.
  • Localization extraction is now conditionally skipped. pr.yml computes changed paths with git diff --name-only --no-renames -z --merge-base and only skips when localization-extraction-change-scope.mjs says no extraction input changed; any detection error falls back to the full check.
  • Native addon reuse on Windows. bun-profile-tests.yml drops the explicit addon build and relies on native-runtime: node; stageOrcadWindowsProcessTree reuses the host install and throws if it is absent or unpatched.
  • Dockerfile base pin. The CLI contract digest moves from an inline --build-arg BASE_IMAGE into the Dockerfile default so the warmer and the runner build the same base.
  • Test refactors for the orcad ARM64 path, SSH relay stage fixtures, and the copying agent-status oracle (early return on empty aliases).

The changes are CI/test-only and the fallbacks are conservative: a cache miss or a diff/scope-detection failure both degrade to the pre-PR behavior rather than skipping a check. I verified the scope predicate covers every input the extractor actually reads (src/** plus config/i18next.config.ts, extractor scripts, lockfiles, tsconfig, install action, patches), the Dockerfile default matches the removed constant exactly, and the orcad staging path validates target, machine, and patch so the removed build step cannot ship silently.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The pull request adds a composite action to restore or build Linux package fixture images and wires those images into CI checks and cache warmups. It adds changed-path detection to control localization extraction verification. It also updates native addon workflow coverage, SSH stage test setup, and an empty-input path in a test fixture helper.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to 497d3

Package checks can still complete, but a bad fixture cache causes repeated builds and slower CI until its key is replaced or invalidated. The PR is mergeable with that cost understood.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 497d3

The package checks still build against the current files and fall back to normal builds when a cache cannot be used. The remaining risk is that a shared fixture image can influence those builds, while its origin is checked only indirectly. Who can populate the shared cache has not been established.

Retained concerns

  • Medium · security · inferred: The new shared archive is accepted as a package-test build-cache source after a tag check, without a repository-enforced origin or content-equivalence check. If a writer can populate a matching cache entry outside the intended warmup path, its layers could influence PR package checks. Such write access has not been established; this is a conditional trust-boundary concern, not a verified attack path.
Security review details

Security Blast Radius

  • inferred — The newly shared cache can affect two Linux package-fixture checks, not a production deployment shown here. Current-context builds and the existing package artifact remain in the test path; a compromised cache writer could nevertheless affect layers used by those checks.

Security Findings and Attack Paths

  • inferred — A matching archive containing the expected image tag can cross from shared cache storage into a PR Docker build. Whether an attacker can write an archive visible to that PR job is unknown, so no cache-poisoning exploit is verified.

Trust Boundaries and Controls

  • observed — The action restricts fixture names and checks that a loaded archive contains the expected tag. PR runs are configured to restore rather than save; failed restoration leaves the cache output empty, and the runners build from the current Docker context.

Resilience and Maintainability Implications

  • inferred — A damaged exact-key entry does not appear repairable through the action’s normal save path, but the package checks retain an uncached-build fallback. The observed consequence is repeated setup work rather than a demonstrated loss of verification.

Hardening Proposals

  • proposed — Confirm the cache service’s effective writer and ref scopes, restrict warmup writes to the intended trusted ref, and consider binding accepted archives to a verifiable producer or content identity. Define a refresh or invalidation policy for stale fixture dependencies and unusable exact-key entries.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 12 files. (5 skipped: 5… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description covers the required sections, including the purpose, changes, rationale, testing, visual proof, review notes, boundary assessment, and checklist. It clearly explains cache fallback beh…
Title check ✅ Passed The title clearly summarizes the main CI changes: reuse of test fixtures, native builds, and package images.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 12 files. (5 skipped: 5 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 76336d23-4e61-46ac-b4b6-a65535dfcd51

📥 Commits

Reviewing files that changed from the base of the PR and between 46907de and 497d341.

📒 Files selected for processing (17)
  • .github/actions/prepare-linux-package-fixture/action.yml
  • .github/workflows/bun-profile-tests.yml
  • .github/workflows/ci-cache-warmup.yml
  • .github/workflows/pr.yml
  • config/docker/cli-launch-contract/Dockerfile
  • config/scripts/ci-cache-warmup-workflow.test.mjs
  • config/scripts/headless-serve-shutdown-matrix.test.mjs
  • config/scripts/linux-package-fixture-cache.test.mjs
  • config/scripts/localization-extraction-change-scope.mjs
  • config/scripts/localization-extraction-change-scope.test.mjs
  • config/scripts/orcad-windows-process-tree.test.mjs
  • config/scripts/pr-code-change-scope.mjs
  • config/scripts/pr-code-change-scope.test.mjs
  • config/scripts/run-headless-serve-shutdown-docker.mjs
  • config/scripts/run-linux-cli-launch-contract-docker.mjs
  • src/main/ssh/ssh-relay-upload-stage-commands.test.ts
  • src/shared/agent-status-store-copying-oracle.test-fixture.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

echo 'built=true' >> "$GITHUB_OUTPUT"

- name: Save fixture image
if: inputs.save-cache == 'true' && steps.cache.outputs.cache-hit != 'true' && steps.image.outputs.built == 'true'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,115p' .github/actions/prepare-linux-package-fixture/action.yml
sed -n '86,112p' .github/workflows/ci-cache-warmup.yml
sed -n '878,908p' .github/workflows/pr.yml

Repository: stablyai/orca

Length of output: 5076


🏁 Script executed:

#!/bin/bash
set -euo pipefail
printf '%s\n' '--- action call sites ---'
rg -n -C 4 'prepare-linux-package-fixture|ORCA_(SHUTDOWN|CLI)_FIXTURE_CACHE_IMAGE|run-(headless-serve-shutdown|linux-cli-launch-contract)-docker' .github config
printf '%s\n' '--- warmup workflow structure ---'
rg -n -C 8 'warm-linux-package-fixtures|schedule:|workflow_dispatch|push:|pull_request:|workflow_call|needs:' .github/workflows/ci-cache-warmup.yml
printf '%s\n' '--- PR package workflow structure ---'
rg -n -C 8 'package|shutdown-fixture-cache|cli-fixture-cache|ORCA_(SHUTDOWN|CLI)_FIXTURE_CACHE_IMAGE|run-(headless-serve-shutdown|linux-cli-launch-contract)-docker' .github/workflows/pr.yml
printf '%s\n' '--- consumer scripts ---'
for f in config/scripts/run-headless-serve-shutdown-docker.mjs config/scripts/run-linux-cli-launch-contract-docker.mjs; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    sed -n '1,260p' "$f"
  fi
done
printf '%s\n' '--- focused diff ---'
git diff --stat 46907de6022dde8b511d6015ac83915bf62de49a 497d3410d3f4bf0ff9295f51d044407b34b15a98
git diff -- .github/actions/prepare-linux-package-fixture/action.yml .github/workflows/ci-cache-warmup.yml .github/workflows/pr.yml 46907de6022dde8b511d6015ac83915bf62de49a 497d3410d3f4bf0ff9295f51d044407b34b15a98

Repository: stablyai/orca

Length of output: 41909


🏁 Script executed:

#!/bin/bash
set -euo pipefail
printf '%s\n' '--- warmup workflow ---'
sed -n '1,125p' .github/workflows/ci-cache-warmup.yml
printf '%s\n' '--- PR package job ---'
sed -n '820,915p' .github/workflows/pr.yml
printf '%s\n' '--- cache action tests ---'
sed -n '1,150p' config/scripts/linux-package-fixture-cache.test.mjs
printf '%s\n' '--- warmup workflow tests ---'
rg -n -C 8 'warm-linux-package-fixtures|save-cache|schedule|pull_request|package fixture' config/scripts/ci-cache-warmup-workflow.test.mjs

Repository: stablyai/orca

Length of output: 14419


Invalidate an unusable fixture cache before saving its replacement.

When docker load or docker image inspect fails, the warmup builds a replacement but still skips actions/cache/save because cache-hit remains true. The scheduled warmup repeats this build, and PR package jobs discard the unusable archive before building without --cache-from. This does not block the package checks, but it removes cache acceleration and adds build and network cost.

Invalidate the bad exact key or use a new cache generation for the replacement. Ensure all restores use that new generation; removing the cache-hit condition alone cannot overwrite an existing cache entry.

@OrcaWin
OrcaWin merged commit 3eb1ade into main Sep 27, 2026
51 checks passed
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