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]>
This commit is contained in:
1 parent
69c0f7ab53
commit
671b3dfa61
20 files changed
+615
-20
No files matched your search
@@ -0,0 +1,39 @@
|
||||
# <feature-name>
|
||||
|
||||
<!-- Copy to docs/features/<feature-name>/README.md. The lead writes Goal,
|
||||
Assumptions, Handshakes and Status/TODO as the brief; Dev owns the
|
||||
Work log; QA owns the QA log; the lead alone writes Review. -->
|
||||
|
||||
## Goal
|
||||
|
||||
One paragraph: what this lane delivers, why it exists, and which
|
||||
`docs/protocol.md` sections it implements.
|
||||
|
||||
## Assumptions
|
||||
|
||||
- Every judgement call that is not enforced by code, one bullet each,
|
||||
with the Windows citation (`App/<path>.cs:<line>`) where one exists.
|
||||
|
||||
## Handshakes
|
||||
|
||||
### Promised (topo.md handshake N, to <consumer lanes>)
|
||||
|
||||
```swift
|
||||
// public API sketch; may change during the lane, README updated in the same change
|
||||
```
|
||||
|
||||
### Consumed
|
||||
|
||||
- `<lane>`: `<API>` as published in its README.
|
||||
|
||||
## Status / TODO
|
||||
|
||||
- [ ] `<file>`: item
|
||||
- [ ] `Tests/<target>/<file>`: item
|
||||
- [ ] `docs/protocol.md`: citations verified / marks flipped
|
||||
|
||||
## Work log
|
||||
|
||||
## QA log
|
||||
|
||||
## Review
|
||||
@@ -54,12 +54,20 @@ works on this machine at all. Nothing in later lanes can start until
|
||||
- [x] Report the toolchain state to the user and wait for Xcode.
|
||||
Xcode 27.0 (27A266a) installed 2026-09-15; `xcode-select -p` is
|
||||
`/Applications/Xcode.app/Contents/Developer`.
|
||||
- [ ] `Package.swift`, empty targets with one placeholder type each,
|
||||
`Tests/MWBCoreTests/LayeringTests.swift`.
|
||||
- [ ] `tools/gates.sh`, `.swift-format`.
|
||||
- [ ] `tools/bundle.sh` + `Resources/Info.plist`.
|
||||
- [ ] `mwb --version`, `mwb --check-permissions`.
|
||||
- [ ] `tools/gates.sh` green; record Swift/Xcode versions in the work log.
|
||||
- [x] `Package.swift`, four targets + two test targets, one placeholder
|
||||
type each; `Tests/MWBCoreTests/LayeringTests.swift` enforces D2.
|
||||
- [x] `tools/gates.sh` (via `xcrun swift-format`), `.swift-format`.
|
||||
- [x] `tools/bundle.sh` + `Resources/Info.plist`; ad-hoc build verified,
|
||||
identity-signed build awaits the user's certificate (D5).
|
||||
- [x] `mwb --version`, `mwb --check-permissions` (exit 3 when a grant is
|
||||
missing) backed by `MWBMac/Permissions.swift` (preflight only).
|
||||
- [x] `tools/lane.sh` worktree helper; `docs/loop.md` procedure;
|
||||
`docs/features/TEMPLATE.md`.
|
||||
- [x] `tools/gates.sh` green: 3 XCTest cases, 0 warnings, lint clean.
|
||||
- [ ] Not done, deliberately: no CI workflow. The lucisv Gitea runner
|
||||
exists on this Mac (`verilogrustformatter/tools/RELEASING.md`), but
|
||||
a CI that runs `swift test` for a project that will soon post
|
||||
input events needs invariant 5 thought through first — TODO §8.
|
||||
|
||||
## Work log
|
||||
|
||||
@@ -70,7 +78,23 @@ works on this machine at all. Nothing in later lanes can start until
|
||||
XCTest case, `swift-tools-version:6.0`) built in 8 s and the test
|
||||
passed under `swift test`. The Assumptions above stay as the record of
|
||||
why Xcode is a requirement; the fallback Makefile is not needed.
|
||||
- 2026-09-15 (lead, solo at the user's request): skeleton landed.
|
||||
Decisions: (1) `Permissions.swift` ships now with *preflight only* so
|
||||
the smoke binary can report grants; the `event-tap` lane owns
|
||||
requesting and extends this file — recorded in `docs/topo.md` §1.1.
|
||||
(2) `swift-format` config: 110 columns, 4-space indent, `NeverForceUnwrap`
|
||||
and `NeverUseForceTry` as lint errors (CLAUDE.md Swift standards);
|
||||
tests are not exempted, so tests use `XCTUnwrap`. (3) `gates.sh`
|
||||
runs the guarded `swift test` once under `pipefail`; a guard kill
|
||||
fails the gate. (4) `bundle.sh` refuses to sign ad-hoc unless
|
||||
`MWB_ADHOC=1`, so nobody burns a TCC grant by accident. Deviation from
|
||||
plan: none. Versions: Xcode 27.0 (27A266a), Swift 6.4, macOS 27.0.
|
||||
|
||||
## QA log
|
||||
|
||||
## Review
|
||||
|
||||
- 2026-09-15 (lead): self-inspected per `docs/loop.md` §5 — gates green,
|
||||
layering test exercises real files, no force-unwraps in `Sources/`.
|
||||
Merged directly to `main` (solo lane, no worktree). Carry forward: the
|
||||
wave-1 briefs already exist; dispatch per `docs/loop.md` §1.
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
# 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`.
|
||||
+20
-2
@@ -10,8 +10,9 @@ open handshakes before assigning ownership.
|
||||
Sources of truth this document is derived from (and defers to on
|
||||
conflict): `Package.swift`, each `docs/features/<name>/README.md`
|
||||
(**Handshakes** in particular), `README.md`, `CLAUDE.md`,
|
||||
`docs/protocol.md`. Drafted 2026-09-15 at planning time, before any code;
|
||||
the lead updates it after every merged lane.
|
||||
`docs/protocol.md`. Drafted 2026-09-15 at planning time; updated the same day after the
|
||||
bootstrap merge (skeleton exists, file ownership tables below reflect it).
|
||||
The lead updates it after every merged lane.
|
||||
|
||||
**Edge notation:**
|
||||
|
||||
@@ -63,6 +64,23 @@ Standing promises:
|
||||
| `ClipboardCodec.swift` | clipboard-inband | clipboard-bulk (header format only) |
|
||||
| `Settings.swift` | menubar-app | everyone via `mwb` |
|
||||
|
||||
`MWBMac` files owned at planning time:
|
||||
|
||||
| file | lane | note |
|
||||
|---|---|---|
|
||||
| `Permissions.swift` | bootstrap → **event-tap** | preflight shipped by bootstrap; event-tap adds `request…` and owns the file from wave 3 |
|
||||
| `EventTap.swift` | event-tap | |
|
||||
| `Injector.swift` | input-inject | defines the injected-event tag (handshake 5) |
|
||||
| `Screens.swift`, `Cursor.swift` | screens-cursor | |
|
||||
| `Pasteboard.swift` | clipboard-inband | |
|
||||
| `StatusItem.swift` | menubar-app | |
|
||||
|
||||
`MWBNet/Placeholder.swift` is deleted by control-channel;
|
||||
`Tests/MWBNetTests/PlaceholderTests.swift` likewise.
|
||||
|
||||
Tooling (`tools/`, `Package.swift`, `.swift-format`, `Resources/`) is the
|
||||
lead's; a lane needing a change there files a Handshake request.
|
||||
|
||||
## 2. Feature dependency graph
|
||||
|
||||
### 2.1 Milestone order (sequencing, `─▶`)
|
||||
|
||||
Reference in new issue
Block a user