Skip to content

feat(#762): lightweight content pre-flight for --chain - #764

Merged
admarble merged 2 commits into
mainfrom
feature/762-feat-lightweight-content-pre-flight-for-chain-ac-p
Jul 15, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/762-feat-lightweight-content-pre-flight-for-chain-ac-p

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

Adds a lightweight, warn-by-default content pre-flight for sequant run --chain (#762). Chain validation previously checked only flag combinations; nothing inspected the content of the issues being chained, so a mis-ordered or unready chain (the #133 downstream-staleness class) sailed through to worktree provisioning.

The pre-flight runs once at chain start, before the first worktree is provisioned, and surfaces four cheap problems:

Per the #604 philosophy (suggest, never auto-decide), warnings never block by default; the new --strict-preflight flag turns any warning into a hard stop before provisioning. Checks compare against the raw CLI order (not the dep-sorted order), so run 39 38 --chain where #39 declares Blocked by #38 still warns rather than being silently pre-fixed by sortByDependencies. A gh fetch failure warn-degrades (that issue's checks are skipped) so the pre-flight never breaks a run.

Key files

  • src/lib/workflow/chain-preflight.ts — new module: pure computePreflightWarnings (unit surface) + gh fetch in runChainPreflight.
  • src/lib/workflow/run-orchestrator.ts — invoke pre-flight in run() before worktree setup; threads raw CLI order via new ResolvedRun.rawIssueOrder.
  • src/lib/workflow/types.ts + bin/cli.ts — strictPreflight option + --strict-preflight flag.
  • src/lib/workflow/chain-preflight.test.ts — 17 tests, one per warning class, verbatim fixtures.

Pre-PR AC Verification

AC Description Status Evidence
AC-1 Warnings for missing AC · dep-order contradiction · file-overlap-order mismatch ✅ computePreflightWarnings; "all three classes at once" test asserts exactly 3 warnings
AC-2 Warn-only by default; opt-in flag fatal before any worktree provisioned ✅ (unit) / ⚠️ (integration) Early-return before worktree block (run-orchestrator.ts); unit tests cover warn-only. See known gap below
AC-3 Reuses assess-collision-detect (extractPathsFromIssueBody + detectFileCollisions) — no new heuristics ✅ Imports + uses both; file-overlap test
AC-4 Closed/merged check consistent with #305; note #592 gap ✅ state === "CLOSED" warning; message cites #592; closed-issue test
AC-5 Unit tests per warning vs verbatim issue-body fixtures ✅ Verbatim Blocked by #38, real ## Acceptance Criteria headings; no synthetic combined fixture

Derived AC

Source Derived AC Status
Order-source correctness Pre-flight compares against raw CLI order, not dep-sorted (run 39 38 --chain where #39 depends-on #38 still warns) ✅ rawIssueOrder threaded through; regression test at [39, 38]

Known gap

  • AC-2 integration: the strict-abort-before-ensureWorktreesChain path is verified by code inspection + type-check, not a full run() integration test — no orchestrator run-harness with gh/state/worktree mocking exists, and building one would be brittle for marginal value. The abort logic is a plain early-return placed above the worktree block; the pure warning computation is fully unit-tested.

Test plan

  • npm run build — passes
  • npm run lint — passes (0 warnings)
  • npx vitest run src/lib/workflow/ — 976 pass, 2 skipped
  • npx vitest run src/lib/workflow/chain-preflight.test.ts — 17 pass
  • node dist/bin/cli.js run --help shows --strict-preflight

Closes #762

Add a warn-by-default content pre-flight that runs at chain start, before
the first worktree is provisioned. It surfaces four cheap problems over the
chained issues:

- missing/empty Acceptance Criteria section
- a declared blocker (`Blocked by #N` / `depends on #N`) that runs AFTER the
  issue in the CLI order
- a predicted file-overlap (reusing assess-collision-detect) whose CLI order
  contradicts the ascending land order
- an issue that is CLOSED on GitHub (#305-consistent; #592 gap noted)

Per #604, warnings never block by default; the new `--strict-preflight` flag
makes any warning fatal before provisioning. Checks compare against the RAW
CLI order (not the dep-sorted order) so `run 39 38 --chain` where #39 is
blocked by #38 still warns. A gh fetch failure warn-degrades rather than
aborting the run.

New module src/lib/workflow/chain-preflight.ts (pure compute + gh fetch),
invoked from RunOrchestrator.run(); adds strictPreflight to RunOptions and
--strict-preflight to bin/cli.ts. Unit tests cover each warning class against
verbatim issue-body fixtures.

Entire-Checkpoint: c69c1388ccf5
…eflight

QA gap fixes on the #762 pre-flight.

Prose false positive: parseDeclaredBlockers matched the marker anywhere in
a body, so #762's own issue parsed as blockers=[38, 36] — both from prose
examples ("...when #39 says blocked by #38", 'real markers like "Blocked by
#36"'). Under --strict-preflight a bogus warning hard-aborts a legitimate
chain, which is precisely the false inference #604 calls worse than none.

The marker is now anchored to line start (allowing list-item and bold forms),
inline code spans are stripped alongside fences and HTML comments, and the "#"
is required so "Blocked by 5 days of review" cannot parse as issue #5.
Verified against the real corpus: the three genuine declarations still parse
(#155 -> 107, #188 -> 187, #223 -> 219), #31's in-fence example stays ignored,
and #762 now yields no blockers.

Also adds --strict-preflight to the two flag tables that list every comparable
run flag (run-command.md, cheat-sheet.md); it previously existed only in
--help and the CHANGELOG.

Tests: 21 pass (4 new, incl. a verbatim-#762-prose regression); the two
rewritten cases encoded the mid-line matching being fixed.
@admarble
admarble merged commit a5778b0 into main Jul 15, 2026
5 checks passed
admarble added a commit that referenced this pull request Jul 15, 2026
PR #764 added --strict-preflight to the flag tables, but nothing documented
what the pre-flight actually does. Users see up to four warning classes printed
at chain start with no reference explaining what triggered them or whether to
act.

Adds a "Chain Pre-flight" section to run-command.md next to Chain Mode and QA
Gate Mode, matching how --qa-gate is documented (flag row plus narrative):
the four warning classes and their triggers, the warn-by-default rule, why the
checks run against the typed order rather than the sorted one, the line-leading
marker rule, and --strict-preflight for CI.

Claims verified against the shipped code: the chain && length > 1 gate, exit
code 1, the four warning kinds, the fetch-degrade note, and the sample warning
text quoted verbatim from the message template.

Table/line-length style matches the file's existing tables (markdownlint is not
wired to CI; this file already carries 46 MD060 and 37 MD013 of the same kind).

Entire-Checkpoint: 6331fb4954a3
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: lightweight content pre-flight for --chain (AC presence, dependency-order sanity)

1 participant