Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(changelog): correct the status-post count and tighten the docs/29 gate

Yudhi Armyndharis5d379062e958
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ea43d3973..65ff13a3b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -114,7 +114,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`Target closed` tore its session down, emitted `session.disconnected` to every consumer, paused
inbound delivery for the reconnect, and answered `503` instead of `404`. Errors the gateway
constructs are now excluded outright.
-- The three whatsapp-web.js status posts and the channel create no longer answer `503` when the
+- The four whatsapp-web.js status posts, the channel create and the call-link create no longer answer `503` when the
browser page dies. The library can throw after the request is already on the wire, and `503` is
the status the clients replay for a POST, so a retry could publish the status twice. They answer
the same opaque `500` the message sends do. `DELETE` on a status keeps `503`, which is safe to
diff --git a/src/engine/docs-29-counts.spec.ts b/src/engine/docs-29-counts.spec.ts
index a28d32bfc..96281bb1f 100644
--- a/src/engine/docs-29-counts.spec.ts
+++ b/src/engine/docs-29-counts.spec.ts
@@ -37,15 +37,22 @@ describe('docs/29 names the engine library versions the tree pins', () => {
});
it('names no other exact version of either library', () => {
- // Non-vacuity, and the actual failure mode: the stale rc13 sat beside a correct figure
- // elsewhere in the file, so a containment check alone would have passed.
+ // Non-vacuity, and the actual failure mode: a stale version sitting beside a correct figure
+ // elsewhere in the file, so a containment check alone would pass. A library reference is not
+ // always adjacent to its version either: the intro names the package in backticks a line above
+ // its build, so an adjacency scan would miss exactly one of the two places this gate protects.
//
- // Only COMPLETE versions count. `1.34.x` names a release line rather than a build and is
- // ordinary prose, so a major.minor.x form is not a claim this gate can adjudicate.
- const mentioned = [...doc.matchAll(/(?:baileys|whatsapp-web\.js)\s+(\d+\.\d+\.\d[\w.-]*)/gi)].map(m => m[1]);
- const allowed = new Set([pkg.dependencies['whatsapp-web.js'], pkg.dependencies['@whiskeysockets/baileys']]);
- expect(mentioned.length).toBeGreaterThan(0);
- expect(mentioned.filter(v => !allowed.has(v))).toEqual([]);
+ // Scan by each pin's own `major.minor.` prefix instead. That is specific enough to skip the
+ // section numbers (29.x.y) and the WhatsApp Web build (2.3000.x) that share the file, and catches
+ // a drifted build wherever it sits. `1.34.x` is left alone on purpose: a `.x` release-line
+ // reference has no digit in its patch position, so the `\d` below never matches it.
+ for (const pin of [pkg.dependencies['whatsapp-web.js'], pkg.dependencies['@whiskeysockets/baileys']]) {
+ const [major, minor] = pin.split('.');
+ const shape = new RegExp(String.raw`\b${major}\.${minor}\.\d[\w.-]*`, 'g');
+ const found = doc.match(shape) ?? [];
+ expect(found.length).toBeGreaterThan(0);
+ expect(found.filter(v => v !== pin)).toEqual([]);
+ }
});
});