emulator: drop --jitless, capture migration errors on failure

The previous commit set NODE_OPTIONS=--jitless on the migration
docker exec. That was wrong for two reasons:
- --jitless disables eval and new Function, which some code in the
  migration path uses, so it broke amd64 builds that had been passing.
- --jitless is a V8 feature gate, not a TCG workaround. If it breaks
  one arch it breaks both — it could never have helped arm64 either.

Revert the --jitless flag and rely on -cpu cortex-a72 (added in the
parent commit) as the root-cause fix for the arm64 TCG SIGTRAP.

Keep the stdout/stderr capture for the migration exec so the next
failure dumps the actual node error through log-provision instead of
being swallowed by the serial-only stream.
This commit is contained in:
Bilal Godil 2026-04-10 11:26:52 -07:00
parent 7bf4a15306
commit 6c5615b931

View File

@ -231,17 +231,26 @@ write_files:
log "init-services done (${elapsed}s)."
log "Running migrations..."
# NODE_OPTIONS=--jitless disables V8's JIT and runs the Ignition
# interpreter only. Migrations are short and I/O-bound so the perf hit
# doesn't matter, and it makes the process immune to V8-JIT ↔ QEMU-TCG
# mistranslation crashes that otherwise kill the node process with
# SIGTRAP (exit 133) during cross-arch builds.
# Capture stdout+stderr so failures surface the actual node error in
# the host-visible provision log instead of being swallowed by the
# serial-only stream.
migrate_log="$(mktemp)"
set +e
docker exec \
--env-file /etc/stack-build.env \
--env-file /etc/stack-build-computed.env \
-e NODE_OPTIONS=--jitless \
stack-build-init \
sh -c 'cd /app/apps/backend && node dist/db-migrations.mjs migrate && node dist/db-migrations.mjs seed'
sh -c 'cd /app/apps/backend && node dist/db-migrations.mjs migrate && node dist/db-migrations.mjs seed' \
> "$migrate_log" 2>&1
migrate_status=$?
set -e
if [ "$migrate_status" -ne 0 ]; then
log "MIGRATIONS FAILED (exit ${migrate_status}) — last 200 lines of migration output:"
tail -200 "$migrate_log" | while IFS= read -r line; do log "migrate: $line"; done || true
rm -f "$migrate_log"
exit "$migrate_status"
fi
rm -f "$migrate_log"
log "Migrations + seed complete."
log "Stopping deps container..."