From d8d8315e3eb971871d51ee08f8f1840ac53a1801 Mon Sep 17 00:00:00 2001 From: Kjell Tore Guttormsen Date: Fri, 1 May 2026 21:24:42 +0200 Subject: [PATCH] test(ai-psychosis): sync perf fixture to actual pattern count (41) --- plugins/ai-psychosis/tests/perf.test.mjs | 26 +++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/plugins/ai-psychosis/tests/perf.test.mjs b/plugins/ai-psychosis/tests/perf.test.mjs index b4f0003..c03a51b 100644 --- a/plugins/ai-psychosis/tests/perf.test.mjs +++ b/plugins/ai-psychosis/tests/perf.test.mjs @@ -78,9 +78,15 @@ function measureWallClock(scriptName, stdinTemplate) { // These mirror each hook's hot path in pure inline code so we can measure // regex + I/O cost without paying the ~80ms ESM cold-start tax. The pattern // list intentionally mirrors the size class of prompt-analyzer's full -// pattern set (~25 regexes) so the benchmark stays representative. +// pattern set (41 regexes = 25 negative + 12 pushback + 4 domain in v1.1.0) +// so the benchmark stays representative. Patterns here are structurally +// equivalent to the real ones (length + complexity), not literal copies — +// the privacy boundary at prompt-analyzer.mjs:119 means production patterns +// must stay co-located with the privacy wipe. Keep in sync with +// prompt-analyzer.mjs pattern count when v1.2 patterns ship (Steps 6-8). const samplePatterns = [ + // Negative emotional patterns (25 — matches v1.1.0) /\bI\s+can'?t\s+do\s+this\s+without\b/i, /\bwhat\s+should\s+I\b/i, /\bI\s+need\s+you\s+to\b/i, @@ -106,6 +112,24 @@ const samplePatterns = [ /\bwhy\s+did\s+I\b/i, /\bI\s+messed\s+up\b/i, /\bI\s+made\s+a\s+mistake\b/i, + // Pushback patterns (12 — matches v1.1.0) + /\bbut\s+(?:that|this)\s+is\s+wrong\b/i, + /\bno,?\s+I\s+(?:meant|asked|said)\b/i, + /\byou(?:'?re|\s+are)\s+(?:wrong|mistaken|incorrect)\b/i, + /\bthat'?s\s+not\s+(?:right|what)\b/i, + /\bactually,?\s+(?:I|the)\b/i, + /\bdisagree\s+(?:with|because)\b/i, + /\bI\s+(?:still|already)\s+(?:think|believe)\b/i, + /\blisten,?\s+(?:I|you)\b/i, + /\bdon'?t\s+(?:tell|give)\s+me\b/i, + /\bjust\s+(?:do|say|tell)\s+(?:it|me)\b/i, + /\bI\s+(?:already|just)\s+decided\b/i, + /\byou\s+(?:keep|always)\s+(?:saying|missing)\b/i, + // Domain patterns (4 — matches v1.1.0) + /\bmy\s+(?:partner|spouse|husband|wife|boyfriend|girlfriend)\b/i, + /\b(?:our|the)\s+relationship\b/i, + /\bbreak\s+up\s+(?:with|over)\b/i, + /\bdating\s+(?:someone|him|her|them)\b/i, ]; function logicSessionStart(dir, sid) {