Files
mac_without_borders/docs/loop.md
T
lucioandClaude Fable 5.1 671b3dfa61 bootstrap: SwiftPM skeleton, gates, bundler, and the lane procedure
Four targets (MWBCore, MWBNet, MWBMac, mwb) with a layering test that
keeps MWBCore free of AppKit/CoreGraphics/Network; tools/gates.sh as the
definition of done; tools/bundle.sh producing a signed dist/mwb.app;
tools/lane.sh for lane worktrees; smoke binary with --version and
--check-permissions. docs/loop.md records the Dev -> QA -> lead loop with
the literal dispatch prompts, the wave schedule and escalations.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-15 23:46:24 -07:00

9.0 KiB
Raw Blame History

loop.md — the Dev → QA → lead loop

Purpose. How a lane goes from a brief to a merged commit, who does what, and the literal prompts the lead dispatches. CLAUDE.md states the rules; this file is the procedure. The lead follows it verbatim so that every lane leaves the same trail: a feature README with Work log, QA log and Review filled in, ticked TODO lines, and a --no-ff merge.

0. Roles

role model owns never
Lead Fable 5.1 (this session) trunk (main), wave planning, briefs, dispatch, the self-inspect review, merges, commits, pushes, docs/topo.md writes lane code (bootstrap was the one exception); trusts a report it has not checked
Dev Opus one lane in one worktree: code, tests, README Work log, ticks in Status/TODO and TODO.md commits; touches files outside the brief's list; asks for permissions
QA Sonnet the same worktree after Dev: verification, attack tests, README QA log, a verdict redesigns; edits anything but tests, the QA log and small unambiguous fixes it records

"Self inspect" is the lead's review: the lead reads the diff with its own eyes and runs the gates itself before writing the Review section. A green QA verdict is evidence, not a decision.

1. Lifecycle of a lane

  1. Pick the wave. docs/topo.md §3 says which two lanes may run together. Anything not in that table runs alone.
  2. Write the brief on main: docs/features/<name>/README.md with Goal, Assumptions, Handshakes and a Status/TODO whose items name their files (template: docs/features/TEMPLATE.md). The file list is the merge contract. Commit as brief: <name>.
  3. Open the lane: tools/lane.sh new <name> → worktree at ../mwb-lanes/<name> on branch lane/<name>.
  4. Dispatch Dev with the prompt in §3, cwd = the worktree. Dev finishes only when tools/gates.sh is green in the worktree.
  5. Dispatch QA with the prompt in §4, same worktree. Verdict is PASS or REWORK with file:line findings.
  6. On REWORK, dispatch Dev again with the QA log as input. At most two rework rounds; a third means the brief was wrong — the lead rewrites the brief and restarts the lane.
  7. Self-inspect (§5). Write the Review section. If review finds a defect, it goes back to step 4 as a rework with the review text as the finding.
  8. Merge: on main, git merge --no-ff lane/<name>, run tools/gates.sh on the merged tree, update docs/topo.md for any edge the lane added or amended, tick the wave line in TODO.md, commit, push, tools/lane.sh done <name>, delete the branch.
  9. Log the wave in §8 of this file: dates, rework count, what the brief got wrong.

Two lanes in flight follow the same steps independently. Their merges are sequential; the second lane's merge re-runs gates on a trunk that already contains the first.

2. What a brief must contain

  • Goal: one paragraph, what and why, which docs/protocol.md sections it implements.
  • Assumptions: every judgement call the dev would otherwise have to make. If the lead cannot write this section, the lane is not ready.
  • Handshakes / Promised: the public API sketched in Swift, marked "may change during the lane; README updated in the same change".
  • Handshakes / Consumed: which other lanes' APIs it uses, by README reference, never by reading their source for undocumented behaviour.
  • Status / TODO: 4–8 checkbox items, each naming the file(s) it touches. The union of those files is the ownership list.
  • Citations: every fact from the Windows source as App/<path>.cs:<line>, matching docs/protocol.md.

3. Dev prompt (dispatch verbatim, fill the brackets)

You are the Dev for lane `<name>` of mwb-mac. Work only in this worktree:
<absolute worktree path> (branch lane/<name>). Read, in order: CLAUDE.md,
README.md, docs/protocol.md, docs/topo.md, docs/features/<name>/README.md.
The README's Status/TODO is your task list and its file list is the only
set of files you may create or edit, plus: docs/features/<name>/README.md
(Assumptions, Handshakes, Status/TODO, Work log), TODO.md (tick your own
lines only), docs/protocol.md (append citations you verified, in your
lane's own subsection), docs/perf/README.md (append measurements).

Rules that end a lane if broken: CLAUDE.md invariants 1–5; no git commit;
no file outside the list — write a Handshake request in your README and
stop that item instead; every test run through tools/guard.sh; never set
MWB_ALLOW_INPUT_TESTS.

Done means: every Status/TODO item ticked or explicitly marked "not done,
deliberately: <why>"; tools/gates.sh exits 0 in this worktree; the Work
log has a dated entry with decisions and deviations; any API change is
reflected in Handshakes. Report: what you built, what you deviated from,
open handshake requests, and the gates.sh tail.

4. QA prompt (dispatch verbatim)

You are QA for lane `<name>` of mwb-mac, in worktree <absolute path>
(branch lane/<name>). Dev is finished. Read CLAUDE.md, docs/protocol.md,
docs/features/<name>/README.md (all sections), then the diff:
git diff main...HEAD.

Verify, do not redesign. In order: (1) run tools/gates.sh yourself;
(2) check each Status/TODO tick against the code and tests — a tick with
no test is a finding; (3) check every protocol claim in the code against
docs/protocol.md and, where cited, the Windows source at
/Users/guoliangchen/repo/PowerToys/src/modules/MouseWithoutBorders/App/
— a mismatch is a finding with both file:line references; (4) try to
break it: malformed bytes, boundary sizes, wrong key, empty/oversized
input, concurrency where the API is Sendable; add the attack as a test in
the lane's test files; (5) check CLAUDE.md file/function size limits and
the layering test; (6) confirm nothing logs key material.

You may fix only typos and missing assertions, and must note each fix in
the QA log. Everything else is a finding: file:line, reproduction, and
what you expected. Write a dated QA log entry ending with a verdict line
`Verdict: PASS` or `Verdict: REWORK` and the findings list. Never set
MWB_ALLOW_INPUT_TESTS; every test run goes through tools/guard.sh.
Report the verdict and the findings.

5. Lead self-inspect checklist

Run in the worktree, by the lead, before writing Review:

  • tools/gates.sh green, run by me.
  • git diff main...HEAD --stat: only files in the brief's list (plus the shared-by-nature files, in the lane's own sections).
  • Read the whole diff. Every protocol constant traces to a docs/protocol.md line; every offset matches §1.1.
  • Invariant 1: golden bytes come from a fixture or a hand assembly in the test, never from the encoder under test.
  • Invariant 2: no code path acts on a packet before framing + decrypt succeed; no print/Logger call includes key, salt, IV or keystrokes.
  • Invariants 3–5 where the lane touches MWBMac.
  • File sizes under 600 production lines; functions under 50 unless commented; no !, try!, fatalError in Sources/.
  • Handshakes section matches the code's public API; any change is also in the Work log.
  • The QA log's findings are each resolved in the Work log or explicitly deferred with a TODO line.
  • TODO.md ticks are only this lane's lines.

Write ## Review with the date, verdict (merge / rework), and what to carry into the next brief. The Review section is the only place the lead writes in a lane's README.

6. Wave schedule

wave lanes gate to start status
0 bootstrap — merged 2026-09-15 (lead, solo)
1 packet-codec ‖ cipher-stream wave 0 merged briefs written; not dispatched
2 session ‖ matrix-edge wave 1 merged briefs to write
3 control-channel ‖ event-tap wave 2 merged briefs to write
4 input-inject ‖ screens-cursor wave 3 merged; screens-cursor README published first (topo handshake 6)
5 clipboard-inband ‖ menubar-app wave 4 merged
6 clipboard-bulk ‖ interop-vectors wave 5 merged; interop-vectors needs a Windows machine (§7)
7 end-to-end, then soak wave 6 merged; needs real devices and MWB_ALLOW_INPUT_TESTS=1 with the user present

7. Escalations — things only the user can do

  • Grant permissions (Accessibility, Input Monitoring) to dist/mwb.app in System Settings, and create the self-signed MWB_SIGN_IDENTITY once (tools/bundle.sh header).
  • Provide a Windows machine with PowerToys for interop-vectors (or a packet capture of a Windows↔Windows session plus its key).
  • Be present for any run with MWB_ALLOW_INPUT_TESTS=1; the lead says so in the report before dispatching such a step.
  • Approve pushes of anything beyond the merge of a reviewed lane.

8. Wave log

  • 2026-09-15, wave 0 (bootstrap) — done by the lead alone at the user's request. No Dev/QA round. What the brief got wrong: nothing yet; the toolchain assumption (Xcode required) held. swift-format is not on PATH — the gate calls it through xcrun.