- internal/transport/client.go: replace bare &http.Transport{} with
DefaultTransport.Clone() so HTTP_PROXY/HTTPS_PROXY/NO_PROXY, ForceAttemptHTTP2,
IdleConnTimeout, and ExpectContinueTimeout are preserved; only intentionally-tuned
fields (DialContext, TLSHandshakeTimeout, ResponseHeaderTimeout, DisableCompression,
MaxIdleConnsPerHost) are overridden.
- cmd/devbox/main.go: statusCmd disk path now calls control.DialState once upfront;
prints "⚠️ daemon not running — showing last-known disk state (run: devbox start)"
when daemon is absent so users aren't silently misled.
- Tests: TestTransportHonorsProxyEnv asserts Proxy!=nil + ForceAttemptHTTP2=true;
TestStatusDaemonNotRunning asserts warning appears on joined-but-no-daemon device.
Trust boundary: handlePush previously verified that every hash in req.Chunks
existed in the blob store, but it trusted req.Chunks as the authoritative list
of chunks the pushed manifest references. A buggy or malicious client could:
(a) Push a manifest referencing chunk C while omitting C from req.Chunks →
hub commits a snapshot whose manifest references a blob that may not
exist → every subsequent pull 404s on C (dangling snapshot).
(b) Include in req.Chunks a chunk not referenced by the manifest →
refcount is bumped for a blob GC can never safely collect (phantom ref).
Fix: after confirming the manifest blob is present, we now fetch + unmarshal
it and derive the DISTINCT chunk hash set directly from Manifest.Entries[*].Chunks.
Each hash in that set is verified to exist in the store; any missing hash rejects
the push with 409 (same status as before). Only manifest-referenced hashes are
passed to db.AddSnapshot() for refcounting.
Size hint: meta.ChunkRef.Size is used only for metrics/dashboard totals and is
stored once (first INSERT; ON CONFLICT only bumps refcount, not size). GC
decisions are made on refcount, not size. We keep req.Chunks as a size-hint
lookup (reqSizes map): if the client is honest the size is correct; if a hash is
absent from req.Chunks the size defaults to 0, which is harmless.
Happy-path unchanged: an honest client (syncer.go) always derives req.Chunks
from the same manifest, so all hashes are present with correct sizes.
Tests: TestHubHappyPath updated to push a real manifest JSON (required now that
the hub parses it); TestPushManifestChunkIntegrity asserts the malicious pattern
is rejected and the head does not advance, then confirms an honest push succeeds.
- status now surfaces per-mount last sync error (+ last_err in --json)
- serve: version/dashboard in startup log, non-loopback --listen warning, graceful SIGTERM shutdown
- warn when --listen is non-loopback (plain HTTP, cleartext bearer tokens)
- startup log now includes build version + dashboard on/off state
- serve blocks on SIGTERM/Interrupt; 10s drain window before exit
- hoist dashboard http.Server so shutdown also drains it
- table-test isLoopback (IPv4, IPv6, empty host, non-loopback variants)
Track lastErr per mount (mirroring lastSync pattern), cleared on
success so a recovered mount shows clean. Errors from LoadIgnoreWith,
Pull, and Sync all land in the map and surface through StateSnapshot
into 'devbox status' (human ⚠️ warning) and --json (last_err field).
- hub: backup <dir> (DR), serve --metrics-token / --access-log, device ls [--json]
(corrected the old aspirational `device list` row → real `device ls`), gc --keep-days
- client: doctor now also warns on clock skew vs the hub (>30s)
- 🩺 `doctor --json`: structured check report for cron/monitoring; still exits
non-zero on ❌ (collects checks into a slice, JSON path suppresses the human lines).
- 🗑️ `conflicts --rm`: delete every `.conflict-` copy after review (lazy cleanup,
not a resolver). Only touches conflict copies — real files untouched.
- ⏱️ `status` shows per-mount last-sync age ("synced 12s ago" / "not synced yet")
from a daemon-tracked timestamp (control.MountState.LastSyncUnix); also in --json.
- 🙈 the reversed no-go: `settings.sync.ignore_defaults` (opt-in, default off) layers
a built-in junk set (node_modules, .git, target, dist, build, .venv, __pycache__,
.next, .DS_Store) onto the matcher — don't ship gigabytes of regenerable junk over
the now-live WAN. Reuses round-1 --exclude plumbing; honored by daemon + publish.
Tests: doctor --json valid+exit-code, conflicts --rm deletes only conflicts,
ignore.Defaults match. go test ./... -race + vet clean.
- 📊 /metrics gains real WAN observability counters beyond the 4 gauges:
blob bytes in/out (the bandwidth signal now the hub is internet-reachable)
plus pushes/conflicts totals for sync churn. Atomic, incremented at the
blob + push handlers.
- 🩺 /healthz now reports the build version ("ok <version>") so a deploy can
curl-verify the new binary is actually live (SetVersion wired in serve).
Test: TestMetricsCountersAndHealthVersion (version in healthz; bytes_in/out
move on a real PUT/GET).
Now the hub is WAN-reachable, the transfer path needed real hardening:
- ⏱️ request timeout fix: replaced the 30s TOTAL http.Client.Timeout (which
killed a 256MiB blob mid-transfer over a slow link) with granular dial / TLS /
response-header timeouts + TCP keepalive. Body transfer is no longer wall-clocked.
- 🔁 retry + exponential backoff on transient blob transfers (network / 5xx),
3 attempts; 4xx fails fast. Blob GET/PUT are content-addressed (idempotent),
so retry is safe; control calls are left alone.
- 🚀 parallel blob uploads (push) and parallel chunk downloads (pull reassembly),
bounded pools (8), sharing the existing rate limiter. WAN is RTT-bound — this
keeps the pipe full instead of one-blob-at-a-time.
- 🗜️ download (response) gzip: round 1 compressed only uploads, but a clone is
download-heavy. Client negotiates gzip explicitly (so the rate limiter counts
wire bytes), hub streams the response through gzip, client decompresses
bomb-safely. Gated by the same settings.transfer.compress flag.
Tests: retry transient-then-success + 4xx-no-retry, gzip download round-trip.
All existing push/pull round-trips green under -race (refactors behavior-preserving).
The "changed my mind" feature: deferred as YAGNI on a LAN, but the hub is now
WAN-reachable (port-forwarded), so over-the-internet sync is a real path and
compression earns its keep.
- client (settings.transfer.compress, default off): gzip a blob upload only
when it actually shrinks — incompressible chunks (media, encrypted) go raw so
we never inflate the wire. Sets Content-Encoding: gzip. Wired into the daemon
sync loop and the initial `publish` upload.
- hub: decompresses gzip uploads before hashing, so dedup + content-address
integrity are unchanged. Bomb-safe — caps BOTH the compressed stream
(MaxBytesReader) and the decompressed size (LimitReader), rejecting a gzip
header over a non-gzip body.
Tests: client gzip-when-smaller / raw-when-not, hub decompress round-trip +
bad-gzip rejection. go test ./... -race clean, go vet clean.
Five device-side wins from the feature review:
- 🤖 `--json` on status/log/conflicts: machine-readable output for fleet
scripting/monitoring. status prefers live daemon state (paused +
base-snapshot), falls back to disk; not-joined → {"joined":false}.
- 🌊 streaming chunker: chunk.SplitReader feeds FastCDC from an io.Reader so
the manifest build no longer slurps whole files into RAM — a multi-GB file
can't OOM the daemon. Identical boundaries/hashes (proven vs fragmented reads).
- ⏱️ `devbox pause --for 2h`: control socket carries a duration; the daemon
schedules an auto-resume timer. Re-pause replaces it; plain pause/resume
cancel it (no surprise resume).
- 🙈 per-mount `devbox mount --exclude <pat>`: device-local ignore layered on
the shared .devignore (LoadIgnoreWith) — skip a local build dir without
touching the shared file. Honored by daemon sync, restore, and deploy.
- 🎛️ rescan cadence is now settings.sync.rescan_seconds (was a hardcoded 60s
const) — tune the watcher fallback per machine without a rebuild.
#6 (doctor non-zero exit) was already shipped — doctor returns an error on ❌.
Tests: SplitReader-vs-buffered, PauseFor auto-resume + cancel, wire duration,
LoadIgnoreWith layering, status/conflicts --json. go test ./... -race clean.
Three hub-side operability/security closures:
- 🧹 `devbox-hub gc --dry-run`: previews the exact snapshots + chunks the
sweep would remove (computed from reachability — same set the real run
deletes) without mutating a thing. Cheap insurance before a destructive GC.
- 🔐 dashboard token auth (`--dashboard-token`): a non-loopback bind was
unauthenticated (warning only) and leaked device names/activity. Token is
accepted via ?token=, Authorization: Bearer, or an HttpOnly cookie pinned
on first ?token= — so EventSource/fetch authenticate with index.html
untouched. Constant-time compare.
- 🩺 `/healthz` (liveness) + `/readyz` (DB-ping → 503 when unreachable): real
probes for the compose selfheal profile / LBs, which only had /metrics.
Tests: TestGCDryRun (accurate + non-destructive), TestDashboardAuth.
README: hub deploy section gains a Production collapsible — front the hub with a
reverse proxy for TLS (client_max_body_size 0 + proxy_buffering off for SSE), and
the never-YOLO upgrade pipeline (dry-run on a copy → smoke → backup → rollback).
General pattern, no private hostnames (repo is public).
The auth smoke ran the new binary from /tmp, but TrueNAS mounts /tmp noexec —
'Permission denied' on exec. Stage binaries under $DEST/.staging (the app dataset,
exec-ok) instead. The fail-safe worked perfectly: it aborted with prod untouched.
Then ran for real — live hub migrated v1→v3, all data preserved, P2 fixes + TLS live.
Compare before/after counts directly (captured pre-run) instead of via the
v1→v2-only .pre-v2.bak, so the dry-run passes on an already-migrated DB (steady
state) AND on a fresh v1→v3 jump. Backup check is now conditional on an actual
version bump. Verified on the real live .10 DB: 0→3, 13/12 devices/shares + 16
chunks preserved, 3 legacy heads backfilled (snap 13→16), orphans=0.
- scripts/hub-auth-smoke.sh: throwaway-instance smoke proving invite revocation
works + +s attenuation holds (admin without +s denied conferring it). No python/jq
dep (curl+sed). Reusable by redeploy + CI. Verified locally.
- deploy/redeploy-hub.sh: rewritten from build→scp→restart into a SAFE pipeline —
migration dry-run on a COPY of live data (live untouched) → auth smoke the new
binary on the NAS → back up binary+DB (stopped, WAL quiescent) → swap + sync unit →
post-verify (hub answers + /v1/invite/revoke=401 proves new code) → AUTO-ROLLBACK
on failure. The hub DB is canonical history; never YOLO a binary onto it.
- deploy/devbox-hub.service: add --gc-every 24h (self-maintain; blobs don't grow
unbounded). HTTPS via NPM note.
The Pi came back online. Ran the headline acceptances on real hardware:
- P1: anon curl|sh install on a clean no-Go arm64 Pi -> working devbox 0346995,
devbox doctor reports linux/arm64.
- P3: dashboard-fleet-verify (remote mode) -> all 5 flow events (join·push·pull·
conflict·gc) on the live SSE stream + history window, on the real Pi.
Upgraded plan.md wording from qemu/local to real-Pi fleet-verified.
- 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.