Skip to content

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

fix(pendo): require aggregation envelopes for search queries

Rudy Celeklibcdf3548bf0a
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 39ddc4c..68a230d 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -6,7 +6,7 @@
},
"metadata": {
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"repository": "https://github.com/coreyhaines31/marketingskills"
},
"plugins": [
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index f1a5cf8..aabe26f 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "marketing-skills",
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"author": {
"name": "Corey Haines"
},
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 45d9d89..9cd1f4c 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "marketing-skills",
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"author": {
"name": "Corey Haines"
},
diff --git a/VERSIONS.md b/VERSIONS.md
index dc6d5ce..2b8e656 100644
--- a/VERSIONS.md
+++ b/VERSIONS.md
@@ -57,6 +57,10 @@ Current versions of all skills. Agents can compare against local versions to che
## Recent Changes
+### 2.11.27 (2026-10-10)
+
+- Validate visitor/account search aggregation envelopes before delivery or preview.
+
### 2.11.26 (2026-10-08)
- **lead-magnets** (2.0.0 → 2.1.0): new `references/content-to-skill.md` (plus corpus design and release companions) on packaging a course, webinar series, podcast, or newsletter archive you own as an installable agent skill: a new kind of lead magnet. From @rudycelekli's #725 (closes #432), folded in rather than added as a new skill. Triggers added: 'course as a skill,' 'package our content as an agent skill.' **ai-seo** (2.7.5 → 2.7.6) points to it.
diff --git a/tests/clis/pendo-search-query-shape.test.cjs b/tests/clis/pendo-search-query-shape.test.cjs
new file mode 100644
index 0000000..22c8ca0
--- /dev/null
+++ b/tests/clis/pendo-search-query-shape.test.cjs
@@ -0,0 +1,24 @@
+const {test}=require('node:test')
+const assert=require('node:assert/strict')
+const {spawnSync}=require('node:child_process')
+const path=require('node:path')
+const cli=path.resolve(__dirname,'../../tools/clis/pendo.js')
+function run(resource,value,preview=false){
+ const args=[resource,'search','--query',value];if(preview)args.push('--dry-run')
+ const source=`global.fetch=async(url,opts)=>{process.stderr.write('FETCH_CALLED');return {status:200,text:async()=>JSON.stringify({url,body:JSON.parse(opts.body),headers:opts.headers})}};process.argv=['node',${JSON.stringify(cli)},...${JSON.stringify(args)}];require(${JSON.stringify(cli)})`
+ return spawnSync(process.execPath,['-e',source],{encoding:'utf8',env:{...process.env,PENDO_INTEGRATION_KEY:'fixture-key'},timeout:5000})
+}
+test('rejects non-aggregation search queries before delivery or preview',()=>{
+ for(const resource of ['visitors','accounts'])for(const value of ['null','[]','true','42','"text"','{}','{"request":null}','{"request":[]}','{"request":{"pipeline":{}}}'])for(const preview of [false,true]){
+ const result=run(resource,value,preview);assert.equal(result.status,1);assert.equal(result.stderr.includes('FETCH_CALLED'),false);assert.match(JSON.parse(result.stderr).error,/aggregation object with request.pipeline as an array/)
+ }
+})
+test('preserves complete search envelopes and masking',()=>{
+ for(const resource of ['visitors','accounts'])for(const preview of [false,true]){
+ const body={response:{mimeType:'application/json'},request:{requestId:'fixture',pipeline:[{source:{[resource]:null}},{limit:10}]}}
+ const result=run(resource,JSON.stringify(body),preview);assert.equal(result.status,0,result.stderr);const output=JSON.parse(result.stdout);assert.deepEqual(output.body,body);assert.equal(output.headers['x-pendo-integration-key'],preview?'***':'fixture-key');assert.match(output.url,/\/aggregation$/)
+ }
+})
+test('preserves malformed search-query diagnostics',()=>{
+ for(const resource of ['visitors','accounts']){const result=run(resource,'{broken');assert.equal(result.stderr.includes('FETCH_CALLED'),false);assert.equal(JSON.parse(result.stdout).error,'Invalid JSON in --query')}
+})
diff --git a/tools/clis/pendo.js b/tools/clis/pendo.js
index 3321b73..467a479 100755
--- a/tools/clis/pendo.js
+++ b/tools/clis/pendo.js
@@ -122,6 +122,9 @@ async function main() {
if (!query) { result = { error: '--query <json> required' }; break }
let body
try { body = JSON.parse(query) } catch { result = { error: 'Invalid JSON in --query' }; break }
+ if (!body || typeof body !== 'object' || Array.isArray(body) || !Array.isArray(body.request?.pipeline)) {
+ throw new Error('--query must be an aggregation object with request.pipeline as an array')
+ }
result = await api('POST', '/aggregation', body)
break
}
@@ -143,6 +146,9 @@ async function main() {
if (!query) { result = { error: '--query <json> required' }; break }
let body
try { body = JSON.parse(query) } catch { result = { error: 'Invalid JSON in --query' }; break }
+ if (!body || typeof body !== 'object' || Array.isArray(body) || !Array.isArray(body.request?.pipeline)) {
+ throw new Error('--query must be an aggregation object with request.pipeline as an array')
+ }
result = await api('POST', '/aggregation', body)
break
}