feat(release): self-determination - ensure at launch, drift warnings, M20 packages/* decision (#38)

- release.sh ensure: aligned no-op; drift -> package-if-needed + health-gated
  activate (M3 gate-then-flip, automated)
- ensure_release_aligned in common.sh: invoked by hello/verify/agent;
  MOSAIC_ENSURE_SKIP guards recursion; run-task warns on drift without
  auto-aligning (workers/suites never trigger builds or model gates)
- ROADMAP: M20 decision recorded - v2 adopts packages/* monorepo at usurpation
- BUILD-LOG Phase 20 + tool-race process note

Live-verified: post-reset pointer loss auto-restored via health-gated
ensure; drift warning fires on desired-version bump; idempotent no-op on
aligned state.

Closes #38
This commit is contained in:
2026-09-03 14:42:09 -05:00
parent 0a17d29bce
commit db330c12c7
8 changed files with 75 additions and 5 deletions
+16
View File
@@ -55,3 +55,19 @@ bootstrap_runtime_dir() {
# auto-invoked by agent.sh) creates it from the template.
mkdir -p "$MOSAIC_DEV_DIR/user"
}
# M16 release self-determination: launchers call this after load_release.
# Cheap no-op when the active pointer matches the desired RELEASE; on drift
# it delegates to `release.sh ensure` (package if needed, health-gated
# activate). The health gate's own task run sets MOSAIC_ENSURE_SKIP so the
# ensure never re-enters itself.
ensure_release_aligned() {
[ -n "${MOSAIC_ENSURE_SKIP:-}" ] && return 0
local pointer="$MOSAIC_DEV_DIR/state/active.json"
local active=""
if [ -f "$pointer" ]; then
active="$(node -e 'try{const p=JSON.parse(require("fs").readFileSync(process.argv[1],"utf8"));process.stdout.write(p.release||"")}catch{}' "$pointer" 2>/dev/null)"
fi
[ "$active" = "$MOSAIC_RELEASE" ] && return 0
MOSAIC_ENSURE_SKIP=1 scripts/release.sh ensure
}