gpui-test — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited gpui-test (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Use this skill when the user asks about #[gpui::test], GPUI test seeds or iterations, deterministic scheduler failures, parking/pending task failures, or how to reproduce a flaky GPUI test.
#[gpui::test] does#[gpui::test] expands to a normal Rust #[test], so it runs under standard Rust test runners such as cargo test and cargo nextest.
It wraps the body in GPUI's deterministic test dispatcher/scheduler and can run the same test multiple times with different seeds. The seed controls scheduler task interleavings and any StdRng argument injected into the test.
The macro supports both synchronous and asynchronous tests.
The macro recognizes arguments by type name:
| Test kind | Supported arguments |
|---|---|
| Sync and async | &TestAppContext, &mut TestAppContext, StdRng |
| Async only | BackgroundExecutor |
| Sync only | &App, &mut App |
StdRng is seeded from the current GPUI test seed, and BackgroundExecutor is backed by the same deterministic test dispatcher.
Use these forms on #[gpui::test(arguments)]:
0, unless SEED is set.seed = N: adds a single explicit seed.seeds(...): adds multiple explicit seeds.iterations = N: runs sequential seeds starting at 0 by default.retries = N: retries a failing run up to N times before surfacing the failure.on_failure = "path::to::function": calls the function after final failure, before resuming the panic.iterations can be combined with explicit seed / seeds; explicit seeds are appended to the 0..iterations range.SEED environment variable is set, it takes precedence over explicit seeds.SEED=N and ITERATIONS=M or iterations = M, the harness runs seeds N..N+M.SEED=<u64> — chooses the scheduler seed. Use this to reproduce a failure printed as failing seed: N. It also seeds injected StdRng arguments. For #[gpui::property_test], it controls the scheduler seed and GPUI applies it to the proptest config for deterministic case generation.ITERATIONS=<usize> — overrides the iterations = ... value at runtime. Use to sweep many seeds without editing the test.PENDING_TRACES=1 or PENDING_TRACES=true — captures and prints pending task traces when the test scheduler panics with Parking forbidden. Use this when run_until_parked() or teardown reports pending work.GPUI_RUN_UNTIL_PARKED_LOG=1 — logs when allow_parking() is enabled. Use to find tests that explicitly permit parking/pending work.DEBUG_SCHEDULER=1 — prints scheduler clock/timer debugging from scheduler::TestScheduler.SCHEDULER_NONINTERACTIVE=1 — suppresses interactive seed progress output in scheduler::TestScheduler::many. This does not affect the #[gpui::test] harness path.RUST_BACKTRACE=1 or RUST_BACKTRACE=full — show panic backtraces.RUST_LOG=<filter> — enable logs when the test initializes logging.ZED_HEADLESS=1 — forces GPUI platform guessing toward headless mode; useful for tests that otherwise interact with platform/window setup.Prefer env vars over editing the test when narrowing a reproduction.
cargo -q test -p <crate-name> <test_name> -- --nocapture SEED=<seed> cargo -q test -p <crate-name> <test_name> -- --nocapture ITERATIONS=100 cargo -q test -p <crate-name> <test_name> -- --nocaptureWhen the harness prints failing seed: <seed>, switch to SEED=<seed> for all future debugging.
Parking forbidden, rerun with pending traces. PENDING_TRACES=1 cargo -q test -p <crate-name> <test_name> -- --nocaptureIf a failing seed was printed or is already known, include it too:
SEED=<seed> PENDING_TRACES=1 cargo -q test -p <crate-name> <test_name> -- --nocaptureInspect the pending traces for a task that was spawned but not awaited, detached, completed, or intentionally allowed to park.
cx.background_executor().timer(duration).await;Avoid smol::Timer::after(...) in GPUI tests that rely on run_until_parked(), because GPUI's scheduler may not track it.
SEED fixed.ITERATIONS to 1 or remove it once a seed is known.StdRng, log or assert the generated scenario after fixing the scheduler seed.ITERATIONS=20, if the failure was scheduler-sensitive.Likely caused by a scheduler interleaving or by StdRng-driven test data. Fix SEED, reproduce, and inspect which task or generated scenario differs.
Parking forbiddenUsually means a foreground/background task is still pending when the scheduler expected the test to make progress or finish. Look for:
cx.run_until_parked() after triggering async work in a test.cx.advance_clock(...) to wait for debounced work in a test.Rerun with PENDING_TRACES=1 before changing code.
The scheduler can report activity from an unexpected thread. Look for work escaping GPUI's foreground/background executors, direct thread spawns, or external async runtimes not controlled by the test dispatcher.
Use the failing seed from sweep output. Avoid assuming test order unless the runner is explicitly serial. Check globals, leaked entities/tasks, and state not reset by test initialization.
#[gpui::test] for tests that need TestAppContext, deterministic executors, fake time, or scheduler interleaving coverage.iterations = N when the test is intentionally checking interleavings.StdRng as a test argument when randomized test data should follow the same seed as the scheduler.cx.background_executor().timer(duration).await for delays/timeouts in GPUI tests.retries while fixing a test unless the user explicitly asks or the test already documents why probabilistic tolerance is intentional. Retries can mask the failure instead of fixing it.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.