Skip to content

ci: isolate nightly package tests from source tree#3274

Open
dierksen wants to merge 2 commits into
flashinfer-ai:mainfrom
dierksen:fix-nightly-package-test-imports
Open

ci: isolate nightly package tests from source tree#3274
dierksen wants to merge 2 commits into
flashinfer-ai:mainfrom
dierksen:fix-nightly-package-test-imports

Conversation

@dierksen
Copy link
Copy Markdown
Collaborator

@dierksen dierksen commented May 8, 2026

📌 Description

🔍 Related Issues

🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.

✅ Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit (or used your preferred method).
  • I have installed the hooks with pre-commit install.
  • I have run the hooks manually with pre-commit run --all-files and fixed any reported issues.

If you are unsure about how to set up pre-commit, see the pre-commit documentation.

🧪 Tests

  • Tests have been added or updated as needed.
  • All tests are passing (unittest, etc.).

Reviewer Notes

Summary by CodeRabbit

  • Chores
    • Nightly test runs now execute in an isolated temporary directory to ensure tests run against the installed distribution rather than local source.
    • Test artifacts (tests and test config) are copied into the temp run directory; the directory is removed on script exit to keep workspace clean.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ad062a7-27c5-421b-8414-81550ccb0144

📥 Commits

Reviewing files that changed from the base of the PR and between 4cfe264 and 8fbb1d7.

📒 Files selected for processing (1)
  • scripts/task_test_nightly_build.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/task_test_nightly_build.sh

📝 Walkthrough

Walkthrough

The nightly build test script computes SOURCE_WORKSPACE, creates a temporary TEST_RUN_DIR and EXIT trap, copies only tests/ and pytest.ini into the temp dir after installing nightly artifacts, then cds into TEST_RUN_DIR to run test shards by invoking the shard script from SOURCE_WORKSPACE/scripts/, and cleans up on exit.

Changes

Nightly Test Isolation

Layer / File(s) Summary
Directory Setup & Cleanup
scripts/task_test_nightly_build.sh
SOURCE_WORKSPACE is computed from the script location, the script cds into it, creates a temporary TEST_RUN_DIR with mktemp -d, and registers an EXIT trap to remove it.
Test File Preparation
scripts/task_test_nightly_build.sh
After installing the nightly wheel/tar, only tests/ and pytest.ini are copied into TEST_RUN_DIR so pytest uses the installed distribution rather than local source files.
Isolated Test Execution
scripts/task_test_nightly_build.sh
Test shard execution is changed to cd into TEST_RUN_DIR before invoking the shard runner script from SOURCE_WORKSPACE/scripts/.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

Poem

🐰 In a tiny temp grove tests rebound,
No local shadows circling round,
pytest.ini and tests in tow,
The wheel alone will run the show,
Cleaned away when the run is done.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only the empty template with unchecked boxes and no actual content describing the changes, rationale, or addressing the required sections. Fill in the Description section with details about what changed and why, link any related issues, and verify the checklist items (pre-commit checks and tests).
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: isolating nightly package tests from the source tree to prevent import shadowing issues.
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

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/task_test_nightly_build.sh (1)

60-67: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Relative FLASHINFER_JIT_CACHE_REPORT_FILE paths are silently deleted by the EXIT trap.

The subshell at line 67 cds into TEST_RUN_DIR, so any relative path in FLASHINFER_JIT_CACHE_REPORT_FILE resolves there. The EXIT trap then runs rm -rf "${TEST_RUN_DIR}", destroying the file before the caller can read it. No error is raised — the report is silently lost.

🛡️ Proposed fix — resolve to absolute path before the cd
 if [ -n "${FLASHINFER_JIT_CACHE_REPORT_FILE}" ]; then
+  FLASHINFER_JIT_CACHE_REPORT_FILE="$(realpath -m "${FLASHINFER_JIT_CACHE_REPORT_FILE}")"
   export FLASHINFER_JIT_CACHE_REPORT_FILE
 fi

realpath -m resolves relative-to-CWD without requiring the file to already exist, so it is safe to call before the report is written.

🤖 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 `@scripts/task_test_nightly_build.sh` around lines 60 - 67, The
FLASHINFER_JIT_CACHE_REPORT_FILE may be a relative path and gets deleted by the
EXIT trap that removes TEST_RUN_DIR because the subshell (cd "${TEST_RUN_DIR}"
&& bash ...) changes CWD; to fix, if FLASHINFER_JIT_CACHE_REPORT_FILE is set,
resolve it to an absolute path before entering the subshell (use a safe resolver
such as realpath -m or similar) and then export the resolved absolute path so
the file is created outside TEST_RUN_DIR and survives the EXIT trap.
🤖 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.

Outside diff comments:
In `@scripts/task_test_nightly_build.sh`:
- Around line 60-67: The FLASHINFER_JIT_CACHE_REPORT_FILE may be a relative path
and gets deleted by the EXIT trap that removes TEST_RUN_DIR because the subshell
(cd "${TEST_RUN_DIR}" && bash ...) changes CWD; to fix, if
FLASHINFER_JIT_CACHE_REPORT_FILE is set, resolve it to an absolute path before
entering the subshell (use a safe resolver such as realpath -m or similar) and
then export the resolved absolute path so the file is created outside
TEST_RUN_DIR and survives the EXIT trap.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9fcd95b8-4898-46f7-8f72-8bd664b7ba32

📥 Commits

Reviewing files that changed from the base of the PR and between 059008c and 4cfe264.

📒 Files selected for processing (1)
  • scripts/task_test_nightly_build.sh

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces test isolation for nightly builds by creating a temporary directory, copying necessary test files into it, and executing tests from that location. This ensures that the tests run against the installed distribution rather than being shadowed by the local source directory. The review feedback suggests a more robust way to define the workspace root by deriving it from the script's location rather than the current working directory.

Comment thread scripts/task_test_nightly_build.sh Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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