@resolveio/server-lib 22.3.64 → 22.3.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/util/ai-qa-policy.js +5 -0
- package/util/ai-qa-policy.js.map +1 -1
package/package.json
CHANGED
package/util/ai-qa-policy.js
CHANGED
|
@@ -139,6 +139,8 @@ function buildResolveIOQaPolicyRules(options) {
|
|
|
139
139
|
}
|
|
140
140
|
if (policy.qaLiveDataRequired) {
|
|
141
141
|
rules.push('For bug fixes and data/publication changes, test against available live app data or a faithful seeded record; do not rely only on static inspection when the user reported a runtime workflow problem.');
|
|
142
|
+
rules.push('Local QA may create, update, or delete representative seed records only in the localhost QA Mongo/database started for the run. Production/live customer databases are read-only for QA unless explicit human approval is provided.');
|
|
143
|
+
rules.push('If the localhost QA database has no records for the workflow under test, seed the smallest faithful record set needed to exercise the customer action and identify the seeded fixture IDs/names in the QA Coverage Matrix. Do not return blocked only because local QA data is empty.');
|
|
142
144
|
rules.push('For import/export/form-submit/data workflows, QA must drive the actual customer action with representative data: capture the relevant starting state, the dialog/form/file selection or action state, and the submitted/resulting state with a row/count/value assertion that proves the bug or feature works.');
|
|
143
145
|
rules.push('A navigation-only screenshot of an empty page, shell, table header, or unchanged screen is not sufficient evidence for data workflow fixes. If the page has no records, seed or choose a faithful test record and identify the record or fixture used.');
|
|
144
146
|
}
|
|
@@ -169,10 +171,12 @@ function buildResolveIORunnerQaCoverageChecklist(input) {
|
|
|
169
171
|
];
|
|
170
172
|
if (/\b(invoice|billing|line item|surcharge|price|pricing|tax|sales tax)\b|(?:^|\/)(?:invoice|pricing|sales-tax|customer|item)(?:\/|-)/i.test(text)) {
|
|
171
173
|
rules.push('Invoice/billing/tax coverage: test create/new and edit/reopen where touched; verify line-item persistence, surcharge add/remove/default/override selection, subtotal/tax/total calculations, taxable vs non-taxable behavior, and the saved invoice detail/list state.');
|
|
174
|
+
rules.push('When invoice/billing/tax QA has no usable local records, seed a minimal localhost-only customer, job/order/delivery or treatment, taxable item, non-taxable/surcharge item, and inventory/location data needed to create and save the invoice workflow; record the fixture IDs/names and do not touch production data.');
|
|
172
175
|
rules.push('Invoice/billing/tax coverage must include at least one concrete row/value assertion from the saved document or UI after submit, not only pre-submit form screenshots.');
|
|
173
176
|
}
|
|
174
177
|
if (/\b(inventory|warehouse|stock|fifo|pick ticket|checkout|check out|transaction)\b|(?:^|\/)(?:inventory|part|chemical|production-location|yard)(?:\/|-)/i.test(text)) {
|
|
175
178
|
rules.push('Inventory coverage: test the relevant source/destination location, transaction creation/reversal, FIFO or location selection when applicable, report/pick-ticket output when touched, and persisted inventory quantities/values after save/edit/delete.');
|
|
179
|
+
rules.push('When inventory QA has no usable local records, seed the smallest localhost-only item/location/quantity/value fixture needed to prove quantity/value movement and identify that fixture in the evidence.');
|
|
176
180
|
}
|
|
177
181
|
if (/\b(report|export|csv|excel|xlsx|download|filter|total|grouping)\b|(?:^|\/)report(?:\/|-)/i.test(text)) {
|
|
178
182
|
rules.push('Report/export coverage: verify rows, filters/date ranges, totals/grouping, download/export output, and at least one row/count/value assertion.');
|
|
@@ -662,6 +666,7 @@ function buildResolveIORunnerRepairPlans(input) {
|
|
|
662
666
|
ticketText: blocker,
|
|
663
667
|
changedFiles: changedFiles
|
|
664
668
|
})), false), [
|
|
669
|
+
'If localhost QA has no usable records for a required workflow, seed a minimal faithful fixture in the local QA database and cite the fixture IDs/names in the matrix; production data stays read-only.',
|
|
665
670
|
'If QA finds a product defect while covering the matrix, fix that defect in a targeted repair wave, rerun compile/startup preflight, then rerun the failed matrix row before continuing.',
|
|
666
671
|
'Return pass only after the matrix is complete; otherwise return needs-fix with the exact missing matrix row.'
|
|
667
672
|
], false), selfGateCommands: [
|
package/util/ai-qa-policy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/ai-qa-policy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AY,EAAE,CAAC,+GAA+G,CAAC,EAC/H,gBAAgB,EAAE,CAAC,gHAAgH,CAAC,EACpI,gBAAgB,EAAE,6EAA6E,KAC7F,KAAK,EAAE,YAAY,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,YAAY,KAAK,6CAA6C,EAAE,CAAC;YACpE,OAAO,wCAAwC,uBAC3C,IAAI,KACP,aAAa,EAAE;oBACd,gGAAgG;oBAChG,8FAA8F;oBAC9F,oIAAoI;iBACpI,EACD,YAAY,EAAE;oBACb,kKAAkK;oBAClK,kNAAkN;oBAClN,qLAAqL;oBACrL,mJAAmJ;oBACnJ,2GAA2G;iBAC3G,EACD,gBAAgB,EAAE;oBACjB,oEAAoE;oBACpE,4DAA4D;oBAC5D,4EAA4E;oBAC5E,iEAAiE;iBACjE,EACD,gBAAgB,EAAE,sLAAsL,KACtM,KAAK,EAAE,YAAY,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,YAAY,KAAK,yBAAyB,EAAE,CAAC;YAChD,OAAO,wCAAwC,uBAC3C,IAAI,KACP,aAAa,EAAE,CAAC,yEAAyE,CAAC,EAC1F,YAAY,EAAE,CAAC,8EAA8E,CAAC,EAC9F,gBAAgB,EAAE,CAAC,gEAAgE,CAAC,EACpF,gBAAgB,EAAE,0GAA0G,KAC1H,KAAK,EAAE,YAAY,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,wCAAwC,uBAC3C,IAAI,KACP,aAAa,EAAE,CAAC,kGAAkG,CAAC,EACnH,YAAY,EAAE,CAAC,mGAAmG,CAAC,EACnH,gBAAgB,EAAE,CAAC,sBAAsB,EAAE,wDAAwD,CAAC,EACpG,gBAAgB,EAAE,4EAA4E,KAC5F,KAAK,EAAE,YAAY,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACJ,CAAC","file":"ai-qa-policy.js","sourcesContent":["export type ResolveIOQaPolicyContext =\n\t| 'support_ticket'\n\t| 'aicoder_dashboard'\n\t| 'ai_terminal'\n\t| 'general';\n\nexport interface ResolveIOQaPolicyOptions {\n\tcontext?: ResolveIOQaPolicyContext;\n\tincludeDevServerRules?: boolean;\n\tqaRepairEnabled?: boolean;\n\tqaEvidenceRequired?: boolean;\n\tqaDistinctScreenshotRequired?: boolean;\n\tqaFailFastCompile?: boolean;\n\tqaLiveDataRequired?: boolean;\n\tqaSelfRepairMaxWaves?: number;\n\tcurrentRoute?: string;\n\tcurrentContextMode?: string;\n\tcustomInstructions?: string[];\n}\n\nexport interface ResolveIORunnerBasicsOptions extends ResolveIOQaPolicyOptions {\n\tincludeQaPolicy?: boolean;\n\tincludeTokenDiscipline?: boolean;\n\tincludeDependencyBootstrap?: boolean;\n\tincludeRepairLoop?: boolean;\n\tincludeEvidenceContract?: boolean;\n\tmaxContextBullets?: number;\n\tmaxRepairWaves?: number;\n}\n\nexport interface ResolveIORunnerPromptInput extends ResolveIORunnerBasicsOptions {\n\tobjective?: string;\n\tblockers?: string[];\n\trelevantFiles?: string[];\n\tevidence?: string[];\n\tpriorSummary?: string;\n\tlatestFailure?: string;\n\tmaxBlockers?: number;\n\tmaxFiles?: number;\n\tmaxEvidence?: number;\n\tmaxTextChars?: number;\n}\n\nexport interface ResolveIORunnerContract {\n\tcontext: ResolveIOQaPolicyContext;\n\tsections: {\n\t\trunnerBasics: string[];\n\t\ttokenDiscipline: string[];\n\t\tdependencyBootstrap: string[];\n\t\trepairLoop: string[];\n\t\tqaPolicy: string[];\n\t\tevidenceContract: string[];\n\t\tfinalNotes: string[];\n\t};\n\trules: string[];\n\tpromptLines: string[];\n}\n\nexport interface ResolveIORunnerPromptBundle extends ResolveIORunnerContract {\n\tobjective: string;\n\tcontextLines: string[];\n\trepairLines: string[];\n\tfullPromptLines: string[];\n}\n\nexport interface ResolveIORunnerRepairPlan {\n\tblockerClass: string;\n\tsourceGate: string;\n\ttargetFiles: string[];\n\tlineHints: string[];\n\tfailureEvidence: string[];\n\trequiredProof: string[];\n\trepairRecipe: string[];\n\tselfGateCommands: string[];\n\tpassingCondition: string;\n}\n\nexport interface ResolveIORunnerRepairTargetOverride {\n\tpreferredSuffixes?: string[];\n\tfallbackFiles?: string[];\n}\n\nexport interface ResolveIORunnerRepairPlanInput extends ResolveIORunnerBasicsOptions {\n\tblockers?: string[];\n\tchangedFiles?: string[];\n\tgateSource?: string;\n\ttargetFileOverrides?: Record<string, ResolveIORunnerRepairTargetOverride>;\n}\n\nexport interface ResolveIORunnerRepairContinuationInput {\n\tcurrentBlockers?: string[];\n\tpreviousBlockers?: string[];\n\tactiveContractBlockers?: string[];\n\tcurrentAttempt?: number;\n\tmaxAttempts?: number;\n\tcurrentRepairWaveCount?: number;\n\tmaxRepairWaves?: number;\n\tdiffHash?: string;\n\tevidenceHash?: string;\n\tpreviousDiffHash?: string;\n\tpreviousEvidenceHash?: string;\n}\n\nexport type ResolveIORunnerRepairContinuationAction =\n\t| 'continue_attempt'\n\t| 'start_repair_wave'\n\t| 'park_repeated_blocker'\n\t| 'park_no_progress'\n\t| 'park_repair_wave_budget';\n\nexport interface ResolveIORunnerRepairContinuationDecision {\n\taction: ResolveIORunnerRepairContinuationAction;\n\trepeatedBlockers: string[];\n\tnewBlockers: string[];\n\tnormalizedCurrentBlockers: string[];\n\tnextAttempt: number;\n\tnextRepairWaveCount: number;\n\treason: string;\n}\n\nexport interface ResolveIORunnerQaCoverageInput {\n\tticketText?: string;\n\tchangedFiles?: string[];\n}\n\nfunction normalizeOptionalString(value: any): string {\n\treturn String(value || '').replace(/\\s+/g, ' ').trim();\n}\n\nfunction normalizePositiveInteger(value: any, fallback: number, min: number, max: number): number {\n\tconst numeric = Number(value);\n\tif (!Number.isFinite(numeric)) {\n\t\treturn fallback;\n\t}\n\tconst rounded = Number(numeric.toFixed(0));\n\treturn Math.max(min, Math.min(max, rounded));\n}\n\nfunction normalizeTextLine(value: any, maxChars: number): string {\n\treturn normalizeOptionalString(value).slice(0, maxChars).trim();\n}\n\nfunction normalizeTextList(values: any, limit: number, maxChars: number): string[] {\n\tif (!Array.isArray(values)) {\n\t\treturn [];\n\t}\n\tconst result: string[] = [];\n\tfor (const value of values) {\n\t\tconst normalized = normalizeTextLine(value, maxChars);\n\t\tif (normalized && !result.includes(normalized)) {\n\t\t\tresult.push(normalized);\n\t\t}\n\t\tif (result.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn result;\n}\n\nexport function normalizeResolveIOQaPolicyOptions(options: ResolveIOQaPolicyOptions = {}): Required<Omit<ResolveIOQaPolicyOptions, 'currentRoute' | 'currentContextMode' | 'customInstructions'>> & {\n\tcurrentRoute: string;\n\tcurrentContextMode: string;\n\tcustomInstructions: string[];\n} {\n\treturn {\n\t\tcontext: options.context || 'general',\n\t\tincludeDevServerRules: options.includeDevServerRules === true,\n\t\tqaRepairEnabled: options.qaRepairEnabled !== false,\n\t\tqaEvidenceRequired: options.qaEvidenceRequired !== false,\n\t\tqaDistinctScreenshotRequired: options.qaDistinctScreenshotRequired !== false,\n\t\tqaFailFastCompile: options.qaFailFastCompile !== false,\n\t\tqaLiveDataRequired: options.qaLiveDataRequired !== false,\n\t\tqaSelfRepairMaxWaves: normalizePositiveInteger(options.qaSelfRepairMaxWaves, 3, 1, 6),\n\t\tcurrentRoute: normalizeOptionalString(options.currentRoute),\n\t\tcurrentContextMode: normalizeOptionalString(options.currentContextMode),\n\t\tcustomInstructions: Array.isArray(options.customInstructions)\n\t\t\t? options.customInstructions.map(normalizeOptionalString).filter(Boolean).slice(0, 12)\n\t\t\t: []\n\t};\n}\n\nexport function buildResolveIOQaPolicyRules(options: ResolveIOQaPolicyOptions = {}): string[] {\n\tconst policy = normalizeResolveIOQaPolicyOptions(options);\n\tconst rules: string[] = [];\n\tif (policy.includeDevServerRules) {\n\t\trules.push(\n\t\t\t'When browser/localhost QA needs long-running commands like `npm run server`, `npm run client`, `npm run dev`, `ng serve`, `vite`, or `nodemon`, start them as managed background processes with log files and PIDs; do not leave foreground dev-server commands as the active shell tool.',\n\t\t\t'Before localhost/browser QA, source `.resolveio-support-tools/env.sh` or `.resolveio-ai-runner-tools/env.sh` when present. It supplies shared EC2 browser cache settings, `PUPPETEER_EXECUTABLE_PATH`/`CHROME_BIN`, Mongo wrappers, and non-conflicting localhost QA ports/URLs.',\n\t\t\t'For ResolveIO app login during browser QA, use the shared AI-runner auth bootstrap when staged: `node ./.resolveio-support-tools/qa-auth-bootstrap.js <project-root> /target-route`, `node ./.resolveio-ai-runner-tools/qa-auth-bootstrap.js <project-root> /target-route`, or the same command from an app root with `../`. It must use the exact localhost client origin, log out/clear stale browser credentials first, call `/login` then `/accessToken`, seed auth storage, and emit `qa-artifacts/auth-bootstrap-result.json` plus a screenshot.',\n\t\t\t'When launching Puppeteer or Playwright on workers, pass `executablePath: process.env.PUPPETEER_EXECUTABLE_PATH || process.env.CHROME_BIN` if either env var is set. Do not download a fresh browser before checking these env vars and `PUPPETEER_CACHE_DIR`.',\n\t\t\t'Use the managed-server pattern for localhost QA: `command > .build-output/<name>.log 2>&1 & PID=$!; trap \"kill $PID 2>/dev/null || true\" EXIT; wait for the port with curl; run browser checks; then kill/wait the PID`. Prefer `npm run client` or `./start_client.sh`; those scripts honor `RESOLVEIO_SUPPORT_QA_CLIENT_PORT` and `PORT`. Never run `ng serve ... | tee ...` or another dev server as a foreground command.'\n\t\t);\n\t}\n\tif (policy.qaFailFastCompile) {\n\t\trules.push('Before browser QA, run the fastest compile/type/startup checks that can prove the app can load. Fix compile/startup failures before launching browser QA.');\n\t}\n\tif (policy.qaRepairEnabled) {\n\t\trules.push(`If compile, startup, browser, or live-data QA fails, run a targeted repair wave for the exact failing route/action/data state, then rerun that same failed step before continuing. Limit self-repair to ${policy.qaSelfRepairMaxWaves} focused waves before returning the precise blocker.`);\n\t\trules.push('QA findings are implementation blockers, not manual TODOs: when QA proves missing fields, wrong publication payloads, failed persistence, bad calculations, missing side effects, or incomplete workflow coverage, return a typed needs-fix blocker so the runner starts a focused repair wave and reruns the same QA coverage.');\n\t}\n\tif (policy.qaLiveDataRequired) {\n\t\trules.push('For bug fixes and data/publication changes, test against available live app data or a faithful seeded record; do not rely only on static inspection when the user reported a runtime workflow problem.');\n\t\trules.push('For import/export/form-submit/data workflows, QA must drive the actual customer action with representative data: capture the relevant starting state, the dialog/form/file selection or action state, and the submitted/resulting state with a row/count/value assertion that proves the bug or feature works.');\n\t\trules.push('A navigation-only screenshot of an empty page, shell, table header, or unchanged screen is not sufficient evidence for data workflow fixes. If the page has no records, seed or choose a faithful test record and identify the record or fixture used.');\n\t}\n\trules.push('Before passing QA, create a QA Coverage Matrix from the approved scope, changed files, generated/publication changes, and touched collections/models. Each matrix row must name the workflow, route/screen, data used, assertion, screenshot/trace artifact, and pass/fail result.');\n\trules.push('QA must cover the full suite of changed customer-facing and data behavior, not only one smoke path. If implementation touches create/edit/delete/reopen flows, each touched flow needs proof or an explicit ticket-backed not-applicable note.');\n\trules.push('If the change touches invoices, billing, taxes, inventory, pricing, surcharges, imports/exports, reports, or publications, QA must include persisted data assertions and calculation/side-effect checks for every touched domain before returning pass.');\n\trules.push('Use desktop screenshots at a wide/full-screen viewport by default: 1920x1080 or wider. Do not use narrow/tablet/mobile screenshots unless the approved ticket is specifically mobile/responsive.');\n\trules.push('For desktop QA, verify the top navigation is in its normal desktop state and not wrapped, collapsed, open, or covering the workflow. For mobile-specific QA, explicitly use a mobile viewport and close the mobile menu unless the menu behavior itself is being proven.');\n\tif (policy.qaDistinctScreenshotRequired) {\n\t\trules.push('Capture one screenshot or trace for each distinct changed customer-facing feature, screen, workflow state, or data result. Do not repeat equivalent screenshots for multiple records unless record-specific behavior changed.');\n\t}\n\trules.push('Every screenshot artifact must include a short customer-facing caption explaining what the screenshot proves. Captions should describe the workflow state, such as Before, Ready to import, Submitted result, or Mobile menu closed.');\n\tif (policy.qaEvidenceRequired) {\n\t\trules.push('Final notes must list the exact QA command, route, account/data used, screenshot/trace/log paths, and result for each changed behavior; if browser QA is not applicable, say why and provide the compile/data proof used instead.');\n\t}\n\tif (policy.currentRoute) {\n\t\trules.push(`Current app context route from the AI terminal is ${policy.currentRoute}${policy.currentContextMode ? ` (${policy.currentContextMode})` : ''}; start QA there when the request refers to this page or current screen.`);\n\t}\n\trules.push(...policy.customInstructions);\n\treturn rules;\n}\n\nexport function buildResolveIORunnerQaCoverageChecklist(input: ResolveIORunnerQaCoverageInput = {}): string[] {\n\tconst text = `${input.ticketText || ''}\\n${(input.changedFiles || []).join('\\n')}`;\n\tconst rules: string[] = [\n\t\t'Build and include a QA Coverage Matrix: changed workflow, route/screen, data fixture/live record, before/action/after assertion, screenshot/trace artifact, caption, and result.',\n\t\t'Fail QA as needs-fix when coverage only proves navigation, headers, empty tables, or UI controls without exercising the changed behavior and persisted result.'\n\t];\n\tif (/\\b(invoice|billing|line item|surcharge|price|pricing|tax|sales tax)\\b|(?:^|\\/)(?:invoice|pricing|sales-tax|customer|item)(?:\\/|-)/i.test(text)) {\n\t\trules.push('Invoice/billing/tax coverage: test create/new and edit/reopen where touched; verify line-item persistence, surcharge add/remove/default/override selection, subtotal/tax/total calculations, taxable vs non-taxable behavior, and the saved invoice detail/list state.');\n\t\trules.push('Invoice/billing/tax coverage must include at least one concrete row/value assertion from the saved document or UI after submit, not only pre-submit form screenshots.');\n\t}\n\tif (/\\b(inventory|warehouse|stock|fifo|pick ticket|checkout|check out|transaction)\\b|(?:^|\\/)(?:inventory|part|chemical|production-location|yard)(?:\\/|-)/i.test(text)) {\n\t\trules.push('Inventory coverage: test the relevant source/destination location, transaction creation/reversal, FIFO or location selection when applicable, report/pick-ticket output when touched, and persisted inventory quantities/values after save/edit/delete.');\n\t}\n\tif (/\\b(report|export|csv|excel|xlsx|download|filter|total|grouping)\\b|(?:^|\\/)report(?:\\/|-)/i.test(text)) {\n\t\trules.push('Report/export coverage: verify rows, filters/date ranges, totals/grouping, download/export output, and at least one row/count/value assertion.');\n\t}\n\tif (/\\b(publication|methods?\\.ts|publications?\\.ts|subscription|publish|payload|field projection)\\b|(?:^|\\/)server\\/src\\/publications\\//i.test(text)) {\n\t\trules.push('Publication/API coverage: verify the changed fields are returned to the UI or method caller that needs them, including list/detail projections and any generated wrapper/call-site behavior.');\n\t}\n\tif (/\\b(import|upload|file|spreadsheet|template)\\b/i.test(text)) {\n\t\trules.push('Import/upload coverage: use a representative file/template, capture ready-to-upload and submitted states, and assert inserted/updated/skipped row counts plus visible result rows.');\n\t}\n\treturn Array.from(new Set(rules));\n}\n\nexport function buildResolveIORunnerBasicsRules(options: ResolveIORunnerBasicsOptions = {}): string[] {\n\treturn buildResolveIORunnerContract(options).rules;\n}\n\nexport function buildResolveIORunnerContract(options: ResolveIORunnerBasicsOptions = {}): ResolveIORunnerContract {\n\tconst maxContextBullets = normalizePositiveInteger(options.maxContextBullets, 8, 3, 20);\n\tconst maxRepairWaves = normalizePositiveInteger(\n\t\toptions.maxRepairWaves ?? options.qaSelfRepairMaxWaves,\n\t\t3,\n\t\t1,\n\t\t6\n\t);\n\tconst context = options.context || 'general';\n\tconst runnerBasics = [\n\t\t'Use repo-local patterns first: read the closest existing implementation, matching tests, model/schema, method/publication, and UI route before editing.',\n\t\t'Make the smallest complete change that satisfies the request; avoid broad refactors, config churn, dependency changes, and generated-file edits unless the workflow explicitly requires regeneration.',\n\t\t'Before returning, state what changed, how it was verified, remaining blockers, and exact artifact paths in final notes.'\n\t];\n\tconst tokenDiscipline = options.includeTokenDiscipline !== false\n\t\t? [\n\t\t\t`Keep context lean: summarize prior history into at most ${maxContextBullets} bullets, retrieve specific files on demand, and do not paste full logs, lockfiles, generated files, or stale ticket/email chains unless they are the current blocker evidence.`,\n\t\t\t'Prefer targeted search/read commands over loading broad directories. If a command returns noisy output, summarize the useful lines and continue with narrower reads.',\n\t\t\t'On retries, carry only the active blocker contract, changed-file list, relevant diff/evidence summary, and latest failing command output. Do not restart with a clean-slate mega prompt.',\n\t\t\t'Stop autonomous retries when the same normalized blocker repeats without meaningful diff or evidence improvement; park with a precise blocker instead of burning tokens.'\n\t\t]\n\t\t: [];\n\tconst dependencyBootstrap = options.includeDependencyBootstrap !== false\n\t\t? [\n\t\t\t'Reuse existing dependency caches and hydrated node_modules when available. Prefer npm install --force with the configured npm cache; do not use npm ci unless the workflow explicitly requires it.',\n\t\t\t'Before reinstalling or downloading browsers, check the existing workspace cache, shared node_modules, PUPPETEER_EXECUTABLE_PATH, CHROME_BIN, PUPPETEER_CACHE_DIR, and project-provided bootstrap scripts.'\n\t\t]\n\t\t: [];\n\tconst repairLoop = options.includeRepairLoop !== false\n\t\t? [\n\t\t\t`Use targeted repair waves: compile/startup blocker, browser route/action blocker, data/publication blocker, and review blocker each get a focused repair, then rerun the exact failed step. Limit this to ${maxRepairWaves} focused waves before returning a precise blocker.`,\n\t\t\t'Repair all instances of a detected blocker class in the touched scope, not only the first occurrence.'\n\t\t]\n\t\t: [];\n\tconst qaPolicy = options.includeQaPolicy !== false\n\t\t? buildResolveIOQaPolicyRules({\n\t\t\t...options,\n\t\t\tqaSelfRepairMaxWaves: maxRepairWaves\n\t\t})\n\t\t: [];\n\tconst evidenceContract = options.includeEvidenceContract !== false\n\t\t? [\n\t\t\t'Evidence must be customer/workflow oriented: routes, buttons, pages, data states, screenshots/traces, command results, and assertions. Do not expose internal file names, backend paths, stack traces, or implementation chatter in customer-facing text.',\n\t\t\t'For UI-facing changes, capture one screenshot or trace per distinct changed feature/workflow; for data-only changes, provide live-data or seeded-data assertion proof.',\n\t\t\t'For import, upload, export, form submit, calculation, publication, or persistence fixes, proof must show the before/action/after workflow state and a concrete row/count/value assertion. Empty shell screenshots do not count as proof.',\n\t\t\t'Desktop proof screenshots must use a wide/full-screen viewport, normally 1920x1080 or wider, with navigation closed/unwrapped unless the ticket is specifically about mobile or menu behavior.',\n\t\t\t'Each screenshot must have a customer-facing caption that says what the image proves; these captions are used in validation emails.'\n\t\t]\n\t\t: [];\n\tconst finalNotes = [\n\t\t'Final notes must include: changed behavior, touched functional areas, exact commands run, exact QA route/data state, screenshot/trace/log paths, and remaining blockers if any.',\n\t\t'If work is parked, final notes must name the blocker class, last failing command/artifact, why another autonomous attempt would repeat, and the smallest manual action needed.'\n\t];\n\tconst sections = {\n\t\trunnerBasics,\n\t\ttokenDiscipline,\n\t\tdependencyBootstrap,\n\t\trepairLoop,\n\t\tqaPolicy,\n\t\tevidenceContract,\n\t\tfinalNotes\n\t};\n\tconst rules = [\n\t\t...runnerBasics,\n\t\t...tokenDiscipline,\n\t\t...dependencyBootstrap,\n\t\t...repairLoop,\n\t\t...qaPolicy,\n\t\t...evidenceContract,\n\t\t...finalNotes\n\t];\n\tconst promptLines = [\n\t\t`ResolveIO shared runner contract (${context}):`,\n\t\t...rules.map((rule) => `- ${rule}`)\n\t];\n\treturn {\n\t\tcontext,\n\t\tsections,\n\t\trules,\n\t\tpromptLines\n\t};\n}\n\nexport function buildResolveIORunnerPromptLines(options: ResolveIORunnerBasicsOptions = {}): string[] {\n\treturn buildResolveIORunnerContract(options).promptLines;\n}\n\nexport function buildResolveIORunnerPromptBundle(input: ResolveIORunnerPromptInput = {}): ResolveIORunnerPromptBundle {\n\tconst contract = buildResolveIORunnerContract(input);\n\tconst maxTextChars = normalizePositiveInteger(input.maxTextChars, 900, 160, 2400);\n\tconst objective = normalizeTextLine(input.objective, maxTextChars)\n\t\t|| 'Complete the requested ResolveIO runner task with minimal, verified changes.';\n\tconst priorSummary = normalizeTextLine(input.priorSummary, maxTextChars);\n\tconst latestFailure = normalizeTextLine(input.latestFailure, maxTextChars);\n\tconst blockers = normalizeTextList(input.blockers, normalizePositiveInteger(input.maxBlockers, 5, 1, 12), maxTextChars);\n\tconst relevantFiles = normalizeTextList(input.relevantFiles, normalizePositiveInteger(input.maxFiles, 12, 1, 30), 260);\n\tconst evidence = normalizeTextList(input.evidence, normalizePositiveInteger(input.maxEvidence, 8, 1, 20), maxTextChars);\n\tconst contextLines = [\n\t\t`Objective: ${objective}`,\n\t\t...(priorSummary ? [`Prior summary: ${priorSummary}`] : []),\n\t\t...(latestFailure ? [`Latest failure: ${latestFailure}`] : []),\n\t\t...(blockers.length ? ['Active blockers:', ...blockers.map((line) => `- ${line}`)] : []),\n\t\t...(relevantFiles.length ? ['Relevant files:', ...relevantFiles.map((line) => `- ${line}`)] : []),\n\t\t...(evidence.length ? ['Known evidence:', ...evidence.map((line) => `- ${line}`)] : [])\n\t];\n\tconst repairLines = blockers.length\n\t\t? [\n\t\t\t'Mandatory repair contract:',\n\t\t\t'- Address each active blocker before unrelated work.',\n\t\t\t'- For each blocker, mark resolved, proven false, or blocked.',\n\t\t\t'- Attach code, data, command, browser, screenshot, or trace proof for each blocker.',\n\t\t\t'- If a blocker repeats with no meaningful diff/evidence change, park instead of starting another broad attempt.'\n\t\t]\n\t\t: [];\n\tconst fullPromptLines = [\n\t\t...contract.promptLines,\n\t\t'',\n\t\t'Runner task context:',\n\t\t...contextLines,\n\t\t...(repairLines.length ? ['', ...repairLines] : [])\n\t];\n\treturn {\n\t\t...contract,\n\t\tobjective,\n\t\tcontextLines,\n\t\trepairLines,\n\t\tfullPromptLines\n\t};\n}\n\nexport function buildResolveIORunnerRepairPromptLines(input: ResolveIORunnerPromptInput = {}): string[] {\n\treturn buildResolveIORunnerPromptBundle(input).repairLines;\n}\n\nexport function normalizeResolveIORunnerBlocker(entry: string): string {\n\treturn String(entry || '')\n\t\t.toLowerCase()\n\t\t.replace(/:[0-9]+(?=\\b|[);,.\\s])/g, ':#')\n\t\t.replace(/\\bline\\s+[0-9]+\\b/g, 'line #')\n\t\t.replace(/\\blines?\\s+[0-9]+\\s*[-–]\\s*[0-9]+\\b/g, 'lines #')\n\t\t.replace(/\\battempt\\s+[0-9]+\\b/g, 'attempt #')\n\t\t.replace(/\\s+/g, ' ')\n\t\t.trim();\n}\n\nfunction uniqueNormalizedResolveIORunnerBlockers(values: any): string[] {\n\tif (!Array.isArray(values)) {\n\t\treturn [];\n\t}\n\treturn Array.from(new Set(\n\t\tvalues\n\t\t\t.map((entry) => normalizeResolveIORunnerBlocker(String(entry || '')))\n\t\t\t.filter(Boolean)\n\t));\n}\n\nexport function findRepeatedResolveIORunnerBlockers(previousBlockers: string[] = [], currentBlockers: string[] = []): string[] {\n\tconst previous = new Set(uniqueNormalizedResolveIORunnerBlockers(previousBlockers));\n\tif (!previous.size) {\n\t\treturn [];\n\t}\n\treturn Array.from(new Set(\n\t\t(currentBlockers || [])\n\t\t\t.map((entry) => String(entry || '').trim())\n\t\t\t.filter((entry) => previous.has(normalizeResolveIORunnerBlocker(entry)))\n\t));\n}\n\nexport function decideResolveIORunnerRepairContinuation(\n\tinput: ResolveIORunnerRepairContinuationInput = {}\n): ResolveIORunnerRepairContinuationDecision {\n\tconst currentBlockers = (input.currentBlockers || [])\n\t\t.map((entry) => String(entry || '').trim())\n\t\t.filter(Boolean);\n\tconst normalizedCurrentBlockers = uniqueNormalizedResolveIORunnerBlockers(currentBlockers);\n\tconst previousBlockers = uniqueNormalizedResolveIORunnerBlockers(input.previousBlockers || []);\n\tconst activeContractBlockers = uniqueNormalizedResolveIORunnerBlockers(input.activeContractBlockers || []);\n\tconst priorBlockers = new Set([...previousBlockers, ...activeContractBlockers]);\n\tconst repeatedBlockers = findRepeatedResolveIORunnerBlockers(Array.from(priorBlockers), currentBlockers);\n\tconst repeated = new Set(repeatedBlockers.map((entry) => normalizeResolveIORunnerBlocker(entry)));\n\tconst newBlockers = currentBlockers.filter((entry) => !repeated.has(normalizeResolveIORunnerBlocker(entry)));\n\tconst currentAttempt = normalizePositiveInteger(input.currentAttempt, 1, 1, 100);\n\tconst maxAttempts = normalizePositiveInteger(input.maxAttempts, 3, 1, 100);\n\tconst currentRepairWaveCount = normalizePositiveInteger(input.currentRepairWaveCount, 0, 0, 100);\n\tconst maxRepairWaves = normalizePositiveInteger(input.maxRepairWaves, 3, 0, 100);\n\tconst diffHash = normalizeOptionalString(input.diffHash);\n\tconst evidenceHash = normalizeOptionalString(input.evidenceHash);\n\tconst previousDiffHash = normalizeOptionalString(input.previousDiffHash);\n\tconst previousEvidenceHash = normalizeOptionalString(input.previousEvidenceHash);\n\tconst noProgress = !!previousDiffHash\n\t\t&& !!previousEvidenceHash\n\t\t&& previousDiffHash === diffHash\n\t\t&& previousEvidenceHash === evidenceHash;\n\tconst nextAttempt = currentAttempt + 1;\n\tconst nextRepairWaveCount = currentRepairWaveCount + 1;\n\tif (noProgress) {\n\t\treturn {\n\t\t\taction: 'park_no_progress',\n\t\t\trepeatedBlockers,\n\t\t\tnewBlockers,\n\t\t\tnormalizedCurrentBlockers,\n\t\t\tnextAttempt,\n\t\t\tnextRepairWaveCount,\n\t\t\treason: 'Targeted repair made no meaningful diff or evidence progress.'\n\t\t};\n\t}\n\tif (repeatedBlockers.length) {\n\t\treturn {\n\t\t\taction: 'park_repeated_blocker',\n\t\t\trepeatedBlockers,\n\t\t\tnewBlockers,\n\t\t\tnormalizedCurrentBlockers,\n\t\t\tnextAttempt,\n\t\t\tnextRepairWaveCount,\n\t\t\treason: 'The same normalized blocker repeated after a targeted repair.'\n\t\t};\n\t}\n\tconst shouldStartNewWave = currentBlockers.length > 0\n\t\t&& (\n\t\t\tactiveContractBlockers.length > 0\n\t\t\t|| currentAttempt >= maxAttempts\n\t\t);\n\tif (shouldStartNewWave) {\n\t\tif (currentRepairWaveCount >= maxRepairWaves) {\n\t\t\treturn {\n\t\t\t\taction: 'park_repair_wave_budget',\n\t\t\t\trepeatedBlockers,\n\t\t\t\tnewBlockers,\n\t\t\t\tnormalizedCurrentBlockers,\n\t\t\t\tnextAttempt,\n\t\t\t\tnextRepairWaveCount,\n\t\t\t\treason: `Repair wave budget exhausted (${currentRepairWaveCount}/${maxRepairWaves}).`\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\taction: 'start_repair_wave',\n\t\t\trepeatedBlockers,\n\t\t\tnewBlockers,\n\t\t\tnormalizedCurrentBlockers,\n\t\t\tnextAttempt: 2,\n\t\t\tnextRepairWaveCount,\n\t\t\treason: 'A prior blocker was cleared and a new blocker appeared; start a focused repair wave instead of consuming the final attempt.'\n\t\t};\n\t}\n\treturn {\n\t\taction: 'continue_attempt',\n\t\trepeatedBlockers,\n\t\tnewBlockers,\n\t\tnormalizedCurrentBlockers,\n\t\tnextAttempt,\n\t\tnextRepairWaveCount: currentRepairWaveCount,\n\t\treason: 'Continue with the next targeted attempt.'\n\t};\n}\n\nexport function classifyResolveIORunnerBlocker(blocker: string): string {\n\tconst text = String(blocker || '');\n\tif (/database call inside loop|findOne.*inside loop|query inside loop/i.test(text)) {\n\t\treturn 'db_call_inside_loop';\n\t}\n\tif (/inventory transaction parity|inventory transactions? are correct|inventory transaction creation\\/reversal|inventory drift|reverse(?:s| old).*inventory|custom chemical lines?/i.test(text)) {\n\t\treturn 'inventory_transaction_parity';\n\t}\n\tif (/company\\/global default line-item surcharge|customer surcharge override|surcharge override.*default|global\\/company surcharge|fallback\\/override|first active surcharge/i.test(text)) {\n\t\treturn 'surcharge_default_precedence';\n\t}\n\tif (/\\bTS\\d{4}\\b[\\s\\S]{0,220}\\bExpected\\s+0\\s+arguments?\\b[\\s\\S]{0,160}\\bgot\\s+1\\b/i.test(text)\n\t\t&& /\\b(publication|publications\\.ts|subscribe|user_specific|ForUser|yardsForUser|customerNotifications|notificationCenter)\\b/i.test(text)) {\n\t\treturn 'user_specific_publication_argument_mismatch';\n\t}\n\tif (/\\b(publication signature mismatch|generated publication signature|publication wrapper)\\b[\\s\\S]{0,220}\\b(?:yardsForUser|[A-Za-z0-9_]*ForUser)\\b[\\s\\S]{0,160}\\bcompile errors?\\b/i.test(text)\n\t\t|| /\\b(?:yardsForUser|[A-Za-z0-9_]*ForUser)\\b[\\s\\S]{0,180}\\bcompile errors?\\b[\\s\\S]{0,180}\\b(publication|publications\\.ts|signature|wrapper)\\b/i.test(text)) {\n\t\treturn 'user_specific_publication_argument_mismatch';\n\t}\n\tif (/\\b(user_specific|user-specific)\\b[\\s\\S]{0,220}\\b(Expected\\s+0\\s+arguments?|got\\s+1|passes?\\s+1\\s+argument|publication wrapper)\\b/i.test(text)) {\n\t\treturn 'user_specific_publication_argument_mismatch';\n\t}\n\tif (/focused verification evidence|Behavior-level test\\/QA evidence|browser QA|screenshot|trace artifacts?|Billing Dashboard.*create\\/edit|server-side evidence|Validation evidence/i.test(text)) {\n\t\treturn 'support_qa_evidence';\n\t}\n\tif (/Approved scope requirement is not covered|approved .* scope lacks/i.test(text)) {\n\t\treturn 'approved_scope_missing';\n\t}\n\tif (/UI-facing ticket needs|browser\\/localhost QA|local\\/browser QA/i.test(text)) {\n\t\treturn 'ui_qa_missing';\n\t}\n\tif (/Report\\/export ticket needs|report rows|export behavior/i.test(text)) {\n\t\treturn 'report_export_missing';\n\t}\n\tif (/QA coverage matrix|full suite|limited smoke|too limited|only proves navigation|empty table|header screenshot|pre-submit only|missing persisted result|missing tax|missing inventory|missing invoice edit|missing reopen/i.test(text)) {\n\t\treturn 'qa_coverage_incomplete';\n\t}\n\tif (/Generated .* changed without a matching/i.test(text)) {\n\t\treturn 'generated_file_mismatch';\n\t}\n\tif (/No repository files changed|no verifiable PR fix/i.test(text)) {\n\t\treturn 'no_repo_diff';\n\t}\n\tif (/QA compile preflight|ng serve failed|Angular ng serve failed|Completion build verification failed|build failed|TypeScript check failed|TypeScript compile|lint failed|TS\\d{4}|Cannot find module/i.test(text)) {\n\t\treturn 'completion_build_failed';\n\t}\n\treturn 'reviewer_blocker';\n}\n\nexport function extractResolveIORunnerRepairLineHints(blocker: string): string[] {\n\tconst hints: string[] = [];\n\tconst lineMatch = String(blocker || '').match(/(?:line\\s+|:)([0-9]+)\\b/i);\n\tif (lineMatch) {\n\t\thints.push(`line ${lineMatch[1]}`);\n\t}\n\tconst loopMatch = String(blocker || '').match(/loop starts near line\\s+([0-9]+)/i);\n\tif (loopMatch) {\n\t\thints.push(`loop starts near line ${loopMatch[1]}`);\n\t}\n\treturn Array.from(new Set(hints));\n}\n\nexport function extractResolveIORunnerRepairTargetFiles(blocker: string, changedFiles: string[] = []): string[] {\n\tconst files = new Set<string>();\n\tconst text = String(blocker || '');\n\tconst pathPattern = /(?:^|\\s)([A-Za-z0-9_.-]+(?:\\/[A-Za-z0-9_.-]+)+\\.(?:ts|tsx|js|jsx|html|scss|css|json|md))/g;\n\tlet match: RegExpExecArray | null;\n\twhile ((match = pathPattern.exec(text))) {\n\t\tfiles.add(match[1].replace(/\\\\/g, '/'));\n\t}\n\tfor (const filePath of changedFiles || []) {\n\t\tconst normalized = String(filePath || '').trim().replace(/\\\\/g, '/');\n\t\tif (normalized && (text.includes(normalized) || text.includes(normalized.replace(/^[^/]+\\//, '')))) {\n\t\t\tfiles.add(normalized);\n\t\t}\n\t}\n\treturn Array.from(files).slice(0, 8);\n}\n\nexport function selectResolveIORunnerRepairTargetFiles(\n\tchangedFiles: string[] = [],\n\tpreferredSuffixes: string[] = [],\n\tfallbackFiles: string[] = []\n): string[] {\n\tconst suffixes = (preferredSuffixes || [])\n\t\t.map((entry) => String(entry || '').trim().replace(/\\\\/g, '/').replace(/^\\/+/, ''))\n\t\t.filter(Boolean);\n\tconst matched = new Set<string>();\n\tfor (const filePath of changedFiles || []) {\n\t\tconst normalized = String(filePath || '').trim().replace(/\\\\/g, '/');\n\t\tif (normalized && suffixes.some((suffix) => normalized === suffix || normalized.endsWith(`/${suffix}`))) {\n\t\t\tmatched.add(normalized);\n\t\t}\n\t}\n\treturn (matched.size\n\t\t? Array.from(matched)\n\t\t: fallbackFiles.map((entry) => String(entry || '').trim().replace(/\\\\/g, '/')).filter(Boolean)\n\t).slice(0, 12);\n}\n\nexport function sanitizeResolveIORunnerRepairPlans(value: any): ResolveIORunnerRepairPlan[] {\n\treturn Array.isArray(value)\n\t\t? value.map((entry: any) => ({\n\t\t\tblockerClass: String(entry?.blockerClass || '').trim(),\n\t\t\tsourceGate: String(entry?.sourceGate || '').trim(),\n\t\t\ttargetFiles: Array.isArray(entry?.targetFiles) ? entry.targetFiles.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\tlineHints: Array.isArray(entry?.lineHints) ? entry.lineHints.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\tfailureEvidence: Array.isArray(entry?.failureEvidence) ? entry.failureEvidence.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\trequiredProof: Array.isArray(entry?.requiredProof) ? entry.requiredProof.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\trepairRecipe: Array.isArray(entry?.repairRecipe) ? entry.repairRecipe.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\tselfGateCommands: Array.isArray(entry?.selfGateCommands) ? entry.selfGateCommands.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\tpassingCondition: String(entry?.passingCondition || '').trim()\n\t\t})).filter((entry: ResolveIORunnerRepairPlan) => entry.blockerClass || entry.failureEvidence.length)\n\t\t: [];\n}\n\nfunction getResolveIORunnerRepairTargetOverride(\n\toptions: ResolveIORunnerRepairPlanInput,\n\tblockerClass: string\n): ResolveIORunnerRepairTargetOverride | null {\n\tconst override = options.targetFileOverrides?.[blockerClass];\n\tif (!override) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tpreferredSuffixes: Array.isArray(override.preferredSuffixes) ? override.preferredSuffixes : [],\n\t\tfallbackFiles: Array.isArray(override.fallbackFiles) ? override.fallbackFiles : []\n\t};\n}\n\nfunction applyResolveIORunnerRepairTargetOverride(\n\tplan: ResolveIORunnerRepairPlan,\n\toptions: ResolveIORunnerRepairPlanInput,\n\tblockerClass: string\n): ResolveIORunnerRepairPlan {\n\tconst override = getResolveIORunnerRepairTargetOverride(options, blockerClass);\n\tif (!override || plan.targetFiles.length) {\n\t\treturn plan;\n\t}\n\treturn {\n\t\t...plan,\n\t\ttargetFiles: selectResolveIORunnerRepairTargetFiles(\n\t\t\toptions.changedFiles || [],\n\t\t\toverride.preferredSuffixes || [],\n\t\t\toverride.fallbackFiles || []\n\t\t)\n\t};\n}\n\nexport function buildResolveIORunnerRepairPlans(input: ResolveIORunnerRepairPlanInput = {}): ResolveIORunnerRepairPlan[] {\n\tconst changedFiles = Array.isArray(input.changedFiles) ? input.changedFiles : [];\n\tconst sourceGate = String(input.gateSource || 'pre_review_or_reviewer').trim() || 'pre_review_or_reviewer';\n\tconst qaRules = buildResolveIORunnerBasicsRules({\n\t\t...input,\n\t\tcontext: input.context || 'general',\n\t\tincludeDevServerRules: input.includeDevServerRules === true,\n\t\tmaxContextBullets: input.maxContextBullets || 8\n\t});\n\treturn Array.from(new Set((input.blockers || []).map((entry) => String(entry || '').trim()).filter(Boolean))).map((blocker) => {\n\t\tconst blockerClass = classifyResolveIORunnerBlocker(blocker);\n\t\tconst base: ResolveIORunnerRepairPlan = {\n\t\t\tblockerClass,\n\t\t\tsourceGate,\n\t\t\ttargetFiles: extractResolveIORunnerRepairTargetFiles(blocker, changedFiles),\n\t\t\tlineHints: extractResolveIORunnerRepairLineHints(blocker),\n\t\t\tfailureEvidence: [blocker].filter(Boolean).slice(0, 8),\n\t\t\trequiredProof: [],\n\t\t\trepairRecipe: [],\n\t\t\tselfGateCommands: [],\n\t\t\tpassingCondition: ''\n\t\t};\n\t\tif (blockerClass === 'db_call_inside_loop') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'Show the database lookup is batched before the loop, or prove the flagged call is not a database collection call.',\n\t\t\t\t\t'Cite the exact file/function and before-vs-after loop/query shape in Repair Execution Notes.',\n\t\t\t\t\t'Confirm the changed diff no longer has any per-item database collection call in any loop body in the touched/target server files.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t'Inspect every loop in the touched/target server files and identify all database collection calls inside those loops.',\n\t\t\t\t\t'Move collection reads before loops using batched `$in` queries, map results by id/key, then use the map inside loops.',\n\t\t\t\t\t'Move writes out of loops using batched `bulkWrite`/multi-update operations prepared inside the loop and executed after the loop.',\n\t\t\t\t\t'If the call is a local array/helper and not a database call, prove that with the declaration/import path and leave the code unchanged.',\n\t\t\t\t\t'Keep the behavior identical except for eliminating every per-item database call.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'git diff HEAD -- <target file>',\n\t\t\t\t\t'rg -n \"for .*\\\\{|\\\\.forEach|for \\\\(\" <target file>',\n\t\t\t\t\t'rg -n \"\\\\.(find|findOne|findOneAsync|count|countDocuments|update|updateOne|updateMany|insert|insertOne|bulkWrite|remove|deleteOne|deleteMany)\\\\(\" <target file>'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'No loop in the touched/target server files has a database collection call in its body, or final notes prove each flagged call is not a database call.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'report_export_missing') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: ['Prove report rows, filters, totals/grouping, and export behavior, or cite ticket evidence that export is out of scope.'],\n\t\t\t\trepairRecipe: ['Exercise the report/export path and record evidence for each report dimension requested by the ticket.'],\n\t\t\t\tselfGateCommands: ['Run the report/export verification command or browser flow for the ticket.'],\n\t\t\t\tpassingCondition: 'Final notes prove rows, filters, totals/grouping, and export behavior or a ticket-backed out-of-scope decision.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'inventory_transaction_parity') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'Prove non-Manual Delivery and Truck Treat custom chemical lines create inventory relief transactions on invoice create.',\n\t\t\t\t\t'Prove invoice edit reverses old custom chemical effects and applies the new custom chemical effects.',\n\t\t\t\t\t'Prove invoice remove/delete reverses the same non-Manual custom chemical inventory effects.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t'Start in server/src/methods/invoices.ts and trace Manual inventory behavior before changing the non-Manual path.',\n\t\t\t\t\t'Reuse the existing inventory transaction helper shape instead of creating a parallel inventory writer.',\n\t\t\t\t\t'Handle all custom chemical lines in one sweep: create, edit, and remove for Delivery and Truck Treat invoices.',\n\t\t\t\t\t'Do not stop after fixing only create; the reviewer blocker includes edit and remove reversal.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'git diff HEAD -- server/src/methods/invoices.ts server/src/methods/inventory-transactions.ts',\n\t\t\t\t\t'rg -n \"is_custom_line_item|addInventoryTransaction|removeInvoice|editInvoice|custom chemical\" server/src/methods/invoices.ts',\n\t\t\t\t\t'Run or add a focused server/data assertion covering create, edit, and remove inventory transactions for non-Manual custom chemical lines.'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'Create, edit, and remove paths for non-Manual custom chemical invoice lines all have inventory transaction proof.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'surcharge_default_precedence') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'Show the persisted company/global default surcharge owner, not just the first active surcharge item.',\n\t\t\t\t\t'Show precedence is customer override when active, then company/global default when active, then empty/none when inactive or unset.',\n\t\t\t\t\t'Show at least one override customer and one default customer path in verification evidence.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t'Find the surcharge default selector and replace any first-active-item fallback with an explicit persisted default setting.',\n\t\t\t\t\t'Keep customer override storage separate from the company/global default setting.',\n\t\t\t\t\t'Reject inactive surcharge items during both override and default fallback.',\n\t\t\t\t\t'Cover unset and inactive settings with safe empty/none behavior.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'git diff HEAD -- angular/app/manage/item angular/app/widgets/dialog/dialog.adjust-customer.content.ts server/src/collections server/src/models',\n\t\t\t\t\t'rg -n \"line_item_surcharge|surcharge|id_line_item_surcharge_override|default\" angular/app server/src',\n\t\t\t\t\t'Run or add a focused fallback/override assertion for active override, active company default, inactive override/default, and unset default.'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'Customer override -> company/global default -> none precedence is persisted and verified.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'support_qa_evidence') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'Include browser route and screenshot/trace artifact paths for each distinct changed customer-facing feature or workflow state.',\n\t\t\t\t\t'Do not duplicate screenshots across multiple customers unless the customer-specific override/fallback behavior is the feature being proven.',\n\t\t\t\t\t'Include data/assertion evidence for requested persistence, calculations, and side effects.',\n\t\t\t\t\t'Include a QA Coverage Matrix row for every approved scope item and every touched workflow/domain.',\n\t\t\t\t\t'For import/export/form-submit/data workflow fixes, include before/action/after screenshots or trace steps plus the exact row/count/value assertion proving the submitted data changed as expected.',\n\t\t\t\t\t'Reject empty page/table/header screenshots as insufficient unless the approved requirement is explicitly an empty-state UI.',\n\t\t\t\t\t'Use a 1920x1080-or-wider desktop viewport for screenshots unless the ticket explicitly requests mobile/responsive behavior; desktop nav must be closed and not wrapped over the workflow.',\n\t\t\t\t\t'Provide a customer-facing caption for each screenshot that explains the workflow state and proof shown.',\n\t\t\t\t\t'If browser QA cannot start, include the exact startup blocker and the compile/preflight command output.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t...qaRules,\n\t\t\t\t\t...buildResolveIORunnerQaCoverageChecklist({\n\t\t\t\t\t\tticketText: input.blockers?.join('\\n') || '',\n\t\t\t\t\t\tchangedFiles\n\t\t\t\t\t}),\n\t\t\t\t\t'Upload or preserve screenshots/trace paths so the PR and support ticket can reference them.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'Run the support QA compile/startup preflight.',\n\t\t\t\t\t'Run the ticket-specific browser QA click-through and capture screenshots/trace artifacts.',\n\t\t\t\t\t'Record artifact paths and data assertions in final notes.'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'Final notes include one QA screenshot/trace path per distinct changed feature plus data assertions for the approved scope.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'qa_coverage_incomplete') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'Provide a QA Coverage Matrix that covers every changed workflow/domain from the approved scope and diff.',\n\t\t\t\t\t'For invoice/billing/tax/inventory changes, include create/edit/reopen/delete or not-applicable coverage plus persisted row/value assertions.',\n\t\t\t\t\t'Show fresh screenshots/traces with customer-facing captions for each distinct changed workflow state.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t'Read the approved scope, BUILD_PLAN, changed files, and prior QA evidence; identify every workflow/domain touched by the implementation.',\n\t\t\t\t\t...buildResolveIORunnerQaCoverageChecklist({\n\t\t\t\t\t\tticketText: blocker,\n\t\t\t\t\t\tchangedFiles\n\t\t\t\t\t}),\n\t\t\t\t\t'If QA finds a product defect while covering the matrix, fix that defect in a targeted repair wave, rerun compile/startup preflight, then rerun the failed matrix row before continuing.',\n\t\t\t\t\t'Return pass only after the matrix is complete; otherwise return needs-fix with the exact missing matrix row.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'Run compile/startup preflight before browser QA.',\n\t\t\t\t\t'Run the ticket-specific browser/data QA flow for every QA Coverage Matrix row.',\n\t\t\t\t\t'Record artifact paths, captions, and persisted row/count/value assertions in final notes.'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'Every QA Coverage Matrix row has a pass result with screenshot/trace/data proof, or the job returns a precise needs-fix blocker that seeds the next repair wave.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'approved_scope_missing') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: ['Add one Self-Review Checklist bullet for the exact missing approved requirement with code/data/browser proof.'],\n\t\t\t\trepairRecipe: ['Verify the missing approved requirement, then implement or document done/not applicable/blocked with proof.'],\n\t\t\t\tselfGateCommands: ['Review final notes for exact approved requirement text and proof artifact.'],\n\t\t\t\tpassingCondition: 'Every missing approved requirement is explicitly mapped to done/not applicable/blocked with proof.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'ui_qa_missing') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: ['Provide browser route plus screenshot/trace/video path, or a precise LOCALHOST_QA_PLAYBOOK startup/access blocker.'],\n\t\t\t\trepairRecipe: ['Run local/browser QA for the failing UI route after the fix, or document the exact startup/access blocker.'],\n\t\t\t\tselfGateCommands: ['source .resolveio-support-tools/env.sh if present', 'Run the ticket-specific localhost/browser QA command or capture blocker.'],\n\t\t\t\tpassingCondition: 'Final notes contain browser QA artifact evidence or a concrete local startup/access blocker.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'generated_file_mismatch') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: ['Show generated client file changes correspond to matching server method/publication source changes.'],\n\t\t\t\trepairRecipe: ['Either update the server owner and regenerate the companion file, or revert the orphan generated file change.'],\n\t\t\t\tselfGateCommands: ['git diff HEAD -- angular/app/methods.ts angular/app/publications.ts server/src/methods server/src/publications'],\n\t\t\t\tpassingCondition: 'No generated client file is changed without its source server owner change.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'user_specific_publication_argument_mismatch') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'List every failing call site and show each one was fixed, not just the first TypeScript error.',\n\t\t\t\t\t'Show whether each call needs the current logged-in user or an explicit other user/driver id.',\n\t\t\t\t\t'Show generated angular/app/publications.ts came from server/src/publications source and was not hand-edited as the behavioral fix.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t'user_specific publications inject the logged-in socket user as the first server parameter; generated client wrappers should remove only that injected parameter.',\n\t\t\t\t\t'Before changing call sites, inspect the source publication signature. If a client can pass a target user/driver, make the source explicit as function(id_current_user: string, id_user?: string) and regenerate.',\n\t\t\t\t\t'Only remove a client argument when the publication truly uses the injected current user only; otherwise preserve explicit target-user/driver calls such as yardsForUser(id_driver).',\n\t\t\t\t\t'Do not hand-edit generated angular/app/publications.ts to accept the injected id_user again; fix source publications/call sites, then regenerate.',\n\t\t\t\t\t'Search the whole app for the failing wrapper name and repair all argument-passing calls in the same pass.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'rg -n \"\\\\b[A-Za-z0-9_]*ForUser\\\\s*\\\\([^)]+\" angular/app server/src',\n\t\t\t\t\t'rg -n \"\\\\byardsForUser\\\\s*\\\\([^)]+\" angular/app server/src',\n\t\t\t\t\t'Run the method/publication generator if server publication source changed.',\n\t\t\t\t\t'Rerun the exact TypeScript/Angular compile command that failed.'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'Generated user_specific wrappers strip only the injected current-user parameter, explicit target-user arguments still compile where required, and the exact compile command exits 0.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'completion_build_failed') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: ['Include the failing command, root cause, fix, and passing rerun output.'],\n\t\t\t\trepairRecipe: ['Fix the compile/test failure directly, then rerun the exact failing command.'],\n\t\t\t\tselfGateCommands: ['Rerun the exact completion/build command shown in the blocker.'],\n\t\t\t\tpassingCondition: 'The exact previously failing build/test command passes or is blocked with concrete environment evidence.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t...base,\n\t\t\trequiredProof: ['Resolve, prove false, or block this reviewer/gate blocker with concrete code/data/browser proof.'],\n\t\t\trepairRecipe: ['Inspect the cited file/evidence, make the smallest supported fix, and cite before-vs-after proof.'],\n\t\t\tselfGateCommands: ['git diff HEAD --stat', 'Run the ticket-specific verification for this blocker.'],\n\t\t\tpassingCondition: 'The blocker text no longer applies and final notes include concrete proof.'\n\t\t}, input, blockerClass);\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/util/ai-qa-policy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+JA,8EAoBC;AAED,kEA2CC;AAED,0FAyBC;AAED,0EAEC;AAED,oEAiFC;AAED,0EAEC;AAED,4EAyCC;AAED,sFAEC;AAED,0EASC;AAaD,kFAUC;AAED,0FAqFC;AAED,wEA+CC;AAED,sFAWC;AAED,0FAeC;AAED,wFAmBC;AAED,gFAcC;AAmCD,0EA8NC;AAtvBD,SAAS,uBAAuB,CAAC,KAAU;IAC1C,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACxD,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAU,EAAE,QAAgB,EAAE,GAAW,EAAE,GAAW;IACvF,IAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,OAAO,QAAQ,CAAC;IACjB,CAAC;IACD,IAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAU,EAAE,QAAgB;IACtD,OAAO,uBAAuB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;AACjE,CAAC;AAED,SAAS,iBAAiB,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AAK,EAAE,YAAY,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,wCAAwC,uBAC3C,IAAI,KACP,aAAa,EAAE,CAAC,kGAAkG,CAAC,EACnH,YAAY,EAAE,CAAC,mGAAmG,CAAC,EACnH,gBAAgB,EAAE,CAAC,sBAAsB,EAAE,wDAAwD,CAAC,EACpG,gBAAgB,EAAE,4EAA4E,KAC5F,KAAK,EAAE,YAAY,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACJ,CAAC","file":"ai-qa-policy.js","sourcesContent":["export type ResolveIOQaPolicyContext =\n\t| 'support_ticket'\n\t| 'aicoder_dashboard'\n\t| 'ai_terminal'\n\t| 'general';\n\nexport interface ResolveIOQaPolicyOptions {\n\tcontext?: ResolveIOQaPolicyContext;\n\tincludeDevServerRules?: boolean;\n\tqaRepairEnabled?: boolean;\n\tqaEvidenceRequired?: boolean;\n\tqaDistinctScreenshotRequired?: boolean;\n\tqaFailFastCompile?: boolean;\n\tqaLiveDataRequired?: boolean;\n\tqaSelfRepairMaxWaves?: number;\n\tcurrentRoute?: string;\n\tcurrentContextMode?: string;\n\tcustomInstructions?: string[];\n}\n\nexport interface ResolveIORunnerBasicsOptions extends ResolveIOQaPolicyOptions {\n\tincludeQaPolicy?: boolean;\n\tincludeTokenDiscipline?: boolean;\n\tincludeDependencyBootstrap?: boolean;\n\tincludeRepairLoop?: boolean;\n\tincludeEvidenceContract?: boolean;\n\tmaxContextBullets?: number;\n\tmaxRepairWaves?: number;\n}\n\nexport interface ResolveIORunnerPromptInput extends ResolveIORunnerBasicsOptions {\n\tobjective?: string;\n\tblockers?: string[];\n\trelevantFiles?: string[];\n\tevidence?: string[];\n\tpriorSummary?: string;\n\tlatestFailure?: string;\n\tmaxBlockers?: number;\n\tmaxFiles?: number;\n\tmaxEvidence?: number;\n\tmaxTextChars?: number;\n}\n\nexport interface ResolveIORunnerContract {\n\tcontext: ResolveIOQaPolicyContext;\n\tsections: {\n\t\trunnerBasics: string[];\n\t\ttokenDiscipline: string[];\n\t\tdependencyBootstrap: string[];\n\t\trepairLoop: string[];\n\t\tqaPolicy: string[];\n\t\tevidenceContract: string[];\n\t\tfinalNotes: string[];\n\t};\n\trules: string[];\n\tpromptLines: string[];\n}\n\nexport interface ResolveIORunnerPromptBundle extends ResolveIORunnerContract {\n\tobjective: string;\n\tcontextLines: string[];\n\trepairLines: string[];\n\tfullPromptLines: string[];\n}\n\nexport interface ResolveIORunnerRepairPlan {\n\tblockerClass: string;\n\tsourceGate: string;\n\ttargetFiles: string[];\n\tlineHints: string[];\n\tfailureEvidence: string[];\n\trequiredProof: string[];\n\trepairRecipe: string[];\n\tselfGateCommands: string[];\n\tpassingCondition: string;\n}\n\nexport interface ResolveIORunnerRepairTargetOverride {\n\tpreferredSuffixes?: string[];\n\tfallbackFiles?: string[];\n}\n\nexport interface ResolveIORunnerRepairPlanInput extends ResolveIORunnerBasicsOptions {\n\tblockers?: string[];\n\tchangedFiles?: string[];\n\tgateSource?: string;\n\ttargetFileOverrides?: Record<string, ResolveIORunnerRepairTargetOverride>;\n}\n\nexport interface ResolveIORunnerRepairContinuationInput {\n\tcurrentBlockers?: string[];\n\tpreviousBlockers?: string[];\n\tactiveContractBlockers?: string[];\n\tcurrentAttempt?: number;\n\tmaxAttempts?: number;\n\tcurrentRepairWaveCount?: number;\n\tmaxRepairWaves?: number;\n\tdiffHash?: string;\n\tevidenceHash?: string;\n\tpreviousDiffHash?: string;\n\tpreviousEvidenceHash?: string;\n}\n\nexport type ResolveIORunnerRepairContinuationAction =\n\t| 'continue_attempt'\n\t| 'start_repair_wave'\n\t| 'park_repeated_blocker'\n\t| 'park_no_progress'\n\t| 'park_repair_wave_budget';\n\nexport interface ResolveIORunnerRepairContinuationDecision {\n\taction: ResolveIORunnerRepairContinuationAction;\n\trepeatedBlockers: string[];\n\tnewBlockers: string[];\n\tnormalizedCurrentBlockers: string[];\n\tnextAttempt: number;\n\tnextRepairWaveCount: number;\n\treason: string;\n}\n\nexport interface ResolveIORunnerQaCoverageInput {\n\tticketText?: string;\n\tchangedFiles?: string[];\n}\n\nfunction normalizeOptionalString(value: any): string {\n\treturn String(value || '').replace(/\\s+/g, ' ').trim();\n}\n\nfunction normalizePositiveInteger(value: any, fallback: number, min: number, max: number): number {\n\tconst numeric = Number(value);\n\tif (!Number.isFinite(numeric)) {\n\t\treturn fallback;\n\t}\n\tconst rounded = Number(numeric.toFixed(0));\n\treturn Math.max(min, Math.min(max, rounded));\n}\n\nfunction normalizeTextLine(value: any, maxChars: number): string {\n\treturn normalizeOptionalString(value).slice(0, maxChars).trim();\n}\n\nfunction normalizeTextList(values: any, limit: number, maxChars: number): string[] {\n\tif (!Array.isArray(values)) {\n\t\treturn [];\n\t}\n\tconst result: string[] = [];\n\tfor (const value of values) {\n\t\tconst normalized = normalizeTextLine(value, maxChars);\n\t\tif (normalized && !result.includes(normalized)) {\n\t\t\tresult.push(normalized);\n\t\t}\n\t\tif (result.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn result;\n}\n\nexport function normalizeResolveIOQaPolicyOptions(options: ResolveIOQaPolicyOptions = {}): Required<Omit<ResolveIOQaPolicyOptions, 'currentRoute' | 'currentContextMode' | 'customInstructions'>> & {\n\tcurrentRoute: string;\n\tcurrentContextMode: string;\n\tcustomInstructions: string[];\n} {\n\treturn {\n\t\tcontext: options.context || 'general',\n\t\tincludeDevServerRules: options.includeDevServerRules === true,\n\t\tqaRepairEnabled: options.qaRepairEnabled !== false,\n\t\tqaEvidenceRequired: options.qaEvidenceRequired !== false,\n\t\tqaDistinctScreenshotRequired: options.qaDistinctScreenshotRequired !== false,\n\t\tqaFailFastCompile: options.qaFailFastCompile !== false,\n\t\tqaLiveDataRequired: options.qaLiveDataRequired !== false,\n\t\tqaSelfRepairMaxWaves: normalizePositiveInteger(options.qaSelfRepairMaxWaves, 3, 1, 6),\n\t\tcurrentRoute: normalizeOptionalString(options.currentRoute),\n\t\tcurrentContextMode: normalizeOptionalString(options.currentContextMode),\n\t\tcustomInstructions: Array.isArray(options.customInstructions)\n\t\t\t? options.customInstructions.map(normalizeOptionalString).filter(Boolean).slice(0, 12)\n\t\t\t: []\n\t};\n}\n\nexport function buildResolveIOQaPolicyRules(options: ResolveIOQaPolicyOptions = {}): string[] {\n\tconst policy = normalizeResolveIOQaPolicyOptions(options);\n\tconst rules: string[] = [];\n\tif (policy.includeDevServerRules) {\n\t\trules.push(\n\t\t\t'When browser/localhost QA needs long-running commands like `npm run server`, `npm run client`, `npm run dev`, `ng serve`, `vite`, or `nodemon`, start them as managed background processes with log files and PIDs; do not leave foreground dev-server commands as the active shell tool.',\n\t\t\t'Before localhost/browser QA, source `.resolveio-support-tools/env.sh` or `.resolveio-ai-runner-tools/env.sh` when present. It supplies shared EC2 browser cache settings, `PUPPETEER_EXECUTABLE_PATH`/`CHROME_BIN`, Mongo wrappers, and non-conflicting localhost QA ports/URLs.',\n\t\t\t'For ResolveIO app login during browser QA, use the shared AI-runner auth bootstrap when staged: `node ./.resolveio-support-tools/qa-auth-bootstrap.js <project-root> /target-route`, `node ./.resolveio-ai-runner-tools/qa-auth-bootstrap.js <project-root> /target-route`, or the same command from an app root with `../`. It must use the exact localhost client origin, log out/clear stale browser credentials first, call `/login` then `/accessToken`, seed auth storage, and emit `qa-artifacts/auth-bootstrap-result.json` plus a screenshot.',\n\t\t\t'When launching Puppeteer or Playwright on workers, pass `executablePath: process.env.PUPPETEER_EXECUTABLE_PATH || process.env.CHROME_BIN` if either env var is set. Do not download a fresh browser before checking these env vars and `PUPPETEER_CACHE_DIR`.',\n\t\t\t'Use the managed-server pattern for localhost QA: `command > .build-output/<name>.log 2>&1 & PID=$!; trap \"kill $PID 2>/dev/null || true\" EXIT; wait for the port with curl; run browser checks; then kill/wait the PID`. Prefer `npm run client` or `./start_client.sh`; those scripts honor `RESOLVEIO_SUPPORT_QA_CLIENT_PORT` and `PORT`. Never run `ng serve ... | tee ...` or another dev server as a foreground command.'\n\t\t);\n\t}\n\tif (policy.qaFailFastCompile) {\n\t\trules.push('Before browser QA, run the fastest compile/type/startup checks that can prove the app can load. Fix compile/startup failures before launching browser QA.');\n\t}\n\tif (policy.qaRepairEnabled) {\n\t\trules.push(`If compile, startup, browser, or live-data QA fails, run a targeted repair wave for the exact failing route/action/data state, then rerun that same failed step before continuing. Limit self-repair to ${policy.qaSelfRepairMaxWaves} focused waves before returning the precise blocker.`);\n\t\trules.push('QA findings are implementation blockers, not manual TODOs: when QA proves missing fields, wrong publication payloads, failed persistence, bad calculations, missing side effects, or incomplete workflow coverage, return a typed needs-fix blocker so the runner starts a focused repair wave and reruns the same QA coverage.');\n\t}\n\tif (policy.qaLiveDataRequired) {\n\t\trules.push('For bug fixes and data/publication changes, test against available live app data or a faithful seeded record; do not rely only on static inspection when the user reported a runtime workflow problem.');\n\t\trules.push('Local QA may create, update, or delete representative seed records only in the localhost QA Mongo/database started for the run. Production/live customer databases are read-only for QA unless explicit human approval is provided.');\n\t\trules.push('If the localhost QA database has no records for the workflow under test, seed the smallest faithful record set needed to exercise the customer action and identify the seeded fixture IDs/names in the QA Coverage Matrix. Do not return blocked only because local QA data is empty.');\n\t\trules.push('For import/export/form-submit/data workflows, QA must drive the actual customer action with representative data: capture the relevant starting state, the dialog/form/file selection or action state, and the submitted/resulting state with a row/count/value assertion that proves the bug or feature works.');\n\t\trules.push('A navigation-only screenshot of an empty page, shell, table header, or unchanged screen is not sufficient evidence for data workflow fixes. If the page has no records, seed or choose a faithful test record and identify the record or fixture used.');\n\t}\n\trules.push('Before passing QA, create a QA Coverage Matrix from the approved scope, changed files, generated/publication changes, and touched collections/models. Each matrix row must name the workflow, route/screen, data used, assertion, screenshot/trace artifact, and pass/fail result.');\n\trules.push('QA must cover the full suite of changed customer-facing and data behavior, not only one smoke path. If implementation touches create/edit/delete/reopen flows, each touched flow needs proof or an explicit ticket-backed not-applicable note.');\n\trules.push('If the change touches invoices, billing, taxes, inventory, pricing, surcharges, imports/exports, reports, or publications, QA must include persisted data assertions and calculation/side-effect checks for every touched domain before returning pass.');\n\trules.push('Use desktop screenshots at a wide/full-screen viewport by default: 1920x1080 or wider. Do not use narrow/tablet/mobile screenshots unless the approved ticket is specifically mobile/responsive.');\n\trules.push('For desktop QA, verify the top navigation is in its normal desktop state and not wrapped, collapsed, open, or covering the workflow. For mobile-specific QA, explicitly use a mobile viewport and close the mobile menu unless the menu behavior itself is being proven.');\n\tif (policy.qaDistinctScreenshotRequired) {\n\t\trules.push('Capture one screenshot or trace for each distinct changed customer-facing feature, screen, workflow state, or data result. Do not repeat equivalent screenshots for multiple records unless record-specific behavior changed.');\n\t}\n\trules.push('Every screenshot artifact must include a short customer-facing caption explaining what the screenshot proves. Captions should describe the workflow state, such as Before, Ready to import, Submitted result, or Mobile menu closed.');\n\tif (policy.qaEvidenceRequired) {\n\t\trules.push('Final notes must list the exact QA command, route, account/data used, screenshot/trace/log paths, and result for each changed behavior; if browser QA is not applicable, say why and provide the compile/data proof used instead.');\n\t}\n\tif (policy.currentRoute) {\n\t\trules.push(`Current app context route from the AI terminal is ${policy.currentRoute}${policy.currentContextMode ? ` (${policy.currentContextMode})` : ''}; start QA there when the request refers to this page or current screen.`);\n\t}\n\trules.push(...policy.customInstructions);\n\treturn rules;\n}\n\nexport function buildResolveIORunnerQaCoverageChecklist(input: ResolveIORunnerQaCoverageInput = {}): string[] {\n\tconst text = `${input.ticketText || ''}\\n${(input.changedFiles || []).join('\\n')}`;\n\tconst rules: string[] = [\n\t\t'Build and include a QA Coverage Matrix: changed workflow, route/screen, data fixture/live record, before/action/after assertion, screenshot/trace artifact, caption, and result.',\n\t\t'Fail QA as needs-fix when coverage only proves navigation, headers, empty tables, or UI controls without exercising the changed behavior and persisted result.'\n\t];\n\tif (/\\b(invoice|billing|line item|surcharge|price|pricing|tax|sales tax)\\b|(?:^|\\/)(?:invoice|pricing|sales-tax|customer|item)(?:\\/|-)/i.test(text)) {\n\t\trules.push('Invoice/billing/tax coverage: test create/new and edit/reopen where touched; verify line-item persistence, surcharge add/remove/default/override selection, subtotal/tax/total calculations, taxable vs non-taxable behavior, and the saved invoice detail/list state.');\n\t\trules.push('When invoice/billing/tax QA has no usable local records, seed a minimal localhost-only customer, job/order/delivery or treatment, taxable item, non-taxable/surcharge item, and inventory/location data needed to create and save the invoice workflow; record the fixture IDs/names and do not touch production data.');\n\t\trules.push('Invoice/billing/tax coverage must include at least one concrete row/value assertion from the saved document or UI after submit, not only pre-submit form screenshots.');\n\t}\n\tif (/\\b(inventory|warehouse|stock|fifo|pick ticket|checkout|check out|transaction)\\b|(?:^|\\/)(?:inventory|part|chemical|production-location|yard)(?:\\/|-)/i.test(text)) {\n\t\trules.push('Inventory coverage: test the relevant source/destination location, transaction creation/reversal, FIFO or location selection when applicable, report/pick-ticket output when touched, and persisted inventory quantities/values after save/edit/delete.');\n\t\trules.push('When inventory QA has no usable local records, seed the smallest localhost-only item/location/quantity/value fixture needed to prove quantity/value movement and identify that fixture in the evidence.');\n\t}\n\tif (/\\b(report|export|csv|excel|xlsx|download|filter|total|grouping)\\b|(?:^|\\/)report(?:\\/|-)/i.test(text)) {\n\t\trules.push('Report/export coverage: verify rows, filters/date ranges, totals/grouping, download/export output, and at least one row/count/value assertion.');\n\t}\n\tif (/\\b(publication|methods?\\.ts|publications?\\.ts|subscription|publish|payload|field projection)\\b|(?:^|\\/)server\\/src\\/publications\\//i.test(text)) {\n\t\trules.push('Publication/API coverage: verify the changed fields are returned to the UI or method caller that needs them, including list/detail projections and any generated wrapper/call-site behavior.');\n\t}\n\tif (/\\b(import|upload|file|spreadsheet|template)\\b/i.test(text)) {\n\t\trules.push('Import/upload coverage: use a representative file/template, capture ready-to-upload and submitted states, and assert inserted/updated/skipped row counts plus visible result rows.');\n\t}\n\treturn Array.from(new Set(rules));\n}\n\nexport function buildResolveIORunnerBasicsRules(options: ResolveIORunnerBasicsOptions = {}): string[] {\n\treturn buildResolveIORunnerContract(options).rules;\n}\n\nexport function buildResolveIORunnerContract(options: ResolveIORunnerBasicsOptions = {}): ResolveIORunnerContract {\n\tconst maxContextBullets = normalizePositiveInteger(options.maxContextBullets, 8, 3, 20);\n\tconst maxRepairWaves = normalizePositiveInteger(\n\t\toptions.maxRepairWaves ?? options.qaSelfRepairMaxWaves,\n\t\t3,\n\t\t1,\n\t\t6\n\t);\n\tconst context = options.context || 'general';\n\tconst runnerBasics = [\n\t\t'Use repo-local patterns first: read the closest existing implementation, matching tests, model/schema, method/publication, and UI route before editing.',\n\t\t'Make the smallest complete change that satisfies the request; avoid broad refactors, config churn, dependency changes, and generated-file edits unless the workflow explicitly requires regeneration.',\n\t\t'Before returning, state what changed, how it was verified, remaining blockers, and exact artifact paths in final notes.'\n\t];\n\tconst tokenDiscipline = options.includeTokenDiscipline !== false\n\t\t? [\n\t\t\t`Keep context lean: summarize prior history into at most ${maxContextBullets} bullets, retrieve specific files on demand, and do not paste full logs, lockfiles, generated files, or stale ticket/email chains unless they are the current blocker evidence.`,\n\t\t\t'Prefer targeted search/read commands over loading broad directories. If a command returns noisy output, summarize the useful lines and continue with narrower reads.',\n\t\t\t'On retries, carry only the active blocker contract, changed-file list, relevant diff/evidence summary, and latest failing command output. Do not restart with a clean-slate mega prompt.',\n\t\t\t'Stop autonomous retries when the same normalized blocker repeats without meaningful diff or evidence improvement; park with a precise blocker instead of burning tokens.'\n\t\t]\n\t\t: [];\n\tconst dependencyBootstrap = options.includeDependencyBootstrap !== false\n\t\t? [\n\t\t\t'Reuse existing dependency caches and hydrated node_modules when available. Prefer npm install --force with the configured npm cache; do not use npm ci unless the workflow explicitly requires it.',\n\t\t\t'Before reinstalling or downloading browsers, check the existing workspace cache, shared node_modules, PUPPETEER_EXECUTABLE_PATH, CHROME_BIN, PUPPETEER_CACHE_DIR, and project-provided bootstrap scripts.'\n\t\t]\n\t\t: [];\n\tconst repairLoop = options.includeRepairLoop !== false\n\t\t? [\n\t\t\t`Use targeted repair waves: compile/startup blocker, browser route/action blocker, data/publication blocker, and review blocker each get a focused repair, then rerun the exact failed step. Limit this to ${maxRepairWaves} focused waves before returning a precise blocker.`,\n\t\t\t'Repair all instances of a detected blocker class in the touched scope, not only the first occurrence.'\n\t\t]\n\t\t: [];\n\tconst qaPolicy = options.includeQaPolicy !== false\n\t\t? buildResolveIOQaPolicyRules({\n\t\t\t...options,\n\t\t\tqaSelfRepairMaxWaves: maxRepairWaves\n\t\t})\n\t\t: [];\n\tconst evidenceContract = options.includeEvidenceContract !== false\n\t\t? [\n\t\t\t'Evidence must be customer/workflow oriented: routes, buttons, pages, data states, screenshots/traces, command results, and assertions. Do not expose internal file names, backend paths, stack traces, or implementation chatter in customer-facing text.',\n\t\t\t'For UI-facing changes, capture one screenshot or trace per distinct changed feature/workflow; for data-only changes, provide live-data or seeded-data assertion proof.',\n\t\t\t'For import, upload, export, form submit, calculation, publication, or persistence fixes, proof must show the before/action/after workflow state and a concrete row/count/value assertion. Empty shell screenshots do not count as proof.',\n\t\t\t'Desktop proof screenshots must use a wide/full-screen viewport, normally 1920x1080 or wider, with navigation closed/unwrapped unless the ticket is specifically about mobile or menu behavior.',\n\t\t\t'Each screenshot must have a customer-facing caption that says what the image proves; these captions are used in validation emails.'\n\t\t]\n\t\t: [];\n\tconst finalNotes = [\n\t\t'Final notes must include: changed behavior, touched functional areas, exact commands run, exact QA route/data state, screenshot/trace/log paths, and remaining blockers if any.',\n\t\t'If work is parked, final notes must name the blocker class, last failing command/artifact, why another autonomous attempt would repeat, and the smallest manual action needed.'\n\t];\n\tconst sections = {\n\t\trunnerBasics,\n\t\ttokenDiscipline,\n\t\tdependencyBootstrap,\n\t\trepairLoop,\n\t\tqaPolicy,\n\t\tevidenceContract,\n\t\tfinalNotes\n\t};\n\tconst rules = [\n\t\t...runnerBasics,\n\t\t...tokenDiscipline,\n\t\t...dependencyBootstrap,\n\t\t...repairLoop,\n\t\t...qaPolicy,\n\t\t...evidenceContract,\n\t\t...finalNotes\n\t];\n\tconst promptLines = [\n\t\t`ResolveIO shared runner contract (${context}):`,\n\t\t...rules.map((rule) => `- ${rule}`)\n\t];\n\treturn {\n\t\tcontext,\n\t\tsections,\n\t\trules,\n\t\tpromptLines\n\t};\n}\n\nexport function buildResolveIORunnerPromptLines(options: ResolveIORunnerBasicsOptions = {}): string[] {\n\treturn buildResolveIORunnerContract(options).promptLines;\n}\n\nexport function buildResolveIORunnerPromptBundle(input: ResolveIORunnerPromptInput = {}): ResolveIORunnerPromptBundle {\n\tconst contract = buildResolveIORunnerContract(input);\n\tconst maxTextChars = normalizePositiveInteger(input.maxTextChars, 900, 160, 2400);\n\tconst objective = normalizeTextLine(input.objective, maxTextChars)\n\t\t|| 'Complete the requested ResolveIO runner task with minimal, verified changes.';\n\tconst priorSummary = normalizeTextLine(input.priorSummary, maxTextChars);\n\tconst latestFailure = normalizeTextLine(input.latestFailure, maxTextChars);\n\tconst blockers = normalizeTextList(input.blockers, normalizePositiveInteger(input.maxBlockers, 5, 1, 12), maxTextChars);\n\tconst relevantFiles = normalizeTextList(input.relevantFiles, normalizePositiveInteger(input.maxFiles, 12, 1, 30), 260);\n\tconst evidence = normalizeTextList(input.evidence, normalizePositiveInteger(input.maxEvidence, 8, 1, 20), maxTextChars);\n\tconst contextLines = [\n\t\t`Objective: ${objective}`,\n\t\t...(priorSummary ? [`Prior summary: ${priorSummary}`] : []),\n\t\t...(latestFailure ? [`Latest failure: ${latestFailure}`] : []),\n\t\t...(blockers.length ? ['Active blockers:', ...blockers.map((line) => `- ${line}`)] : []),\n\t\t...(relevantFiles.length ? ['Relevant files:', ...relevantFiles.map((line) => `- ${line}`)] : []),\n\t\t...(evidence.length ? ['Known evidence:', ...evidence.map((line) => `- ${line}`)] : [])\n\t];\n\tconst repairLines = blockers.length\n\t\t? [\n\t\t\t'Mandatory repair contract:',\n\t\t\t'- Address each active blocker before unrelated work.',\n\t\t\t'- For each blocker, mark resolved, proven false, or blocked.',\n\t\t\t'- Attach code, data, command, browser, screenshot, or trace proof for each blocker.',\n\t\t\t'- If a blocker repeats with no meaningful diff/evidence change, park instead of starting another broad attempt.'\n\t\t]\n\t\t: [];\n\tconst fullPromptLines = [\n\t\t...contract.promptLines,\n\t\t'',\n\t\t'Runner task context:',\n\t\t...contextLines,\n\t\t...(repairLines.length ? ['', ...repairLines] : [])\n\t];\n\treturn {\n\t\t...contract,\n\t\tobjective,\n\t\tcontextLines,\n\t\trepairLines,\n\t\tfullPromptLines\n\t};\n}\n\nexport function buildResolveIORunnerRepairPromptLines(input: ResolveIORunnerPromptInput = {}): string[] {\n\treturn buildResolveIORunnerPromptBundle(input).repairLines;\n}\n\nexport function normalizeResolveIORunnerBlocker(entry: string): string {\n\treturn String(entry || '')\n\t\t.toLowerCase()\n\t\t.replace(/:[0-9]+(?=\\b|[);,.\\s])/g, ':#')\n\t\t.replace(/\\bline\\s+[0-9]+\\b/g, 'line #')\n\t\t.replace(/\\blines?\\s+[0-9]+\\s*[-–]\\s*[0-9]+\\b/g, 'lines #')\n\t\t.replace(/\\battempt\\s+[0-9]+\\b/g, 'attempt #')\n\t\t.replace(/\\s+/g, ' ')\n\t\t.trim();\n}\n\nfunction uniqueNormalizedResolveIORunnerBlockers(values: any): string[] {\n\tif (!Array.isArray(values)) {\n\t\treturn [];\n\t}\n\treturn Array.from(new Set(\n\t\tvalues\n\t\t\t.map((entry) => normalizeResolveIORunnerBlocker(String(entry || '')))\n\t\t\t.filter(Boolean)\n\t));\n}\n\nexport function findRepeatedResolveIORunnerBlockers(previousBlockers: string[] = [], currentBlockers: string[] = []): string[] {\n\tconst previous = new Set(uniqueNormalizedResolveIORunnerBlockers(previousBlockers));\n\tif (!previous.size) {\n\t\treturn [];\n\t}\n\treturn Array.from(new Set(\n\t\t(currentBlockers || [])\n\t\t\t.map((entry) => String(entry || '').trim())\n\t\t\t.filter((entry) => previous.has(normalizeResolveIORunnerBlocker(entry)))\n\t));\n}\n\nexport function decideResolveIORunnerRepairContinuation(\n\tinput: ResolveIORunnerRepairContinuationInput = {}\n): ResolveIORunnerRepairContinuationDecision {\n\tconst currentBlockers = (input.currentBlockers || [])\n\t\t.map((entry) => String(entry || '').trim())\n\t\t.filter(Boolean);\n\tconst normalizedCurrentBlockers = uniqueNormalizedResolveIORunnerBlockers(currentBlockers);\n\tconst previousBlockers = uniqueNormalizedResolveIORunnerBlockers(input.previousBlockers || []);\n\tconst activeContractBlockers = uniqueNormalizedResolveIORunnerBlockers(input.activeContractBlockers || []);\n\tconst priorBlockers = new Set([...previousBlockers, ...activeContractBlockers]);\n\tconst repeatedBlockers = findRepeatedResolveIORunnerBlockers(Array.from(priorBlockers), currentBlockers);\n\tconst repeated = new Set(repeatedBlockers.map((entry) => normalizeResolveIORunnerBlocker(entry)));\n\tconst newBlockers = currentBlockers.filter((entry) => !repeated.has(normalizeResolveIORunnerBlocker(entry)));\n\tconst currentAttempt = normalizePositiveInteger(input.currentAttempt, 1, 1, 100);\n\tconst maxAttempts = normalizePositiveInteger(input.maxAttempts, 3, 1, 100);\n\tconst currentRepairWaveCount = normalizePositiveInteger(input.currentRepairWaveCount, 0, 0, 100);\n\tconst maxRepairWaves = normalizePositiveInteger(input.maxRepairWaves, 3, 0, 100);\n\tconst diffHash = normalizeOptionalString(input.diffHash);\n\tconst evidenceHash = normalizeOptionalString(input.evidenceHash);\n\tconst previousDiffHash = normalizeOptionalString(input.previousDiffHash);\n\tconst previousEvidenceHash = normalizeOptionalString(input.previousEvidenceHash);\n\tconst noProgress = !!previousDiffHash\n\t\t&& !!previousEvidenceHash\n\t\t&& previousDiffHash === diffHash\n\t\t&& previousEvidenceHash === evidenceHash;\n\tconst nextAttempt = currentAttempt + 1;\n\tconst nextRepairWaveCount = currentRepairWaveCount + 1;\n\tif (noProgress) {\n\t\treturn {\n\t\t\taction: 'park_no_progress',\n\t\t\trepeatedBlockers,\n\t\t\tnewBlockers,\n\t\t\tnormalizedCurrentBlockers,\n\t\t\tnextAttempt,\n\t\t\tnextRepairWaveCount,\n\t\t\treason: 'Targeted repair made no meaningful diff or evidence progress.'\n\t\t};\n\t}\n\tif (repeatedBlockers.length) {\n\t\treturn {\n\t\t\taction: 'park_repeated_blocker',\n\t\t\trepeatedBlockers,\n\t\t\tnewBlockers,\n\t\t\tnormalizedCurrentBlockers,\n\t\t\tnextAttempt,\n\t\t\tnextRepairWaveCount,\n\t\t\treason: 'The same normalized blocker repeated after a targeted repair.'\n\t\t};\n\t}\n\tconst shouldStartNewWave = currentBlockers.length > 0\n\t\t&& (\n\t\t\tactiveContractBlockers.length > 0\n\t\t\t|| currentAttempt >= maxAttempts\n\t\t);\n\tif (shouldStartNewWave) {\n\t\tif (currentRepairWaveCount >= maxRepairWaves) {\n\t\t\treturn {\n\t\t\t\taction: 'park_repair_wave_budget',\n\t\t\t\trepeatedBlockers,\n\t\t\t\tnewBlockers,\n\t\t\t\tnormalizedCurrentBlockers,\n\t\t\t\tnextAttempt,\n\t\t\t\tnextRepairWaveCount,\n\t\t\t\treason: `Repair wave budget exhausted (${currentRepairWaveCount}/${maxRepairWaves}).`\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\taction: 'start_repair_wave',\n\t\t\trepeatedBlockers,\n\t\t\tnewBlockers,\n\t\t\tnormalizedCurrentBlockers,\n\t\t\tnextAttempt: 2,\n\t\t\tnextRepairWaveCount,\n\t\t\treason: 'A prior blocker was cleared and a new blocker appeared; start a focused repair wave instead of consuming the final attempt.'\n\t\t};\n\t}\n\treturn {\n\t\taction: 'continue_attempt',\n\t\trepeatedBlockers,\n\t\tnewBlockers,\n\t\tnormalizedCurrentBlockers,\n\t\tnextAttempt,\n\t\tnextRepairWaveCount: currentRepairWaveCount,\n\t\treason: 'Continue with the next targeted attempt.'\n\t};\n}\n\nexport function classifyResolveIORunnerBlocker(blocker: string): string {\n\tconst text = String(blocker || '');\n\tif (/database call inside loop|findOne.*inside loop|query inside loop/i.test(text)) {\n\t\treturn 'db_call_inside_loop';\n\t}\n\tif (/inventory transaction parity|inventory transactions? are correct|inventory transaction creation\\/reversal|inventory drift|reverse(?:s| old).*inventory|custom chemical lines?/i.test(text)) {\n\t\treturn 'inventory_transaction_parity';\n\t}\n\tif (/company\\/global default line-item surcharge|customer surcharge override|surcharge override.*default|global\\/company surcharge|fallback\\/override|first active surcharge/i.test(text)) {\n\t\treturn 'surcharge_default_precedence';\n\t}\n\tif (/\\bTS\\d{4}\\b[\\s\\S]{0,220}\\bExpected\\s+0\\s+arguments?\\b[\\s\\S]{0,160}\\bgot\\s+1\\b/i.test(text)\n\t\t&& /\\b(publication|publications\\.ts|subscribe|user_specific|ForUser|yardsForUser|customerNotifications|notificationCenter)\\b/i.test(text)) {\n\t\treturn 'user_specific_publication_argument_mismatch';\n\t}\n\tif (/\\b(publication signature mismatch|generated publication signature|publication wrapper)\\b[\\s\\S]{0,220}\\b(?:yardsForUser|[A-Za-z0-9_]*ForUser)\\b[\\s\\S]{0,160}\\bcompile errors?\\b/i.test(text)\n\t\t|| /\\b(?:yardsForUser|[A-Za-z0-9_]*ForUser)\\b[\\s\\S]{0,180}\\bcompile errors?\\b[\\s\\S]{0,180}\\b(publication|publications\\.ts|signature|wrapper)\\b/i.test(text)) {\n\t\treturn 'user_specific_publication_argument_mismatch';\n\t}\n\tif (/\\b(user_specific|user-specific)\\b[\\s\\S]{0,220}\\b(Expected\\s+0\\s+arguments?|got\\s+1|passes?\\s+1\\s+argument|publication wrapper)\\b/i.test(text)) {\n\t\treturn 'user_specific_publication_argument_mismatch';\n\t}\n\tif (/focused verification evidence|Behavior-level test\\/QA evidence|browser QA|screenshot|trace artifacts?|Billing Dashboard.*create\\/edit|server-side evidence|Validation evidence/i.test(text)) {\n\t\treturn 'support_qa_evidence';\n\t}\n\tif (/Approved scope requirement is not covered|approved .* scope lacks/i.test(text)) {\n\t\treturn 'approved_scope_missing';\n\t}\n\tif (/UI-facing ticket needs|browser\\/localhost QA|local\\/browser QA/i.test(text)) {\n\t\treturn 'ui_qa_missing';\n\t}\n\tif (/Report\\/export ticket needs|report rows|export behavior/i.test(text)) {\n\t\treturn 'report_export_missing';\n\t}\n\tif (/QA coverage matrix|full suite|limited smoke|too limited|only proves navigation|empty table|header screenshot|pre-submit only|missing persisted result|missing tax|missing inventory|missing invoice edit|missing reopen/i.test(text)) {\n\t\treturn 'qa_coverage_incomplete';\n\t}\n\tif (/Generated .* changed without a matching/i.test(text)) {\n\t\treturn 'generated_file_mismatch';\n\t}\n\tif (/No repository files changed|no verifiable PR fix/i.test(text)) {\n\t\treturn 'no_repo_diff';\n\t}\n\tif (/QA compile preflight|ng serve failed|Angular ng serve failed|Completion build verification failed|build failed|TypeScript check failed|TypeScript compile|lint failed|TS\\d{4}|Cannot find module/i.test(text)) {\n\t\treturn 'completion_build_failed';\n\t}\n\treturn 'reviewer_blocker';\n}\n\nexport function extractResolveIORunnerRepairLineHints(blocker: string): string[] {\n\tconst hints: string[] = [];\n\tconst lineMatch = String(blocker || '').match(/(?:line\\s+|:)([0-9]+)\\b/i);\n\tif (lineMatch) {\n\t\thints.push(`line ${lineMatch[1]}`);\n\t}\n\tconst loopMatch = String(blocker || '').match(/loop starts near line\\s+([0-9]+)/i);\n\tif (loopMatch) {\n\t\thints.push(`loop starts near line ${loopMatch[1]}`);\n\t}\n\treturn Array.from(new Set(hints));\n}\n\nexport function extractResolveIORunnerRepairTargetFiles(blocker: string, changedFiles: string[] = []): string[] {\n\tconst files = new Set<string>();\n\tconst text = String(blocker || '');\n\tconst pathPattern = /(?:^|\\s)([A-Za-z0-9_.-]+(?:\\/[A-Za-z0-9_.-]+)+\\.(?:ts|tsx|js|jsx|html|scss|css|json|md))/g;\n\tlet match: RegExpExecArray | null;\n\twhile ((match = pathPattern.exec(text))) {\n\t\tfiles.add(match[1].replace(/\\\\/g, '/'));\n\t}\n\tfor (const filePath of changedFiles || []) {\n\t\tconst normalized = String(filePath || '').trim().replace(/\\\\/g, '/');\n\t\tif (normalized && (text.includes(normalized) || text.includes(normalized.replace(/^[^/]+\\//, '')))) {\n\t\t\tfiles.add(normalized);\n\t\t}\n\t}\n\treturn Array.from(files).slice(0, 8);\n}\n\nexport function selectResolveIORunnerRepairTargetFiles(\n\tchangedFiles: string[] = [],\n\tpreferredSuffixes: string[] = [],\n\tfallbackFiles: string[] = []\n): string[] {\n\tconst suffixes = (preferredSuffixes || [])\n\t\t.map((entry) => String(entry || '').trim().replace(/\\\\/g, '/').replace(/^\\/+/, ''))\n\t\t.filter(Boolean);\n\tconst matched = new Set<string>();\n\tfor (const filePath of changedFiles || []) {\n\t\tconst normalized = String(filePath || '').trim().replace(/\\\\/g, '/');\n\t\tif (normalized && suffixes.some((suffix) => normalized === suffix || normalized.endsWith(`/${suffix}`))) {\n\t\t\tmatched.add(normalized);\n\t\t}\n\t}\n\treturn (matched.size\n\t\t? Array.from(matched)\n\t\t: fallbackFiles.map((entry) => String(entry || '').trim().replace(/\\\\/g, '/')).filter(Boolean)\n\t).slice(0, 12);\n}\n\nexport function sanitizeResolveIORunnerRepairPlans(value: any): ResolveIORunnerRepairPlan[] {\n\treturn Array.isArray(value)\n\t\t? value.map((entry: any) => ({\n\t\t\tblockerClass: String(entry?.blockerClass || '').trim(),\n\t\t\tsourceGate: String(entry?.sourceGate || '').trim(),\n\t\t\ttargetFiles: Array.isArray(entry?.targetFiles) ? entry.targetFiles.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\tlineHints: Array.isArray(entry?.lineHints) ? entry.lineHints.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\tfailureEvidence: Array.isArray(entry?.failureEvidence) ? entry.failureEvidence.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\trequiredProof: Array.isArray(entry?.requiredProof) ? entry.requiredProof.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\trepairRecipe: Array.isArray(entry?.repairRecipe) ? entry.repairRecipe.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\tselfGateCommands: Array.isArray(entry?.selfGateCommands) ? entry.selfGateCommands.map((item: any) => String(item || '').trim()).filter(Boolean).slice(0, 20) : [],\n\t\t\tpassingCondition: String(entry?.passingCondition || '').trim()\n\t\t})).filter((entry: ResolveIORunnerRepairPlan) => entry.blockerClass || entry.failureEvidence.length)\n\t\t: [];\n}\n\nfunction getResolveIORunnerRepairTargetOverride(\n\toptions: ResolveIORunnerRepairPlanInput,\n\tblockerClass: string\n): ResolveIORunnerRepairTargetOverride | null {\n\tconst override = options.targetFileOverrides?.[blockerClass];\n\tif (!override) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tpreferredSuffixes: Array.isArray(override.preferredSuffixes) ? override.preferredSuffixes : [],\n\t\tfallbackFiles: Array.isArray(override.fallbackFiles) ? override.fallbackFiles : []\n\t};\n}\n\nfunction applyResolveIORunnerRepairTargetOverride(\n\tplan: ResolveIORunnerRepairPlan,\n\toptions: ResolveIORunnerRepairPlanInput,\n\tblockerClass: string\n): ResolveIORunnerRepairPlan {\n\tconst override = getResolveIORunnerRepairTargetOverride(options, blockerClass);\n\tif (!override || plan.targetFiles.length) {\n\t\treturn plan;\n\t}\n\treturn {\n\t\t...plan,\n\t\ttargetFiles: selectResolveIORunnerRepairTargetFiles(\n\t\t\toptions.changedFiles || [],\n\t\t\toverride.preferredSuffixes || [],\n\t\t\toverride.fallbackFiles || []\n\t\t)\n\t};\n}\n\nexport function buildResolveIORunnerRepairPlans(input: ResolveIORunnerRepairPlanInput = {}): ResolveIORunnerRepairPlan[] {\n\tconst changedFiles = Array.isArray(input.changedFiles) ? input.changedFiles : [];\n\tconst sourceGate = String(input.gateSource || 'pre_review_or_reviewer').trim() || 'pre_review_or_reviewer';\n\tconst qaRules = buildResolveIORunnerBasicsRules({\n\t\t...input,\n\t\tcontext: input.context || 'general',\n\t\tincludeDevServerRules: input.includeDevServerRules === true,\n\t\tmaxContextBullets: input.maxContextBullets || 8\n\t});\n\treturn Array.from(new Set((input.blockers || []).map((entry) => String(entry || '').trim()).filter(Boolean))).map((blocker) => {\n\t\tconst blockerClass = classifyResolveIORunnerBlocker(blocker);\n\t\tconst base: ResolveIORunnerRepairPlan = {\n\t\t\tblockerClass,\n\t\t\tsourceGate,\n\t\t\ttargetFiles: extractResolveIORunnerRepairTargetFiles(blocker, changedFiles),\n\t\t\tlineHints: extractResolveIORunnerRepairLineHints(blocker),\n\t\t\tfailureEvidence: [blocker].filter(Boolean).slice(0, 8),\n\t\t\trequiredProof: [],\n\t\t\trepairRecipe: [],\n\t\t\tselfGateCommands: [],\n\t\t\tpassingCondition: ''\n\t\t};\n\t\tif (blockerClass === 'db_call_inside_loop') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'Show the database lookup is batched before the loop, or prove the flagged call is not a database collection call.',\n\t\t\t\t\t'Cite the exact file/function and before-vs-after loop/query shape in Repair Execution Notes.',\n\t\t\t\t\t'Confirm the changed diff no longer has any per-item database collection call in any loop body in the touched/target server files.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t'Inspect every loop in the touched/target server files and identify all database collection calls inside those loops.',\n\t\t\t\t\t'Move collection reads before loops using batched `$in` queries, map results by id/key, then use the map inside loops.',\n\t\t\t\t\t'Move writes out of loops using batched `bulkWrite`/multi-update operations prepared inside the loop and executed after the loop.',\n\t\t\t\t\t'If the call is a local array/helper and not a database call, prove that with the declaration/import path and leave the code unchanged.',\n\t\t\t\t\t'Keep the behavior identical except for eliminating every per-item database call.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'git diff HEAD -- <target file>',\n\t\t\t\t\t'rg -n \"for .*\\\\{|\\\\.forEach|for \\\\(\" <target file>',\n\t\t\t\t\t'rg -n \"\\\\.(find|findOne|findOneAsync|count|countDocuments|update|updateOne|updateMany|insert|insertOne|bulkWrite|remove|deleteOne|deleteMany)\\\\(\" <target file>'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'No loop in the touched/target server files has a database collection call in its body, or final notes prove each flagged call is not a database call.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'report_export_missing') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: ['Prove report rows, filters, totals/grouping, and export behavior, or cite ticket evidence that export is out of scope.'],\n\t\t\t\trepairRecipe: ['Exercise the report/export path and record evidence for each report dimension requested by the ticket.'],\n\t\t\t\tselfGateCommands: ['Run the report/export verification command or browser flow for the ticket.'],\n\t\t\t\tpassingCondition: 'Final notes prove rows, filters, totals/grouping, and export behavior or a ticket-backed out-of-scope decision.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'inventory_transaction_parity') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'Prove non-Manual Delivery and Truck Treat custom chemical lines create inventory relief transactions on invoice create.',\n\t\t\t\t\t'Prove invoice edit reverses old custom chemical effects and applies the new custom chemical effects.',\n\t\t\t\t\t'Prove invoice remove/delete reverses the same non-Manual custom chemical inventory effects.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t'Start in server/src/methods/invoices.ts and trace Manual inventory behavior before changing the non-Manual path.',\n\t\t\t\t\t'Reuse the existing inventory transaction helper shape instead of creating a parallel inventory writer.',\n\t\t\t\t\t'Handle all custom chemical lines in one sweep: create, edit, and remove for Delivery and Truck Treat invoices.',\n\t\t\t\t\t'Do not stop after fixing only create; the reviewer blocker includes edit and remove reversal.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'git diff HEAD -- server/src/methods/invoices.ts server/src/methods/inventory-transactions.ts',\n\t\t\t\t\t'rg -n \"is_custom_line_item|addInventoryTransaction|removeInvoice|editInvoice|custom chemical\" server/src/methods/invoices.ts',\n\t\t\t\t\t'Run or add a focused server/data assertion covering create, edit, and remove inventory transactions for non-Manual custom chemical lines.'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'Create, edit, and remove paths for non-Manual custom chemical invoice lines all have inventory transaction proof.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'surcharge_default_precedence') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'Show the persisted company/global default surcharge owner, not just the first active surcharge item.',\n\t\t\t\t\t'Show precedence is customer override when active, then company/global default when active, then empty/none when inactive or unset.',\n\t\t\t\t\t'Show at least one override customer and one default customer path in verification evidence.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t'Find the surcharge default selector and replace any first-active-item fallback with an explicit persisted default setting.',\n\t\t\t\t\t'Keep customer override storage separate from the company/global default setting.',\n\t\t\t\t\t'Reject inactive surcharge items during both override and default fallback.',\n\t\t\t\t\t'Cover unset and inactive settings with safe empty/none behavior.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'git diff HEAD -- angular/app/manage/item angular/app/widgets/dialog/dialog.adjust-customer.content.ts server/src/collections server/src/models',\n\t\t\t\t\t'rg -n \"line_item_surcharge|surcharge|id_line_item_surcharge_override|default\" angular/app server/src',\n\t\t\t\t\t'Run or add a focused fallback/override assertion for active override, active company default, inactive override/default, and unset default.'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'Customer override -> company/global default -> none precedence is persisted and verified.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'support_qa_evidence') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'Include browser route and screenshot/trace artifact paths for each distinct changed customer-facing feature or workflow state.',\n\t\t\t\t\t'Do not duplicate screenshots across multiple customers unless the customer-specific override/fallback behavior is the feature being proven.',\n\t\t\t\t\t'Include data/assertion evidence for requested persistence, calculations, and side effects.',\n\t\t\t\t\t'Include a QA Coverage Matrix row for every approved scope item and every touched workflow/domain.',\n\t\t\t\t\t'For import/export/form-submit/data workflow fixes, include before/action/after screenshots or trace steps plus the exact row/count/value assertion proving the submitted data changed as expected.',\n\t\t\t\t\t'Reject empty page/table/header screenshots as insufficient unless the approved requirement is explicitly an empty-state UI.',\n\t\t\t\t\t'Use a 1920x1080-or-wider desktop viewport for screenshots unless the ticket explicitly requests mobile/responsive behavior; desktop nav must be closed and not wrapped over the workflow.',\n\t\t\t\t\t'Provide a customer-facing caption for each screenshot that explains the workflow state and proof shown.',\n\t\t\t\t\t'If browser QA cannot start, include the exact startup blocker and the compile/preflight command output.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t...qaRules,\n\t\t\t\t\t...buildResolveIORunnerQaCoverageChecklist({\n\t\t\t\t\t\tticketText: input.blockers?.join('\\n') || '',\n\t\t\t\t\t\tchangedFiles\n\t\t\t\t\t}),\n\t\t\t\t\t'Upload or preserve screenshots/trace paths so the PR and support ticket can reference them.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'Run the support QA compile/startup preflight.',\n\t\t\t\t\t'Run the ticket-specific browser QA click-through and capture screenshots/trace artifacts.',\n\t\t\t\t\t'Record artifact paths and data assertions in final notes.'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'Final notes include one QA screenshot/trace path per distinct changed feature plus data assertions for the approved scope.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'qa_coverage_incomplete') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'Provide a QA Coverage Matrix that covers every changed workflow/domain from the approved scope and diff.',\n\t\t\t\t\t'For invoice/billing/tax/inventory changes, include create/edit/reopen/delete or not-applicable coverage plus persisted row/value assertions.',\n\t\t\t\t\t'Show fresh screenshots/traces with customer-facing captions for each distinct changed workflow state.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t'Read the approved scope, BUILD_PLAN, changed files, and prior QA evidence; identify every workflow/domain touched by the implementation.',\n\t\t\t\t\t...buildResolveIORunnerQaCoverageChecklist({\n\t\t\t\t\t\tticketText: blocker,\n\t\t\t\t\t\tchangedFiles\n\t\t\t\t\t}),\n\t\t\t\t\t'If localhost QA has no usable records for a required workflow, seed a minimal faithful fixture in the local QA database and cite the fixture IDs/names in the matrix; production data stays read-only.',\n\t\t\t\t\t'If QA finds a product defect while covering the matrix, fix that defect in a targeted repair wave, rerun compile/startup preflight, then rerun the failed matrix row before continuing.',\n\t\t\t\t\t'Return pass only after the matrix is complete; otherwise return needs-fix with the exact missing matrix row.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'Run compile/startup preflight before browser QA.',\n\t\t\t\t\t'Run the ticket-specific browser/data QA flow for every QA Coverage Matrix row.',\n\t\t\t\t\t'Record artifact paths, captions, and persisted row/count/value assertions in final notes.'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'Every QA Coverage Matrix row has a pass result with screenshot/trace/data proof, or the job returns a precise needs-fix blocker that seeds the next repair wave.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'approved_scope_missing') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: ['Add one Self-Review Checklist bullet for the exact missing approved requirement with code/data/browser proof.'],\n\t\t\t\trepairRecipe: ['Verify the missing approved requirement, then implement or document done/not applicable/blocked with proof.'],\n\t\t\t\tselfGateCommands: ['Review final notes for exact approved requirement text and proof artifact.'],\n\t\t\t\tpassingCondition: 'Every missing approved requirement is explicitly mapped to done/not applicable/blocked with proof.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'ui_qa_missing') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: ['Provide browser route plus screenshot/trace/video path, or a precise LOCALHOST_QA_PLAYBOOK startup/access blocker.'],\n\t\t\t\trepairRecipe: ['Run local/browser QA for the failing UI route after the fix, or document the exact startup/access blocker.'],\n\t\t\t\tselfGateCommands: ['source .resolveio-support-tools/env.sh if present', 'Run the ticket-specific localhost/browser QA command or capture blocker.'],\n\t\t\t\tpassingCondition: 'Final notes contain browser QA artifact evidence or a concrete local startup/access blocker.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'generated_file_mismatch') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: ['Show generated client file changes correspond to matching server method/publication source changes.'],\n\t\t\t\trepairRecipe: ['Either update the server owner and regenerate the companion file, or revert the orphan generated file change.'],\n\t\t\t\tselfGateCommands: ['git diff HEAD -- angular/app/methods.ts angular/app/publications.ts server/src/methods server/src/publications'],\n\t\t\t\tpassingCondition: 'No generated client file is changed without its source server owner change.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'user_specific_publication_argument_mismatch') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: [\n\t\t\t\t\t'List every failing call site and show each one was fixed, not just the first TypeScript error.',\n\t\t\t\t\t'Show whether each call needs the current logged-in user or an explicit other user/driver id.',\n\t\t\t\t\t'Show generated angular/app/publications.ts came from server/src/publications source and was not hand-edited as the behavioral fix.'\n\t\t\t\t],\n\t\t\t\trepairRecipe: [\n\t\t\t\t\t'user_specific publications inject the logged-in socket user as the first server parameter; generated client wrappers should remove only that injected parameter.',\n\t\t\t\t\t'Before changing call sites, inspect the source publication signature. If a client can pass a target user/driver, make the source explicit as function(id_current_user: string, id_user?: string) and regenerate.',\n\t\t\t\t\t'Only remove a client argument when the publication truly uses the injected current user only; otherwise preserve explicit target-user/driver calls such as yardsForUser(id_driver).',\n\t\t\t\t\t'Do not hand-edit generated angular/app/publications.ts to accept the injected id_user again; fix source publications/call sites, then regenerate.',\n\t\t\t\t\t'Search the whole app for the failing wrapper name and repair all argument-passing calls in the same pass.'\n\t\t\t\t],\n\t\t\t\tselfGateCommands: [\n\t\t\t\t\t'rg -n \"\\\\b[A-Za-z0-9_]*ForUser\\\\s*\\\\([^)]+\" angular/app server/src',\n\t\t\t\t\t'rg -n \"\\\\byardsForUser\\\\s*\\\\([^)]+\" angular/app server/src',\n\t\t\t\t\t'Run the method/publication generator if server publication source changed.',\n\t\t\t\t\t'Rerun the exact TypeScript/Angular compile command that failed.'\n\t\t\t\t],\n\t\t\t\tpassingCondition: 'Generated user_specific wrappers strip only the injected current-user parameter, explicit target-user arguments still compile where required, and the exact compile command exits 0.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\tif (blockerClass === 'completion_build_failed') {\n\t\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t\t...base,\n\t\t\t\trequiredProof: ['Include the failing command, root cause, fix, and passing rerun output.'],\n\t\t\t\trepairRecipe: ['Fix the compile/test failure directly, then rerun the exact failing command.'],\n\t\t\t\tselfGateCommands: ['Rerun the exact completion/build command shown in the blocker.'],\n\t\t\t\tpassingCondition: 'The exact previously failing build/test command passes or is blocked with concrete environment evidence.'\n\t\t\t}, input, blockerClass);\n\t\t}\n\t\treturn applyResolveIORunnerRepairTargetOverride({\n\t\t\t...base,\n\t\t\trequiredProof: ['Resolve, prove false, or block this reviewer/gate blocker with concrete code/data/browser proof.'],\n\t\t\trepairRecipe: ['Inspect the cited file/evidence, make the smallest supported fix, and cite before-vs-after proof.'],\n\t\t\tselfGateCommands: ['git diff HEAD --stat', 'Run the ticket-specific verification for this blocker.'],\n\t\t\tpassingCondition: 'The blocker text no longer applies and final notes include concrete proof.'\n\t\t}, input, blockerClass);\n\t});\n}\n"]}
|