next.js
7bb1489f - docs(agents): add rust-turbopack skill for Rust tests and benchmarks (#102179)

Commit
2 hours ago
docs(agents): add rust-turbopack skill for Rust tests and benchmarks (#102179) ### What? This PR adds a `rust-turbopack` skill (`.agents/skills/rust-turbopack/`) for building, testing and benchmarking Rust changes. - **`SKILL.md`** covers: - rebuilding the native binding before Next.js e2e tests; - checks CI runs that a local `cargo check` misses (clippy with `-D warnings`, the `process_pool` feature for standalone `turbopack` checks, Miri on the pinned toolchain); - Turbopack fixture conventions: `UPDATE=1` snapshot refreshes, nextest or `cargo test`, which `output/` directories are tracked, compile-time fixture discovery, `scopeHoisting: false` coverage, analyzer graph snapshots; - wasi test limitations; - not sharing `CARGO_TARGET_DIR` between worktrees. - **`benchmarking.md`** covers benchmarking Turbopack and `next build` with locally built bindings: - a native binding built from a dirty tree disables the persistent cache, so set `TURBO_ENGINE_IGNORE_DIRTY=1` for every arm; - keep a separate `.next` per arm and build the baseline in its own worktree; - interleave runs; - measure RSS by process role; - Criterion caveats. The root "Rust/Cargo" section moves out. The `cargo fmt` and `super::` import conventions go to `turbopack/AGENTS.md`, which `crates/AGENTS.md` now references, and the ICE tip goes to the skill. Code-level `turbo_tasks` gotchas (`value_impl` blocks, cloned task inputs, and `format!` brace escaping in generated JavaScript) also go to `turbopack/AGENTS.md`. `sandbox-bench` links to the benchmarking guide. ### Why? Rust work in this repo kept hitting the same problems: - e2e tests ran against a stale native binding; - clippy failed in CI after a clean `cargo check`; - new fixtures weren't discovered until the test binary was rebuilt; - worktrees sharing a target directory tested the wrong source; - "warm" benchmark builds were actually cold, because the binding came from a dirty tree. ### How? The root `AGENTS.md` shrinks from 550 to 545 lines. | Theme | Where it went | | --- | --- | | `cargo fmt` ordering, `super::` imports | `turbopack/AGENTS.md` "Rust conventions" (moved from root), referenced from `crates/AGENTS.md` | | ICE: delete incremental artifacts | `SKILL.md` (moved from root) | | Rebuild native before e2e, clippy `-D warnings`, `process_pool`, Miri | `SKILL.md` | | nextest or `cargo test`, `UPDATE=1`, fixture discovery, tracked snapshot output, `scopeHoisting: false`, analyzer graph snapshots | `SKILL.md`, "Turbopack fixtures" | | `value_impl` helpers, cloned task inputs, `format!` brace escaping | `turbopack/AGENTS.md` | | wasi abort-on-panic and `parking_lot` | `SKILL.md`, which links `scripts/wasi-test-host/README.md` | | Separate target dir per worktree | `SKILL.md`, "Target directories" | | Dirty-tree FS cache, per-arm `.next`, baseline worktree, interleaving, RSS roles (Linux and macOS differences), Criterion | `benchmarking.md` | | Dropped: portable-build-cache task snapshot test | Too specific | | Dropped: machine-specific disk sizes and host details | Environment-specific | | Dropped: one-off compiler and macro workarounds | Too narrow to generalize | Related draft PRs from the same pass: CI reading in `pr-status-triage`, `run-tests`, and `rebase-pr`. This PR has no dependency on them. ### Verification - Prettier 3.6.2 `--check` and alex 9.1.0 on the new skill files - Checked the facts against `packages/next-swc/package.json`, `turbopack-node/Cargo.toml`, `turbopack/Cargo.toml`, `turbopack-tests` (README, `.gitignore`, harnesses), `.cargo/config.toml`, `db_versioning.rs`, `turbo-tasks/src/parallel.rs` and `scripts/wasi-test-host/README.md`; `git check-ignore` confirmed which fixture outputs are ignored - Root `AGENTS.md`: 545 lines vs. 550 on canary - Not run: cargo builds or benchmarks (documentation-only change) <!-- NEXT_JS_LLM --> <!-- fleet ecad2aa1-2fed-4a45-9391-10cce92387cc --> --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading