@resolveio/server-lib 22.3.240 → 22.3.242

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "22.3.240",
3
+ "version": "22.3.242",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -180,6 +180,7 @@ function buildResolveIOQaPolicyRules(options) {
180
180
  }
181
181
  function buildResolveIORunnerQaCoverageChecklist(input) {
182
182
  if (input === void 0) { input = {}; }
183
+ void input;
183
184
  var rules = [
184
185
  '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.',
185
186
  'Fail QA as needs-fix when coverage only proves navigation, headers, empty tables, or UI controls without exercising the changed behavior and concrete result.',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/util/ai-qa-policy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+JA,8EAoBC;AAED,kEAyEC;AAED,0FASC;AAED,0EAEC;AAED,oEAiFC;AAED,0EAEC;AAED,4EAyCC;AAED,sFAEC;AAED,0EASC;AAaD,kFAUC;AAED,0FAqFC;AAED,wEAsCC;AAED,sFAWC;AAED,0FAeC;AAED,wFAmBC;AAED,gFAcC;AAmCD,0EA0KC;AAvsBD,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,OAA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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\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, repair the local QA user settings/tour flags if the app forces the post-login settings/tour gate, verify the browser reached the requested target route, and emit `qa-artifacts/auth-bootstrap-result.json`, `qa-artifacts/auth-bootstrap-storage-state.json`, plus a screenshot. For support-ticket QA, use Puppeteer first when `PUPPETEER_EXECUTABLE_PATH` or `CHROME_BIN` is set; `PLAYWRIGHT_MISSING` is not a blocker while that Puppeteer env exists. For every fresh Puppeteer/Playwright page, open the localhost origin, set localStorage from `auth-bootstrap-storage-state.json`, then navigate to the target route. The storage artifact may expose top-level object `localStorage`, array `localStorageEntries`, or Playwright-style `origins[].localStorage`; normalize all three shapes before setting storage (`Object.entries` for objects, `{key,value}` or `{name,value}` for arrays). Never run `for...of` directly on top-level `localStorage` unless it is already an array. A login-shell screenshot after bootstrap means the QA script failed to seed auth and must rerun the same row with storage seeded before returning needs-fix.',\n\t\t\t\t'For support-ticket QA, run the browser as the ticket reporter whenever possible; if the ticket or latest customer response names another affected user, run as that affected user instead. Use `qa-live-data-seed-result.json.selected.qa_user_context` and `auth-bootstrap-result.json.user` to record the chosen user. Generic admin/dev QA is acceptable only when no reporter/affected user can be identified or copied into localhost QA; in that case the matrix must say why.',\n\t\t\t'For ResolveIO browser checks, do not use Puppeteer/Playwright `networkidle0` or `networkidle2` as the page-ready condition; ResolveIO pages can keep background API/socket/polling activity open. Navigate with `domcontentloaded`, then wait for concrete route/workflow DOM text, buttons, table rows, dialogs, saved records, or persisted data assertions before screenshots.',\n\t\t\t'Use browser API compatibility helpers instead of version-fragile calls: every row-level Puppeteer script must declare `const delay = ms => new Promise(resolve => setTimeout(resolve, ms));` before navigation and use `await delay(...)` for fixed waits. Do not use `page.$x`, `page.waitForTimeout`, `networkidle0`, or `networkidle2`. Use `page.evaluateHandle`/DOM traversal or Playwright `locator` when definitely using Playwright. If a browser helper call throws because the current runtime lacks that API, fix the QA script and rerun the same matrix row before marking it failed.',\n\t\t\t'Browser click targeting must prefer exact interactive controls: `button`, `a[href]`, `[role=\"button\"]`, `input[type=\"button\"]`, `input[type=\"submit\"]`, `select`, option/combobox controls, and app-specific clickable elements with a small visible bounding box. Do not include broad `div`, `span`, `body`, or `*` elements in click-by-text helpers; they often match whole-page containers and produce false progress. If a text match has a huge bounding box or contains unrelated page/navigation text, skip it and find a smaller descendant/control.',\n\t\t\t'For QA row probes, use broad DOM text scans only for read-only diagnostics. Do not drive workflow clicks from broad `document.querySelectorAll(\"*\")` or generic container matches. After at most two focused selector attempts on the seeded route/data, either capture the blocker screenshot and return `needs-fix`, or switch to persisted data assertions if the row can be proven without another UI click.',\n\t\t\t'When launching Puppeteer on workers, pass `executablePath: process.env.PUPPETEER_EXECUTABLE_PATH || process.env.CHROME_BIN` if either env var is set. If either env var points to an executable, do not run `npx puppeteer browsers install`, `puppeteer browsers install`, Playwright install, or any browser download. Do not connect to `localhost:9223`, `/json/version`, or any Chrome remote-debug endpoint unless `RESOLVEIO_SUPPORT_QA_BROWSER_URL` or `RESOLVEIO_RUNNER_QA_BROWSER_URL` is explicitly set after sourcing the staged env and the endpoint responds; otherwise launch a scoped Puppeteer browser from the staged executable. If Playwright is missing but Puppeteer env exists, continue with Puppeteer instead of returning `PLAYWRIGHT_MISSING`. If the staged browser is missing or not executable, return one precise dependency blocker instead of downloading inside the QA owner turn.',\n\t\t\t'Do not scan broad roots such as `/var/app/resolveio-ai-workspace`, `/tmp/resolveio-support-qa`, or `/var/lib/resolveio` to rediscover Puppeteer, Playwright, or Chromium. Source the staged env file and use its `PUPPETEER_EXECUTABLE_PATH`/`CHROME_BIN`; if the staged browser/runtime is missing, return a precise dependency blocker.',\n\t\t\t'When the current directory is an app/project root, shared QA tools may be staged one directory up. Prefer `../.resolveio-support-tools/env.sh` or `../.resolveio-ai-runner-tools/env.sh` before writing custom browser code. Do not use bare `require(\"puppeteer\")` from an app root until checking the project/server node_modules or the staged helper pattern.',\n\t\t\t'Secret handling: never print, cat, paste, or summarize `.env`, `.env.runtime`, `.env.codex`, `settings.json`, `.mongo-runtime.json`, Mongo URLs, API keys, tokens, or passwords in command output, QA artifacts, screenshots, captions, or final notes. Source staged env files or read only the named QA artifacts; redact connection strings if a tool emits one.',\n\t\t\t'For targeted QA row repair, read `qa-artifacts/qa-live-data-seed-result.json`, `qa-artifacts/auth-bootstrap-result.json`, `qa-artifacts/auth-bootstrap-storage-state.json`, and `qa-artifacts/qa-workflow-probe-result.json` before writing browser probes. Use seeded `selected` ids/names directly when they match the ticket diagnosis; do not guess filters, record numbers, or dropdown options when the seed artifact already provides the exact QA fixture. After route navigation, wait for concrete route/workflow DOM text or controls for up to the row timeout before calling a page shell-only; a 1-2 second fixed delay is not enough evidence that a ResolveIO route failed to hydrate.',\n\t\t\t'QA owner source-code boundary: browser QA may write only QA artifacts, screenshots, traces, captions, coverage matrices, temporary row probe scripts, and localhost-only fixture data. Do not edit application source files, generated wrappers, package files, migrations, or tests from the QA lane. If QA proves the customer-reported behavior is still wrong, return `needs-fix` with the exact matrix row, proof artifact, suspected files, and smallest repair hint so the build lane can fix it.',\n\t\t\t'When updating `qa-artifacts/qa-coverage-matrix.json`, verify the target row index still matches the active workflow before writing. If the row at that index has a different workflow, locate the row by exact workflow text; if multiple rows share a workflow, update only the row whose route/assertion matches the active row. Never overwrite an unrelated passing row or create duplicate workflow rows to work around a cursor mismatch.',\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\tif (policy.context === 'support_ticket') {\n\t\t\trules.push(\n\t\t\t\t'For support-ticket QA validation, the manager normally runs compile/startup preflight and keeps the local harness alive before the QA owner starts. In that mode, the QA owner must not run `run-local-qa.sh`, `npm run server`, `npm run client`, `ng serve`, `mongod`, `gulp`, or compile/build commands again; probe the existing localhost URLs and proceed to auth/browser proof.',\n\t\t\t\t'If the preflighted support-ticket harness is not reachable, return a precise blocked/needs-fix result with the probed URL, HTTP/socket error, and qa-artifacts log paths. Do not start a duplicate server, duplicate client, duplicate Mongo, or duplicate compile from inside the browser QA owner.'\n\t\t\t);\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, test against available live app state or a faithful seeded scenario; 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('When a ticket or customer response names concrete entities, live-data seeding must fetch those exact production records into localhost QA where possible. QA must prove every named entity or return a seed/query blocker; representative substitute records are not pass evidence for named-record bug reports.');\n\t\trules.push('QA must drive the actual customer action identified by the diagnosis and capture the relevant starting state, action state, and resulting state with a concrete assertion chosen from the code/data/UI path under test.');\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\trules.push('Let the model choose the proof technique from the ticket, diagnosis, code, UI, and local data evidence. Shared runner policy must not prescribe domain-specific routes, buttons, collections, or workflow categories. The only shared acceptance rule is that the proof must exercise the reported behavior and show before/action/after evidence; route-load, compile-pass, scorecard-pass, or model-claim alone is not success.');\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('When updating `qa-artifacts/qa-coverage-matrix.json`, support both matrix schemas: the file may be an array or an object with a `rows` array. Use `const rows = Array.isArray(matrix) ? matrix : matrix.rows` for row updates and preserve the original schema when writing it back. Never skip row updates because only `Array.isArray(matrix)` is false.');\n\trules.push('When a QA Coverage Matrix row is marked `pass`, remove stale negative fields from that row before writing it: `blocker`, `failure`, `error`, `notes`, `next_actions`, `failed_reason`, and `blocked_reason`. Passed rows must not retain old blocker text from earlier retries.');\n\trules.push('QA must cover the changed customer-facing and data behavior, not only one smoke path. If implementation touches multiple independent state transitions, each touched transition needs proof or an explicit ticket-backed not-applicable note.');\n\trules.push('If the change touches customer-visible state, persisted data, calculations, publications, or server methods, QA must include at least one concrete assertion tied to the changed behavior before returning pass.');\n\trules.push('The QA Coverage Matrix should stay small and diagnosis-driven: one route/setup row when useful, one active customer action row, and one persisted/result row are enough for most support bugs. Add rows only when the approved proof_plan or changed behavior genuinely requires another independent workflow.');\n\trules.push('After localhost startup/auth succeeds, immediately drive the target customer workflow in the browser. Do not spend an open-ended reasoning pass after auth; create fresh feature screenshots/captions plus persisted row/count/value assertions, or return needs-fix with the exact blocker.');\n\trules.push('After startup/auth succeeds, missing selectors, dropdowns, options, saved values, rows, disabled/enabled states, or customer workflow controls are product/data QA failures. Mark the matrix row failed and return `needs-fix` with the exact row blocker and artifact paths; reserve `blocked` for true external/manual blockers such as auth, startup, infrastructure, credentials, or unavailable third-party systems.');\n\trules.push('Once any QA Coverage Matrix row is marked in_progress, finish that row promptly by marking it pass, failed, or blocked with screenshot/caption/assertion evidence. Leaving in_progress rows without workflow artifacts is a QA failure and should trigger a targeted repair wave.');\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\trules.push('Before every screenshot, settle the ResolveIO shell: press Escape, blur active controls, move the mouse away from the top/side nav, wait at least 750ms, and verify the target row/control/value has a visible bounding box inside the viewport. If the target text exists in DOM but is covered by the menu, sidebar, header, or a dark overlay, close the overlay or adjust the QA user/menu setting and recapture; do not count the covered screenshot as proof.');\n\trules.push('For table/list evidence, a pass screenshot must show the actual target row cells and the changed value in the same frame. Header-only, pagination-only, covered-row, or DOM-only proof can diagnose a failure, but cannot be used as customer-facing pass evidence.');\n\trules.push('For selection/filter workflows, a pass screenshot must show the relevant control with a real non-placeholder selected value, an open control with the specific live option used, or a resulting data row/action state caused by that selection. Screenshots where required controls still show only placeholders are empty-state evidence and must be failed or recaptured before pass.');\n\trules.push('A matrix shortcut may only pass after all row-specific evidence gates pass. If any row was rejected for shallow proof, missing selected values, missing persisted data, or stale/contradictory matrix data, keep the row failed and trigger a targeted repair/retest instead of marking the matrix complete.');\n\trules.push('Route/screen screenshots are valid only when they show the specific workflow being tested. If a route redirects to a generic shell, default manage page, menu-only view, auth screen, or a different feature screen, mark that matrix row failed/blocked with the mismatch; never count that screenshot as pass evidence.');\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 for action, 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 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 concrete result.',\n\t\t'Let the model derive the specific proof rows from the ticket diagnosis, changed files, and runtime evidence; shared policy must not expand a ticket into unrelated app workflows or keyword categories.',\n\t\t'Exercise the touched customer action and verify the saved, calculated, displayed, or emitted result with the smallest concrete assertion that proves the reported behavior.',\n\t\t'When QA has no usable local records, seed the smallest localhost-only record set needed to prove the active customer action, record fixture IDs/names, and do not touch production data.'\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, runtime behavior blocker, business-proof 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 any customer-reported behavior change, proof must follow the model-authored diagnosis proof plan and show the before/action/after business state with a concrete pass/fail 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 (/\\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 (/QA coverage matrix|full suite|limited smoke|too limited|only proves navigation|empty table|header screenshot|pre-submit only|missing persisted result/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 === '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 independently changed customer-visible/data behavior.',\n\t\t\t\t\t'For data workflow fixes, include before/action/after screenshots or trace steps plus the exact concrete assertion proving the changed behavior.',\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'Before pass, prove each cited screenshot visibly contains the target row/control/value and is not covered by the ResolveIO menu/sidebar/header overlay. If DOM text passes but screenshot is covered, recapture after closing/settling the shell.',\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 behavior from the approved scope and diff.',\n\t\t\t\t\t'Let the diagnosis and diff determine proof rows; do not expand into unrelated product workflows from keywords alone.',\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"]}
1
+ {"version":3,"sources":["../../src/util/ai-qa-policy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+JA,8EAoBC;AAED,kEAyEC;AAED,0FAUC;AAED,0EAEC;AAED,oEAiFC;AAED,0EAEC;AAED,4EAyCC;AAED,sFAEC;AAED,0EASC;AAaD,kFAUC;AAED,0FAqFC;AAED,wEAsCC;AAED,sFAWC;AAED,0FAeC;AAED,wFAmBC;AAED,gFAcC;AAmCD,0EA0KC;AAxsBD,SAAS,uBAAuB,CAAC,KAAU;IAC1C,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,E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zB,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\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, repair the local QA user settings/tour flags if the app forces the post-login settings/tour gate, verify the browser reached the requested target route, and emit `qa-artifacts/auth-bootstrap-result.json`, `qa-artifacts/auth-bootstrap-storage-state.json`, plus a screenshot. For support-ticket QA, use Puppeteer first when `PUPPETEER_EXECUTABLE_PATH` or `CHROME_BIN` is set; `PLAYWRIGHT_MISSING` is not a blocker while that Puppeteer env exists. For every fresh Puppeteer/Playwright page, open the localhost origin, set localStorage from `auth-bootstrap-storage-state.json`, then navigate to the target route. The storage artifact may expose top-level object `localStorage`, array `localStorageEntries`, or Playwright-style `origins[].localStorage`; normalize all three shapes before setting storage (`Object.entries` for objects, `{key,value}` or `{name,value}` for arrays). Never run `for...of` directly on top-level `localStorage` unless it is already an array. A login-shell screenshot after bootstrap means the QA script failed to seed auth and must rerun the same row with storage seeded before returning needs-fix.',\n\t\t\t\t'For support-ticket QA, run the browser as the ticket reporter whenever possible; if the ticket or latest customer response names another affected user, run as that affected user instead. Use `qa-live-data-seed-result.json.selected.qa_user_context` and `auth-bootstrap-result.json.user` to record the chosen user. Generic admin/dev QA is acceptable only when no reporter/affected user can be identified or copied into localhost QA; in that case the matrix must say why.',\n\t\t\t'For ResolveIO browser checks, do not use Puppeteer/Playwright `networkidle0` or `networkidle2` as the page-ready condition; ResolveIO pages can keep background API/socket/polling activity open. Navigate with `domcontentloaded`, then wait for concrete route/workflow DOM text, buttons, table rows, dialogs, saved records, or persisted data assertions before screenshots.',\n\t\t\t'Use browser API compatibility helpers instead of version-fragile calls: every row-level Puppeteer script must declare `const delay = ms => new Promise(resolve => setTimeout(resolve, ms));` before navigation and use `await delay(...)` for fixed waits. Do not use `page.$x`, `page.waitForTimeout`, `networkidle0`, or `networkidle2`. Use `page.evaluateHandle`/DOM traversal or Playwright `locator` when definitely using Playwright. If a browser helper call throws because the current runtime lacks that API, fix the QA script and rerun the same matrix row before marking it failed.',\n\t\t\t'Browser click targeting must prefer exact interactive controls: `button`, `a[href]`, `[role=\"button\"]`, `input[type=\"button\"]`, `input[type=\"submit\"]`, `select`, option/combobox controls, and app-specific clickable elements with a small visible bounding box. Do not include broad `div`, `span`, `body`, or `*` elements in click-by-text helpers; they often match whole-page containers and produce false progress. If a text match has a huge bounding box or contains unrelated page/navigation text, skip it and find a smaller descendant/control.',\n\t\t\t'For QA row probes, use broad DOM text scans only for read-only diagnostics. Do not drive workflow clicks from broad `document.querySelectorAll(\"*\")` or generic container matches. After at most two focused selector attempts on the seeded route/data, either capture the blocker screenshot and return `needs-fix`, or switch to persisted data assertions if the row can be proven without another UI click.',\n\t\t\t'When launching Puppeteer on workers, pass `executablePath: process.env.PUPPETEER_EXECUTABLE_PATH || process.env.CHROME_BIN` if either env var is set. If either env var points to an executable, do not run `npx puppeteer browsers install`, `puppeteer browsers install`, Playwright install, or any browser download. Do not connect to `localhost:9223`, `/json/version`, or any Chrome remote-debug endpoint unless `RESOLVEIO_SUPPORT_QA_BROWSER_URL` or `RESOLVEIO_RUNNER_QA_BROWSER_URL` is explicitly set after sourcing the staged env and the endpoint responds; otherwise launch a scoped Puppeteer browser from the staged executable. If Playwright is missing but Puppeteer env exists, continue with Puppeteer instead of returning `PLAYWRIGHT_MISSING`. If the staged browser is missing or not executable, return one precise dependency blocker instead of downloading inside the QA owner turn.',\n\t\t\t'Do not scan broad roots such as `/var/app/resolveio-ai-workspace`, `/tmp/resolveio-support-qa`, or `/var/lib/resolveio` to rediscover Puppeteer, Playwright, or Chromium. Source the staged env file and use its `PUPPETEER_EXECUTABLE_PATH`/`CHROME_BIN`; if the staged browser/runtime is missing, return a precise dependency blocker.',\n\t\t\t'When the current directory is an app/project root, shared QA tools may be staged one directory up. Prefer `../.resolveio-support-tools/env.sh` or `../.resolveio-ai-runner-tools/env.sh` before writing custom browser code. Do not use bare `require(\"puppeteer\")` from an app root until checking the project/server node_modules or the staged helper pattern.',\n\t\t\t'Secret handling: never print, cat, paste, or summarize `.env`, `.env.runtime`, `.env.codex`, `settings.json`, `.mongo-runtime.json`, Mongo URLs, API keys, tokens, or passwords in command output, QA artifacts, screenshots, captions, or final notes. Source staged env files or read only the named QA artifacts; redact connection strings if a tool emits one.',\n\t\t\t'For targeted QA row repair, read `qa-artifacts/qa-live-data-seed-result.json`, `qa-artifacts/auth-bootstrap-result.json`, `qa-artifacts/auth-bootstrap-storage-state.json`, and `qa-artifacts/qa-workflow-probe-result.json` before writing browser probes. Use seeded `selected` ids/names directly when they match the ticket diagnosis; do not guess filters, record numbers, or dropdown options when the seed artifact already provides the exact QA fixture. After route navigation, wait for concrete route/workflow DOM text or controls for up to the row timeout before calling a page shell-only; a 1-2 second fixed delay is not enough evidence that a ResolveIO route failed to hydrate.',\n\t\t\t'QA owner source-code boundary: browser QA may write only QA artifacts, screenshots, traces, captions, coverage matrices, temporary row probe scripts, and localhost-only fixture data. Do not edit application source files, generated wrappers, package files, migrations, or tests from the QA lane. If QA proves the customer-reported behavior is still wrong, return `needs-fix` with the exact matrix row, proof artifact, suspected files, and smallest repair hint so the build lane can fix it.',\n\t\t\t'When updating `qa-artifacts/qa-coverage-matrix.json`, verify the target row index still matches the active workflow before writing. If the row at that index has a different workflow, locate the row by exact workflow text; if multiple rows share a workflow, update only the row whose route/assertion matches the active row. Never overwrite an unrelated passing row or create duplicate workflow rows to work around a cursor mismatch.',\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\tif (policy.context === 'support_ticket') {\n\t\t\trules.push(\n\t\t\t\t'For support-ticket QA validation, the manager normally runs compile/startup preflight and keeps the local harness alive before the QA owner starts. In that mode, the QA owner must not run `run-local-qa.sh`, `npm run server`, `npm run client`, `ng serve`, `mongod`, `gulp`, or compile/build commands again; probe the existing localhost URLs and proceed to auth/browser proof.',\n\t\t\t\t'If the preflighted support-ticket harness is not reachable, return a precise blocked/needs-fix result with the probed URL, HTTP/socket error, and qa-artifacts log paths. Do not start a duplicate server, duplicate client, duplicate Mongo, or duplicate compile from inside the browser QA owner.'\n\t\t\t);\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, test against available live app state or a faithful seeded scenario; 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('When a ticket or customer response names concrete entities, live-data seeding must fetch those exact production records into localhost QA where possible. QA must prove every named entity or return a seed/query blocker; representative substitute records are not pass evidence for named-record bug reports.');\n\t\trules.push('QA must drive the actual customer action identified by the diagnosis and capture the relevant starting state, action state, and resulting state with a concrete assertion chosen from the code/data/UI path under test.');\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\trules.push('Let the model choose the proof technique from the ticket, diagnosis, code, UI, and local data evidence. Shared runner policy must not prescribe domain-specific routes, buttons, collections, or workflow categories. The only shared acceptance rule is that the proof must exercise the reported behavior and show before/action/after evidence; route-load, compile-pass, scorecard-pass, or model-claim alone is not success.');\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('When updating `qa-artifacts/qa-coverage-matrix.json`, support both matrix schemas: the file may be an array or an object with a `rows` array. Use `const rows = Array.isArray(matrix) ? matrix : matrix.rows` for row updates and preserve the original schema when writing it back. Never skip row updates because only `Array.isArray(matrix)` is false.');\n\trules.push('When a QA Coverage Matrix row is marked `pass`, remove stale negative fields from that row before writing it: `blocker`, `failure`, `error`, `notes`, `next_actions`, `failed_reason`, and `blocked_reason`. Passed rows must not retain old blocker text from earlier retries.');\n\trules.push('QA must cover the changed customer-facing and data behavior, not only one smoke path. If implementation touches multiple independent state transitions, each touched transition needs proof or an explicit ticket-backed not-applicable note.');\n\trules.push('If the change touches customer-visible state, persisted data, calculations, publications, or server methods, QA must include at least one concrete assertion tied to the changed behavior before returning pass.');\n\trules.push('The QA Coverage Matrix should stay small and diagnosis-driven: one route/setup row when useful, one active customer action row, and one persisted/result row are enough for most support bugs. Add rows only when the approved proof_plan or changed behavior genuinely requires another independent workflow.');\n\trules.push('After localhost startup/auth succeeds, immediately drive the target customer workflow in the browser. Do not spend an open-ended reasoning pass after auth; create fresh feature screenshots/captions plus persisted row/count/value assertions, or return needs-fix with the exact blocker.');\n\trules.push('After startup/auth succeeds, missing selectors, dropdowns, options, saved values, rows, disabled/enabled states, or customer workflow controls are product/data QA failures. Mark the matrix row failed and return `needs-fix` with the exact row blocker and artifact paths; reserve `blocked` for true external/manual blockers such as auth, startup, infrastructure, credentials, or unavailable third-party systems.');\n\trules.push('Once any QA Coverage Matrix row is marked in_progress, finish that row promptly by marking it pass, failed, or blocked with screenshot/caption/assertion evidence. Leaving in_progress rows without workflow artifacts is a QA failure and should trigger a targeted repair wave.');\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\trules.push('Before every screenshot, settle the ResolveIO shell: press Escape, blur active controls, move the mouse away from the top/side nav, wait at least 750ms, and verify the target row/control/value has a visible bounding box inside the viewport. If the target text exists in DOM but is covered by the menu, sidebar, header, or a dark overlay, close the overlay or adjust the QA user/menu setting and recapture; do not count the covered screenshot as proof.');\n\trules.push('For table/list evidence, a pass screenshot must show the actual target row cells and the changed value in the same frame. Header-only, pagination-only, covered-row, or DOM-only proof can diagnose a failure, but cannot be used as customer-facing pass evidence.');\n\trules.push('For selection/filter workflows, a pass screenshot must show the relevant control with a real non-placeholder selected value, an open control with the specific live option used, or a resulting data row/action state caused by that selection. Screenshots where required controls still show only placeholders are empty-state evidence and must be failed or recaptured before pass.');\n\trules.push('A matrix shortcut may only pass after all row-specific evidence gates pass. If any row was rejected for shallow proof, missing selected values, missing persisted data, or stale/contradictory matrix data, keep the row failed and trigger a targeted repair/retest instead of marking the matrix complete.');\n\trules.push('Route/screen screenshots are valid only when they show the specific workflow being tested. If a route redirects to a generic shell, default manage page, menu-only view, auth screen, or a different feature screen, mark that matrix row failed/blocked with the mismatch; never count that screenshot as pass evidence.');\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 for action, 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\tvoid input;\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 concrete result.',\n\t\t'Let the model derive the specific proof rows from the ticket diagnosis, changed files, and runtime evidence; shared policy must not expand a ticket into unrelated app workflows or keyword categories.',\n\t\t'Exercise the touched customer action and verify the saved, calculated, displayed, or emitted result with the smallest concrete assertion that proves the reported behavior.',\n\t\t'When QA has no usable local records, seed the smallest localhost-only record set needed to prove the active customer action, record fixture IDs/names, and do not touch production data.'\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, runtime behavior blocker, business-proof 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 any customer-reported behavior change, proof must follow the model-authored diagnosis proof plan and show the before/action/after business state with a concrete pass/fail 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 (/\\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 (/QA coverage matrix|full suite|limited smoke|too limited|only proves navigation|empty table|header screenshot|pre-submit only|missing persisted result/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 === '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 independently changed customer-visible/data behavior.',\n\t\t\t\t\t'For data workflow fixes, include before/action/after screenshots or trace steps plus the exact concrete assertion proving the changed behavior.',\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'Before pass, prove each cited screenshot visibly contains the target row/control/value and is not covered by the ResolveIO menu/sidebar/header overlay. If DOM text passes but screenshot is covered, recapture after closing/settling the shell.',\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 behavior from the approved scope and diff.',\n\t\t\t\t\t'Let the diagnosis and diff determine proof rows; do not expand into unrelated product workflows from keywords alone.',\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"]}
@@ -27,7 +27,6 @@ export interface ResolveIOSupportDiagnosisFailingPath {
27
27
  description: string;
28
28
  }
29
29
  export interface ResolveIOSupportDiagnosisBusinessProofContract {
30
- issue_class?: ResolveIOSupportIssueClass;
31
30
  setup_state: string;
32
31
  action_under_test: string;
33
32
  expected_business_state_change: string;