refactor(justfile): rename, relay auto-start, bootstrap, DRY cleanup#1117
Merged
Conversation
just dev now runs the relay in the background (redirected to a tmp log) so new users can spin up both the relay and desktop app with one command. Also adds _ensure-migrations as a prerequisite so Docker services and migrations are guaranteed before anything starts. Minor cleanup to just staging: BUZZ_RELAY_URL is now exported before sourcing instance-env.sh, letting the default substitution skip rather than firing and being immediately overridden.
Removing the mktemp redirection — relay stdout/stderr now flow to the same terminal as Tauri/Vite, making startup errors immediately visible.
Three code-review bugs, all in the relay startup sequence: 1. Relay leaked on set -e exit before trap registration: install a partial relay-only trap immediately after RELAY_PID=$!, then upgrade it to the full cleanup once INSTANCE_ID is available. 2. cleanup-instance-agents.sh failure could abort the trap body before kill $RELAY_PID ran: add || true after the script call. 3. cargo run -p buzz-relay & had two problems: it triggered a separate background compile (buzz-relay was absent from the explicit build step) and captured cargo's PID rather than the relay binary's PID, making the kill unreliable on macOS where cargo doesn't exec() into the child. Follow the pattern from scripts/e2e-relay-membership.sh and e2e-git-perms.sh: add buzz-relay to the explicit cargo build and launch ./target/debug/buzz-relay & directly.
e3881cf to
c671846
Compare
… updates bootstrap recipe (idempotent, safe to re-run): - Prepends hermit's bin/ to PATH so tools resolve correctly regardless of whether the user has sourced bin/activate-hermit in their shell - Copies .env.example → .env if .env is absent - Invokes cargo/node/pnpm --version to trigger hermit lazy downloads Wired into entry-point recipes (setup, dev, staging, relay, relay-web); each of those recipe bodies also gets `export PATH=.../bin:$PATH` since just runs each recipe in a separate subprocess. DRY / consistency fixes: - migrate is now a public alias for _ensure-migrations (removes duplicate cargo run -p buzz-admin invocation) - staging trap gains || true on cleanup-instance-agents.sh call, matching the defensive style already used in dev - goose and goose-bg share their 14-line setup block via new scripts/_goose-env.sh (sourced by both; sets env_args array) - _ensure-sidecar-stubs and desktop-release-build get comments noting their shared binary list must stay in sync - staging and desktop-release-build get comments documenting why pnpm install is unconditional in those recipes Section reorganization (cosmetic, no logic changes): - reindex-kind0 moved from Build & Check → Utilities - desktop-screenshot, mesh-e2e, mesh-e2e-hardware moved from Build & Check → Test Docs: - README quick-start removes manual cp .env.example .env (handled by just setup) and updates "Every day" flow: just dev now starts both the relay and desktop in one command; mentions split-terminal alternative - CONTRIBUTING first-time setup and relay sections updated to match
c671846 to
85c5670
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrites the
Justfile(renamed fromjustfile) with four categories of improvement: relay integration, prerequisite bootstrapping, correctness fixes, and housekeeping.Relay auto-start in
just devjust devpreviously started the desktop app with no relay, leaving new users with an app that had nowhere to connect. It now buildsbuzz-relayas part of the existingcargo buildstep, starts./target/debug/buzz-relayin the background before launching Tauri, and kills it cleanly on exit. The relay URL defaults tows://localhost:3000viascripts/instance-env.sh— nothing new to configure.just bootstrap— idempotent prerequisite installerNew recipe that prepends hermit's
bin/to PATH and invokescargo,node, andpnpm --versionto trigger hermit's lazy tool download. Also copies.env.example→.envif.envis absent. Safe to re-run; subsequent calls complete in ~1s when tools are already cached. Wired as a first prerequisite ofsetup,dev,staging,relay, andrelay-webso those recipes work correctly even when hermit hasn't been activated in the parent shell.Relay lifecycle correctness (from code review)
Three bugs in the original relay-start implementation, all fixed:
pnpm install,source instance-env.sh, or theINSTANCE_IDnode command exited non-zero before the EXIT trap was registered — fixed by registering a partial relay-only trap immediately afterRELAY_PID=$!and upgrading it onceINSTANCE_IDis availablecargo run -p buzz-relay &captured cargo's PID rather than the relay binary's PID (cargo doesn't alwaysexec()into its child on macOS) — fixed by includingbuzz-relayin the explicitcargo buildstep and launching./target/debug/buzz-relay &directly, following the pattern inscripts/e2e-relay-membership.shcleanup-instance-agents.shfailing in the trap could abort beforekill "$RELAY_PID"ran — fixed with|| trueDRY cleanup and housekeeping
migrateis now a public alias for_ensure-migrations(removes the duplicatecargo run -p buzz-admin -- migrate)stagingtrap gains|| trueon the cleanup script call, matchingdev's defensive stylegooseandgoose-bgshare their 14-line setup block via newscripts/_goose-env.sh(sourced by both)_ensure-sidecar-stubsanddesktop-release-buildnoting their shared binary list must stay in sync;staginganddesktop-release-buildget comments explaining their unconditionalpnpm installreindex-kind0→ Utilities;desktop-screenshot,mesh-e2e,mesh-e2e-hardware→ Testcp .env.example .envremoved from setup steps (handled byjust bootstrap), "Every day" flow updated tojust devas a single command, split-terminal alternative documented