Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs: correct claims the code does not support, and cover three gaps

Yudhi Armyndharisa4c4ae054e0f
diff --git a/docs/29-engine-capability-matrix.md b/docs/29-engine-capability-matrix.md
index 6b77b9d33..0f573c731 100644
--- a/docs/29-engine-capability-matrix.md
+++ b/docs/29-engine-capability-matrix.md
@@ -158,28 +158,31 @@ reaching READY is not evidence that every patch landed. See docs/12 for the oper
This is the patch visibility the matrix cells refer to. Every patch is engine-specific (8 on wwjs,
2 on Baileys), and **no row carries a row-level patch mark on both engines**. The two column-wide
patches are a separate matter: πŸ”§ΒΉ underwrites every wwjs cell and πŸ”§β΅ every baileys cell, so in
-that sense every row does depend on a patch on each side. "Patch-dependent" below means the
-row-level marks.
-
-| Patch | Matrix rows that depend on it |
-| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| πŸ”§ΒΉ message-id backport | **The whole wwjs column** (header-marked, not repeated per row): every wwjs cell that sends, receives or resolves a message id. On unpatched 1.34.7 against WhatsApp Web β‰₯ 2.3000.x, sends return no message object and chat/media reads throw the minified `r: r`. Not row-specific, so the wwjs column header carries `πŸ”§ΒΉ`. |
-| πŸ”§Β² status-send repair | `postTextStatus`, `postImageStatus`, `postVideoStatus`, `postVoiceStatus` β€” **wwjs cells only**. Stock 1.34.7 throws before any status send on current WhatsApp Web builds. These four rows are βœ… on both engines, but the wwjs side works only because of this patch. |
-| πŸ”§Β³ newsletter link preview | `sendTextMessage` (and any send carrying a link preview) **to a channel JID** on wwjs. Row-marked on `sendTextMessage` as the common case. |
-| πŸ”§β΄ ready-sync | `initialize` on wwjs (warm-restore readiness race). Row-marked. |
-| πŸ”§β΅ app-state resync bound | No single row β€” keeps the Baileys socket's app-state resync from spinning (~1000 wasted 60s queries/day). Connection health under **every baileys cell**; the baileys column header carries `πŸ”§β΅`. |
-| πŸ”§βΆ newsletter-create parse | `createChannel` on **baileys** β€” without it the call always answers 500 and leaks the channel it just created. Row-marked. |
-| πŸ”§β· participant arity | `removeParticipants`, `promoteParticipants`, `demoteParticipants` on **wwjs**. Without it a request naming only non-members throws an arity assertion on removal, and promote/demote answer `200` for people WhatsApp never touched; the patch returns one boolean per REQUESTED id so the adapter reports a real per-participant outcome. Row-marked. |
-| πŸ”§βΉ group description | `setGroupDescription` on **wwjs**. Without it every call throws in the page and answers a bare `500`, so the capability is dead rather than degraded; `setGroupSubject` beside it is unaffected. Row-marked. |
-| πŸ”§βΈ block/unblock | `blockContact`, `unblockContact` on **wwjs**. Without it both answer an opaque `500` on every id, so the capability is dead rather than degraded; the blocklist read still works, which makes the failure look one-sided. |
-| πŸ”§ΒΉβ° media send repair | Every **wwjs** send that carries media: `sendImageMessage`, `sendVideoMessage`, `sendAudioMessage`, `sendVoiceMessage`, `sendDocumentMessage`, `sendStickerMessage` and the media status posts. On the WhatsApp Web builds from 2026-09-17 the library's own id is clobbered by the media model and every such send answers a bare `500`, while text sends keep working. Not row-marked: it covers a whole class of rows rather than one. |
+that sense every row does depend on a patch on each side. "Patch-dependent" below means a patch
+this row needs specifically, which is usually marked in the row and, for the two that cover a whole
+class of rows (πŸ”§βΈ and πŸ”§ΒΉβ°), stated in the table instead.
+
+| Patch | Matrix rows that depend on it |
+| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| πŸ”§ΒΉ message-id backport | **The whole wwjs column** (header-marked, not repeated per row): every wwjs cell that sends, receives or resolves a message id. On unpatched 1.34.7 against WhatsApp Web β‰₯ 2.3000.x, sends return no message object and chat/media reads throw the minified `r: r`. Not row-specific, so the wwjs column header carries `πŸ”§ΒΉ`. |
+| πŸ”§Β² status-send repair | `postTextStatus`, `postImageStatus`, `postVideoStatus`, `postVoiceStatus` β€” **wwjs cells only**. Stock 1.34.7 throws before any status send on current WhatsApp Web builds. These four rows are βœ… on both engines, but the wwjs side works only because of this patch. |
+| πŸ”§Β³ newsletter link preview | `sendTextMessage` (and any send carrying a link preview) **to a channel JID** on wwjs. Row-marked on `sendTextMessage` as the common case. |
+| πŸ”§β΄ ready-sync | `initialize` on wwjs (warm-restore readiness race). Row-marked. |
+| πŸ”§β΅ app-state resync bound | No single row β€” keeps the Baileys socket's app-state resync from spinning (~1000 wasted 60s queries/day). Connection health under **every baileys cell**; the baileys column header carries `πŸ”§β΅`. |
+| πŸ”§βΆ newsletter-create parse | `createChannel` on **baileys** β€” without it the call always answers 500 and leaks the channel it just created. Row-marked. |
+| πŸ”§β· participant arity | `removeParticipants`, `promoteParticipants`, `demoteParticipants` on **wwjs**. Without it a request naming only non-members throws an arity assertion on removal, and promote/demote answer `200` for people WhatsApp never touched; the patch returns one boolean per REQUESTED id so the adapter reports a real per-participant outcome. Row-marked. |
+| πŸ”§βΉ group description | `setGroupDescription` on **wwjs**. Without it every call throws in the page and answers a bare `500`, so the capability is dead rather than degraded; `setGroupSubject` beside it is unaffected. Row-marked. |
+| πŸ”§βΈ block/unblock | `blockContact`, `unblockContact` on **wwjs**. Without it both answer an opaque `500` on every id, so the capability is dead rather than degraded; the blocklist read still works, which makes the failure look one-sided. |
+| πŸ”§ΒΉβ° media send repair | Every **wwjs** send that carries media: `sendImageMessage`, `sendVideoMessage`, `sendAudioMessage` (voice notes included, through `ptt`), `sendDocumentMessage`, `sendStickerMessage` and the media status posts. On the WhatsApp Web builds from 2026-09-17 the library's own id is clobbered by the media model and every such send answers a bare `500`, while text sends keep working. Not row-marked: it covers a whole class of rows rather than one. |
Rows that are βœ… on **both** engines where one side is patch-dependent: `initialize` (πŸ”§β΄ wwjs),
`sendTextMessage` (πŸ”§Β³ wwjs), `postTextStatus` / `postImageStatus` / `postVideoStatus` /
`postVoiceStatus` (πŸ”§Β² wwjs), `removeParticipants` / `promoteParticipants` / `demoteParticipants`
-(πŸ”§β· wwjs), `setGroupDescription` (πŸ”§βΉ wwjs), and every media-carrying send (πŸ”§ΒΉβ° wwjs). Everything else that is βœ…-both carries no row-level mark, but still
-rests on the column-wide πŸ”§ΒΉ (wwjs) and πŸ”§β΅ (baileys) β€” no row runs on stock library code on both
-sides.
+(πŸ”§β· wwjs), `setGroupDescription` (πŸ”§βΉ wwjs), `blockContact` / `unblockContact` (πŸ”§βΈ wwjs), and
+every media-carrying send (πŸ”§ΒΉβ° wwjs). The last two are not marked in the rows themselves, because
+each covers a whole class of rows rather than one; every other entry here is. Everything else that
+is βœ…-both carries no patch dependency of its own, but still rests on the column-wide πŸ”§ΒΉ (wwjs) and
+πŸ”§β΅ (baileys), so no row runs on stock library code on both sides.
### 29.3.3 Why no patch surfaces `transferChannelOwnership`'s swallowed reason
diff --git a/src/common/docs-next-version.spec.ts b/src/common/docs-next-version.spec.ts
index f75102d5b..a3ae72b0c 100644
--- a/src/common/docs-next-version.spec.ts
+++ b/src/common/docs-next-version.spec.ts
@@ -8,31 +8,65 @@ import { join } from 'path';
* prose was only ever checked by someone reading it, and a typo, or a page left behind when the
* release number changed, would ship pointing operators at a version that never existed.
*
- * The rule this pins is the narrow one that is always true:
+ * The rule this pins is the narrow one that is always true: a version OLDER than or equal to the
+ * package version is history and is not this spec's business, while a NEWER one is a forward
+ * reference to the release being prepared, so there may be exactly one of them. The day the tag is
+ * cut, bumping `package.json` is enough: the references become history and this spec falls silent.
*
- * - a version OLDER than or equal to the package version is history and is not this spec's business;
- * - a version NEWER than it is a forward reference to the release being prepared, so there may be
- * exactly ONE of them, and the changelog must still be open (`[Unreleased]`) for it to make sense.
+ * WHAT IT CANNOT SEE, stated rather than assumed. The docs name far more third-party versions than
+ * ours, so the scan below is a heuristic with two deliberate holes:
*
- * So the day the tag is cut, bumping `package.json` is enough: the references become history and this
- * spec falls silent. What it catches is the pair going out of step.
+ * - only versions sharing the package's MAJOR count. While the project is on `0.x` that is what
+ * separates our `0.23.6` from `1.34.7` (whatsapp-web.js) or `7.0.0` (Baileys). The cost is that a
+ * forward reference across a major bump is invisible, and it has to be: `1.0.0` appears about
+ * eighteen times already, as a plugin manifest version, a roadmap milestone and a spec URL.
+ * - only versions that read as prose. A version glued to a preceding operator or colon belongs to
+ * something else (`httpx>=0.25.0`, `prom/alertmanager:v0.26.0`) and is skipped, as is one inside
+ * quotes, which is a literal in an example rather than a sentence about this project.
+ *
+ * Both holes fail SILENT, never loud: they can let a stale reference through, and that is the right
+ * direction for a gate nobody can override.
*/
const ROOT = join(__dirname, '..', '..');
-const SEMVER = /\b(\d+)\.(\d+)\.(\d+)\b/g;
-function packageVersion(): [number, number, number] {
- const raw = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf8')) as { version: string };
- const parts = raw.version.split('.').map(Number);
- return [parts[0], parts[1], parts[2]];
-}
+/**
+ * A semantic version that reads as prose: at the start of a line or after whitespace, a backtick or
+ * an opening paren, with an optional `v`. Deliberately NOT after `=`, `<`, `>`, `~`, `^`, `:`, `/`
+ * or a quote, which is where a dependency constraint, an image tag or a JSON literal puts one.
+ */
+const PROSE_SEMVER = /(?:^|[\s`(])v?(\d+)\.(\d+)\.(\d+)\b/gm;
+
+export type Semver = [number, number, number];
-function isNewer(a: [number, number, number], b: [number, number, number]): boolean {
+function isNewer(a: Semver, b: Semver): boolean {
if (a[0] !== b[0]) return a[0] > b[0];
if (a[1] !== b[1]) return a[1] > b[1];
return a[2] > b[2];
}
-/** Every doc file plus the changelog: the prose an operator reads, not the code. */
+/**
+ * Versions named in `text` that are newer than `current` and share its major, keyed by the numeric
+ * form so `v0.23.6` and `0.23.6` are one entry rather than two. Exported for this file's own tests:
+ * a gate that is only ever run against the live tree has no negative case.
+ */
+export function forwardVersionsIn(text: string, current: Semver): string[] {
+ const found = new Set<string>();
+ for (const match of text.matchAll(PROSE_SEMVER)) {
+ const version: Semver = [Number(match[1]), Number(match[2]), Number(match[3])];
+ if (version[0] !== current[0]) continue;
+ if (!isNewer(version, current)) continue;
+ found.add(version.join('.'));
+ }
+ return [...found].sort();
+}
+
+function packageVersion(): Semver {
+ const raw = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf8')) as { version: string };
+ const [major, minor, patch] = raw.version.split('.').map(Number);
+ return [major, minor, patch];
+}
+
+/** Every doc file plus the changelog and the readme: the prose an operator reads, not the code. */
function docFiles(): string[] {
const docsDir = join(ROOT, 'docs');
const docs = readdirSync(docsDir)
@@ -41,36 +75,47 @@ function docFiles(): string[] {
return [...docs, join(ROOT, 'CHANGELOG.md'), join(ROOT, 'README.md')];
}
+describe('forwardVersionsIn', () => {
+ const current: Semver = [0, 23, 5];
+
+ it('finds a forward reference however it is written, and counts it once', () => {
+ expect(forwardVersionsIn('upgrading from 0.23.6 to `0.23.6` (v0.23.6)', current)).toEqual(['0.23.6']);
+ });
+
+ it('ignores history, the current version, and anything of another major', () => {
+ expect(forwardVersionsIn('0.23.4 and 0.23.5 and 1.34.7 and 7.0.0', current)).toEqual([]);
+ });
+
+ it('ignores a version that belongs to something else', () => {
+ // The three shapes this tree actually contains: a dependency constraint, a container image tag,
+ // and a version literal inside a JSON example.
+ expect(
+ forwardVersionsIn('httpx>=0.25.0,<1.0 and prom/alertmanager:v0.26.0 and "version": "0.99.0"', current),
+ ).toEqual([]);
+ });
+
+ it('reports every distinct forward version, which is what the gate refuses', () => {
+ expect(forwardVersionsIn('from 0.23.6 in one page and 0.24.0 in another', current)).toEqual(['0.23.6', '0.24.0']);
+ });
+});
+
describe('a version named in the docs before its tag exists', () => {
- it('is the same one everywhere, and only while the changelog is still open', () => {
+ it('is the same one everywhere', () => {
const current = packageVersion();
- const changelog = readFileSync(join(ROOT, 'CHANGELOG.md'), 'utf8');
const ahead = new Map<string, string[]>();
for (const file of docFiles()) {
const text = readFileSync(file, 'utf8');
// The changelog's own released headings are the history it exists to record, not forward
- // references, so they are read from the body below rather than matched here.
+ // references, so only the unreleased section above them is read.
const body = file.endsWith('CHANGELOG.md') ? text.split(/^## \[\d/m)[0] : text;
- for (const match of body.matchAll(SEMVER)) {
- const version: [number, number, number] = [Number(match[1]), Number(match[2]), Number(match[3])];
- // Only this project's own version line. The docs name plenty of third-party versions, and
- // some of them sort above ours; a gate that argued about a dependency bump would be noise.
- // A forward reference to OpenWA is by construction the current minor or the next one.
- if (version[0] !== current[0]) continue;
- if (version[1] !== current[1] && version[1] !== current[1] + 1) continue;
- if (!isNewer(version, current)) continue;
- const key = match[0];
- ahead.set(key, [...(ahead.get(key) ?? []), file.replace(ROOT + '/', '')]);
+ for (const version of forwardVersionsIn(body, current)) {
+ ahead.set(version, [...(ahead.get(version) ?? []), file.replace(ROOT + '/', '')]);
}
}
- const named = [...ahead.keys()].sort();
- expect(named.length).toBeLessThanOrEqual(1);
-
- if (named.length === 1) {
- // A forward reference only makes sense while the release it names is still being prepared.
- expect(changelog).toContain('## [Unreleased]');
- }
+ // Named in the assertion, not just counted, so a red build says WHICH versions and WHICH pages.
+ const named = [...ahead.entries()].map(([version, files]) => `${version} in ${[...new Set(files)].join(', ')}`);
+ expect(named.length > 1 ? named.sort() : []).toEqual([]);
});
});
diff --git a/src/engine/adapters/baileys-events.ts b/src/engine/adapters/baileys-events.ts
index 37b059a27..cd2299091 100644
--- a/src/engine/adapters/baileys-events.ts
+++ b/src/engine/adapters/baileys-events.ts
@@ -201,10 +201,12 @@ export class BaileysEvents {
void this.host.inboundLimiter
.run(() => this.processInboundMessage(msg))
.catch((error: unknown) => {
- // Two different failures land here and they are not the same event. The limiter closing is
- // an orderly teardown; anything else is a real download failure, and reporting it as
- // "saturated" sent operators to look at concurrency settings for a problem that was never
- // there. Say which one happened.
+ // Only one failure can actually land here today: the limiter closing, an orderly teardown.
+ // Its queue is unbounded so it never sheds, and processInboundMessage swallows its own
+ // errors, so nothing else rejects. The other arm is defence in depth against a rejection
+ // shape that does not exist yet, and it names the error rather than calling it
+ // "saturated", which used to send operators to look at concurrency settings for a problem
+ // that was never there. The retry below cannot reject either, for the same reason.
const closed = error instanceof Error && error.message.startsWith('ConcurrencyLimiter closed');
this.host.logger.warn(
closed
diff --git a/src/engine/adapters/baileys-history.spec.ts b/src/engine/adapters/baileys-history.spec.ts
index 098de104b..43af7a014 100644
--- a/src/engine/adapters/baileys-history.spec.ts
+++ b/src/engine/adapters/baileys-history.spec.ts
@@ -183,6 +183,30 @@ describe('hydrateNames', () => {
expect(resyncAppState.mock.calls.filter(([, initial]) => initial === true)).toHaveLength(1);
});
+ it('retries the snapshot on the next reconnect when the pull itself failed', async () => {
+ // The once-per-instance flag is set BEFORE the await so two connects cannot pull concurrently,
+ // which means a failed pull would otherwise spend the one attempt this instance gets and leave
+ // the address book empty until a process restart.
+ const set = jest.fn().mockRejectedValueOnce(new Error('socket closed')).mockResolvedValue(undefined);
+ const resyncAppState = jest.fn().mockResolvedValue(undefined);
+ const { history: h } = history(
+ {
+ groupFetchAllParticipating: jest.fn().mockResolvedValue({}),
+ resyncAppState,
+ authState: { creds: { accountSyncCounter: 1 }, keys: { set } },
+ },
+ { contactCount: 0 },
+ );
+
+ await h.hydrateNames(); // the pull throws and is swallowed by the outer catch
+ expect(set).toHaveBeenCalledTimes(1);
+ expect(resyncAppState.mock.calls.filter(([, initial]) => initial === true)).toHaveLength(0);
+
+ await h.hydrateNames();
+ expect(set).toHaveBeenCalledTimes(2);
+ expect(resyncAppState).toHaveBeenCalledWith(['critical_unblock_low'], true);
+ });
+
it('uses the incremental resync on a first link (accountSyncCounter is still 0)', async () => {
// First connect still has Baileys' own snapshot path in flight; forcing another snapshot would
// race it. Empty contacts here are the boot window, not a missed reconnect.
diff --git a/src/engine/adapters/baileys-status-own-send.spec.ts b/src/engine/adapters/baileys-status-own-send.spec.ts
index 7f510fe2b..37a30e3a6 100644
--- a/src/engine/adapters/baileys-status-own-send.spec.ts
+++ b/src/engine/adapters/baileys-status-own-send.spec.ts
@@ -3,21 +3,27 @@ import type { WASocket } from '@whiskeysockets/baileys';
/**
* A status post and a status revoke both go through `sock.sendMessage` directly rather than the
- * messaging delegate's chokepoint, so each has to record its own id. Without that, the library's
- * `append` echo of the post is not recognised as this session's and is reported as an inbound
- * message; nothing else in the suite covered either call.
+ * messaging delegate's chokepoint, so each has to record its own id. Nothing else in the suite
+ * covered either call.
+ *
+ * What the recording buys differs per call, and neither is "the post shows up as an inbound
+ * message": the projector drops a `fromMe` status outright, so a post's echo would be discarded
+ * anyway, just after the whole inbound pipeline had run for it. The revoke is the one with a
+ * visible consequence. Its echo is a `protocolMessage` REVOKE, which the event handler turns into
+ * `onMessageRevoked` whether or not it came from this session, so deleting your own status would
+ * raise a `message.revoked` webhook for your own delete.
*/
-function makeStatus(sendMessage: jest.Mock): { status: BaileysStatus; remembered: string[] } {
- const remembered: string[] = [];
+function makeStatus(sendMessage: jest.Mock): { status: BaileysStatus; remembered: Array<string | null | undefined> } {
+ // Records the argument verbatim, with no guard of its own: OwnSendRegistry.remember is what
+ // ignores a nullish id (see baileys-own-sends.spec.ts), and a guard here would test the stub.
+ const remembered: Array<string | null | undefined> = [];
const host = {
ensureReady: () => undefined,
getSocket: () => ({ sendMessage }) as unknown as WASocket,
toEngineJid: (jid: string) => jid,
normalizedSelfJid: () => '[email protected]',
toUnixSeconds: () => 1700000000,
- rememberOwnSend: (id: string | null | undefined) => {
- if (id) remembered.push(id);
- },
+ rememberOwnSend: (id: string | null | undefined) => remembered.push(id),
} as unknown as BaileysStatusHost;
return { status: new BaileysStatus(host), remembered };
}
@@ -41,12 +47,14 @@ describe('BaileysStatus records the ids of the statuses this session sends', ()
expect(remembered).toEqual(['REVOKE-1']);
});
- it('records nothing when the send echoes no id back', async () => {
+ it('survives a send that echoes nothing back, and hands on the nothing it found', async () => {
+ // The library can resolve a send with no message object at all. Reading the id off it must not
+ // throw, and the registry is what decides that an absent id is not worth remembering.
const sendMessage = jest.fn().mockResolvedValue(undefined);
const { status, remembered } = makeStatus(sendMessage);
- await status.deleteStatus('STATUS-1');
+ await expect(status.deleteStatus('STATUS-1')).resolves.not.toThrow();
- expect(remembered).toEqual([]);
+ expect(remembered).toEqual([undefined]);
});
});
diff --git a/src/modules/plugins/plugin-installer.spec.ts b/src/modules/plugins/plugin-installer.spec.ts
index 95a2261ce..98a939f4c 100644
--- a/src/modules/plugins/plugin-installer.spec.ts
+++ b/src/modules/plugins/plugin-installer.spec.ts
@@ -94,6 +94,24 @@ describe('parsePluginPackage', () => {
expect(() => parsePluginPackage(zipOf({ 'index.js': 'x' }))).toThrow(/no manifest/i);
});
+ it('rejects bytes that are not a zip at all with a 400', () => {
+ expect(() => parsePluginPackage(Buffer.from('not a zip at all'))).toThrow(BadRequestException);
+ });
+
+ it('rejects an archive whose trailer parses but whose directory does not, with a 400', () => {
+ // adm-zip's constructor reads only the end-of-central-directory record; the central directory
+ // is parsed lazily by getEntries(). An archive corrupted between the two throws out of
+ // getEntries ('Invalid CEN header'), which used to escape as a plain Error and reach the
+ // caller as a 500 for what is an unreadable upload.
+ const good = zipOf({ 'manifest.json': JSON.stringify(validManifest), 'index.js': 'x' });
+ const bad = Buffer.from(good);
+ const eocd = bad.lastIndexOf(Buffer.from([0x50, 0x4b, 0x05, 0x06]));
+ bad.writeUInt32LE(0xdeadbeef, bad.readUInt32LE(eocd + 16)); // clobber the first CEN signature
+
+ expect(() => parsePluginPackage(bad)).toThrow(BadRequestException);
+ expect(() => parsePluginPackage(bad)).toThrow(/not a valid \.zip archive/i);
+ });
+
it('rejects a manifest missing a required field', () => {
const bad = { ...validManifest, main: undefined };
expect(() => parsePluginPackage(zipOf({ 'manifest.json': JSON.stringify(bad), 'index.js': 'x' }))).toThrow(
diff --git a/src/modules/session/dto/session-proxy-credentials.spec.ts b/src/modules/session/dto/session-proxy-credentials.spec.ts
index 2183007ae..80c567348 100644
--- a/src/modules/session/dto/session-proxy-credentials.spec.ts
+++ b/src/modules/session/dto/session-proxy-credentials.spec.ts
@@ -29,13 +29,13 @@ describe('proxy credential escapes on both routes that accept a proxy URL', () =
it('refuses it on the proxy update route, naming the escape', async () => {
expect(await messagesFrom(UpdateSessionProxyDto, { proxyUrl: BAD })).toEqual([
- expect.stringContaining('percent-escape'),
+ expect.stringContaining('invalid percent-escape'),
]);
});
it('refuses it on the session create route', async () => {
expect(await messagesFrom(CreateSessionDto, { name: 'sess', proxyUrl: BAD })).toEqual([
- expect.stringContaining('percent-escape'),
+ expect.stringContaining('invalid percent-escape'),
]);
});
diff --git a/src/modules/session/session.service.spec.ts b/src/modules/session/session.service.spec.ts
index 0be1f2517..1120f732d 100644
--- a/src/modules/session/session.service.spec.ts
+++ b/src/modules/session/session.service.spec.ts
@@ -6070,9 +6070,12 @@ describe('SessionService', () => {
});
});
- // ── stop ──────────────────────────────────────────────────────────
+ // ── stop / logout / forceKill ─────────────────────────────────────
- describe('stop', () => {
+ // Named for all three: the disconnect-announcement cases below cover logout and forceKill as
+ // well, since the three share one teardown guard, and reporting them under 'stop' alone hid
+ // which verb a failure belonged to.
+ describe('stop (and the teardown its siblings share)', () => {
it('should disconnect engine and set status to DISCONNECTED', async () => {
const session = createMockSession();
(repository.findOne as jest.Mock).mockResolvedValue(session);
diff --git a/src/modules/webhook/filters/filter-evaluator.spec.ts b/src/modules/webhook/filters/filter-evaluator.spec.ts
index d290dec40..725267e21 100644
--- a/src/modules/webhook/filters/filter-evaluator.spec.ts
+++ b/src/modules/webhook/filters/filter-evaluator.spec.ts
@@ -248,10 +248,13 @@ describe('evaluateFilters', () => {
// them rather than scoping them, which is a real surprise for anyone allowlisting a group, so
// it is pinned here and warned about in docs/06 rather than left to be discovered.
it('suppresses message.ack and message.failed, whose payload carries no conversation', () => {
- const ackPayload = { id: 'M1', messageId: 'M1', status: 'delivered', ack: 3 };
+ // Real pairings: deliveryStatusToAck maps delivered to 2 and failed to -1, and message.failed
+ // is a copy of the same object, so the fixture must not invent a status/ack pair of its own.
+ const ackPayload = { id: 'M1', messageId: 'M1', status: 'delivered', ack: 2 };
+ const failedPayload = { id: 'M1', messageId: 'M1', status: 'failed', ack: -1 };
const allow = filters({ field: 'chatId', operator: 'is', value: ['[email protected]'] });
expect(evaluateFilters(allow, 'message.ack', ackPayload)).toBe(false);
- expect(evaluateFilters(allow, 'message.failed', { ...ackPayload, status: 'failed' })).toBe(false);
+ expect(evaluateFilters(allow, 'message.failed', failedPayload)).toBe(false);
// And the exclusion direction delivers them, for the same reason: the field is not there.
const deny = filters({ field: 'chatId', operator: 'isNot', value: ['[email protected]'] });