Skip to content

ci: hydrate Rust in trusted Testbox broker - #10141

Closed
lawrencecchen wants to merge 3 commits into
feat-testbox-broker-integrationfrom
feat-testbox-broker-hydration-prototype
Closed

ci: hydrate Rust in trusted Testbox broker#10141
lawrencecchen wants to merge 3 commits into
feat-testbox-broker-integrationfrom
feat-testbox-broker-hydration-prototype

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

This PR is stacked on #10135. Keep the trust-boundary PR separate. PR 10135 alone does not enable Rust builds.

Summary

  • Validate the exact reviewed source commit, tree, and Ghostty gitlink.
  • Initialize the exact Ghostty checkout and install the Linux build headers.
  • Use the trusted broker Zig installer and Rust setup action.
  • Fetch Zig and Cargo dependencies without compilation.
  • Move the fixed reviewed checkout outside the Testbox CLI sync root.
  • Write a schema-3 setup identity and upload it for 14 days.
  • Install a broker-owned warm-build entrypoint under /tmp/.testbox.
  • Serialize each fixed Cargo build with flock and a 20-minute limit.

The candidate checkout is input data. The workflow does not source a candidate shell script. The warm build can execute the reviewed Rust source only after the token isolation work in the base PR is complete.

Static verification

  • bash -n scripts/blacksmith-testbox-broker/setup.sh
  • shellcheck scripts/blacksmith-testbox-broker/setup.sh
  • actionlint .github/workflows/ci-workflow-guard-tests-testbox-broker.yml
  • Python PyYAML safe_load of the workflow
  • git diff HEAD^ HEAD --check

All checks passed at 16e715b. No local Cargo, Rust, Zig, Xcode, or Testbox command ran.

Timing plan

After both PRs merge and the protected environment pins the exact broker and reviewed source identities:

  1. Use one Testbox, one operator, and one target directory.
  2. Record CLI warmup start to ready time.
  3. Record the first target-empty Cargo build.
  4. Run 10 serialized warmup pairs, then 50 serialized measured pairs through the separate benchmark runner.
  5. Record CLI sync time, remote Cargo time, and total wall time separately.
  6. Retain all raw values and report median and p95. Do not retain only summaries.
  7. Compare with the existing 161.47-second clean, 0.21-second uncontended no-op, and 9.13-second changed-file records.
  8. Do not run a new local M5 Rust comparison. Local Rust is prohibited. Use existing macOS evidence only.

Expected result

Testbox reuse should beat repeated clean builds near the third build. It is unlikely to beat the M5 Max end-to-end warm loop because each remote build adds sync and control delay. The Testbox value is a safe, repeatable Linux lane, not a proven faster local edit loop.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Hydrates Rust in the trusted Testbox broker so CI can safely prepare and run Rust builds. Previously the broker integration validated the trust boundary but could not enable Rust builds; now CI prepares the reviewed source, pins toolchains, fetches dependencies, installs a warm-build entrypoint, and records a verifiable setup identity.

  • Adds scripts/blacksmith-testbox-broker/setup.sh with prepare/hydrate/warm-build:
    • Validates reviewed source commit, tree, and Ghostty gitlink; initializes Ghostty; treats the candidate checkout as data only.
    • Installs Linux build headers (clang, libclang-dev, pkg-config), fetches Zig and Cargo dependencies without compilation.
    • Moves the fixed reviewed checkout outside the Testbox CLI sync root and installs a broker-owned warm-build entrypoint at /tmp/.testbox/cmux-tui-rust-warm-build.
    • Serializes each warm Cargo build with flock and a 20-minute timeout.
    • Writes schema-1 prepare and schema-3 setup identities including toolchain versions and file digests.
  • Updates .github/workflows/ci-workflow-guard-tests-testbox-broker.yml:
    • Adds “Prepare” and “Hydrate” steps, installs repository-pinned Zig via scripts/install-zig-ci.sh, and sets up Rust via ./.github/actions/setup-cmux-tui-rust.
    • Uploads the setup identity artifact for 14 days using actions/upload-artifact.

Review and rollout

  • Verify BLACKSMITH_TESTBOX_BROKER_SHA, BLACKSMITH_TESTBOX_REVIEWED_REF, BLACKSMITH_TESTBOX_REVIEWED_SHA, and inputs.testbox_id are set in the protected environment.
  • Ensure the runner is the X64 32‑vCPU Ubuntu 24.04 pool and that cmux-tui/rust-toolchain.toml matches the repository action pin.
  • No app code migrations required; warm builds execute only after the trust boundary is enforced and run through the installed entrypoint.

Written for commit 16e715b. Summary will update on new commits.

Review in cubic

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 03496c3e-8e01-4e01-a5d7-2273fc34bfb2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 16e715be98

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


- name: Install repository-pinned Zig
shell: bash
run: ./scripts/install-zig-ci.sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep post-token setup inside the broker helper boundary

After Begin Testbox, the required workflow-guard-tests job runs tests/test_testbox_workflow_security.py, which rejects repository scripts outside scripts/blacksmith-testbox-broker/ and local ./.github actions. This invocation therefore fails with post-token script is outside the trusted broker directory: scripts/install-zig-ci.sh; after fixing it, the following setup-cmux-tui-rust local action would fail the same guard. Route both setup operations through the trusted broker boundary or deliberately update the guard and its trust policy.

Useful? React with 👍 / 👎.

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Superseded by the product-native Testbox workflow in #10135. The replacement uses the pinned Blacksmith lifecycle actions and no custom hydration broker.

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