Skip to content

CI: Extract sandbox tests to their own job#7888

Open
ShaharNaveh wants to merge 3 commits into
RustPython:mainfrom
ShaharNaveh:ci-sandbox-tests
Open

CI: Extract sandbox tests to their own job#7888
ShaharNaveh wants to merge 3 commits into
RustPython:mainfrom
ShaharNaveh:ci-sandbox-tests

Conversation

@ShaharNaveh
Copy link
Copy Markdown
Contributor

@ShaharNaveh ShaharNaveh commented May 17, 2026

related to #7883.
I'll continue optimizing the CI so only necessary jobs trigger on their related changes

Summary by CodeRabbit

  • Tests
    • CI adds a dedicated sandbox test job that performs Linux compilation checks, sandbox smoke tests, and a separate SSL build step.
    • Sandbox tests run when related code or test areas change and always run on the main branch.
    • Sandbox-related steps were moved out of the previous test flow for clearer, focused validation.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 4cae1b20-7368-49ca-9118-d20a08e42406

📥 Commits

Reviewing files that changed from the base of the PR and between 78cc472 and 366fb0c.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yaml

📝 Walkthrough

Walkthrough

The CI workflow adds upstream_lib and extra_tests change flags in determine_changes, implements diff steps to set them, removes sandbox steps from rust_tests, and adds a new conditional sandbox_test job that runs Linux-only sandbox compilation, builds with freeze-stdlib, runs sandbox smoke tests, and performs an ssl-openssl build.

Changes

CI Sandbox Test Extraction

Layer / File(s) Summary
Change detection outputs and diff checks
.github/workflows/ci.yaml
determine_changes outputs now include upstream_lib and extra_tests; two new steps run git diff against Lib/** (excluding Lib/test/**) and extra_tests/** and set changed=true/false outputs.
Sandbox job creation and rust_tests cleanup
.github/workflows/ci.yaml
Sandbox compilation, sandbox smoke tests, and the ssl-openssl build are removed from rust_tests. A new sandbox_test job on ubuntu-latest runs conditionally when CI is not skipped and any of rust_code, upstream_lib, or extra_tests are true (and always on main), performing checkout, cache restore, sandbox cargo check (no host_env), freeze-stdlib build, sandbox smoke test scripts, and an ssl-openssl build.

Sequence Diagram

sequenceDiagram
  participant GitHubActions
  participant determine_changes
  participant sandbox_test_job
  participant rust_tests_job

  GitHubActions->>determine_changes: run diff checks (Lib/** excl Lib/test/**, extra_tests/**)
  determine_changes->>GitHubActions: set outputs (rust_code, upstream_lib, extra_tests)
  GitHubActions->>sandbox_test_job: conditional start (outputs true or branch main)
  sandbox_test_job->>sandbox_test_job: checkout, restore cache, install toolchain
  sandbox_test_job->>sandbox_test_job: cargo check (sandbox, no host_env)
  sandbox_test_job->>sandbox_test_job: cargo build (freeze-stdlib)
  sandbox_test_job->>sandbox_test_job: run sandbox smoke test scripts
  sandbox_test_job->>sandbox_test_job: run ssl-openssl build
  GitHubActions->>rust_tests_job: continue without sandbox steps
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • youknowone

Poem

🐰 I hopped through diffs with nose so bright,
Lib and extras sniffed in the night,
Sandbox now lives in its own little glen,
Builds run tidy, then quiet again,
A carrot for CI — hop, test, delight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: extracting sandbox tests from the rust_tests job into a dedicated sandbox_test job in the CI workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/ci.yaml (1)

179-225: ⚡ Quick win

Consider adding a timeout to prevent indefinite hangs.

Other test-related jobs in this workflow specify timeouts (e.g., rust_tests has 45 minutes, miri has 30 minutes). Adding a timeout to this job would prevent it from hanging indefinitely if compilation or smoke tests encounter issues.

⏱️ Suggested timeout addition
 sandbox_test:
   runs-on: ubuntu-latest
+  timeout-minutes: 30
   needs:
     - determine_changes
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yaml around lines 179 - 225, The sandbox_test job
currently lacks a timeout and can hang indefinitely; add a timeout-minutes value
(e.g., timeout-minutes: 45) to the sandbox_test job definition so the GitHub
Actions runner will cancel the job after the specified time; locate the
sandbox_test job block (job id: sandbox_test) and insert the timeout-minutes key
at the job level (alongside runs-on/name/needs) to match other jobs like
rust_tests or miri.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yaml:
- Around line 183-190: The CI condition is referencing
needs.determine_changes.outputs.extra_tests (plural) but the actual output is
named extra_test (singular), causing the check to miss changes; update the
condition to use needs.determine_changes.outputs.extra_test (or alternatively
rename the output in the determine_changes job to extra_tests) so the boolean
produced by determine_changes (extra_test) is evaluated correctly alongside
needs.determine_changes.outputs.rust_code and
needs.determine_changes.outputs.upstream_lib and the job triggers when files
under extra_tests/** are modified.

---

Nitpick comments:
In @.github/workflows/ci.yaml:
- Around line 179-225: The sandbox_test job currently lacks a timeout and can
hang indefinitely; add a timeout-minutes value (e.g., timeout-minutes: 45) to
the sandbox_test job definition so the GitHub Actions runner will cancel the job
after the specified time; locate the sandbox_test job block (job id:
sandbox_test) and insert the timeout-minutes key at the job level (alongside
runs-on/name/needs) to match other jobs like rust_tests or miri.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 5713da13-cbe0-46d8-a019-89c8a1a19ffc

📥 Commits

Reviewing files that changed from the base of the PR and between 4b9416a and e017dbb.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml

Comment thread .github/workflows/ci.yaml
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
.github/workflows/ci.yaml (1)

183-190: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Fix the output reference mismatch.

Line 188 references extra_tests but the output is defined as extra_test (singular) on line 49. This will cause the condition to always evaluate the wrong variable, and the job won't trigger when only extra_tests/** files are modified.

🐛 Proposed fix
      !contains(github.event.pull_request.labels.*.name, 'skip:ci') && (
        needs.determine_changes.outputs.rust_code == 'true' ||
        needs.determine_changes.outputs.upstream_lib == 'true' ||
-        needs.determine_changes.outputs.extra_tests == 'true'
+        needs.determine_changes.outputs.extra_test == 'true'
      )
    ) || github.ref == 'refs/heads/main'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yaml around lines 183 - 190, The condition in the CI
job references needs.determine_changes.outputs.extra_tests but the actual output
from the determine_changes job is named extra_test; update the reference so both
names match (either change needs.determine_changes.outputs.extra_tests to
needs.determine_changes.outputs.extra_test in the conditional or rename the
determine_changes job output to extra_tests) so the conditional block that
checks extra_test(s) (the needs.determine_changes.outputs.* entry used in the if
clause) evaluates correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In @.github/workflows/ci.yaml:
- Around line 183-190: The condition in the CI job references
needs.determine_changes.outputs.extra_tests but the actual output from the
determine_changes job is named extra_test; update the reference so both names
match (either change needs.determine_changes.outputs.extra_tests to
needs.determine_changes.outputs.extra_test in the conditional or rename the
determine_changes job output to extra_tests) so the conditional block that
checks extra_test(s) (the needs.determine_changes.outputs.* entry used in the if
clause) evaluates correctly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 12de6e6b-7dce-479c-8bea-cb1eef00e1a9

📥 Commits

Reviewing files that changed from the base of the PR and between e017dbb and 78cc472.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml

@youknowone
Copy link
Copy Markdown
Member

I am not sure how this help CI optimization. could you explain more?

@ShaharNaveh
Copy link
Copy Markdown
Contributor Author

I am not sure how this help CI optimization. could you explain more?

Sure, the idea is to make cargo test to run only when there's change to rust related code or when something changes under Lib/** but not Lib/test/**. atm, the job has some steps that needs to be triggered with different conditions.

I'm decoupling the rust_test job by creating new jobs/moving some steps to a more suited job

@youknowone
Copy link
Copy Markdown
Member

isn't host_env expected to share the same triggering condition?

@ShaharNaveh
Copy link
Copy Markdown
Contributor Author

isn't host_env expected to share the same triggering condition?

host_env is tested as long as a PR doesn't have the ci:skip label (it's triggered no matter what)

@ShaharNaveh ShaharNaveh requested a review from youknowone May 21, 2026 06:45
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.

2 participants