diff --git a/skills/verify/SKILL.md b/skills/verify/SKILL.md new file mode 100644 index 0000000..9fb76aa --- /dev/null +++ b/skills/verify/SKILL.md @@ -0,0 +1,75 @@ +--- +name: verify +description: >- + Run risk-proportional black-box runtime QA, inspect remote CI checks, promote + verified GitHub Draft PRs, and execute human-gated merge closeout with + Projects v2 board transitions. Use when verifying a ready-reviewed GitHub PR + or aborting an abandoned Draft PR. Not for static diff review (use + code-review), debugging (use diagnose), or implementation (use implement). +--- + +# Verify + +## Use when +- Verifying a GitHub PR whose latest `code-review` passed with `verdict=ready`. +- Promoting a verified Draft PR to ready-for-review and running merge closeout. +- Explicitly aborting an abandoned or superseded Draft PR. +- Not for static diff review (`code-review`), debugging (`diagnose`), or writing + code / managing `todo.txt` state (`implement`). + +## Steps +Precondition: an existing open GitHub PR verified via `gh repo view --json url` +per [planning-contract.md](../projects/references/planning-contract.md) (no +manual PR fallback; route to `implement` if none exists). `verify` has zero +`todo.txt` cleanup responsibility (`implement` owns its checkpoint file). + +1. **Phase 1: Read-Only Runtime QA and CI.** Before running QA checks, read + [references/qa-dispositions.md](references/qa-dispositions.md). Confirm the + latest `cr-review-meta` matches exact current `head_sha` with + `verdict=ready`; if missing, stale, or `needs_rework`, halt and route to + `code-review`. Execute `RV-*` checks (sized by risk tier) with explicit + dispositions (`PASS`, `FAIL`, `BLOCKED (env/fixture)`, + `BLOCKED (out-of-bounds)`, `INCONCLUSIVE`), and inspect `gh pr checks`. On + red CI, inspect `gh run view --log-failed` and route to `diagnose` or + `implement`. +2. **Phase 2: Promotion.** Before posting the ledger, promoting, closing out, + or aborting, read + [references/closeout-and-abort.md](references/closeout-and-abort.md). When + Phase 1 passes (zero `FAIL`, zero unresolved `BLOCKED (env/fixture)` or + `INCONCLUSIVE`, green CI), post the final Verification Ledger comment, + promote the PR (`gh pr ready`), and move the board card + `Work in Progress -> Review` per + [github-projects-v2.md](../projects/references/github-projects-v2.md). +3. **Phase 3: Human Merge Gate and Closeout.** Present the verification packet + (static provenance, runtime dispositions, CI, and `Contract Drift` per + [pr-and-drift.md](../implement/references/pr-and-drift.md)) for human merge + authorization. On approval: merge the PR, execute `Review -> Completed` + directly via `issue.projectItems` per + [github-projects-v2.md](../projects/references/github-projects-v2.md), and + chain `reconcile-docs` + `projects` when `Contract Drift` != `none`. On + rejection: run `gh pr ready --undo` and move `Review -> Work in Progress`. +4. **Explicit Draft PR Abort (on request only).** Only when explicitly invoked + to close an abandoned/superseded Draft PR, skip Steps 1-3 and follow the + abort path in + [references/closeout-and-abort.md](references/closeout-and-abort.md) + (`gh pr close` + revert board card to `Backlog`). + +## Your call +- **`live-infra` authorization**: approve before running `live-infra` checks. +- **Non-passing checks**: decide repair, fixture fix, or operator window for + `FAIL`, `BLOCKED`, or `INCONCLUSIVE` dispositions. +- **Merge or abort authorization**: approve/reject merge at Phase 3, or confirm + before aborting a Draft PR (`gh pr close` + `Backlog`). + +## Done when +- Merged: PR merged, card in `Completed`, and drift handoff emitted if needed. +- Rejected/blocked: PR stays Draft, card in `Work in Progress`, handoff stated. +- Aborted: Draft PR closed and card reverted to `Backlog`. + +## Hands off to +- `code-review`: missing, stale, or `needs_rework` `cr-review-meta` (`Suggested Next Step: /code-review`). +- `implement`: QA or CI requires code fixes (`Suggested Next Step: /implement #`). +- `diagnose`: opaque CI or runtime failure (`Suggested Next Step: /diagnose`). +- `reconcile-docs` and `projects`: post-merge when `Contract Drift` != `none` (`Suggested Next Step: /reconcile-docs`). +- Emit one outcome-matched `Suggested Next Step:` on standalone turns; suppress + when delegated per [skeleton.md](../build-skill/references/skeleton.md). diff --git a/skills/verify/references/closeout-and-abort.md b/skills/verify/references/closeout-and-abort.md new file mode 100644 index 0000000..595e8a8 --- /dev/null +++ b/skills/verify/references/closeout-and-abort.md @@ -0,0 +1,130 @@ +# Verification Ledger, Promotion, Closeout, and Abort + +Reference for `verify` Phase 2 (Promotion), Phase 3 (Human Merge Gate and +Closeout), human rejection rollback, and explicit Draft PR abort. + +> **Zero `todo.txt` responsibility**: `verify` never reads, edits, or deletes +> `todo.txt` or `implement-state` checkpoint files. `implement` solely owns +> checkpoint lifecycle and cleanup. + +--- + +## 1. Verification Ledger Comment Template (Phase 2) + +Post one Verification Ledger comment on the PR only after Phase 1 passes +(verified `cr-review-meta` `head_sha` + `verdict=ready`, zero `FAIL`, zero +unresolved `BLOCKED (env/fixture)` or `INCONCLUSIVE`, and green CI): + +```bash +gh pr comment --body-file +``` + +### Ledger Template +```markdown +## Verification Ledger + +- **Reviewed Head SHA**: `` +- **Static Provenance**: `code-review` (`verdict=ready`) +- **Rigor Tier**: `` +- **Remote CI (`gh pr checks`)**: `PASS` +- **Contract Drift**: `` + +### Runtime QA Dispositions + +| Check ID | Scope | Disposition | Evidence | +| :--- | :--- | :--- | :--- | +| `RV-01` | `local` | `PASS` | `` | +| `RV-02` | `live-infra` | `BLOCKED (out-of-bounds)` | `` | + +### Notes / Operator Follow-ups +- `` +``` + +--- + +## 2. Phase 2: Draft PR Promotion (`Work in Progress -> Review`) + +1. Confirm the Verification Ledger comment is posted on ``. +2. Promote the Draft PR to ready-for-review: + ```bash + gh pr ready + ``` +3. Move the linked issue card `Work in Progress -> Review` using the + `issue.projectItems` single-query resolution and `SINGLE_SELECT` mutation in + [github-projects-v2.md](../../projects/references/github-projects-v2.md) + (Section 4). Confirm the transition ownership matches + [planning-contract.md](../../projects/references/planning-contract.md). + +--- + +## 3. Phase 3: Human Merge Gate and Post-Merge Closeout + +Present the verification packet to the human owner (static provenance, runtime +dispositions, CI status, any `BLOCKED (out-of-bounds)` operator items, and the +PR body's `Contract Drift` value per +[pr-and-drift.md](../../implement/references/pr-and-drift.md)) and wait for +explicit merge authorization. + +### 3a. On Human Approval (Merge + `Review -> Completed`) +1. Merge the pull request using the repository's configured merge strategy (for + example, squash merge): + ```bash + gh pr merge --squash --delete-branch + ``` +2. Move the linked issue card `Review -> Completed` directly via + `issue.projectItems` per + [github-projects-v2.md](../../projects/references/github-projects-v2.md) + (Section 4): + - Query `issue.projectItems(first: 20)` filtered by + `project.number == $project_number` (from `AGENTS.md`). + - Resolve `project_id`, `item_id` (`PVTI_...`), `status_field_id` + (`PVTSSF_...`), and the `Completed` `option_id`. + - Execute `updateProjectV2ItemFieldValue` with + `value: { singleSelectOptionId: $completed_option_id }`. +3. **Partial-failure idempotency**: If the PR merge succeeds but the Projects v2 + mutation fails (network/API error), report the partial state clearly. + Re-running `verify` Phase 3 board closeout or `projects` reconciliation + safely moves the stranded card `Review -> Completed` without re-merging. +4. **Contract Drift chaining**: Read the fixed-format `Contract Drift:` line + from the PR body per + [pr-and-drift.md](../../implement/references/pr-and-drift.md): + - If `Contract Drift: none`: closeout is complete; recommend next ready slice + via `projects` or `implement` if applicable. + - If `Contract Drift` != `none`: chain `reconcile-docs` first to update + canonical docs (`ARCHITECTURE.md`, `ROADMAP.md`, `docs/designs/*.md`), + followed by `projects` to align downstream issues and milestones. + +### 3b. On Human Rejection Rollback (`Review -> Work in Progress`) +If the human owner rejects the merge or requests rework: +1. Convert the PR back to Draft: + ```bash + gh pr ready --undo + ``` +2. Move the linked issue card `Review -> Work in Progress` via + `issue.projectItems` per + [github-projects-v2.md](../../projects/references/github-projects-v2.md) + (Section 4). +3. Record the human owner's requested changes and route back to `implement` + (or `code-review` if only review triage is needed). + +--- + +## 4. Abandoned / Superseded Draft PR Abort Path + +> **Explicit invocation only**: Enter this path ONLY when the user explicitly +> asks to abort or close an abandoned/superseded Draft PR. Never trigger this +> path automatically from a failed Phase 1 check or Phase 3 rejection. + +1. Verify GitHub repository identity via `gh repo view --json url` and confirm + the target PR is an open Draft PR (`gh pr view --json state,isDraft,url`). +2. Confirm explicit user approval stating the PR to close and the linked issue + card that will revert to `Backlog`. +3. Close the Draft PR with an explicit reason comment: + ```bash + gh pr close --comment "Closing abandoned/superseded Draft PR: " + ``` +4. Move the linked issue card back to `Backlog` via `issue.projectItems` per + [github-projects-v2.md](../../projects/references/github-projects-v2.md) + (Section 4). +5. Do not touch `todo.txt` or `implement-state` files; if an orphaned branch + checkpoint exists locally, `implement` owns its cleanup. diff --git a/skills/verify/references/qa-dispositions.md b/skills/verify/references/qa-dispositions.md new file mode 100644 index 0000000..08c297e --- /dev/null +++ b/skills/verify/references/qa-dispositions.md @@ -0,0 +1,143 @@ +# Runtime QA Perspectives, Tiers, and Dispositions + +Reference for `verify` Phase 1 (Read-Only Runtime QA and CI). Keep verification +effort proportional to failure consequences and change uncertainty rather than +diff line count alone. + +--- + +## 1. Static Provenance Gate (`cr-review-meta` Check) + +Before running runtime checks, confirm that `code-review` has already audited +the exact current PR commit with `verdict=ready`: + +1. Fetch the PR's current head commit SHA: + ```bash + gh pr view --json headRefOid,isDraft,url,body + ``` +2. Inspect paginated PR reviews for the latest `cr-review-meta` HTML comment: + ```bash + gh api --paginate repos/{owner}/{repo}/pulls//reviews \ + --jq '[.[] | select(.body | contains("cr-review-meta:"))] | last | .body' + ``` + Expected marker format: + ```html + + ``` +3. **Hard Block Rule**: + - If `cr-review-meta` is **missing**, halt Phase 1 and route to `code-review`. + - If `head_sha` does **not** match `headRefOid` (stale review after new + commits), halt Phase 1 and route to `code-review`. + - If `verdict` is `needs_rework` (anything other than `ready`), halt Phase 1 + and route to `code-review` or `implement`. + - Never substitute runtime QA for static code review, and never waive a + missing or stale `verdict=ready` marker. + +--- + +## 2. Operational Rigor Tiers + +Select the minimum tier matching the slice's risk profile. Escalate individual +perspectives whenever a small diff touches a high-risk boundary (for example, +a two-line auth, permission, or URL sanitizer change). + +| Tier | Typical Slice | Minimum Required Runtime & CI Checks | Execution Mode | +| :--- | :--- | :--- | :--- | +| **Lightweight** | Copy updates, styling tweaks, isolated low-risk fixes with no new state or untrusted inputs | 1. Execute `RV-*` checks from the `code-review` body (if present).
2. Run relevant existing automated tests and a targeted smoke/regression check on the touched view or CLI path.
3. Verify `gh pr checks` is green. | Direct execution in current session. | +| **Standard** | New UI component, ordinary API integration, or modification to an established workflow | 1. Execute all `RV-*` checks plus falsifiable assertions for every acceptance criterion.
2. Run automated test suite, typecheck, and lint.
3. Verify happy, empty, and error states plus persistence across reload.
4. Run targeted regression checks on shared entrypoints.
5. Verify `gh pr checks` is green. | Direct execution by default. Use an isolated black-box subagent (withholding diff and author self-audit) only if multi-step workflow bias warrants independence. | +| **High-Assurance** | Auth, permissions, payments, destructive actions, sensitive data, concurrent/conflict state, or cross-cutting architecture | All `Standard` checks, plus:
1. Explicit conflict, duplicate-submission, and aggregate-state reconciliation assertions.
2. Adversarial input checks against security boundaries.
3. Secondary backend/API reads confirming persisted truth after mutations. | Independent black-box subagent for behavioral scenarios paired with `gh pr checks` verification. | + +--- + +## 3. Selectable Black-Box QA Perspectives + +Select only the perspectives warranted by the slice's risk profile. Convert +every selected perspective and every `RV-*` item into concrete falsifiable +checks rather than vague instructions ("check security"). + +| Perspective | Core Question | Concrete Runtime Checks to Construct | +| :--- | :--- | :--- | +| **Behavioral & Workflow** | Can the user complete the intended end-to-end task across real states? | Verify each required user journey across loading, empty, error/retry, partial, and success states; confirm state survives reload and matches authoritative backend reads. | +| **State & Concurrency** | Do local UI elements, sibling rows, and aggregate counters stay aligned with authoritative state? | Check duplicate-click guards, timeout/retry recovery, and conflict responses (such as `409`); assert that aggregate counters and sibling items reconcile with authoritative server state rather than drifting via partial local heuristics. | +| **Security Boundaries** | Can untrusted data execute code, break attributes, or route to unsafe destinations? | Exercise dynamic values across DOM/template and URL sinks with at least one adversarial payload; verify safe escaping, context-appropriate URL validation (`href`/`src`/`action`), and auth/permission enforcement. | +| **Ergonomics & Accessibility** | Is the slice usable on narrow screens, with touch, and via keyboard/assistive tech? | Check narrow mobile viewport (`375px`) for overflow, `>= 44x44px` touch targets, sequential keyboard `Tab` focus, visible `:focus-visible` outlines, and `aria-live` announcements for dynamic feedback. | +| **Scope & Regression** | Did the slice disturb adjacent features or shared entrypoints? | Run targeted smoke checks on neighboring views, routes, or CLI subcommands that share modified modules, routers, or schemas. | + +--- + +## 4. Falsifiable Check Format & Scope Boundaries + +Every check must declare its exact failure condition and scope before execution. +Never use open-ended observational prompts ("run the command and see what +happens"). + +```text +ID: RV-01 (or QA-01) +Scope: local | live-infra +Command / Action: +Assertion: PASS if ; FAIL if +``` + +### `local` vs. `live-infra` Boundaries +- **`local`**: Runs against local builds, unit/integration suites, ephemeral + test fixtures, local dev servers, or sandboxed mocks. Execute directly during + Phase 1. +- **`live-infra`**: Requires privileged access, host rebuilds, production or + staging migrations, live external APIs with side effects, or homelab/cloud + infrastructure changes. + - Execute `live-infra` checks **only** when the human owner has explicitly + authorized the target environment and operation. + - Without explicit authorization, do **not** fabricate execution or mark + `PASS`; record `BLOCKED (out-of-bounds)` and preserve the exact command and + `FAIL if ...` criteria for an authorized operator window. + +--- + +## 5. Five-State Disposition Contract + +Every required check ends in exactly one disposition. `BLOCKED` records an +honest execution boundary, never permission to assume correctness or count an +unexecuted check as `PASS`. + +| Situation | Disposition | Required Action | +| :--- | :--- | :--- | +| Check executes (`local`, or explicitly authorized `live-infra`) and satisfies the expected condition | `PASS` | Attach observable proof (exit code, command output, HTTP status, DOM measurement, or screenshot). | +| Check executes and triggers its `FAIL if ...` condition | `FAIL` | Record reproducible steps and observed vs. expected output; block Phase 2 promotion. | +| Local fixture, seed, dependency, or tool setup prevents execution | `BLOCKED (env/fixture)` | Diagnose and repair the local blocker before judging the implementation (distinct from a product bug); block Phase 2 promotion until resolved. | +| `live-infra` check requires permissions or infrastructure unavailable or not explicitly authorized for this run | `BLOCKED (out-of-bounds)` | Preserve exact command and `FAIL if ...` criteria for the human owner; surface explicitly in the Phase 3 packet. | +| Check executes, but available evidence cannot prove or falsify the assertion | `INCONCLUSIVE` | State what signal is missing and how to make the check deterministically falsifiable; block Phase 2 promotion until resolved or explicitly decided by the human owner. | + +--- + +## 6. Remote CI Inspection (`gh pr checks`) + +1. Inspect remote CI status for the PR: + ```bash + gh pr checks + ``` +2. If all required checks pass, record CI as `PASS` in the Verification Ledger. +3. If any check is pending, wait or report pending status before Phase 2 + promotion. +4. If any check fails (red CI): + - Fetch failed job logs directly: + ```bash + gh run view --log-failed + ``` + - Block Phase 2 promotion. + - Route root-cause investigation of opaque CI failures to `diagnose`, or + clear code/test regressions to `implement`. + +--- + +## 7. Authority Separation & Anti-Rationalization Rules + +- **Authority separation**: `code-review` establishes **static provenance** for + a specific `head_sha`; `verify` establishes **runtime behavioral and CI + evidence**; neither substitutes for the other, and only the human owner + authorizes merge/release. +- **Expected values before observation**: State the exact `FAIL if ...` + condition before running the check. If an assertion expects `2` and the + system returns `1`, record `FAIL`, never `PASS` with a narrative excuse. +- **Separate fixture health from product bugs**: If a test seed or fixture + mismatches schema reality, mark `BLOCKED (env/fixture)` and fix the fixture + rather than misclassifying it as a passing check or a product regression.