Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(scripts): harvest JS SDK route literals in every quote style

Yudhi Armyndharisdf8e7ace5851
diff --git a/scripts/check-sdk-coverage.mjs b/scripts/check-sdk-coverage.mjs
index 3f0090712..fb010680f 100644
--- a/scripts/check-sdk-coverage.mjs
+++ b/scripts/check-sdk-coverage.mjs
@@ -70,8 +70,9 @@ const CHAIN = new RegExp(`${TERM}(?:\\s*\\+\\s*${TERM})*`, 'g');
*
* `baseValue` is a resolved `…Service.base()` body (Go). Each rule exists because its absence
* produced a false positive:
- * (a) quoted literals in any quote style — the JS client writes some paths in single quotes, and
- * a backtick-only scan silently skips them (the shipped forward gate still does).
+ * (a) quoted literals in any quote style — the JS client writes some paths in single quotes, which
+ * a backtick-only scan silently skips. The forward gate (check-sdk-routes.mjs) was blind to
+ * exactly those nine literals until it was widened to match this one.
* (b) `+`-chains — Java and Go assemble paths rather than writing them whole.
* (c) base plus a bare suffix, with and without an interposed id segment — Go's per-service
* helpers take `"/read"` or `"reply"` and the caller never names the whole path.
diff --git a/scripts/check-sdk-routes.mjs b/scripts/check-sdk-routes.mjs
index 980d9f81b..9bd07e6ee 100644
--- a/scripts/check-sdk-routes.mjs
+++ b/scripts/check-sdk-routes.mjs
@@ -52,7 +52,14 @@ const walk = (dir, exts, out = []) => {
// Source directories only — test files assert against fixtures and may legitimately name paths the
// package never builds.
const SDKS = [
- { name: 'javascript', dir: 'sdk/javascript/src', exts: ['.ts'], re: /`(\/api\/[^`]*)`/g },
+ // Any quote style, not just backticks. The JS client writes its parameterless routes as
+ // single-quoted strings — nine of them, including the `/api/health/ready` path Kubernetes and the
+ // container HEALTHCHECK probe — and a backtick-only scan never saw one. Renaming any of those on
+ // the server regenerated openapi.json, passed `openapi:check`, passed this gate (which never
+ // harvested the literal), and passed the JS suite (whose oracle is the URL the SDK itself built),
+ // so the published client would 404 with CI fully green. check-sdk-coverage.mjs already harvests
+ // every quote style; this brings the forward gate level with it.
+ { name: 'javascript', dir: 'sdk/javascript/src', exts: ['.ts'], re: /[`"'](\/api\/[^`"']*)[`"']/g },
{ name: 'php', dir: 'sdk/php/src', exts: ['.php'], re: /["'](\/api\/[^"']*)["']/g },
{ name: 'python', dir: 'sdk/python/openwa', exts: ['.py'], re: /["'](\/api\/[^"']*)["']/g },
];