Consolidation branch for U7, per the new one-branch working mode. **Supersedes #2607, #2635, #2640** — the three of my PRs that were stuck on review threads. My other seven (#2602, #2605, #2606, #2611, #2621, #2628, #2633) are green with **zero unresolved threads** and are deliberately left alone for the merge sweep. ## What is in here, file by file | file | change | guards before → after | |---|---|---| | `plugins/…/glasses/src/agent-actions.ts` | gates, destinations and degraded-resolution refusal all resolve from the task's own workflow | 2 → 0 | | `plugins/…/glasses/src/quick-capture.ts` | accepted capture columns come from the board; default no longer names the deleted column | 1 → 0 | | `plugins/…/glasses/src/settings.ts` | quick-capture default was `triage`, the column #2515 removed | (assignment, uncounted) | | `plugins/…/dependency-graph/src/GraphTaskNode.tsx` | redundant column condition deleted | 1 → 0 | | `packages/engine/src/executor.ts` | 8 rebound guards compare the resolved column; 4 resume-eligibility literals share one resolver | 151 → 143 (+4 off-bar) | | `packages/engine/src/__tests__/` | 4 new suites, 26 cases | — | `plugins/` reaches **zero** column guards with this branch. ## The three threads it closes **#2607 — five findings, all mine, all the same rule.** I kept *qualifying* a legacy-id fallback instead of removing it: | attempt | rule | hole review found | |---|---|---| | 1 | fall back to `todo` when the role is missing | moved cards to phantom columns | | 2 | …only if the workflow **declares** `todo` | aliased **review** lane named `todo` | | 3 | …and only if no other role is assigned to it | **traitless** parking column named `todo` | The qualifications were the mistake. Once `resolveLanes` returns a lane set the workflow *has* a column vocabulary, so "no column carries the hold trait" is a complete answer — refuse. `destination()` is two lines now, with no aliasing surface left to qualify. Plus a sixth, which is a genuinely different state: **degraded resolution is indistinguishable from the default board.** `resolveWorkflowIrForTask` is total by design — a missing definition silently returns the *default* coding IR — so a card on a custom board whose definition could not be read resolved to `todo`/`in-progress`. `undefined` lanes cannot express that (it means "no workflow at all", where the legacy ids *are* the answer). The actions now refuse with 409. #2618 would replace this check with resolver provenance; it is not merged, so this does not depend on it. **#2635 — "seven rebound sites remain untested."** Fair; my "same shape" note was an assertion, not coverage. Seven of the eight need a live graph run to reach, so the *shape* is pinned instead: a static check that no guard in front of a rebound move compares against a column literal, with a vacuity case (the same detection run against the original shape) and a match-count floor (≥8), because a guard reporting success on zero matches is worse than no guard. **#2640 — duplicate workflow resolution.** Framed as I/O; it is also a correctness bug. Eligibility and re-entry are two halves of one decision and resolved the workflow separately, so a workflow edit landing between them has the halves reading *different boards*. Now one caller-owned memo per decision — caller-owned because a process-lifetime cache would have to guess when a mid-flight workflow edit invalidates it. ## Behavioural findings, not tidying - **The last-resort recovery for completed-but-stranded work did not exist off the default lineage.** `promotedFromPlannerColumn` was false on a renamed board, so finished work resting in planning was never promoted; the code fell through to a review handoff that role adjacency rejects, and the card stayed stuck with its work complete. - **Rebound guards could not see the column their own move targeted.** U5b converted the move target; the eight `column !== "todo"` checks in front of it were left literal, so on a renamed board the engine moved a card into the column it was already in — and `moveTaskInternal` runs reset-on-entry on every real move, so at the `preserveProgress: false` site it reset step progress a second time. - **The FN-1404 `task:move` audit row was lying**, recording `to: "todo"` while the move target was resolved. A run-audit trail that disagrees with the move it describes is worse than none. Not a comparison, so no census counts it. - **A task interrupted by an engine pause never resumed on a renamed board** (off-bar, `in-review`/`in-progress` literals): four comparisons decided one question and had to agree; two of them disagreed on a renamed board, so re-entry silently never fired. ## Revert proofs, isolated per site | reverted | result | |---|---| | `destination()` back to attempt 3 | 3 of 38 fail | | degraded-resolution refusals removed | 2 of 42 fail | | capture set back to the legacy five | 2 of 3 fail (renamed-board suite) | | forward exclusions → literals | 1 of 14 fails | | missing-wip refusal removed | 2 of 14 fail | | `promotedFromPlannerColumn` → literals | 3 of 7 fail | | promotion target → `"in-progress"` | 3 of 7 fail | | one rebound guard → `!== "todo"` | 1 of 3 fails (static shape) | | resume lanes → legacy trio | 1 of 5 fails | Every conversion is paired with a negative — a forward move, a not-a-planner-lane card, a default-lineage card, an unresolvable workflow — so neither "always fire" nor "never fire" can pass for "resolve the role". ## Commit discipline Twelve commits, each one thing: the code move (`resolvePlannerLanes` out of `triage.ts`) is separate from every behavior change, and each review fix is its own commit with its own revert proof. ## Verification - `pnpm test:gate` **71/71** - 162/162 across the glasses plugin's 19 files; 26/26 across the four new engine suites - engine + glasses typecheck clean; `pnpm lint` clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Engine recovery and retries now work correctly with renamed or customized workflow columns. * Tasks in manual-intake columns are no longer automatically planned. * Agent actions and quick capture now respect each board’s declared columns and lifecycle stages. * Awaiting-approval tasks are recognized regardless of their current column. * Command Center SDLC funnel stages now accurately reflect customized workflows. * **Documentation** * Added guidance for safely changing workflow-column logic and interpreting lifecycle-column checks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
85 lines
3.7 KiB
TypeScript
85 lines
3.7 KiB
TypeScript
// @vitest-environment node
|
|
|
|
/*
|
|
FNXC:WorkflowLifecycleColumns 2026-07-30-18:55 (PR #2635 review, greptile P2):
|
|
|
|
"Seven rebound sites remain untested" — fair, and stating it as a coverage note was not an answer.
|
|
Seven of the eight sit inside graph-failure / stuck-kill / dependency-gate paths that need a live
|
|
graph run to reach, so behavioural coverage for each would cost more scaffolding than the change
|
|
itself. What they share is a SHAPE, so the shape is what gets pinned.
|
|
|
|
This is a static check over `executor.ts`: every guard in front of a rebound move must compare
|
|
against a RESOLVED value, never a column literal. It fails on the exact defect the PR fixes — a
|
|
`column !== "todo"` check standing in front of a `moveTask(..., reboundColumn)` — at whichever of
|
|
the eight sites it is reintroduced, including sites added later that no behavioural test knows about.
|
|
|
|
It is a static check and is labelled as one: it proves the pattern is absent, not that each path
|
|
behaves. `executor-rebound-already-there.test.ts` carries the behavioural proof for the one
|
|
reachable site (`parkCompletedBlockedTask`).
|
|
|
|
It lives in its OWN file because the shared executor test helpers mock `node:fs`, so a suite that
|
|
imports them cannot read source off disk — a detail worth writing down, since the failure looks
|
|
like a broken path rather than a mocked module.
|
|
*/
|
|
import { describe, expect, it } from "vitest";
|
|
import { readFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import { dirname, join } from "node:path";
|
|
|
|
describe("no rebound move is guarded by a column literal", () => {
|
|
const source = readFileSync(
|
|
join(dirname(fileURLToPath(import.meta.url)), "..", "executor.ts"),
|
|
"utf8",
|
|
);
|
|
/** Comments blanked in place so prose about the old shape is not read as code. */
|
|
const code = source
|
|
.replace(/\/\*[\s\S]*?\*\//g, (comment) => comment.replace(/[^\n]/g, " "))
|
|
.replace(/\/\/.*$/gm, "");
|
|
const lines = code.split("\n");
|
|
|
|
it("resolves the rebound column before every guarded rebound move", () => {
|
|
const offenders: string[] = [];
|
|
|
|
lines.forEach((line, index) => {
|
|
if (!/moveTask\([^)]*reboundColumn/.test(line) && !/reboundColumn,/.test(line)) return;
|
|
// Walk back a few lines to the guard that admits this move.
|
|
for (let i = Math.max(0, index - 6); i <= index; i += 1) {
|
|
if (/column\s*(?:===|!==)\s*["'](?:todo|triage|in-progress|in-review|done|archived)["']/.test(lines[i] ?? "")) {
|
|
offenders.push(`${i + 1}: ${(lines[i] ?? "").trim()}`);
|
|
}
|
|
}
|
|
});
|
|
|
|
expect(offenders).toEqual([]);
|
|
});
|
|
|
|
it("finds the defect when it is reintroduced (the check is not vacuous)", () => {
|
|
// Same detection, run over a fixture carrying the original shape. Without this, a regex that
|
|
// silently stopped matching would report a clean file forever.
|
|
const reintroduced = [
|
|
` if (task.column !== "todo") {`,
|
|
` await this.store.moveTask(task.id, reboundColumn, { preserveProgress: true });`,
|
|
` }`,
|
|
];
|
|
const offenders: string[] = [];
|
|
|
|
reintroduced.forEach((line, index) => {
|
|
if (!/moveTask\([^)]*reboundColumn/.test(line)) return;
|
|
for (let i = Math.max(0, index - 6); i <= index; i += 1) {
|
|
if (/column\s*(?:===|!==)\s*["'](?:todo|triage|in-progress|in-review|done|archived)["']/.test(reintroduced[i] ?? "")) {
|
|
offenders.push(String(i + 1));
|
|
}
|
|
}
|
|
});
|
|
|
|
expect(offenders).toEqual(["1"]);
|
|
});
|
|
|
|
it("still sees the eight rebound moves it is meant to cover", () => {
|
|
// A guard that reports success on zero matches is worse than no guard.
|
|
const reboundMoves = lines.filter((line) => /moveTask\([^)]*(?:rebound|Rebound)Column/.test(line));
|
|
|
|
expect(reboundMoves.length).toBeGreaterThanOrEqual(8);
|
|
});
|
|
});
|