$npx -y skills add mralaminahamed/wp-dev-skills --skill wp-ci-qaUse when a pull request has QA failures, a \"Testing Failed\" label, or QA comments reporting broken features — reading QA feedback and PR comments, tracing root cause using root-cause-patterns.md, applying scoped conventional-commit fixes, swapping labels (Testing Failed to Need
| 1 | # Fix PR QA Failures |
| 2 | |
| 3 | > **Model note:** This skill traces non-obvious root causes across PHP, JS, and CI — run on `sonnet` or `opus`. Do not downgrade to `haiku`; cause identification requires reasoning across multiple files. |
| 4 | |
| 5 | ## When to use |
| 6 | |
| 7 | - "QA marked my PR as Testing Failed", "fix the bugs in QA comments", "address QA feedback". |
| 8 | - "A PR has a 'Testing Failed' label", "QA left comments saying features are broken". |
| 9 | - "Trace the root cause of a QA-reported bug and fix it with scoped commits". |
| 10 | - "Post a QA re-test comment after fixing the reported issues". |
| 11 | |
| 12 | **Not for:** Writing new features or fresh code — use `wp-github-flow`. Setting up a CI pipeline from scratch — this skill triages failures in existing CI. |
| 13 | |
| 14 | ## Overview |
| 15 | |
| 16 | Full workflow for diagnosing and fixing bugs reported by QA on an open PR. Starts from the GitHub PR URL, ends with labels updated and a QA re-test comment posted. |
| 17 | |
| 18 | ## Supporting files |
| 19 | |
| 20 | - `scripts/fetch-pr-context.sh <pr> [owner/repo]` — Step 1 in one command: prints |
| 21 | PR metadata, labels, and the full QA comment thread (newest last). |
| 22 | - `references/root-cause-patterns.md` — catalog of recurring bug patterns |
| 23 | (symptom → cause → detect → fix). **Read before tracing; append after.** |
| 24 | - `references/qa-comment-template.md` — the Step 8 re-test comment template + rules. |
| 25 | - `references/github-actions-wp-matrix.md` — PHPUnit/PHPCS/PHPStan workflow configs, PHP×WP version matrix, caching, and CI failure triage. |
| 26 | |
| 27 | ## Workflow |
| 28 | |
| 29 | ```dot |
| 30 | digraph fix_qa { |
| 31 | rankdir=TB; |
| 32 | "Read PR + QA comments" -> "Checkout branch"; |
| 33 | "Checkout branch" -> "Trace root causes in code"; |
| 34 | "Trace root causes in code" -> "Fix scope-by-scope"; |
| 35 | "Fix scope-by-scope" -> "Lint / static analysis"; |
| 36 | "Lint / static analysis" -> "Commit each fix separately"; |
| 37 | "Commit each fix separately" -> "Push branch"; |
| 38 | "Push branch" -> "Update PR labels"; |
| 39 | "Update PR labels" -> "Post QA re-test comment"; |
| 40 | } |
| 41 | ``` |
| 42 | |
| 43 | ## Step 1 — Read PR and QA comments |
| 44 | |
| 45 | ```bash |
| 46 | scripts/fetch-pr-context.sh <number> <owner/repo> |
| 47 | ``` |
| 48 | |
| 49 | Or manually: |
| 50 | ```bash |
| 51 | gh pr view <number> --repo <owner/repo> \ |
| 52 | --json title,body,author,baseRefName,headRefName,state,labels |
| 53 | gh pr view <number> --repo <owner/repo> --json comments,reviews |
| 54 | ``` |
| 55 | |
| 56 | Collect: |
| 57 | - Which features QA says are broken (exact words) — read the **latest** QA comment; across re-fix rounds some features get confirmed fixed while others stay broken |
| 58 | - Which features QA confirms work (do not regress these) |
| 59 | - Label currently on the PR (`Testing Failed`, `Need Testing`, etc.) |
| 60 | |
| 61 | ## Step 2 — Checkout the branch |
| 62 | |
| 63 | ```bash |
| 64 | git fetch origin <branch> |
| 65 | git checkout <branch> |
| 66 | ``` |
| 67 | |
| 68 | If the repo is not cloned locally, find it under `wp-content/plugins/` or the relevant project path. |
| 69 | |
| 70 | ## Step 3 — Trace root causes |
| 71 | |
| 72 | Start from the action/hook/controller that handles the broken feature. |
| 73 | |
| 74 | **First, scan `references/root-cause-patterns.md`** — most QA failures match a |
| 75 | known pattern (array-cast-to-1, hook-fired-in-one-path, chart-renders-raw-id, |
| 76 | duplicate-component-drift, default-margin-misalignment). It gives symptom → |
| 77 | detect → fix for each. |
| 78 | |
| 79 | Key questions when no known pattern matches: |
| 80 | 1. What hook/action fires this email / feature? Where is it fired |
| 81 | (`grep -rn "do_action( 'hook'"`)? Is it reached on EVERY path to that state? |
| 82 | 2. Are any model `get_*()` returning wrong values after `load()` mutates state? |
| 83 | 3. (Frontend) Is a lib component rendering a raw key because no label/tooltip |
| 84 | render prop was passed? Does a sibling surface have a fix this one lacks? |
| 85 | |
| 86 | When you trace a NEW non-obvious cause, append it to the catalog before moving on. |
| 87 | |
| 88 | ## Step 4 — Fix scope-by-scope |
| 89 | |
| 90 | One logical bug = one commit. Do not bundle unrelated fixes. |
| 91 | |
| 92 | After each fix, verify th |