managarten/apps/mana/apps
Till JS 048184bef0 fix(macmini): auto-rebuild stale sveltekit-base before per-app web builds
Per-app web Dockerfiles do `FROM sveltekit-base:local` and do NOT re-COPY
packages/shared-* — those packages are baked into the base image. So a
change to packages/shared-utils, packages/shared-ui, etc. only reaches
the live web app if the base image is also rebuilt.

This bit us THREE times on 2026-04-08 alone:
1. CSP fix in shared-utils ('wasm-unsafe-eval') sat unused in production
   for over an hour because every `build-app.sh mana-web` cheerfully
   reused the cached base layer that still contained the old shared-utils.
2. Same problem with the BaseListView export in shared-ui after the
   ListView consolidation refactor — mana-web's build failed because the
   Rollup pass couldn't resolve the new symbol from the stale base.
3. Same shape, different package, repeatedly.

The pattern is identical every time and the manual workaround
(`build-app.sh --base` first) is something you only think to run if you
already know how the layering works. Make the script catch it.

New `is_base_image_stale` helper compares the base image's `Created`
timestamp against the latest git commit touching paths the base image
actually depends on:
  - packages/                       (all shared-* packages baked in)
  - docker/Dockerfile.sveltekit-base
  - pnpm-lock.yaml                  (transitive dep changes)

When building any *-web service, if the image is stale or missing, the
base is rebuilt automatically before the per-app build kicks off, with
the triggering commit's oneline printed for transparency.

Date parsing notes:
- macOS Docker emits the Created field with the local TZ offset
  ("...+02:00"), not Z. We strip the fractional + offset suffix and
  parse the literal local clock time with BSD date (no -u), which is
  what the original timestamp meant on this host. GNU date is the
  fallback for Linux dev boxes and handles the full ISO directly.
- If parsing fails for any reason we conservatively force a rebuild
  rather than risk shipping stale code.

Verified end-to-end against the live Mac Mini's current state earlier
today: image 55s newer than the last packages/ commit at the time →
"fresh, skip" (correct). When the next packages/ commit lands, the
script will see commit_epoch > image_epoch and trigger the base
rebuild automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 22:34:29 +02:00
..
landing docs(devlog): voice quick-add pipeline + LLM parsing live in prod 2026-04-08 18:01:21 +02:00
mobile chore: complete ManaCore → Mana rename (docs, go modules, plists, images) 2026-04-07 12:26:10 +02:00
web fix(macmini): auto-rebuild stale sveltekit-base before per-app web builds 2026-04-08 22:34:29 +02:00