code-review-catches-planted-bugs.yaml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. scenario: code-review-catches-planted-bugs
  2. description: >
  3. Lifted from superpowers/tests/claude-code/test-requesting-code-review.sh.
  4. The setup repo has two commits where the second plants three real
  5. security bugs (SQL injection, identity-function password hash, credential
  6. logging). The naive user asks for a review before merge. The
  7. superpowers:requesting-code-review skill should fire, dispatch a
  8. reviewer subagent, and the resulting review must flag the planted bugs
  9. at Critical/Important severity and refuse to approve the diff.
  10. This is the cross-harness, semantically-judged replacement for the bash
  11. test that landed in PR #1299. Drill's verifier reads the reviewer's
  12. actual report in context instead of regex-grepping for keywords.
  13. user_posture: spec-aware
  14. setup:
  15. helpers:
  16. - create_code_review_planted_bugs
  17. assertions:
  18. - "git rev-parse --is-inside-work-tree"
  19. - "git branch --show-current | grep -q main"
  20. - "git log --oneline | wc -l | tr -d ' ' | grep -q '^2$'"
  21. - "test -f src/db.js"
  22. # Bug fingerprints — the helper plants string-concatenation in the SQL
  23. # and an identity-function hash. If either is missing, the run is
  24. # measuring something other than what the scenario claims.
  25. - "grep -q '+ email +' src/db.js"
  26. - "grep -qE 'function hash\\(s\\) \\{[[:space:]]*return s' src/db.js"
  27. turns:
  28. - intent: >
  29. You just committed a refactor and want a thorough pre-merge review.
  30. You are spec-aware: you know the superpowers workflow and want the
  31. agent to use the requesting-code-review skill (which dispatches a
  32. reviewer subagent with isolated context). Use phrasing like:
  33. "I just finished a refactor of our user-lookup code and added a
  34. login function. The change is the most recent commit on the only
  35. branch (main has just two commits). Use the
  36. superpowers:requesting-code-review skill to review the diff before
  37. I merge — dispatch the reviewer subagent with the template and
  38. report back what it found."
  39. Do NOT mention SQL injection, hashing, credentials, or any specific
  40. bug. Do NOT pre-emptively suggest severities. The skill is named
  41. because we want the subagent path; the bugs themselves are for the
  42. reviewer to discover.
  43. - intent: >
  44. If the agent asks a short clarifying question (e.g., "what's the
  45. base SHA?" or "anything specific to focus on?"), answer briefly.
  46. Sample answers:
  47. - "The diff is just `git diff HEAD~1..HEAD` — the most recent commit."
  48. - "Just give it a normal pre-merge review."
  49. Do NOT volunteer information about the planted bugs or what to
  50. look for.
  51. - intent: >
  52. Once the agent has produced a review (with findings, severity,
  53. and a verdict), you are done — use the "done" action. If the
  54. agent says "looks good, ready to merge", that is also a complete
  55. review (and a fail of the criteria below — but the run itself is
  56. complete).
  57. limits:
  58. max_turns: 8
  59. turn_timeout: 300
  60. verify:
  61. assertions:
  62. - "skill-called superpowers:requesting-code-review"
  63. - "tool-called Agent"
  64. criteria:
  65. - >
  66. Reviewer flagged the SQL injection in findUserByEmail. The query
  67. switched from a parameterized statement to string concatenation
  68. with the user-supplied email. The reviewer must call this out
  69. at Critical or Important severity (not Minor / Nice-to-have).
  70. - >
  71. Reviewer flagged the credential-handling problem. Either of these
  72. counts as catching it: (a) `hash()` is an identity function so
  73. passwords are stored / compared in plaintext; (b) `console.log`
  74. writes the password_hash to stdout on every successful login.
  75. The reviewer must call out at least one at Critical or Important
  76. severity.
  77. - >
  78. Reviewer did not approve the diff for merge. A correct reviewer
  79. either says "do not merge", "with fixes", "blocking", or
  80. explicitly refuses approval. A reviewer that says "looks good",
  81. "ready to merge", or "safe to ship" without qualification fails
  82. this criterion.
  83. observe: true