diff --git a/README.md b/README.md index 93aab22..efb8db5 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,11 @@ ``` > [!NOTE] -> ๐ŸŽ‰ **devbox v1 is feature-complete.** All milestones M0โ€“M7 are built and -> **fleet-verified on real hardware** (two Macs live-syncing through a hub on a NAS). -> The [spec](docs/superpowers/specs/2026-06-22-devbox-design.md) is fully implemented; -> every command below is wired up and tested. Star/watch and follow along. โญ +> ๐ŸŽ‰ **devbox v1 is feature-complete** (M0โ€“M7.6, **fleet-verified on real hardware** โ€” +> Macs + arm64 Pis live-syncing through a hub on a NAS) **and v2 has begun.** ๐Ÿ”ฎ +> The [v1 spec](docs/superpowers/specs/2026-06-22-devbox-design.md) is fully implemented; +> the [v2 spec](docs/V2-SPEC.md) sequences M8โ†’M11 โ€” **M8 foundations are landing now.** +> Star/watch and follow along. โญ > > | Milestone | Status | > |---|---| @@ -48,6 +49,7 @@ > | M7 โ€” Hardening: `devbox doctor`, reconnect/backoff, rescan fallback, name-clash, release builds | โœ… done โ€” **doctor/stop/hooks + share-name guard + dead-watcher rescan fleet-verified** ๐Ÿ›ก๏ธ | > | M7.5 โ€” Adversarial security/data-loss audit + fixes (path-traversal, blob integrity, never-clobber, safe GC) | โœ… done โ€” **26 findings, all promise-breakers fixed, race-clean** ๐Ÿ” | > | M7.6 โ€” Hardening: fsync durability ยท DoS caps + timeouts ยท pidfile PID-reuse guard ยท join proof-of-possession | โœ… done โ€” fleet-verified on arm64 ๐Ÿ›ก๏ธ | +> | ๐Ÿ”ฎ **M8 โ€” v2 Foundations**: schema migration runner ยท per-`(share,id)` snapshots ยท daemon control socket + `pause`/`resume` | ๐Ÿ”จ in progress โ€” **migration runner + control socket shipped; verified on a copy of the real hub DB** ๐Ÿ—๏ธ | --- @@ -326,7 +328,8 @@ container automatically. ๐Ÿช„ | `devbox ignore ` | ๐Ÿ™ˆ Append a pattern to `./.devignore` | | `devbox hook edit ` | ๐Ÿช Scaffold/open a hook in `$EDITOR`; `hook list ` shows installed | | `devbox doctor` | ๐Ÿฉบ Diagnose watcher limits, perms, bash, hub connectivity + bearer | -| `devbox pause` / `resume` / `peers` | โธ๏ธ๐ŸŒ *Planned โ€” need daemon IPC / a hub peers endpoint* | +| `devbox pause` / `resume` | โธ๏ธโ–ถ๏ธ Suspend/resume the running daemon's syncing via its control socket (M8) | +| `devbox peers` | ๐ŸŒ *Planned โ€” needs a hub peers endpoint (M10)* | @@ -498,27 +501,24 @@ flowchart LR > ๐Ÿ”ฎ **Looking ahead:** the full **[v2 design spec](docs/V2-SPEC.md)** โ€” multi-owner teams + ACLs, > client-side E2E encryption (convergent, keeps dedup), LAN peer chunk-exchange + hub HA, 3-way merge, -> and a TUI โ€” sequenced M8โ†’M11 by dependency. (Captured, not committed: only M8 foundations is justified today.) +> and a TUI โ€” sequenced M8โ†’M11 by dependency. **M8 foundations are landing now**; M9โ€“M11 stay +> demand-driven (build E2E when an untrusted-hub user exists, P2P when the uplink hurts, the TUI when asked). ```mermaid flowchart LR - M0["M0 ๐Ÿฆด\nSkeleton"] --> M1["M1 ๐Ÿ‘€\nWatch + ignore\n+ secrets"] - M1 --> M2["M2 ๐Ÿ›ฐ๏ธ\nHub + push\n+ /metrics"] - M2 --> M3["M3 ๐Ÿ”„\nTwo-way sync\n+ conflicts"] - M3 --> M4["M4 ๐Ÿ”’\nRead-only\n+ bandwidth"] - M4 --> M5["M5 ๐Ÿช\nHooks"] - M5 --> M6["M6 ๐Ÿ•ฐ๏ธ\nVersioning"] - M6 --> M65["M6.5 ๐Ÿšข\nDeploy"] - M65 --> M7["M7 ๐Ÿ›ก๏ธ\nHardening"] - style M0 fill:#1e5a2e,stroke:#51cf66,color:#fff - style M1 fill:#1e5a2e,stroke:#51cf66,color:#fff - style M2 fill:#1e5a2e,stroke:#51cf66,color:#fff - style M3 fill:#1e5a2e,stroke:#51cf66,color:#fff - style M4 fill:#1e5a2e,stroke:#51cf66,color:#fff - style M5 fill:#1e5a2e,stroke:#51cf66,color:#fff + M6["M6 ๐Ÿ•ฐ๏ธ\nVersioning"] --> M65["M6.5 ๐Ÿšข\nDeploy"] + M65 --> M7["M7 ๐Ÿ›ก๏ธ\nHardening\n+ M7.5/7.6 audit"] + M7 --> M8["M8 ๐Ÿ—๏ธ\nv2 Foundations\nmigration ยท control socket"] + M8 --> M9["M9 ๐Ÿ”\nTrust + HA\nACL ยท E2E ยท S3"] + M9 --> M10["M10 ๐Ÿค\nCluster + merge\nP2P ยท resolver"] + M10 --> M11["M11 โœจ\nPolish\nTUI ยท power"] style M6 fill:#1e5a2e,stroke:#51cf66,color:#fff style M65 fill:#1e5a2e,stroke:#51cf66,color:#fff style M7 fill:#1e5a2e,stroke:#51cf66,color:#fff + style M8 fill:#5a4a1e,stroke:#ffd43b,color:#fff + style M9 fill:#0d1117,stroke:#4F9CF9,color:#fff + style M10 fill:#0d1117,stroke:#4F9CF9,color:#fff + style M11 fill:#0d1117,stroke:#4F9CF9,color:#fff ``` | | Milestone | Deliverable | @@ -534,15 +534,17 @@ flowchart LR | โœ… | **M7 โ€” Hardening** ๐Ÿ›ก๏ธ | `devbox doctor`, `stop`/pidfile, `hook edit/list`, SSE backoff+jitter, **60s rescan fallback** (survives dead/limited inotify watchers โ€” PRD risk #1), share-name guard, release builds โ€” fleet-verified | | โœ… | **M7.5 โ€” Audit hardening** ๐Ÿ” | adversarial security/data-loss audit + fixes: blob-hash **path-traversal** blocked, **download blob-integrity** check, manifest-path **containment**, secret-guard **case-insensitive** + more patterns, **never-clobber** ignored/guarded files, **GC made safe** vs cross-share refcount undercount โ€” all with regression tests, race-clean, fleet-verified | | โœ… | **M7.6 โ€” Hardening complete** ๐Ÿ›ก๏ธ | ๐Ÿ’ฝ **fsync durability** on atomic writes (power-loss safe), ๐Ÿšช **request size caps + server timeouts** (DoS), ๐Ÿ†” **pidfile PID-reuse guard** (start-time token), ๐Ÿชช **join proof-of-possession** (ed25519 signature, token not burned on a bad request) โ€” fanned out to parallel worktree agents, regression-tested, race-clean, fleet-verified | +| ๐Ÿ”จ | **M8 โ€” v2 Foundations** ๐Ÿ—๏ธ | ๐Ÿ”‘ **schema migration runner** (`PRAGMA user_version`, transactional, `VACUUM INTO` backup, refuses a newer DB) ยท ๐Ÿ”ข **per-`(share,id)` snapshots** (fixes the cross-share refcount undercount; GC + head-backfill reworked) โ€” **verified on a copy of the real `.10` hub DB** (13 dev / 12 share / 16 chunk preserved, 3 legacy heads repaired) ยท ๐ŸŽ›๏ธ **daemon control socket** (`internal/control`, Unix socket, HTTP/1.1, `0600`) wiring `devbox pause`/`resume` + live-socket-aware `status`. **Next in M8:** conflict sidecar + `restore`/`deploy` conflict-copy (M8-3), principals/roles/invites (M8a) |
-๐Ÿ”ฎ genuinely v2 (would change the single-owner model) +๐Ÿ”ฎ still ahead in M8 / genuinely v2 -Everything that protects data or the box is done. What's left only matters under a **different threat model** and is intentionally not in v1: +Landed in M8 above: the migration runner, per-`(share,id)` snapshots, and the control socket. Still sequenced ahead: -- ๐Ÿ”‘ **Read-side ACL + deny-by-default writes** โ€” only meaningful once shares span *multiple owners* (v2 teams); in v1 every enrolled device is yours, so a restrictive ACL would just break multi-device sync. -- ๐Ÿ”ข **Per-`(share,id)` snapshot refcounts** โ€” purely cosmetic now: the GC is ground-truth-safe regardless, and the collision only *under*-counts (never a leak or loss). Not worth a live-hub schema migration. -- ๐Ÿ“ **Conflict-copy on explicit `restore`/`deploy`** โ€” `restore` is a deliberate "go back" where overwriting is the intent; preserving every uncommitted edit as a `.conflict` is a v2 UX call. +- ๐Ÿ“ **Conflict-copy on explicit `restore`/`deploy`** *(M8-3)* โ€” needs base/ancestor awareness so it preserves only *uncommitted* edits without breaking restore-reproduces-snapshot; rides the conflict **sidecar**. +- ๐Ÿ‘ฅ **Principals / roles / invites + write enforcement** *(M8a)* โ€” the membership layer E2E + P2P both need underneath them. +- ๐Ÿ”‘ **Read-side ACL + deny-by-default writes** *(M9)* โ€” only meaningful once shares span *multiple owners*; the genuinely new attack surface, staged after write-side. +- ๐Ÿ”ข **`snapshot_chunks` edge table** *(M9)* โ€” a derived-refcount source for E2E/P2P; deferred until a consumer exists (the migration runner makes adding it a one-liner).
diff --git a/docs/V2-SPEC.md b/docs/V2-SPEC.md index bc67800..3f3ec84 100644 --- a/docs/V2-SPEC.md +++ b/docs/V2-SPEC.md @@ -4,13 +4,15 @@ **From a single-owner sync tool โ†’ trusted, multi-person sync at cluster scale โ€” still 100% self-hostable.** -![status](https://img.shields.io/badge/status-%F0%9F%93%90%20spec%20%C2%B7%20planning-blueviolet?style=for-the-badge) +![status](https://img.shields.io/badge/status-%F0%9F%8F%97%EF%B8%8F%20M8%20building-ffd43b?style=for-the-badge) ![base](https://img.shields.io/badge/builds_on-v1%20(M0%E2%80%93M7.6)-00ADD8?style=for-the-badge) -> ๐Ÿ“‹ This is a **design spec**, not shipped code. v1 (M0โ€“M7.6) is complete, audited, and hardened. -> v2 is the next arc. Nothing here changes the v1 build until a milestone is planned and executed. +> ๐Ÿ“‹ This is the v2 **design spec**. v1 (M0โ€“M7.6) is complete, audited, and hardened; **M8 +> foundations are now landing on `main`** (see the โœ… marks in ยง5 and the roadmap). M9โ€“M11 stay +> captured-not-committed โ€” demand-driven, built when a real user needs them. Every v2 change is +> additive: the v1 CLI + hook contract is sacred. --- @@ -99,6 +101,14 @@ mental model ("Dropbox you host") intact while unlocking scale and privacy. ### 5.1 ๐Ÿ—๏ธ Data-model cleanup  ยท  effort: M  ยท  **M8 (lands first)** +> โœ… **Shipped (M8):** the `PRAGMA user_version` migration runner (transactional, `VACUUM INTO` +> backup, refuses a newer DB) and the per-`(share,id)` snapshots re-key (fixing the undercount, with +> a head-backfill + reworked GC). **Verified on a copy of the live `.10` hub DB** โ€” 13 dev / 12 share / +> 16 chunk preserved, `user_version 0โ†’1`, 3 legacy cross-share heads repaired. `snapshot_chunks` is +> **deferred to M9** (no consumer yet; the runner makes adding it a one-line migration), and `chunks.refcount` +> stays the maintained ground truth until then. `restore`/`deploy` conflict-copy moves to **M8-3** (it +> needs the sidecar's base/ancestor awareness โ€” a naive version breaks restore-reproduces-snapshot). + **The bug (verified):** `server.go:300` sets `snapshotID := req.ManifestHash`, and `snapshots.id` is a **global** PK (`meta.go`). When two shares hold identical content their snapshot ids collide; `AddSnapshot` hits the idempotent branch and **skips the chunk-refcount loop**, so `chunks.refcount` @@ -216,11 +226,13 @@ records nothing about the merge that made it. ### 5.6 โœจ Client UX: TUI + power  ยท  effort: L  ยท  **M8 socket / M11 TUI+power** -- **M8 โ€” the load-bearing primitive: a daemon control socket** (`internal/control`). v1's daemon - exposes nothing; `status`/`conflicts` only read disk and can't see the *running* daemon. Add a - Unix socket (Windows named pipe), **HTTP/1.1 over it** (Docker's pattern โ€” routing + JSON for free), - `0600`: `GET /state`, `GET /events` (SSE), `POST /pause|/resume`. This finally wires the - long-promised `devbox pause/resume` to the daemon and feeds everything below. +- **M8 โ€” the load-bearing primitive: a daemon control socket** (`internal/control`). โœ… **Shipped:** + Unix socket, **HTTP/1.1 over it** (Docker's pattern โ€” routing + JSON for free), `0600`, with + `GET /state` + `POST /pause`/`/resume` wiring the long-promised `devbox pause`/`resume` and a + live-socket-aware `devbox status`. Windows is a stub (the fleet is mac/Linux). **`GET /events` (SSE) + was deliberately *not* built** โ€” it only feeds the M11 TUI, which doesn't exist yet (ponytail: a + producer with no consumer; re-add the fan-out broker when the TUI lands). This finally lets the CLI + see the *running* daemon, not just disk. - **M11 โ€” TUI** (`bubbletea`, Elm-architecture so `Update` never blocks): `devbox` with **no args** launches a live dashboard on a TTY (mounts, sync state, peers, conflicts, throughput) โ€” and still prints plain status when piped, so scripts are unaffected. @@ -256,7 +268,7 @@ flowchart LR | Milestone | Ships | Gated by | |---|---|---| -| ๐Ÿ—๏ธ **M8 โ€” Foundations** | per-`(share,id)` refcounts + `snapshot_chunks` + migration runner ยท principals/roles/invites/delegation + **write** enforcement ยท conflict sidecar + `Entry.Binary` + pin ยท daemon **control socket** + real `pause/resume` ยท conflict-copy on `restore`/`deploy` | โ€” | +| ๐Ÿ—๏ธ **M8 โ€” Foundations** ๐Ÿ”จ | โœ… migration runner (`PRAGMA user_version`) ยท โœ… per-`(share,id)` snapshots + reworked GC (refcount undercount fixed; verified on a copy of the real hub DB) ยท โœ… daemon **control socket** + real `pause`/`resume` ยท โฌœ principals/roles/invites + **write** enforcement (M8a) ยท โฌœ conflict sidecar + `Entry.Binary` + pin + conflict-copy on `restore`/`deploy` (M8-3) ยท โฌœ `snapshot_chunks` edge table (deferred to M9 โ€” no consumer yet) | โ€” | | ๐Ÿ” **M9 โ€” Trust & durability** | **read-side ACL** (deny-by-default) ยท **E2E** per-share keyed-convergent encryption ยท **S3/R2** blob backend + **Litestream** HA | M8 (membership, migration runner, refcounts) | | ๐Ÿค **M10 โ€” Cluster & merge** | **LAN peer chunk-exchange** (P2P, hub-authoritative) ยท **interactive conflict resolver** + **diff3 3-way text merge** | M8 sidecar ยท M9 convergent-encryption co-design | | โœจ **M11 โ€” Polish** | **full TUI** dashboard ยท **power** sanity (battery/metered/windows) ยท groups ยท packfile batching | M8 control socket |