$npx -y skills add rstackjs/agent-skills --skill rstack-eco-ci-debugDebug Rstack ecosystem CI failures and attribute the real source PR or downstream change. Always use this skill when the user mentions Rspack eco-ci, rstack-ecosystem-ci, a suite turning red, a downstream regression, a green-to-red pivot, canary bisect, @rspack-canary/core, or da
| 1 | # Rstack Eco CI Debug |
| 2 | |
| 3 | Use this skill to debug Rstack ecosystem CI failures without over-blaming the first Rspack commit that appears red in status data. |
| 4 | |
| 5 | This version covers the Rspack stack. |
| 6 | |
| 7 | ## Preconditions |
| 8 | |
| 9 | Before starting, ask the user which local checkout paths they have available. Do not assume machine-specific paths. |
| 10 | |
| 11 | - **Local Rspack checkout** — required for inspecting commits, resolving canary SHAs, and reviewing PR diffs. Ask for it before running any `git -C <rspack-path>` command. |
| 12 | - **Local downstream project checkout** — required when using `pnpm.overrides` to test specific Rspack versions (for example, during canary bisect). Ask for it before making approved temporary reproduction edits to `package.json`, `pnpm-lock.yaml`, or equivalent package-manager files. |
| 13 | - **Local `rstack-ecosystem-ci` checkout** — optional. If available, use its `data/rspack.json` as the first local status source. Pass the checkout path to local helpers that read git refs, for example `scripts/rspack-status.sh --repo <ecosystem-ci-path>`. |
| 14 | - **GitHub access** — prefer authenticated `gh` for `web-infra-dev/rspack` and `rstackjs/rstack-ecosystem-ci`. If `gh` is unavailable, use `origin/data:rspack.json` from a local `rstack-ecosystem-ci` checkout, workflow/job URLs, and the GitHub connector or public pages where available; state any evidence gap in the report. |
| 15 | |
| 16 | Fetch the local Rspack repo before resolving commits: |
| 17 | |
| 18 | ```bash |
| 19 | git -C <rspack-path> fetch origin main --tags |
| 20 | ``` |
| 21 | |
| 22 | - Treat GitHub Actions job logs as the source of truth for failure signatures. |
| 23 | - Do not modify project files unless the user explicitly asks for a fix or approves temporary reproduction edits. Temporary reproduction edits must be recorded and restored before reporting results unless the user asks to keep them. |
| 24 | |
| 25 | ## Investigation Model |
| 26 | |
| 27 | Rspack eco-ci runs a downstream project matrix against a freshly built Rspack artifact. A suite turning red means that a specific combination failed: |
| 28 | |
| 29 | ```text |
| 30 | current downstream project state + tested Rspack artifact |
| 31 | ``` |
| 32 | |
| 33 | It does not automatically mean the visible Rspack pivot PR is the true root cause. Downstream dependency updates, snapshot changes, test logic changes, and Rspack release/canary windows can all create misleading pivots. |
| 34 | |
| 35 | Some eco-ci failures are flaky even when they appear as a clean green-to-red transition. Repeated selector timeouts, browser navigation waits, dev-server readiness failures, and network-idle waits must be checked against old commit comments, old failed runs, and automation memory before attributing them to the current pivot. |
| 36 | |
| 37 | Always distinguish: |
| 38 | |
| 39 | - `Surface attribution`: the Rspack commit/PR where status data first shows the suite red. |
| 40 | - `Actual source`: the PR, version window, or downstream change that actually introduced the failing condition. |
| 41 | - `Failure signature`: the stable error text, command, assertion diff, stack, or log block used to compare runs. |
| 42 | |
| 43 | ## Optional Tools |
| 44 | |
| 45 | Read the linked reference before using any of these tools. Do not ask the user generically "which tool do you want"; instead, suggest the specific tool that matches the situation. Only invoke a tool when its strict trigger conditions are met; do not run it "just in case". |
| 46 | |
| 47 | - **Rspack status helper** — use `scripts/rspack-status.sh --repo <ecosystem-ci-path>` when you need the latest and previous rows from `data/rspack.json`, including failed suite names, job URLs, and suite-set delta. Pass a JSON file path instead when you already have a local snapshot. This helper only summarizes status data; it does not inspect logs or attribute root causes. |
| 48 | |
| 49 | - **Canary date bisect** — use in Phase 1 only when the Rspack commit window is too coarse to attribute a PR and downstream causes have already been ruled out. Trigger this when **all** of the following are true: |
| 50 | - The green-to-red pivot spans **more than 3 Rspack commits** or crosses a release/canary boundary. |
| 51 | - The failure signature is stable across the red rows in that window. |
| 52 | - The same Rspack commit does **not** appear in both green and red runs (which would indicate a downstream cause). |
| 53 | Do **not** trigger when the pivot is a single commit or when the surface PR diff already explains the signature. |
| 54 | Read [references/canary-date-bisect.md](references/canary-date-bisect.md) and ask the user for the local downstream checkout path and the narrowest failing command. |
| 55 | |
| 56 | - **Rsbuild config debug** — use in Phase 1 o |