Files
mac_without_borders/docs/loop.md
T
2026-09-16 02:38:11 -07:00

11 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 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.

Standing instruction from the user (2026-09-15/16): one lane at a time, directly on main in this repository — no worktrees, no lane branches; Dev commits as it goes and need not keep every commit compiling; QA reviews code quality and completeness of the port, not tests; nobody writes test suites — the user tests the app at the end.

0. Roles

role model owns never
Lead Fable 5.1 (this session) main, briefs, dispatch, inspection, merges, pushes, docs/topo.md writes lane code (bootstrap was the one exception); trusts a report it has not read against the diff
Dev Opus 5 one lane on main: the port, the README Work log, ticks in Status/TODO and TODO.md, small frequent commits pushes; touches files outside the brief; writes test suites; asks for permissions
QA Sonnet 5 the same tree after Dev: a code-quality and completeness review, the README QA log, a verdict redesigns; writes tests; edits beyond small unambiguous fixes it records

"Inspect" is the lead's review: the lead reads the diff with its own eyes and runs tools/gates.sh before writing the Review section.

1. Lifecycle of a lane (strictly serial)

  1. 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). Commit as brief: <name>.
  2. Note the start commit: git rev-parse HEAD — the lane's diff is everything after it. No branch, no worktree.
  3. Dispatch Dev (§3) in the repository. Dev commits to main as it goes and finishes when every Status/TODO item is ticked or explicitly deferred, and tools/gates.sh is green on the final commit.
  4. Dispatch QA (§4), same tree, diff = git diff <start>..HEAD. Verdict PASS or REWORK.
  5. 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 it.
  6. Inspect (§5). Write and commit the Review section. A defect found here goes back to step 3 as a rework with the review text as the finding.
  7. Close: run tools/gates.sh, update docs/topo.md for any edge the lane added or amended, tick the lane line in TODO.md, commit <name>: close lane, push.
  8. Log the lane in §8: dates, rework count, what the brief got wrong.
  9. Only now write the next brief.

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 earlier lanes' APIs it uses, by README reference.
  • Status / TODO: 4–8 checkbox items, each naming the file(s) it touches and the Windows behaviour it ports. 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 in the repository
/Users/guoliangchen/repo/mac_without_borders on main. Read, in order: CLAUDE.md,
README.md, docs/protocol.md, docs/contracts.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) and docs/protocol.md (append citations you verified, in your
lane's own subsection).

This is a port: read the Windows source at
/Users/guoliangchen/repo/PowerToys/src/modules/MouseWithoutBorders/App/
for every behaviour you implement and cite the line in a comment next
to each constant and each non-obvious rule. Port behaviour, not shape.

Do not write test suites — the user tests the app. Commit as you go with
small, clearly named commits; a commit need not compile. Do not push.
Rules that end a lane if broken: CLAUDE.md invariants 1–5; no file
outside the list — write a Handshake request in your README and stop
that item instead; never post input events or touch the real pasteboard.

Done means: every Status/TODO item ticked or marked "not done,
deliberately: <why>"; tools/gates.sh exits 0 on your last commit; the
Work log has a dated entry with decisions and deviations; any API change
is reflected in Handshakes. Report: what you ported, 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 the repository
/Users/guoliangchen/repo/mac_without_borders on main. Dev is finished.
Read CLAUDE.md, docs/protocol.md, docs/features/<name>/README.md (all
sections), then the diff: git diff <start commit>..HEAD.

You review code quality and completeness of the port. You do not write
tests and you do not redesign. In order: (1) run tools/gates.sh;
(2) for each Status/TODO tick, find the code that implements it and
compare against the Windows source at
/Users/guoliangchen/repo/PowerToys/src/modules/MouseWithoutBorders/App/
— a behaviour the Windows version has that the port silently lacks, or
a constant/offset/rule that differs from docs/protocol.md, is a finding
with both file:line references; (3) read every changed file top to
bottom for readability: CLAUDE.md size limits, layering, naming, force
unwraps, dead code, comments that cite nothing; (4) confirm nothing logs
key material and nothing acts on a packet before framing + decrypt.

You may fix only typos and trivially wrong comments, committing each
with a message starting `qa:` and noting it in the QA log. Everything
else is a finding: file:line, what the Windows source does, what the
port does. Write a dated QA log entry ending with `Verdict: PASS` or
`Verdict: REWORK` and the findings list. Commit the README. Report the
verdict and the findings.

5. Lead inspection checklist

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

  • tools/gates.sh green on the lane's last commit, run by me.
  • git diff <start>..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.
  • Completeness: walk the Windows feature's behaviours (the brief's Status/TODO plus the cited source) and confirm each is present or deliberately deferred with a reason.
  • Invariant 2: no code path acts on a packet before framing + decrypt succeed; no log line includes key, salt, IV or keystrokes.
  • Invariants 3–5 where the lane touches MWBMac.
  • Size limits; no !, try!, fatalError in Sources/.
  • Handshakes match the code's public API; changes are in the Work log.
  • Each QA finding is resolved in the Work log or deferred with a TODO line.

Write ## Review with the date, verdict (merge / rework), and what to carry into the next brief.

6. Lane order

Strictly one at a time, in this order (mirrors TODO.md):

# lane status
0 bootstrap merged 2026-09-15 (lead, solo)
1 wire-core merged 2026-09-16 (worktree; the last lane to use one)
2 session-matrix merged 2026-09-16 (one rework)
3 control-channel merged 2026-09-16 (two reworks)
4 input-capture merged 2026-09-16 (one rework)
5 input-inject in progress
6 app-shell CP1: first manual acceptance checkpoint (contracts C5)
7 clipboard CP2
8 extras CP3
9 polish driven by the checkpoints' findings

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).
  • Test the app at the checkpoints in docs/contracts.md C5 (after lanes 6, 7 and 8): the lead hands over dist/mwb.app and a short checklist; findings come back as TODO lines for the next lane.
  • Provide a Windows machine with PowerToys for real interop checks.

8. Lane log

  • 2026-09-16, lane 4 (input-capture) — Dev (Opus), QA (Sonnet) REWORK with four host-side findings (unguarded thread field, a lock taken on the local path, a wrong lock-count claim, switch-to-all swallow rule), Dev rework, lead inspection. What the brief got wrong: the modifier mask list omitted right Control (0x2000) — the dev caught it. Two in-lane bug fixes in the ring's coalescing.

  • 2026-09-16, lane 3 (control-channel) — Dev (Opus); QA (Sonnet) REWORK (Name2IP/DNS subnet flow, id collision gated to clients, Awake rule); Dev rework; QA round 2 REWORK (the Awake fix moved the comparison to a channel-global beat that no session shares); Dev rework 2 with an authorised one-method change in Session; lead inspected the second rework directly instead of a third QA round. What the brief got wrong: it put userActive on the channel's tick, which invited exactly the global-window bug. Lesson: a per-session rule belongs in Session, and briefs should say which side owns a comparison, not just the value.

  • 2026-09-16, lane 2 (session-matrix) — Dev (Opus), QA (Sonnet) REWORK with three findings (read-error budget, persist-on-learn, parkCursor gating); an external plan review the same day produced docs/contracts.md (C1 sequencing folded into the rework); Dev rework, QA PASS, lead merge. What the brief got wrong: it named Session.send per connection, contradicting Windows' one-Id broadcast; and it did not say who owns cross-module state — now C3.

  • 2026-09-16, lane 1 (wire-core) — Dev (Opus) one pass, QA (Sonnet) PASS with one doc typo fixed, lead merge. Brief held. Findings the dev surfaced for later lanes are in docs/protocol.md §10.1. Mid-lane the user ruled out worktrees; this procedure now runs on main.

  • 2026-09-15, lane 0 (bootstrap) — done by the lead alone at the user's request. swift-format is not on PATH; the gate calls it through xcrun. Later the same day the user set the standing instruction at the top of this file; loop rewritten to match.