Skip to content

feat(cli): sequant ready <issue> — post-resolve A+ QA gate (#683) - #686

Merged
admarble merged 3 commits into
mainfrom
feature/683-feat-cli-sequant-ready-issue-post-resolve-a-qa-gat
Jun 1, 2026
Merged

admarble merged 3 commits into
mainfrom
feature/683-feat-cli-sequant-ready-issue-post-resolve-a-qa-gat

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

Adds sequant ready <issue> — a post-resolve A+ QA gate that reproduces the maintainer's manual fresh-session pass deterministically. It drives an already-resolved issue's worktree through a full-weight qa → loop → qa pipeline, surfaces every gap in a structured report, and stops at the human merge gate — it never merges. Closes #683.

What it does

$ sequant ready 712
  → full-weight /qa   (SEQUANT_FULL_QA=1 forces the branch-freshness / process-state
                       pre-flight checks even under an orchestrator)
  → /loop             (auto-fix gaps, scoped by gate policy)
  → re-/qa            (policy `ac`: until ACs met · `a-plus`: until READY_FOR_MERGE)
  → gap report        (auto-fixed + remaining/accepted + verdict)
  → STOP at human merge gate

Gate policy (ready.policy in settings, default "ac"; --policy ac|a-plus):

  • ac (default) — stop once no AC_NOT_MET remains; quality gaps reported, not auto-fixed; Non-Goal-touching findings are report-only.
  • a-plus (opt-in) — loop toward READY_FOR_MERGE, auto-fixing quality gaps.

Both bounded by --max-iterations, an optional --budget token cap, and the LOOP_NO_DIFF stagnation guard. A #534 regression guard ensures a zero-diff worktree or null verdict is never reported ready.

Architecture

  • src/commands/ready.ts — command shell (option parsing, worktree resolution, state persistence, report rendering).
  • src/lib/workflow/ready-gate.ts — reusable engine (runReadyGate, DI-injectable phase runner). A future sequant run --ready-gate can reuse it.
  • Full-weight QA: new ExecutionConfig.fullQa → SEQUANT_FULL_QA=1 for the qa phase; qa/SKILL.md (×3 dirs) honors it.
  • New waiting_for_human_merge issue status, wired through every exhaustive IssueStatus consumer.

Tests

29 deterministic vitest cases (ready-gate.test.ts, ready.test.ts): phase sequence, policy thresholds, all guard exits, #534 guards, Non-Goal report-only, exit-code mapping, report shape. Build (tsc) + lint (--max-warnings 0) green; skill dirs byte-identical.

AC status (see QA comment)

8/9 ACs MET. AC-7 (backtest with measured recall/noise over 27 pre-fix commits) is a manual offline live-LLM run — its methodology, corpus, harness, and scoring rubric are committed (docs/investigations/ready-gate-backtest.md); the measured numbers are produced on this branch per the issue's rollout-plan step 2, before public promotion. The command ships behind its experimental marker meanwhile.

Verdict

NEEDS_VERIFICATION — code/docs complete and tested; AC-7 awaits the offline backtest (external/manual, not a code gap).

🤖 Generated with Claude Code

Add a standalone `sequant ready <issue>` command that reproduces the
maintainer's manual fresh-session A+ QA pass deterministically: drives an
already-resolved issue's worktree through a full-weight `qa → loop → qa`
pipeline and STOPS at the human merge gate — it never merges.

- Engine: src/lib/workflow/ready-gate.ts (runReadyGate, DI-injectable phase
  runner). Command shell: src/commands/ready.ts.
- Full-weight QA (AC-2): new ExecutionConfig.fullQa sets SEQUANT_FULL_QA=1 for
  the qa phase; qa/SKILL.md (×3) honors it to run the standalone branch-
  freshness / process-state pre-flight checks even under an orchestrator —
  catching the no-implementation / divergent-branch class (#318/#529/#570).
- Gate policy (AC-3/AC-3a): ready.policy in settings (default "ac"),
  overridable via --policy. `ac` stops at no AC_NOT_MET and reports (not
  fixes) quality gaps; Non-Goal-touching findings are report-only. `a-plus`
  loops to READY_FOR_MERGE. Both bounded by --max-iterations, --budget token
  cap, and the LOOP_NO_DIFF stagnation guard.
- #534 guard (AC-5): zero-diff worktree or null/unparseable verdict →
  NO_IMPLEMENTATION, never ready.
- Never merges (AC-4): terminates in new `waiting_for_human_merge` status with
  a structured markdown/JSON gap report.
- Tests: 29 deterministic cases (ready-gate.test.ts, ready.test.ts).
- Docs (AC-7/AC-8): docs/reference/ready-command.md,
  docs/investigations/ready-gate-backtest.md, README, CHANGELOG.
admarble added 2 commits May 31, 2026 19:54
`Verdict: ✅ READY_FOR_MERGE` parsed as null because the regex only allowed
`**`/whitespace between `Verdict:` and the token — so a genuine QA pass was
recorded as "QA completed without a parseable verdict" (live repro:
`sequant run 687 --phases exec,qa`, where QA had already posted
READY_FOR_MERGE and opened PR #688).

Widen the gap to any run of non-alphanumeric chars (emoji, asterisks,
whitespace) via a negated ASCII class — ReDoS-safe and
no-misleading-character-class-clean, matching parseQaSummary. Also hardens
`sequant ready`, whose #534 guard would otherwise misclassify an
emoji-verdict pass as NO_IMPLEMENTATION. Adds regression tests.
…sequant-ready-issue-post-resolve-a-qa-gat

# Conflicts:
#	CHANGELOG.md
@admarble
admarble merged commit 3ca827a into main Jun 1, 2026
7 checks passed
admarble added a commit that referenced this pull request Jul 30, 2026
…ng (#861)

* fix(#850): parse bare-checkbox ACs under an Acceptance Criteria heading

Every AC_PATTERNS entry required an ID prefix, so ordinary human-written
issues (bare `- [ ]` items, no ID) parsed to zero ACs, silently blinding
every TS-side AC consumer including the ready gate's Non-Goal classifier.

parseAcceptanceCriteria is now section-aware (mirroring parseNonGoals):
existing ID patterns run unchanged on every line, plus a bare-checkbox
fallback that fires only under a case-insensitive `## Acceptance Criteria`
heading, synthesizing stable AC-N IDs that skip explicit-marker collisions.

Real matcha-maps issue bodies committed as hermetic fixtures: #686 (4),
#703 (2, lowercase heading), #745 (6, existing ID path), #750 (0, negative
guard resolving the AC-2 vs AC-3 contradiction the spec surfaced).

Entire-Checkpoint: 87d4ea18cbb9

* fix(#850): pre-scan explicit AC IDs so bare-before-explicit ordering cannot drop an author's AC

A bare checkbox listed before an explicit **AC-1:** under the same heading
synthesized AC-1 first, and the explicit AC-1 was then silently dropped by
the first-occurrence dedupe. Synthesis now skips IDs owned by explicit
markers anywhere in the body, not just those seen so far.

Mutation-verified: reverting the explicitIds guard fails exactly the new
test 'skips IDs taken by explicit markers that appear after the bare item'
(36 passed, 1 failed); restored, all 37 pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): sequant ready <issue> — post-resolve A+ QA gate that drives an issue to merge-readiness

1 participant