Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(session): run lifetime checks on PostgreSQL
Yudhi Armyndharisaded16cc8099
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex b22614bce..6ae451c06 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -259,20 +259,20 @@ jobs:# holds across a backup round trip, a retention window and a local-midnight count, that webhook# failure recovery and media metadata updates hold on the real server, that a send# idempotency key is claimed by a unique-violation insert, and that a replace-all import runs (its- # idempotency-key trim casts a varchar session id against a uuid). All eight- # self-skip unless DATABASE_TYPE=postgres, so they are a no-op in the default test job and only- # execute here against the postgres:16 service.+ # idempotency-key trim casts a varchar session id against a uuid). The PostgreSQL-specific+ # suites self-skip unless DATABASE_TYPE=postgres. Session lifetime scenarios run against+ # SQLite in the default test job and against the postgres:16 service here.## TZ is deliberately NOT UTC: the pin's whole job is to make a `timestamp` column mean the same# instant on a host that runs in another zone, and on a UTC runner every assertion about it# would pass for the wrong reason (the UTC-pin spec fails outright rather than pass vacuously).- - name: Postgres specs (FTS + migrations + ordering + schema + UTC + recovery + idempotency + import)+ - name: Postgres specs (FTS + migrations + ordering + schema + UTC + recovery + idempotency + import + lifetime)# --runInBand: the specs issue DDL against the one shared service database, and jest's# default file-parallelism races their catalog writes (pg_type duplicate-key). The lock# spec's own two-migrator race is in-file (Promise.all) and unaffected by runInBand. The# synchronize spec additionally CREATEs and DROPs a scratch database of its own, which is# only safe serialized.- run: npx jest --runInBand src/database/migrations/__tests__/1782400000000-AddMessagesFts.pg.spec.ts src/database/migrations/__tests__/pg-boot-migrations.pg.spec.ts src/modules/message/message-list-ordering.pg.spec.ts src/database/migrations/__tests__/pg-entity-synchronize.pg.spec.ts src/database/postgres-utc.pg.spec.ts src/modules/webhook/webhook-recovery.pg.spec.ts src/modules/message/idempotency/send-idempotency.service.pg.spec.ts src/modules/infra/infra-data.import.pg.spec.ts+ run: npx jest --runInBand src/database/migrations/__tests__/1782400000000-AddMessagesFts.pg.spec.ts src/database/migrations/__tests__/pg-boot-migrations.pg.spec.ts src/modules/message/message-list-ordering.pg.spec.ts src/database/migrations/__tests__/pg-entity-synchronize.pg.spec.ts src/database/postgres-utc.pg.spec.ts src/modules/webhook/webhook-recovery.pg.spec.ts src/modules/message/idempotency/send-idempotency.service.pg.spec.ts src/modules/infra/infra-data.import.pg.spec.ts src/modules/session/session-content-lifetime.spec.tsenv:TZ: Asia/JakartaDATABASE_TYPE: postgresdiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 12072c3ce..30dcbd2c4 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -232,17 +232,18 @@ jobs:# only case-folds on a real server), that the UTC pin holds across a backup round trip, a# retention window and a local-midnight count, that webhook failure recovery and media metadata# updates hold on the real server, that a send idempotency key is claimed by a unique-violation- # insert, and that a replace-all import runs. All eight self-skip unless DATABASE_TYPE=postgres, so- # they are a no-op in the default test job and only execute here against the postgres:16 service.+ # insert, and that a replace-all import runs. The PostgreSQL-specific suites self-skip unless+ # DATABASE_TYPE=postgres. Session lifetime scenarios use SQLite in the default test job and+ # the postgres:16 service here.# TZ is deliberately not UTC, for the reason ci.yml states.- - name: Postgres specs (FTS + migrations + ordering + schema + UTC + recovery + idempotency + import)+ - name: Postgres specs (FTS + migrations + ordering + schema + UTC + recovery + idempotency + import + lifetime)# --runInBand: same reason the CI job passes it — both specs issue DDL against the one# shared service database, and jest's default file-parallelism races their catalog writes# (the first v0.19.0 tag failed this step on `relation "messages" already exists` over a# tree CI had passed minutes earlier). The lock spec's own two-migrator race is in-file# (Promise.all) and unaffected by runInBand. The synchronize spec additionally CREATEs and# DROPs a scratch database of its own, which is only safe serialized.- run: npx jest --runInBand src/database/migrations/__tests__/1782400000000-AddMessagesFts.pg.spec.ts src/database/migrations/__tests__/pg-boot-migrations.pg.spec.ts src/modules/message/message-list-ordering.pg.spec.ts src/database/migrations/__tests__/pg-entity-synchronize.pg.spec.ts src/database/postgres-utc.pg.spec.ts src/modules/webhook/webhook-recovery.pg.spec.ts src/modules/message/idempotency/send-idempotency.service.pg.spec.ts src/modules/infra/infra-data.import.pg.spec.ts+ run: npx jest --runInBand src/database/migrations/__tests__/1782400000000-AddMessagesFts.pg.spec.ts src/database/migrations/__tests__/pg-boot-migrations.pg.spec.ts src/modules/message/message-list-ordering.pg.spec.ts src/database/migrations/__tests__/pg-entity-synchronize.pg.spec.ts src/database/postgres-utc.pg.spec.ts src/modules/webhook/webhook-recovery.pg.spec.ts src/modules/message/idempotency/send-idempotency.service.pg.spec.ts src/modules/infra/infra-data.import.pg.spec.ts src/modules/session/session-content-lifetime.spec.tsenv:TZ: Asia/JakartaDATABASE_TYPE: postgresdiff --git a/docs/09-testing-strategy.md b/docs/09-testing-strategy.mdindex c4817b3ac..faf2c6b27 100644--- a/docs/09-testing-strategy.md+++ b/docs/09-testing-strategy.md@@ -259,7 +259,7 @@ request's superseded run; push runs on `main` are never cancelled or queued behi| `lint` | backend ESLint, full-program TypeScript check, formatting, version consistency, .dockerignore context, OpenAPI snapshot, SDK routes and webhook events against the contract, contract coverage per SDK, SDK docs against the shipped client surface, client wire shapes (`check:contract-shapes` — the JavaScript SDK's, dashboard's, Python's, Go's and Java's hand-written types against the OpenAPI schemas; the PHP client returns untyped arrays and has no types layer to gate) || `audit` | dependency security audit of all three npm trees (root, `dashboard/` and `sdk/javascript/`); when npm's audit endpoint cannot answer, the root audit skips with a warning annotation here while the dashboard and SDK audits, a plain `npm audit`, fail closed, so the job still goes red until a re-run; the release gate and the weekly scan fail (`CHECK_AUDIT_REQUIRED=1`) || `test` | backend coverage run, repo-file drift gates (`test:docs`), script unit tests (node:test), e2e smoke tests |-| `test-postgres` | real PostgreSQL 16 service, backend build, migration smoke, and the PostgreSQL specs (FTS provider, boot-migration lock, message list ordering, entity synchronize, UTC pin, webhook recovery, send idempotency keys, replace-all import) |+| `test-postgres` | real PostgreSQL 16 service, backend build, migration smoke, and the PostgreSQL specs (FTS provider, boot-migration lock, message list ordering, entity synchronize, UTC pin, webhook recovery, send idempotency keys, replace-all import, session content lifetimes) || `dashboard` | dashboard install, lint, formatting, type-check, i18n parity, build, unit tests || `scripts-smoke` | shellcheck on `docker-entrypoint.sh` and every `scripts/*.sh`, plus the backup/restore smoke test || `chart` | helm lint, helm template with default and fully-toggled values, kubeconform on both renders, the rendered-behaviour check, actionlint on the workflows |