- Hub emits 3 new flow events: pull (head fetch/propagation, handleHead), conflict
(stale-parent push, handlePush), gc (in-process sweep). Opt-in periodic GC via
'serve --gc-every <dur>' (default off) self-maintains the hub AND animates each
sweep; runGC stays put (no risky refactor of mark-and-sweep).
- Server-side history ring: per-minute activity buckets (push/pull/conflict/gc +
bytes), last 60 min, in /api/state — the sparkline now survives a page reload
(was computed from the live stream only). Recorded under the Emit lock; race-clean.
- Frontend (index.html): pull = teal inbound pulse, conflict = red collision burst,
gc = amber hub sweep + toast; stacked per-minute history sparkline seeded from
/api/state and growing live. One file, no new deps.
- dashboard-fleet-verify.sh: rewritten — drives join·push·pull·conflict·gc and
asserts all 5 on the SSE stream + the history window; adds LOCAL=1 mode (native,
no Pi). Verified locally end-to-end. Tests: TestHistoryRing. go test ./... -race clean.
P2 adversarial audit (6 finders + skeptic verification, 13 agents). Two real
findings fixed with regression tests; rest documented as single-owner residuals.
- FIX (+s attenuation): MayGrant never constrained the GRANTED reshare bit, so an
invite could confer +s the caller didn't hold (req.Reshare copied verbatim).
MayGrant now takes grantReshare and rejects conferring +s you don't hold (owners
unconstrained) — attenuation is total over role + target + reshare.
- FIX (invite revocation): invites were unrevocable 24h bearer capabilities — no
way to kill a leaked/regretted one. Added meta.RevokeInvite (token+binding in one
tx), POST /v1/invite/revoke (only a caller who could mint it may revoke), and
'devbox invite revoke <token>'.
- Tests: TestMayGrant (+5 +s cases), TestInviteCannotGrantReshareCallerLacks,
TestInviteRevoke. go test ./... -race clean (18 pkgs).
- docs/M8a-audit.md: findings, confirmed defenses, accepted residuals.
Confirmed-defended under attack: single-use redeem (atomic CAS), role bounding,
revoke-at-auth (revoked=0 in bearer+role lookups), cross-share binding, PoP.
- LICENSE: replace the placeholder with canonical GNU AGPLv3 — the README's
open-core model (hosted tier = commercial) needs copyleft, not MIT. Fixes the
earlier commit that mislabeled it MIT.
- plan.md: P1 row -> ✅ SHIPPED with the real outcome (arm64 targets, release.sh,
CI, hub image, public devbox-dist, public GitHub mirror, two-method secret scan).
Next pointer -> P2 (M8a auth audit). Badges: release live + public.
- README: status -> 'v2 P1 shipped · public', + release badge, install badge notes
'go install'.
- LICENSE: MIT (enables the adoption push; public repo was all-rights-reserved).
- go.mod + all imports: git.shoemoney.ai/shoemoney/devbox -> github.com/shoemoney/devbox,
so outsiders can 'go install github.com/shoemoney/devbox/cmd/devbox@latest'. Forgejo
stays the self-hosted home; the registry (devbox-hub) + public dist (devbox-dist) are
unchanged. vet + build + go test -race all green after the rename.
- README: document the go install path.
Security: full git-history scan (manual blob sweep + gitleaks, 84 commits) found
ZERO secrets — Forgejo token never committed, no keys/passwords/private keys.
Private code stays private; the public shoemoney/devbox-dist repo carries only the
install scripts + release binaries as release assets, so a clean Pi/box can:
curl -fsSL .../devbox-dist/releases/download/latest/install.sh | sh
with no auth. release.sh now targets devbox-dist (tags hang off its branch),
uploads install.sh/install.ps1 alongside the binaries, and rewrites SHA256SUMS to
the de-versioned asset names so shasum -c matches. install.sh/install.ps1/README
point at the new public URLs.
- build-release.sh: add linux/arm64 (Raspberry Pi!) + linux/arm targets — the
curl|sh install on a clean Pi needs a real arm64 asset to download.
- scripts/release.sh: one-shot local release. Cross-compiles, then creates/updates
the Forgejo release and uploads de-versioned assets (devbox_<os>_<arch>) that
install.sh fetches directly. No CI runner required.
- .forgejo + .github CI workflows: go vet + build + test -race on push/PR;
on vX.Y.Z tag, build-release + publish. GitHub's runs on hosted runners today.
- docker-compose: pull the published hub image by default; --build for local source.
The image runs as uid 10001; the VOLUME /data was root-owned so sqlite/blob
writes failed and the container exited on boot. Create + chown /data to the
devbox user before VOLUME/USER (a named volume inherits the image dir's
ownership). Verified on real arm64 docker (.13): builds, runs non-root, serves
/metrics + dashboard /api/state, 31.9MB. Also made install.sh's service setup
non-fatal (a failing systemctl --user / launchctl over headless SSH warns +
continues instead of aborting the whole install) — fleet-verified: systemd
user service enabled w/ Restart=always, NRestarts proved self-heal.
Maximum-easy adoption:
- install.sh (macOS+Linux): curl|sh friendly. Detects OS/arch, resolves the
binary (env → local dist/ → download → go-build fallback), lets you pick the
install dir (smart default + prompt on a TTY), and optionally sets up a
KEEP-ALIVE auto-restart service — launchd KeepAlive (mac) / systemd
Restart=always user unit (linux). Flags + env for non-interactive use.
- install.ps1 (Windows): copy exe + user PATH + optional restart-on-failure
Scheduled Task at logon.
- Hub Docker: Dockerfile (multi-stage, static CGO-free, alpine, healthcheck-
ready) + docker-compose.yml (restart: unless-stopped = self-heal, named
volume, dashboard-ready, optional autoheal profile for unhealthy-restart) +
.dockerignore — drop-in for TrueNAS/Synology/unRAID.
- macOS Full Disk Access: 'devbox doctor' now tests the ACTUAL protected mount
paths (~/Desktop, ~/Documents, ~/Downloads, iCloud) and flags any it can't
read, with the exact System Settings fix + a deep link; install.sh points to
it on mac. Windows install.ps1 notes Controlled Folder Access (off by default).
(TCC.db probe was unreliable across macOS versions — testing the real mounts
is honest + version-proof.) shellcheck-clean; 18 pkgs -race green; win+mac build.
Single self-contained index.html (vanilla JS + canvas, zero deps/CDN,
go:embed'd, air-gap safe). Cyberpunk net-ops aesthetic: a breathing glowing
hub core with counter-rotating rings, device nodes orbiting (online bright /
idle dim), magenta share nodes; on a push a trailed particle streams
device→core→share then a fan-out ripple to subscribers, joins burst in.
7 glassmorphism metric tiles with hand-drawn canvas sparklines + eased
counters; an auto-scrolling color-coded activity stream (capped 50); SSE
auto-reconnect with a live/reconnecting indicator; ?demo=1 synthesizes a
stream for the wow-factor and offline preview. Built by a worktree subagent
(frontend-design), screenshot-verified against the REAL hub backend — live
/api/state + /api/events both drive it (see docs/images/dashboard.png).
Added a 📦 data-URI favicon (kills the only console 404).
Proves the dashboard SSE flow stream end-to-end on an isolated arm64 hub:
captures /api/events, then a device join + publish produce live 'join' and
'push' flow events on the stream. Green on .13: join(ubuntu) + push(team,
1 chunk, 15B, new_head) both streamed. Self-cleans; never touches the live .10.
Optional, off by default: devbox-hub serve --dashboard [--dashboard-addr
127.0.0.1:8099]. A separate, loopback-by-default listener (never widens the
API surface; warns if bound non-loopback since it's unauthenticated read-only).
- internal/hub/dashboard: embedded UI (go:embed index.html) + GET /api/state
(hub/totals/devices/shares snapshot) + GET /api/events (SSE live flow stream).
A nil *Dashboard is Emit-safe so hub handlers call it unconditionally.
- meta reads for the snapshot: Devices(), ShareStats() (one rolled-up query),
SumChunkBytes(). 'online' is activity-tracked since hub start (2-min window).
- hub emits 'join' (device enrolled) and 'push' (device→share, bytes/chunks/
snapshot/new_head) flow events.
Tests: state reflects the DB + a push event reaches a live SSE subscriber +
nil-safe Emit. index.html here is a placeholder — the epic frontend lands next.
Bare 'devbox' on a fresh, unjoined machine offers a step-by-step wizard:
[Y] yes please [n] no, I'm a devbox expert — don't ask again
'n' writes a setup-skipped marker in the config dir and never asks again;
'devbox setup' runs it explicitly anytime. The wizard owns the one fiddly
step (join: hub URL + token, with a hint where to get the token) then
points at mount/publish/start — mount stays a printed next-step, not a
reimplementation (ponytail). Gated on a real TTY so pipes/scripts are
never blocked; extracted a shared joinHub helper so the wizard and
'devbox join' don't diverge. Stdlib ModeCharDevice (no go-isatty).
Test: opt-out gate + don't-ask-again persistence.
It only called EffectiveMember and dropped one return; its sole prod
caller (the push gate) discarded that return anyway. Inline it: the gate
calls EffectiveMember directly and the test now targets the real method.
Kept blobstore.Store (single impl, but the documented M9 S3/R2 seam) and
control.Daemon (single impl, but breaks the daemon->control import cycle).
restore conflict-copy shipped (never-lose-a-byte on revert). Reframed the
conflict sidecar as M10 (only its resolver consumes it — ponytail) and
snapshot_chunks as M9. M8 nodes flipped green in both roadmap mermaids;
tables + §5.1/§5.5 updated. M9–M11 stay demand-driven.
Closes the audit's deferred #18 — the right way this time. An explicit
'devbox restore' no longer silently clobbers UNCOMMITTED local edits:
- captureUncommitted reads the bytes of any local file that differs from
BOTH the snapshot being restored AND the current hub head (== an edit
that was never pushed) BEFORE the restore overwrites/deletes it.
- After applySnapshot runs, those bytes are written back as .conflict-
<host>-<ts> copies (discoverable via 'devbox conflicts', and they
propagate like any conflict copy).
The head comparison is the key: a CLEAN restore (no uncommitted edits)
captures nothing and reproduces the snapshot exactly — TestRestoreWholeTree
still passes. Capture-before / write-after ordering means applySnapshot's
delete pass never eats the copy. Refactored the conflict-name probe into a
shared freeConflictName. Deploy stays as-is (read-only/pinned mounts have
no uncommitted edits to lose). New test: an uncommitted v3 survives a
revert to v1 as a conflict copy. 18 pkgs -race green; windows builds.
invites + members + write enforcement all shipped & proven on arm64 Pis
(.13 owner invited an editor, .15 redeemed and pushed). README CLI table
+ M8 rows + V2-SPEC §5.2 updated; 3 migrations verified on a real hub-DB
copy (0→1→2→3). M8-3 (sidecar/restore-copy) still the open M8 piece.
Re-runnable two-host fleet test against an ISOLATED hub (never the live
.10). Owner on one Pi invites bob editor; a device on ANOTHER Pi redeems
via the join PoP flow, lands as bob/editor, and pushes an edit (snapshots
1->2). Bakes in the 64-char-token gotcha (randomBearer = 32 bytes; a {32}
grep truncates it -> 401). Green on .13+.15 arm64; self-cleans both hosts.
Completes M8a's collaboration surface. A member mints an invite; the
invitee redeems it through the EXISTING /v1/join proof-of-possession flow
and lands enrolled + assigned the bound principal + granted the bound role.
- migration #3: invites table (token_hash → principal/share/role/+s),
chains 0→1→2→3 — verified on a copy of the real hub DB.
- POST /v1/invite (authed) enforces ATTENUATION server-side via the pure,
unit-tested meta.MayGrant: never grant above your own role, never touch a
principal who outranks you, viewers can't grant, editors need +s. On a
legacy share the inviter is seeded as owner before the explicit flip so
they (and their same-principal devices) never self-lock-out.
- /v1/join applies a redeemed invite's binding (plain token = v1 join).
- transport.Invite + devbox invite <share> <principal> <role> [--reshare].
Tests: MayGrant attenuation matrix, invite binding round-trip, and the
end-to-end TestInviteFlow (owner invites → flip preserves owner → invitee
redeems into editor → editor-without-+s denied). 18 pkgs -race green;
linux/amd64 + windows cross-build.
The read companion to devbox-hub member set/rm/list. Additive: new
PathMembers endpoint (authed; reads stay open in M8a — gating is M9),
proto.Member/MembersResponse, transport Members(), and a devbox members
<share> client command that prints 'legacy share' or the role grants
(principal, role, +s). Role name<->level mapping moved to meta
(ParseRole/RoleName) and the devbox-hub CLI deduped onto it; new
meta.ACLMode(share). Test: legacy reads empty, a grant flips it explicit
and lists bob/editor/+s. 18 pkgs -race green; windows cross-builds.
Flip M8a write-side to ✅ (still one 🔨 on M8 overall): principals + roles
+ write gate + admin CLI landed, both migrations verified chaining 0→1→2
on a copy of the real hub DB. Device-facing invites + GET /members noted
as still-ahead; read-side gating stays M9.
Repo-wide audit (per request) came back lean — no dead exports, no
reinvented stdlib. Two real cuts:
- delete the Windows control.Server.Publish no-op: Publish was removed
from the real server when /events was trimmed, so nothing calls it.
- move the control.Daemon interface into shared control.go (was duplicated
across server.go + server_windows.go build-tag split → drift risk).
Kept (disagreed with cutting): blobstore.Store interface is the documented
M9 S3 seam (6 lines, clean contract); c.Bearer() is a tiny test accessor.
V2-SPEC §5.2 (write-side, staged before read-side M9). Migration #2 (rides
the M8 runner, chains 0→1→2 — verified on real .10 data, version 2, all
counts preserved):
- principals table + devices.principal_id (every v1 device backfills to one
synthetic 'owner' principal — byte-identical to v1 until a share opts in).
- members(share, principal_id, role, can_reshare) + shares.acl_mode. A share
with zero grants is 'legacy' (every device an implicit owner = v1); the
first grant flips it to 'explicit' = deny-by-default.
- EffectiveRole(device, share) resolves device→principal→role; legacy⇒owner.
- Push write gate: role>=editor AND the access.writable clamp (which can only
REMOVE write). Legacy shares reduce to the v1 writable bit exactly.
- devbox-hub member set/rm/list + principal <device> <principal> admin CLI —
the populate path, so the role layer has a real consumer now (no dead code).
Tests: legacy↔explicit lifecycle, deny-by-default, viewer<editor, HTTP push
gate (403 unmembered/viewer, opens at editor). 18 pkgs -race green; hub
cross-compiles linux/amd64; windows builds.
Reusable safety gate: copies the live hub DB (all 3 WAL files — copying
only .db migrates an EMPTY db and false-passes), runs the new binary's
migration in isolation, and asserts version advanced, backup made, and
counts preserved (devices/shares/chunks equal, snapshots may grow from
backfill, no orphan heads). Live hub never touched. Re-run before every
hub upgrade; adjust the INVARIANTS block per migration. Already green on
the real .10 data: 13 dev / 12 share / 16 chunk preserved, 3 heads repaired.
ponytail-review caught it: publishActivity -> ctrl.Publish -> broker -> SSE
was a producer with nothing on the other end. GET /events only feeds the
M11 TUI, which is demand-driven and not built. /state + /pause + /resume
cover every real caller (devbox status/pause/resume). Cut the broker,
handleEvents, Publish, publishActivity, and the ctrl handle — re-add the
(small, known) fan-out when a TUI actually consumes it. Net -100 lines.
isTTY only gates a cosmetic status enrichment; os.Stdout.Stat() &
ModeCharDevice is the stdlib one-liner. Cygwin detection is moot on a
mac/Linux fleet. go-isatty demoted back to an indirect dep.
The v2 foundation (V2-SPEC §5.1). Two things land:
- PRAGMA user_version migration runner in internal/hub/meta: ordered,
append-only, each step in its own txn with the version bump LAST so a
crash rolls back cleanly. Backs up an existing DB to <path>.pre-v2.bak
(VACUUM INTO) before migrating; refuses a DB written by a newer build.
Every later v2 schema change rides this.
- Re-key snapshots from a GLOBAL id PK to per-(share, id). v1's global id
meant identical content pushed to two shares collided on one row, so the
second share never counted its chunk refcounts (undercount) and recorded
no snapshot row. Per-share rows fix the refcount and let each share own
its history. Wire id/Head stays the manifest hash — clients unchanged.
Migration also backfills any share head left rowless by the v1 idempotent
push, restoring the head-has-a-row invariant. GC reworked to prune per
(share, id), decrementing each share's chunks and freeing a shared
manifest blob at most once.
Tests: cross-share refcount, migration versioning + refuse-newer, and a
realistic populated-v1 -> v2 upgrade (data preserved, backup written,
head backfill). All 17 pkgs -race green; hub cross-compiles linux/amd64.
Deferred to M8-3 (conflict sidecar): restore/deploy conflict-copy — a naive
version breaks restore-reproduces-snapshot; it needs the base/ancestor
awareness the sidecar introduces. snapshot_chunks edge table deferred to
M9 (no consumer yet; the runner makes adding it a one-line migration).
Add internal/control: an HTTP/1.1 control plane the daemon hosts on a
0600 Unix socket (control.sock) in the config dir — GET /state, GET
/events (SSE), POST /pause|/resume — plus a stdlib net/http client
(DialState/Pause/Resume) that returns a typed ErrNotRunning when the
daemon is down so callers can fall back.
Wire into the daemon: paused atomic.Bool gates runMount's trigger loop
(drains while paused, no-ops the initial nudge), a per-mount nudge
registry lets Resume catch every mount up, and StateSnapshot feeds
/state. The control server starts in Run and is non-fatal — sync never
depends on it. Windows gets a build-tagged stub (named-pipe upgrade
path noted).
CLI: devbox pause/resume call the client (friendly 'daemon not running'
when absent); status prefers the live socket but ONLY on a TTY, so piped
output stays byte-identical to v1 for scripts.
Researched (6 parallel agents, grounded in v1 code + prior art) and synthesized
docs/V2-SPEC.md: vision, the two architectural forks (add-don't-replace),
6 theme designs with concrete schema/proto deltas + crash-safe migrations, a
dependency-ordered M8→M11 roadmap, and a risks table. Key throughline:
convergent encryption is the lynchpin that lets E2E coexist with dedup AND P2P.
Ponytail guard: captured ≠ committed — only M8 (refcount fix + migration runner
+ principals/roles + control socket) is justified now; M9–M11 are demand-driven.
Linked from the README roadmap.
Ponytail review of the hardening batch:
- JoinChallenge was a bare token||pubkey concat — unambiguous only because
ed25519 keys are fixed 32 bytes. Now domain-separated + NUL-delimited
('devbox-join\0<token>\0<pubkey>') so the boundary is explicit regardless of
key length, and the sig can't collide with any other devbox signing use.
- inlined the one-caller pidfileContents() into writePid.
(Kept the Linux /proc start-time guard: the daemon's real home is the Pi
cluster, where PID-reuse-after-crash is a genuine window; the magic field index
is already a named const. Declined the flock rewrite of fleet-verified code.)
- status badge: 'v1 complete · M0–M7' → '🛡️ v1 · audited + hardened'
- Go badge 1.22+ → 1.26+ (matches go.mod)
- top milestone summary now carries M7.5 (audit) + M7.6 (hardening), consistent
with the detailed table
- new '🔐 Security & Durability' section (table + a mermaid of the integrity/path
guard chain) + TOC entry — showcases the audit/hardening honestly under the
single-owner threat model
Per ponytail review of the hardening batch: TestHubByteCapsAreSane only fails on
a deliberate const edit (not a real bug) and its comment described timeouts it
never tested. The happy-path limits test carries the regression weight.
The device id is derived from the pubkey in JoinRequest, but the hub never
checked the joiner actually held that key — anyone with a token could enroll
claiming another device's identity. Now the client signs JoinChallenge(token,
pubkey) with its ed25519 private key and the hub verifies it (ed25519.Verify)
BEFORE redeeming the token — so a bad request can't burn a legitimate one-time
token either. proto gains a Signature field + the shared JoinChallenge helper.
Regression test: garbage/missing/wrong-key sigs all 401, token survives, valid
join enrolls.
A crashed daemon's PID can be recycled by an unrelated process, so the bare-PID
pidfile let 'devbox stop' SIGTERM a stranger and 'devbox start' refuse over a
reused PID. The pidfile now records '<pid> <starttoken>' (Linux /proc/<pid>/stat
field 22 start time); runningPid only treats the PID as our daemon when the
token still matches. Falls back to bare-PID liveness where the token is
unverifiable (non-Linux) — no regression. Verified on real linux/arm64.
[fanned-out subagent: harden-pidfile]
The hub read request bodies with unbounded io.ReadAll / json.Decode and ran
http.ListenAndServe with zero timeouts — a single client could OOM it or hold
connections open (slowloris). Now:
- handleBlob caps the body at 256 MiB, decode() caps JSON at 8 MiB, both via
http.MaxBytesReader -> 413 when exceeded.
- serve uses an http.Server with ReadHeaderTimeout/ReadTimeout/IdleTimeout +
MaxHeaderBytes. WriteTimeout intentionally unset so the long-lived /v1/events
SSE stream isn't killed. [fanned-out subagent: harden-dos]
A power loss between rename and the data hitting disk could leave a truncated/
empty file despite the atomic rename — breaking 'never lose a byte'. Now both
atomic-write paths f.Sync() the temp file before rename and best-effort fsync
the parent dir after (so the rename entry is durable too):
- internal/syncer/pull.go atomicWrite (pulled file content)
- internal/hub/blobstore Disk.Put (stored blobs)
Dir fsync is best-effort (unsupported on Windows). [fanned-out subagent: harden-fsync]
- rescan tickers for all mounts started in lockstep, so every 60s they rebuilt
manifests simultaneously (self-synchronized load spike on big trees). Stagger
the first tick by a random offset.
- jittered() called rand.Int63n(int64(d/2)) which panics for sub-2ns durations
(d/2==0). Guard it. (Latent: a panic in a recover-less goroutine.)
- healthyStream was 2min — 4x larger than typical SSE recycle (~30-60s), so a
recycled-but-healthy stream never reset backoff and sat at the 30s ceiling.
Lowered to 20s. Regression test for the jitter panic.