super-productivity/packages/super-sync-server/scripts
Johannes Millan f15a20ba8d fix(supersync): make interrupted CONCURRENTLY migrations recoverable
A bare CREATE INDEX CONCURRENTLY aborted mid-build (the in-image step
timeout firing at its 1800s default when a raised MIGRATION_TIMEOUT was
not forwarded, an external stop, or OOM) leaves the migration failed and
an INVALID index of the target name, wedging the deploy. Deployed images
reported only a bare "prisma migrate deploy failed (exit 143)" with no
recovery steps, so operators had no way forward.

- deploy.sh: forward MIGRATE_STEP_TIMEOUT into the migrator so a large
  MIGRATION_TIMEOUT is not silently capped at the image default (1800s)
  and kill a slow CREATE INDEX CONCURRENTLY early (the root cause).
- migrate-deploy.sh: normalize BusyBox `timeout` 143 -> 124 so a step
  timeout hits the timeout branch, not the generic one.
- migrate-deploy.sh: emit_interrupted_recovery_hint() prints copy-paste
  recovery (drop the INVALID index, roll the record back, re-run) for an
  interrupted CONCURRENTLY build, from BOTH the 124 timeout branch (where
  a normalized 143 -- the incident's own signal -- lands) and the generic
  non-gate branch (OOM/137), plus the existing P3009 re-run path. Every
  path prints guidance only and NEVER auto-resolves a bare CREATE.
- env.example: document the now-forwarded MIGRATE_STEP_TIMEOUT knob.
- tests: cover 143 normalization, the incident's 143->124 timeout-branch
  recovery, the P3009 and non-gate bare-create recovery, and the
  forwarded step timeout.

The bare CREATE stays bare and fail-loud on purpose: 20260613000001
ships in v18.11.0-v18.14.0 and is applied natively on healthy deploys,
so converting it to a drop-then-create shape would change its checksum
and break every DB that already applied it.

Recovery for the current wedged deploy (20260613000001):
  DROP INDEX CONCURRENTLY IF EXISTS "operations_entity_ids_gin";
  prisma migrate resolve --rolled-back \
    20260613000001_add_operation_entity_ids_gin_index
then re-run the deploy with the step timeout raised enough for the GIN
build (and clear any idle-in-transaction blocker first).
2026-07-17 17:56:57 +02:00
..
analyze-storage.ts fix(sync): preserve own vector clock counter across full-state op resets 2026-04-01 15:41:13 +02:00
backup.sh feat(sync): add backup strategy with accounts-only dump and disaster recovery docs 2026-03-18 20:15:45 +01:00
build-and-push.sh fix(sync): point manual supersync image push at super-productivity org (#7871) 2026-06-01 13:32:06 +02:00
clear-data.ts refactor(sync): remove tombstone system 2025-12-28 12:08:28 +01:00
delete-user.ts fix(superSync): Update admin scripts and README for Postgres compatibility 2025-12-12 20:48:40 +01:00
deploy.sh fix(supersync): make interrupted CONCURRENTLY migrations recoverable 2026-07-17 17:56:57 +02:00
docker-monitor.sh feat(sync-server): add active-users-quick monitor command 2026-04-21 15:03:42 +02:00
health-alert.sh fix(sync-server): security hardening and GDPR log compliance 2026-03-18 20:48:51 +01:00
migrate-deploy.sh fix(supersync): make interrupted CONCURRENTLY migrations recoverable 2026-07-17 17:56:57 +02:00
migrate-payload-bytes.ts perf(sync): SuperSync server speed + correctness hardening (#7621) 2026-05-15 17:24:16 +02:00
monitor.ts feat(sync-server): add active-users-quick monitor command 2026-04-21 15:03:42 +02:00
MONITORING-README.md Add active users monitoring command with engagement metrics (#6921) 2026-03-22 23:15:14 +01:00
recover-user.ts feat(super-sync-server): add recover-user data-recovery script 2026-05-22 19:18:40 +02:00
run-all-monitoring.ts fix(sync-server): use compiled JS for monitoring scripts in Docker 2026-03-27 17:33:38 +01:00