Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(session): run the two-node delete spec on PostgreSQL
Yudhi Armyndharis1cfaa0a8a591
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 6ae451c06..1384b30bc 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -260,8 +260,8 @@ jobs:# 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). 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.+ # suites self-skip unless DATABASE_TYPE=postgres. Session lifetime and two-node delete 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@@ -272,7 +272,7 @@ jobs:# 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 src/modules/session/session-content-lifetime.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.ts src/modules/session/session-delete-claim.spec.tsenv:TZ: Asia/JakartaDATABASE_TYPE: postgresdiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 30dcbd2c4..8fc0bb514 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -233,8 +233,8 @@ jobs:# 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. 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.+ # DATABASE_TYPE=postgres. Session lifetime and two-node delete 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 + lifetime)# --runInBand: same reason the CI job passes it — both specs issue DDL against the one@@ -243,7 +243,7 @@ jobs:# 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 src/modules/session/session-content-lifetime.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.ts src/modules/session/session-delete-claim.spec.tsenv:TZ: Asia/JakartaDATABASE_TYPE: postgresdiff --git a/docs/09-testing-strategy.md b/docs/09-testing-strategy.mdindex cb15a81aa..f80e12ffe 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, session content lifetimes) |+| `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, two-node session delete) || `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 |diff --git a/src/common/test-lane-partition.spec.ts b/src/common/test-lane-partition.spec.tsindex 2d2283c15..7f61fcc3c 100644--- a/src/common/test-lane-partition.spec.ts+++ b/src/common/test-lane-partition.spec.ts@@ -150,7 +150,10 @@ describe('Test lane partition', () => {* leaves release-gate-parity green (the two still agree) and the scenarios silently SQLite-only.* Listed by hand for that reason, and a plain spec this job gains must be listed too.*/- const dialectSwitchedSpecs = ['src/modules/session/session-content-lifetime.spec.ts'];+ const dialectSwitchedSpecs = [+ 'src/modules/session/session-content-lifetime.spec.ts',+ 'src/modules/session/session-delete-claim.spec.ts',+ ];it.each(['ci.yml', 'release.yml'])('runs the dialect-switched specs in the %s test-postgres job', file => {const named = postgresJobSpecs(file).filter(path => !path.endsWith('.pg.spec.ts'));