Skip to content

fix(workboard): run git diff --check at node-ticket import - #56

Merged
tomorrowflow merged 3 commits into
mainfrom
fix/workboard-import-diff-check
Oct 13, 2026
Merged

tomorrowflow merged 3 commits into
mainfrom
fix/workboard-import-diff-check

Conversation

@tomorrowflow

Copy link
Copy Markdown
Owner

Problem

In the Phase 4 window, both of dev's defect verdicts (BUG-57 round 0, KA-8 round 0) came down to the same mechanical check. The card notes require a clean git diff --check, the imported range failed it, and each session reported done anyway without a failed proof entry. In BUG-57 the operator accepted, so a check Workboard could run itself turned into a disagreement, and agreement no longer measured judgment.

Solution

  • The check: at import, after the bundle is fetched and before factory/<card> is created or moved, the host clone runs git diff --check <from> <head>.
  • On failure:
    • The card gets a failed import check proof entry and is blocked.
    • The block reason leads with the command and its output, because the re-run session sees comments cut to 400 characters.
    • The node worktree stays, so a re-run fixes the errors with a new commit and imports again.
  • Rework rounds: the check covers only the round's own commits. WorkboardNodeRework gains an optional startCommit, the PR tip the round started from. A reviewer's commits, or an "Update branch" merge of main, therefore never block the session. A rework record from before this change falls back to the host branch head.
  • Stale cards: assertCurrent() runs before recording, so a card that was re-dispatched while its bundle was in transit is left alone.
  • Re-run fix (third commit): a re-run claims the card while it still holds the failed import's pending record, and the handoff sweep fires on that claim. The sweep then imported the old head again.
    • With the import check, that blocked the re-run before its session could fix anything.
    • With any other import failure, the card jumped to review mid-start. That second case was already broken on main.
    • Fix: handoffCard now skips a pending record older than the card's claim, because that record belongs to the start that replaces it.
    • The same commit checks the rework tip as a commit id before it reaches host git as an argument.
    • It also moves the start-queue tests into node-ticket-handoff.start-queue.test.ts to stay under the line cap.
  • Lint fix in a separate commit: store-card-helpers.ts goes back under the 700-line cap. main sits at 701 because feat(workboard): measure each run's turn-end context against the smart zone #51 and feat(workboard): queue a node-ticket start on a full slot and stay on the board #52 each stayed under the cap but together crossed it.

Impact

  • Operators: a whitespace failure never reaches review. The card shows a blocked state with the exact lines.
  • KPIs: the failure counts as a block in the trust KPIs, which is intended, because the session reported done on a failing required check.
  • Update behavior: startCommit is optional and normalized, so existing records load unchanged and no migration is needed.

Evidence

pnpm test <file> --maxWorkers=1: node-ticket-handoff.test.ts 24.9 s wall, node-ticket-handoff.start-queue.test.ts 13.5 s. The full Workboard suite passes too: 469 tests in 33 files.

New and changed tests, each failing on the code before the fix:

  • A commit with trailing whitespace is blocked:
    • It gets the failed proof entry and the reason text.
    • It creates no host branch and keeps the node worktree.
    • After a re-run whose session commits the fix, it reaches review at the fixed head.
  • The re-run helper now fires the handoff sweep during the start, as the live scheduler does. Before the re-run fix, both re-run tests failed with it: the import-check re-run was blocked again, and the plain re-run went to review mid-start.
  • The rework test's reviewer fixup commit now carries trailing whitespace. The round still imports to review, and the rework record names the reviewer's commit as startCommit.

Other gates:

  • tsgo:extensions shows only the unrelated qa-lab @openclaw/crabbox-provider error that is already on main.
  • oxlint passes on extensions/workboard/src and the contract.

Review, in two independent rounds; all five findings are fixed here:

  • Round 1: the rework-range defect, the 400-character truncation and the missing assertCurrent.
  • Round 2: the re-run race and the unvalidated startCommit.

One limit is left as it is: the check compares trees, so a session that merges main during its own round is charged for main's whitespace.

🤖 Generated with Claude Code

tomorrowflow and others added 3 commits October 13, 2026 10:08
#51 and #52 each stayed under the cap and together reached 701 lines on
main. The attempt rebuild carries contextTokens in one line.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Both of dev's defect verdicts in the Phase 4 window were a failing
`git diff --check` that the session reported done anyway. The host clone
now runs it over the imported range before it creates the ticket branch.
A failure adds a failed `import check` proof entry and blocks the card
with the command and output first, so the re-run session reads them and
fixes them with a new commit in the same node worktree.

A rework round checks only its own commits: the rework record gains
`startCommit`, the branch tip the round started from, so a reviewer's
commits or an "Update branch" merge of main never block the session.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A re-run claims the card while it still carries the pending handoff of
the failed import, and the handoff sweep fires on that claim. It then
imported the old head again: an import-check failure blocked the re-run
before its session could fix it, and a generic failure jumped to review
mid-start. A pending record older than the card's claim now belongs to
the start that replaces it.

The rework round's starting tip is checked as a commit id before it
reaches host git. The start queue tests move to their own file to keep
the handoff tests under the line cap.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@tomorrowflow
tomorrowflow marked this pull request as ready for review October 13, 2026 08:38
@tomorrowflow
tomorrowflow merged commit 848d903 into main Oct 13, 2026
1 check passed
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.

1 participant