@resolveio/server-lib 22.3.236 → 22.3.237

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.
@@ -47,11 +47,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
47
47
  return to.concat(ar || Array.prototype.slice.call(from));
48
48
  };
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.buildResolveIOSupportIssueClassProbePlan = void 0;
50
51
  exports.evaluateResolveIOSupportPreflightGate = evaluateResolveIOSupportPreflightGate;
51
52
  exports.selectResolveIOSupportSimilarCaseHints = selectResolveIOSupportSimilarCaseHints;
52
53
  exports.buildResolveIOSupportDiagnosisEvidencePack = buildResolveIOSupportDiagnosisEvidencePack;
53
54
  exports.buildResolveIOSupportDiagnosisProofMatrix = buildResolveIOSupportDiagnosisProofMatrix;
54
55
  exports.evaluateResolveIOSupportDiagnosisEvidenceQuality = evaluateResolveIOSupportDiagnosisEvidenceQuality;
56
+ exports.evaluateResolveIOSupportDiagnosisProductRepairReadiness = evaluateResolveIOSupportDiagnosisProductRepairReadiness;
55
57
  exports.normalizeResolveIOSupportDiagnosisGate = normalizeResolveIOSupportDiagnosisGate;
56
58
  exports.extractResolveIOSupportDiagnosisGateFromText = extractResolveIOSupportDiagnosisGateFromText;
57
59
  exports.validateResolveIOSupportDiagnosisGate = validateResolveIOSupportDiagnosisGate;
@@ -61,9 +63,9 @@ exports.validateResolveIOSupportClarificationContract = validateResolveIOSupport
61
63
  exports.buildResolveIOSupportCustomerReplyReadinessContract = buildResolveIOSupportCustomerReplyReadinessContract;
62
64
  exports.validateResolveIOSupportCustomerReplyReadinessContract = validateResolveIOSupportCustomerReplyReadinessContract;
63
65
  exports.decideResolveIOSupportCustomerReplyPolicy = decideResolveIOSupportCustomerReplyPolicy;
64
- exports.buildResolveIOSupportIssueClassProbes = buildResolveIOSupportIssueClassProbes;
66
+ exports.buildResolveIOSupportBusinessProofProbes = buildResolveIOSupportBusinessProofProbes;
65
67
  exports.validateResolveIOSupportIssueClassProbePlan = validateResolveIOSupportIssueClassProbePlan;
66
- exports.buildResolveIOSupportIssueClassProbePlan = buildResolveIOSupportIssueClassProbePlan;
68
+ exports.buildResolveIOSupportBusinessProofPlan = buildResolveIOSupportBusinessProofPlan;
67
69
  exports.hashResolveIOSupportV5Evidence = hashResolveIOSupportV5Evidence;
68
70
  exports.validateResolveIOSupportNextActionContract = validateResolveIOSupportNextActionContract;
69
71
  exports.buildResolveIOSupportManagerExecutionPacket = buildResolveIOSupportManagerExecutionPacket;
@@ -927,52 +929,10 @@ function normalizeIssueClass(value) {
927
929
  var normalized = cleanText(value, 80)
928
930
  .toLowerCase()
929
931
  .replace(/[\s-]+/g, '_');
930
- var aliases = {
931
- no_op: 'no_op_submit',
932
- no_op_submit: 'no_op_submit',
933
- submit_noop: 'no_op_submit',
934
- missing_data: 'missing_wrong_data',
935
- wrong_data: 'missing_wrong_data',
936
- missing_wrong_data: 'missing_wrong_data',
937
- filter_mismatch: 'filter_query_mismatch',
938
- query_mismatch: 'filter_query_mismatch',
939
- filter_query_mismatch: 'filter_query_mismatch',
940
- invoice_pdf_export: 'invoice_pdf_export',
941
- pdf_export: 'invoice_pdf_export',
942
- export: 'invoice_pdf_export',
943
- upload: 'upload_import',
944
- import: 'upload_import',
945
- upload_import: 'upload_import',
946
- behavior: 'missing_wrong_data',
947
- workflow_behavior: 'missing_wrong_data',
948
- general: 'missing_wrong_data',
949
- general_inquiry: 'missing_wrong_data',
950
- customer_inquiry: 'missing_wrong_data',
951
- data_mismatch: 'missing_wrong_data',
952
- warehouse_mismatch: 'missing_wrong_data',
953
- data_visibility_mapping: 'missing_wrong_data',
954
- data_mapping: 'missing_wrong_data',
955
- visibility_mapping: 'missing_wrong_data',
956
- display_mapping: 'missing_wrong_data',
957
- route_auth: 'route_auth_hydration',
958
- auth_hydration: 'route_auth_hydration',
959
- route_auth_hydration: 'route_auth_hydration',
960
- slow_query: 'slow_query_performance',
961
- performance: 'slow_query_performance',
962
- slow_query_performance: 'slow_query_performance',
963
- feature: 'missing_wrong_data',
964
- feature_request: 'missing_wrong_data',
965
- request_new_feature: 'missing_wrong_data',
966
- requested_behavior_change: 'missing_wrong_data',
967
- new_feature: 'missing_wrong_data'
968
- };
969
- if (aliases[normalized]) {
970
- return aliases[normalized];
971
- }
972
- if (/\b(data|field|value|visibility|mapping|display|warehouse|quantity|inventory)\b/i.test(normalized)) {
973
- return 'missing_wrong_data';
932
+ if (!normalized) {
933
+ return '';
974
934
  }
975
- return '';
935
+ return normalized.replace(/[^a-z0-9_./:-]+/g, '').slice(0, 80);
976
936
  }
977
937
  function normalizeReproductionStatus(value) {
978
938
  var normalized = cleanText(value, 80).toLowerCase();
@@ -1293,7 +1253,6 @@ function normalizeResolveIOSupportSimilarCaseCandidate(value) {
1293
1253
  function selectResolveIOSupportSimilarCaseHints(input) {
1294
1254
  var e_4, _a;
1295
1255
  if (input === void 0) { input = {}; }
1296
- var issueClass = normalizeIssueClass(input.issueClass);
1297
1256
  var ownerFiles = cleanList(input.ownerFiles, 12, 300).map(normalizeOwnerFilePath).filter(Boolean);
1298
1257
  var ownerFileSet = new Set(ownerFiles);
1299
1258
  var ownerDirs = new Set(ownerFiles.map(supportOwnerFileDirectory).filter(Boolean));
@@ -1315,11 +1274,6 @@ function selectResolveIOSupportSimilarCaseHints(input) {
1315
1274
  }
1316
1275
  var signals = [];
1317
1276
  var score = accepted ? 100 : 40;
1318
- var candidateIssueClass = normalizeIssueClass(candidate.issueClass);
1319
- if (issueClass && candidateIssueClass && issueClass === candidateIssueClass) {
1320
- score += 45;
1321
- signals.push("issue_class:".concat(issueClass));
1322
- }
1323
1277
  var exactOwnerOverlap = candidate.ownerFiles.filter(function (file) { return ownerFileSet.has(normalizeOwnerFilePath(file)); });
1324
1278
  if (exactOwnerOverlap.length) {
1325
1279
  score += 35 + Math.min(20, exactOwnerOverlap.length * 5);
@@ -1351,7 +1305,7 @@ function selectResolveIOSupportSimilarCaseHints(input) {
1351
1305
  ticketNumber: candidate.ticketNumber,
1352
1306
  title: candidate.title,
1353
1307
  outcome: candidate.outcome || (candidate.commitSha ? 'commit_hint' : ''),
1354
- issueClass: candidateIssueClass || candidate.issueClass,
1308
+ issueClass: candidate.issueClass,
1355
1309
  ownerFiles: candidate.ownerFiles.slice(0, 8),
1356
1310
  commitSha: candidate.commitSha,
1357
1311
  commitMessage: candidate.commitMessage,
@@ -1383,7 +1337,6 @@ function selectResolveIOSupportSimilarCaseHints(input) {
1383
1337
  }
1384
1338
  var SUPPORT_DIAGNOSIS_GATE_REQUIRED_FIELDS = [
1385
1339
  'issue_case',
1386
- 'issue_class',
1387
1340
  'accepted_hypothesis',
1388
1341
  'rejected_alternatives',
1389
1342
  'failing_path',
@@ -1393,13 +1346,13 @@ var SUPPORT_DIAGNOSIS_GATE_REQUIRED_FIELDS = [
1393
1346
  'status'
1394
1347
  ];
1395
1348
  var SUPPORT_DIAGNOSIS_REQUIRED_EVIDENCE = [
1396
- 'customer complaint, expected result, observed result, route/module, and account/customer context',
1349
+ 'customer complaint, expected result, observed result, route/module when relevant, and account/customer context',
1397
1350
  'reproduction proof or blocked-reproduction reason',
1398
1351
  'one accepted falsifiable root-cause hypothesis with evidence',
1399
1352
  'rejected alternatives showing the runner did not guess',
1400
- 'frontend/backend/shared failing path',
1353
+ 'diagnosed failing path in the current code or data flow',
1401
1354
  'small exact owner_files set',
1402
- 'before/action/after business proof plan',
1355
+ 'model-chosen before/action/after business proof plan',
1403
1356
  'AIQaBusinessAssertion acceptance requirement'
1404
1357
  ];
1405
1358
  var SUPPORT_DIAGNOSIS_FORBIDDEN_ACTIONS = [
@@ -1409,70 +1362,6 @@ var SUPPORT_DIAGNOSIS_FORBIDDEN_ACTIONS = [
1409
1362
  'Do not accept route load, screenshot, scorecard, wow score, or model claim as ticket acceptance.',
1410
1363
  'Do not run product-code repair until SupportDiagnosisGate validates.'
1411
1364
  ];
1412
- var SUPPORT_ISSUE_CLASS_PROBE_CATALOG = [{
1413
- issue_class: 'no_op_submit',
1414
- probe_type: 'issue_class_probe',
1415
- failure_class: 'business',
1416
- action: 'Submit the reported form/action and prove a persisted state change or expected validation result.',
1417
- proof_required: 'Before/action/after DOM or data proof that the submit is no longer a no-op.',
1418
- required_artifacts: ['before form state', 'submit action trace', 'post-submit DOM/data proof', 'method or network result'],
1419
- acceptance_gate: 'aiqa_business_assertion',
1420
- false_pass_blockers: ['route loaded only', 'button clicked without persisted result', 'model claim without DOM/data proof']
1421
- }, {
1422
- issue_class: 'missing_wrong_data',
1423
- probe_type: 'issue_class_probe',
1424
- failure_class: 'business',
1425
- action: 'Load the named record/list and compare visible data to the expected persisted source.',
1426
- proof_required: 'Visible data and persisted data match the customer expectation.',
1427
- required_artifacts: ['expected source record', 'visible DOM/data snapshot', 'persisted data comparison'],
1428
- acceptance_gate: 'aiqa_business_assertion',
1429
- false_pass_blockers: ['non-empty page only', 'wrong account/customer context', 'sample substitute for named record']
1430
- }, {
1431
- issue_class: 'filter_query_mismatch',
1432
- probe_type: 'issue_class_probe',
1433
- failure_class: 'business',
1434
- action: 'Apply the reported filter/query inputs and assert included/excluded rows or counts.',
1435
- proof_required: 'Returned rows/counts match the expected dataset and exclude the wrong records.',
1436
- required_artifacts: ['filter input trace', 'included/excluded row proof', 'query or publication result proof'],
1437
- acceptance_gate: 'aiqa_business_assertion',
1438
- false_pass_blockers: ['filter control visible only', 'route screenshot without row proof']
1439
- }, {
1440
- issue_class: 'invoice_pdf_export',
1441
- probe_type: 'issue_class_probe',
1442
- failure_class: 'business',
1443
- action: 'Generate the invoice/PDF/export and inspect the generated artifact.',
1444
- proof_required: 'Generated artifact contains the expected customer-visible rows, totals, fields, or file output.',
1445
- required_artifacts: ['export trigger trace', 'generated file artifact path', 'parsed artifact content proof'],
1446
- acceptance_gate: 'aiqa_business_assertion',
1447
- false_pass_blockers: ['download button visible only', 'unparsed file exists only']
1448
- }, {
1449
- issue_class: 'upload_import',
1450
- probe_type: 'issue_class_probe',
1451
- failure_class: 'business',
1452
- action: 'Run the upload/import workflow with a representative file and assert parsed plus persisted results.',
1453
- proof_required: 'Import result message and persisted rows/counts changed as expected.',
1454
- required_artifacts: ['input file fixture', 'import result message', 'persisted row/count delta'],
1455
- acceptance_gate: 'aiqa_business_assertion',
1456
- false_pass_blockers: ['file picker opens only', 'upload toast without persisted delta']
1457
- }, {
1458
- issue_class: 'route_auth_hydration',
1459
- probe_type: 'issue_class_probe',
1460
- failure_class: 'route',
1461
- action: 'Open the route as the affected user and prove authenticated hydration reaches the functional screen.',
1462
- proof_required: 'Hydrated route shows required controls/data for the affected account and no shell-only fallback.',
1463
- required_artifacts: ['auth context', 'hydrated DOM proof', 'console/network error log'],
1464
- acceptance_gate: 'aiqa_business_assertion',
1465
- false_pass_blockers: ['home route proof', 'login shell proof', 'header-only screenshot']
1466
- }, {
1467
- issue_class: 'slow_query_performance',
1468
- probe_type: 'issue_class_probe',
1469
- failure_class: 'business',
1470
- action: 'Run the reported query/workflow with timing/log evidence before and after the fix.',
1471
- proof_required: 'Timing improves or meets target while result equivalence is preserved.',
1472
- required_artifacts: ['before timing', 'after timing', 'result equivalence proof', 'query/log trace'],
1473
- acceptance_gate: 'aiqa_business_assertion',
1474
- false_pass_blockers: ['compile pass only', 'single timing without before/after comparison']
1475
- }];
1476
1365
  function normalizeSupportSimilarCaseSelection(value, input) {
1477
1366
  var object = cleanObject(value);
1478
1367
  if (Array.isArray(value)) {
@@ -1533,7 +1422,6 @@ function buildResolveIOSupportDiagnosisEvidencePack(input) {
1533
1422
  var normalizedDiagnosis = validation.normalized;
1534
1423
  var proofMatrix = validation.proofMatrix || buildResolveIOSupportDiagnosisProofMatrix(diagnosisSource, input.now);
1535
1424
  var ownerFileHints = cleanList(__spreadArray(__spreadArray(__spreadArray([], __read(cleanList(input.ownerFiles, 16, 500)), false), __read(cleanList(normalizedDiagnosis === null || normalizedDiagnosis === void 0 ? void 0 : normalizedDiagnosis.owner_files, 16, 500)), false), __read(cleanList(activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.targetFiles, 8, 500)), false), 16, 500).map(normalizeOwnerFilePath).filter(Boolean);
1536
- var issueClassHint = normalizeIssueClass(input.issueClass || (normalizedDiagnosis === null || normalizedDiagnosis === void 0 ? void 0 : normalizedDiagnosis.issue_class));
1537
1425
  var text = cleanText([
1538
1426
  input.text,
1539
1427
  bundle === null || bundle === void 0 ? void 0 : bundle.supportV5ScopeDigest,
@@ -1543,7 +1431,6 @@ function buildResolveIOSupportDiagnosisEvidencePack(input) {
1543
1431
  (_d = input.ticketContext) === null || _d === void 0 ? void 0 : _d.summary
1544
1432
  ].filter(Boolean).join(' '), 3000);
1545
1433
  var similarInput = {
1546
- issueClass: issueClassHint || (normalizedDiagnosis === null || normalizedDiagnosis === void 0 ? void 0 : normalizedDiagnosis.issue_class),
1547
1434
  ownerFiles: ownerFileHints,
1548
1435
  text: text,
1549
1436
  candidates: Array.isArray(input.similarCaseHints) ? input.similarCaseHints : [],
@@ -1560,7 +1447,6 @@ function buildResolveIOSupportDiagnosisEvidencePack(input) {
1560
1447
  return {
1561
1448
  packId: "support-diagnosis-pack-".concat(hashResolveIOSupportV5Evidence({
1562
1449
  status: status,
1563
- issueClassHint: issueClassHint,
1564
1450
  ownerFileHints: ownerFileHints,
1565
1451
  blockers: validation.blockers,
1566
1452
  text: text,
@@ -1577,11 +1463,14 @@ function buildResolveIOSupportDiagnosisEvidencePack(input) {
1577
1463
  diagnosisValid: validation.valid,
1578
1464
  diagnosisStatus: validation.status,
1579
1465
  validationBlockers: validation.blockers,
1580
- issueClassHint: issueClassHint || undefined,
1581
1466
  ownerFileHints: ownerFileHints.slice(0, 12),
1582
1467
  activeMicrotaskId: activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.microtaskId,
1583
1468
  similarCaseSelection: similarCaseSelection,
1584
- issueClassProbeCatalog: SUPPORT_ISSUE_CLASS_PROBE_CATALOG,
1469
+ businessProofGuidance: [
1470
+ 'Let the model choose the proof mechanics from the current ticket, code path, and data evidence; do not map the ticket into a fixed issue/proof category.',
1471
+ 'Use only checks that directly prove or falsify this customer complaint.',
1472
+ 'Acceptance requires AIQaBusinessAssertion before/action/after proof tied to the diagnosis proof_plan; route load or a model claim is not enough.'
1473
+ ],
1585
1474
  proofMatrix: proofMatrix,
1586
1475
  structuredFacts: {
1587
1476
  currentDiagnosisStatus: validation.status,
@@ -1603,28 +1492,6 @@ function buildResolveIOSupportDiagnosisEvidencePack(input) {
1603
1492
  generatedAt: generatedAt
1604
1493
  };
1605
1494
  }
1606
- function inferResolveIOSupportIssueClassFromText(value) {
1607
- var text = cleanText(value, 3000).toLowerCase();
1608
- if (/\b(upload|import|csv|spreadsheet|attachment|file)\b/.test(text)) {
1609
- return 'upload_import';
1610
- }
1611
- if (/\b(invoice|pdf|export|print|printed|report|download)\b/.test(text)) {
1612
- return 'invoice_pdf_export';
1613
- }
1614
- if (/\b(filter|query|search|wrong customer|wrong account|mismatch)\b/.test(text)) {
1615
- return 'filter_query_mismatch';
1616
- }
1617
- if (/\b(route|auth|permission|login|hydrate|hydration|blank page|shell)\b/.test(text)) {
1618
- return 'route_auth_hydration';
1619
- }
1620
- if (/\b(slow|timeout|performance|latency|takes too long|hang)\b/.test(text)) {
1621
- return 'slow_query_performance';
1622
- }
1623
- if (/\b(submit|save|click|button|no-op|does nothing|not saving)\b/.test(text)) {
1624
- return 'no_op_submit';
1625
- }
1626
- return 'missing_wrong_data';
1627
- }
1628
1495
  function firstSupportDiagnosisText() {
1629
1496
  var e_5, _a;
1630
1497
  var values = [];
@@ -1656,71 +1523,24 @@ function extractSupportDiagnosisLineValue(text, label, max) {
1656
1523
  return cleanText(match === null || match === void 0 ? void 0 : match[1], max);
1657
1524
  }
1658
1525
  function inferSupportDiagnosisRouteModuleFromOwners(ownerFiles, text) {
1659
- var joinedOwners = ownerFiles.join('\n');
1660
- if (/part\/detail|part-detail|inventory/i.test("".concat(joinedOwners, "\n").concat(text))) {
1661
- return 'H2SKO part inventory detail / inventory print workflow';
1662
- }
1663
- if (/document\/pick-ticket|pick-ticket/i.test(joinedOwners)) {
1664
- return 'H2SKO pick-ticket print/report workflow';
1665
- }
1666
- if (/invoice/i.test("".concat(joinedOwners, "\n").concat(text))) {
1667
- return 'invoice/PDF/export workflow';
1668
- }
1669
- if (/upload|import/i.test("".concat(joinedOwners, "\n").concat(text))) {
1670
- return 'upload/import workflow';
1671
- }
1672
- return firstSupportDiagnosisText(extractSupportDiagnosisLineValue(text, 'Route'), extractSupportDiagnosisLineValue(text, 'Module'));
1526
+ return firstSupportDiagnosisText(extractSupportDiagnosisLineValue(text, 'Route'), extractSupportDiagnosisLineValue(text, 'Module'), extractSupportDiagnosisLineValue(text, 'Workflow'), ownerFiles.length ? "Affected owner path: ".concat(ownerFiles[0]) : '');
1673
1527
  }
1674
- function buildSupportDiagnosisProofPlanScaffold(issueClass, complaint, routeModule) {
1528
+ function buildSupportDiagnosisProofPlanScaffold(complaint, routeModule) {
1675
1529
  var target = cleanText(routeModule || complaint || 'the reported workflow', 300);
1676
- if (issueClass === 'upload_import') {
1677
- return {
1678
- before: 'Capture the target records/counts before re-running the customer import.',
1679
- before_state_unavailable_reason: '',
1680
- action: "Run the same upload/import path for ".concat(target, " with the staged customer attachment or an equivalent ticket fixture."),
1681
- after: 'Every expected imported row is attached/persisted with the correct relationships and no silently skipped rows.',
1682
- business_assertion: 'The import creates or updates all ticket-expected records, not just a successful upload shell.',
1683
- route: target,
1684
- data_assertion: 'Mongo/DOM row counts and representative imported records match the attachment contents.',
1685
- artifact_expectation: 'before count JSON, import action trace/screenshot, after count JSON, representative imported record proof',
1686
- business_proof_contract: {
1687
- issue_class: issueClass,
1688
- setup_state: 'Customer attachment or localhost fixture is available before import.',
1689
- action_under_test: 'Execute the import workflow end to end.',
1690
- expected_business_state_change: 'All expected rows/relationships exist after import.',
1691
- prohibited_false_pass: 'Upload completion, route load, screenshot, scorecard, or model claim alone is not acceptance.',
1692
- proof_artifacts: ['before Mongo/data snapshot', 'import action trace or screenshot', 'after Mongo/data snapshot', 'row-level mismatch report'],
1693
- data_or_dom_assertion: 'Imported record counts and key fields match the source attachment.'
1694
- }
1695
- };
1696
- }
1697
- var action = issueClass === 'invoice_pdf_export'
1698
- ? "Run the print/report/export path for ".concat(target, " using the named customer record.")
1699
- : issueClass === 'filter_query_mismatch'
1700
- ? "Run the filtered/search/query workflow for ".concat(target, " using the named customer/account context.")
1701
- : "Run the exact customer-reported workflow for ".concat(target, ".");
1530
+ var action = "Run the exact customer-reported workflow for ".concat(target, ".");
1702
1531
  return {
1703
- before: 'Capture the customer-reported wrong/missing value before repair using the staged ticket context.',
1532
+ before: 'Capture the customer-reported failing behavior or state before repair using the staged ticket context.',
1704
1533
  before_state_unavailable_reason: '',
1705
1534
  action: action,
1706
- after: 'The same workflow shows the expected customer/account data and no longer shows the wrong value.',
1707
- business_assertion: 'The reported business value is correct after the action, not merely that the route loaded.',
1535
+ after: 'The same workflow reaches the customer-expected behavior or state.',
1536
+ business_assertion: 'The customer-reported behavior is correct after the action, not merely that the route loaded.',
1708
1537
  route: target,
1709
- data_assertion: 'DOM/print/report output and persisted source data agree for the named customer record.',
1710
- artifact_expectation: 'before screenshot/data snapshot, action trace, after screenshot/data snapshot, AIQaBusinessAssertion JSON',
1711
- business_proof_contract: {
1712
- issue_class: issueClass,
1713
- setup_state: 'The named customer record is present in the staged support data before action.',
1714
- action_under_test: action,
1715
- expected_business_state_change: 'The visible/output business data matches the expected persisted value.',
1716
- prohibited_false_pass: 'Route load, screenshot-only proof, scorecard pass, or model claim alone is not acceptance.',
1717
- proof_artifacts: ['before DOM/data snapshot', 'action trace/screenshot', 'after DOM/data snapshot', 'Mongo or persisted data comparison'],
1718
- data_or_dom_assertion: 'The displayed/output value matches the expected persisted customer value.'
1719
- }
1538
+ data_assertion: 'The observable UI, output, persisted state, or calculated result matches the customer-expected outcome for this ticket.',
1539
+ artifact_expectation: 'model-chosen evidence sufficient to prove the business assertion'
1720
1540
  };
1721
1541
  }
1722
1542
  function buildResolveIOSupportDiagnosisRetryScaffold(input) {
1723
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1543
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1724
1544
  var existing = normalizeResolveIOSupportDiagnosisGate(input.diagnosisGate, input.now);
1725
1545
  var scopeText = cleanText([
1726
1546
  (_a = input.bundle) === null || _a === void 0 ? void 0 : _a.supportV5ScopeDigest,
@@ -1729,15 +1549,13 @@ function buildResolveIOSupportDiagnosisRetryScaffold(input) {
1729
1549
  ].filter(Boolean).join('\n'), 3000);
1730
1550
  var ownerFiles = Array.from(new Set(__spreadArray(__spreadArray([], __read(cleanList(existing === null || existing === void 0 ? void 0 : existing.owner_files, 8, 500)), false), __read(cleanList((_f = input.evidencePack) === null || _f === void 0 ? void 0 : _f.ownerFileHints, 8, 500)), false).map(normalizeOwnerFilePath).filter(Boolean))).slice(0, 8);
1731
1551
  var complaint = firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.issue_case.customer_complaint, extractSupportDiagnosisLineValue(scopeText, 'Customer complaint'), extractSupportDiagnosisLineValue(scopeText, 'Issue'), extractSupportDiagnosisLineValue(scopeText, 'Approved scope'), scopeText);
1732
- var issueClass = normalizeIssueClass((existing === null || existing === void 0 ? void 0 : existing.issue_class) || ((_g = input.evidencePack) === null || _g === void 0 ? void 0 : _g.issueClassHint))
1733
- || inferResolveIOSupportIssueClassFromText("".concat(scopeText, "\n").concat(ownerFiles.join('\n')));
1734
1552
  var routeModule = firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.issue_case.route_module, inferSupportDiagnosisRouteModuleFromOwners(ownerFiles, scopeText), extractSupportDiagnosisLineValue(scopeText, 'Route'), extractSupportDiagnosisLineValue(scopeText, 'Module'));
1735
1553
  var expected = firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.issue_case.expected_result, extractSupportDiagnosisLineValue(scopeText, 'Expected'), complaint ? "The customer-reported workflow should use the correct business data for: ".concat(complaint) : '');
1736
1554
  var observed = firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.issue_case.observed_result, extractSupportDiagnosisLineValue(scopeText, 'Observed'), complaint ? "The observed behavior is the customer report that needs reproduction: ".concat(complaint) : '');
1737
- var accountContext = firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.issue_case.account_customer_context, extractSupportDiagnosisLineValue(scopeText, 'Client'), extractSupportDiagnosisLineValue(scopeText, 'Customer'), extractSupportDiagnosisLineValue(scopeText, 'Reporter'), (_j = (_h = input.bundle) === null || _h === void 0 ? void 0 : _h.supportV5SupervisorState) === null || _j === void 0 ? void 0 : _j.currentGoal);
1555
+ var accountContext = firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.issue_case.account_customer_context, extractSupportDiagnosisLineValue(scopeText, 'Client'), extractSupportDiagnosisLineValue(scopeText, 'Customer'), extractSupportDiagnosisLineValue(scopeText, 'Reporter'), (_h = (_g = input.bundle) === null || _g === void 0 ? void 0 : _g.supportV5SupervisorState) === null || _h === void 0 ? void 0 : _h.currentGoal);
1738
1556
  var proofPlan = (existing === null || existing === void 0 ? void 0 : existing.proof_plan) && (existing.proof_plan.action || existing.proof_plan.business_assertion)
1739
1557
  ? existing.proof_plan
1740
- : buildSupportDiagnosisProofPlanScaffold(issueClass, complaint, routeModule);
1558
+ : buildSupportDiagnosisProofPlanScaffold(complaint, routeModule);
1741
1559
  return {
1742
1560
  instruction: 'Starter only. Replace scaffolded guesses with verified ticket/code/browser/Mongo/log evidence before returning support_diagnosis_gate. Do not copy TODO/placeholder text and do not leave strings blank.',
1743
1561
  support_diagnosis_gate: {
@@ -1750,7 +1568,6 @@ function buildResolveIOSupportDiagnosisRetryScaffold(input) {
1750
1568
  reproduction_status: (existing === null || existing === void 0 ? void 0 : existing.issue_case.reproduction_status) || 'blocked',
1751
1569
  reproduction_blocker: (existing === null || existing === void 0 ? void 0 : existing.issue_case.reproduction_blocker) || 'TODO: replace with blocker only if reproduction cannot be performed.'
1752
1570
  },
1753
- issue_class: issueClass,
1754
1571
  accepted_hypothesis: {
1755
1572
  statement: firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.accepted_hypothesis.statement) || 'TODO: one falsifiable root-cause theory backed by current-ticket evidence.',
1756
1573
  falsifiable_test: firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.accepted_hypothesis.falsifiable_test) || 'TODO: exact test that would prove this hypothesis wrong.',
@@ -1777,8 +1594,7 @@ function normalizeSupportDiagnosisBusinessProofContract(value, issueClassHint) {
1777
1594
  return undefined;
1778
1595
  }
1779
1596
  var issueClass = normalizeIssueClass(source.issue_class || source.issueClass || issueClassHint)
1780
- || normalizeIssueClass(issueClassHint)
1781
- || 'missing_wrong_data';
1597
+ || normalizeIssueClass(issueClassHint);
1782
1598
  var expectedBusinessStateChange = pickText(source, ['expected_business_state_change', 'expectedBusinessStateChange', 'expected_change', 'expectedChange', 'after'], 1000);
1783
1599
  var dataOrDomAssertion = pickText(source, [
1784
1600
  'data_or_dom_assertion',
@@ -1794,20 +1610,12 @@ function normalizeSupportDiagnosisBusinessProofContract(value, issueClassHint) {
1794
1610
  var proofArtifacts = cleanList(source.proof_artifacts || source.proofArtifacts || source.artifacts || source.artifact_paths || source.artifactPaths, 10, 500);
1795
1611
  var hasPathLikeArtifactName = proofArtifacts.some(function (artifact) { return /[/.\\]|json|artifact|aiqa|evidence/i.test(artifact); });
1796
1612
  if (proofArtifacts.length && hasPathLikeArtifactName && proofArtifacts.every(supportProofArtifactLooksVague)) {
1797
- var derivedArtifact = firstSupportDiagnosisText(dataOrDomAssertion ? "DOM/data proof artifact: ".concat(dataOrDomAssertion) : '', expectedBusinessStateChange ? "before/after business data proof artifact: ".concat(expectedBusinessStateChange) : '');
1613
+ var derivedArtifact = firstSupportDiagnosisText(dataOrDomAssertion ? "Business proof artifact: ".concat(dataOrDomAssertion) : '', expectedBusinessStateChange ? "Before/after business-state proof artifact: ".concat(expectedBusinessStateChange) : '');
1798
1614
  if (derivedArtifact && !proofArtifacts.includes(derivedArtifact)) {
1799
1615
  proofArtifacts.push(derivedArtifact);
1800
1616
  }
1801
1617
  }
1802
- return {
1803
- issue_class: issueClass,
1804
- setup_state: pickText(source, ['setup_state', 'setupState', 'before', 'precondition'], 1000),
1805
- action_under_test: pickText(source, ['action_under_test', 'actionUnderTest', 'action', 'steps'], 1000),
1806
- expected_business_state_change: expectedBusinessStateChange,
1807
- prohibited_false_pass: pickText(source, ['prohibited_false_pass', 'prohibitedFalsePass', 'false_pass', 'falsePass'], 1000),
1808
- proof_artifacts: proofArtifacts,
1809
- data_or_dom_assertion: dataOrDomAssertion
1810
- };
1618
+ return __assign(__assign({}, (issueClass ? { issue_class: issueClass } : {})), { setup_state: pickText(source, ['setup_state', 'setupState', 'before', 'precondition'], 1000), action_under_test: pickText(source, ['action_under_test', 'actionUnderTest', 'action', 'steps'], 1000), expected_business_state_change: expectedBusinessStateChange, prohibited_false_pass: pickText(source, ['prohibited_false_pass', 'prohibitedFalsePass', 'false_pass', 'falsePass'], 1000), proof_artifacts: proofArtifacts, data_or_dom_assertion: dataOrDomAssertion });
1811
1619
  }
1812
1620
  function supportDiagnosisNarrativeText(value, max) {
1813
1621
  if (max === void 0) { max = 1200; }
@@ -2169,33 +1977,31 @@ function supportDiagnosisTextLooksGeneric(value, minimumLength) {
2169
1977
  || meaningfulWords.length < 3
2170
1978
  || /^(n a|na|none|null|unknown|todo|tbd|pending|fix|bug|issue|problem|broken|not working|works|should work)$/i.test(compact)
2171
1979
  || /\b(todo|tbd|placeholder|replace with|do not copy|do not leave blank|ticket specific|unknown|guess|maybe|probably|something|somewhere|stuff|things?)\b/i.test(compact)
1980
+ || /\b(inspected as customer facing .* context|expected customer facing business result from ticket evidence|observed reported wrong business result from ticket|from ticket or screenshot evidence)\b/i.test(compact)
2172
1981
  || /^(fix|debug|investigate|check|look into|test|verify)( the)? (issue|bug|problem|ticket|route|page)$/i.test(compact)
2173
1982
  || /^(the )?(issue|bug|problem|ticket|route|page)( is)? (fixed|broken|not working|wrong)$/i.test(compact);
2174
1983
  }
2175
1984
  function collectGenericSupportDiagnosisFields(gate) {
2176
- var _a, _b, _c, _d;
2177
1985
  var fields = [
2178
- ['issue_case.expected_result', gate.issue_case.expected_result, 18],
2179
- ['issue_case.observed_result', gate.issue_case.observed_result, 18],
1986
+ ['issue_case.customer_complaint', gate.issue_case.customer_complaint, 18],
2180
1987
  ['accepted_hypothesis.statement', gate.accepted_hypothesis.statement, 24],
2181
1988
  ['accepted_hypothesis.falsifiable_test', gate.accepted_hypothesis.falsifiable_test, 24],
2182
1989
  ['proof_plan.before', gate.proof_plan.before || gate.proof_plan.before_state_unavailable_reason, 24],
2183
1990
  ['proof_plan.action', gate.proof_plan.action, 24],
2184
1991
  ['proof_plan.after', gate.proof_plan.after, 24],
2185
1992
  ['proof_plan.business_assertion', gate.proof_plan.business_assertion, 24],
2186
- ['proof_plan.data_assertion', gate.proof_plan.data_assertion, 24],
2187
- ['proof_plan.business_proof_contract.setup_state', (_a = gate.proof_plan.business_proof_contract) === null || _a === void 0 ? void 0 : _a.setup_state, 24],
2188
- ['proof_plan.business_proof_contract.action_under_test', (_b = gate.proof_plan.business_proof_contract) === null || _b === void 0 ? void 0 : _b.action_under_test, 24],
2189
- ['proof_plan.business_proof_contract.expected_business_state_change', (_c = gate.proof_plan.business_proof_contract) === null || _c === void 0 ? void 0 : _c.expected_business_state_change, 24],
2190
- ['proof_plan.business_proof_contract.data_or_dom_assertion', (_d = gate.proof_plan.business_proof_contract) === null || _d === void 0 ? void 0 : _d.data_or_dom_assertion, 24]
1993
+ ['proof_plan.data_assertion', gate.proof_plan.data_assertion, 24]
2191
1994
  ];
1995
+ if (gate.issue_case.reproduction_status === 'reproduced') {
1996
+ fields.push(['issue_case.expected_result', gate.issue_case.expected_result, 18], ['issue_case.observed_result', gate.issue_case.observed_result, 18]);
1997
+ }
2192
1998
  var genericFields = fields
2193
1999
  .filter(function (_a) {
2194
2000
  var _b = __read(_a, 3), field = _b[0], value = _b[1], minimumLength = _b[2];
2195
2001
  if (!cleanText(value, 1000)) {
2196
2002
  return false;
2197
2003
  }
2198
- if ((field === 'proof_plan.data_assertion' || field === 'proof_plan.business_proof_contract.data_or_dom_assertion')
2004
+ if (field === 'proof_plan.data_assertion'
2199
2005
  && /\b(id|url|pdf)\b/i.test(cleanText(value, 1000))) {
2200
2006
  return supportDiagnosisTextLooksGeneric(value, 12);
2201
2007
  }
@@ -2219,9 +2025,9 @@ function supportProofArtifactLooksVague(value) {
2219
2025
  return true;
2220
2026
  }
2221
2027
  var compact = text.replace(/[^a-z0-9]+/g, ' ').trim();
2222
- var businessSignal = /\b(dom|data|mongo|delta|row|rows|count|counts|record|records|persist|persisted|parsed|field|fields|pdf|export|invoice|upload|import|dropdown|selected|selection|id|total|timing|duration|latency|query|network|console|method|publication|response|before|after)\b/i.test(compact);
2223
- var routeOnlySignal = /\b(screenshot|screen shot|browser trace|trace|log|page|route|screen)\b/i.test(compact);
2224
- return !businessSignal || (/^(screenshot|screen shot|browser trace|trace|log|page screenshot|route screenshot|screen screenshot)$/i.test(compact) && routeOnlySignal);
2028
+ var words = compact.split(/\s+/).filter(Boolean);
2029
+ return words.length < 3
2030
+ || /^(screenshot|screen shot|browser trace|trace|log|page screenshot|route screenshot|screen screenshot|artifact|proof|evidence)$/i.test(compact);
2225
2031
  }
2226
2032
  function proofPlanLooksRouteOnly(proofPlan) {
2227
2033
  var assertionText = cleanText([
@@ -2236,8 +2042,9 @@ function proofPlanLooksRouteOnly(proofPlan) {
2236
2042
  }
2237
2043
  var routeOnlySignal = /\b(route|page|screen|dashboard|url|component|shell)\b/.test(assertionText)
2238
2044
  && /\b(loads?|loaded|renders?|rendered|opens?|opened|visible|visibility|hydrates?|hydrated|screenshot)\b/.test(assertionText);
2239
- var businessSignal = /\b(save|saved|persist|persisted|create|created|update|updated|delete|deleted|filter|filtered|exclude|excluded|include|included|row|rows|record|records|count|counts|total|totals|value|values|data|mongo|query|result|results|invoice|pdf|export|download|upload|import|dropdown|selection|selected|form|submit|submitted|validation|error message|customer|account|user|permission|auth|control|button|status|calculation|performance|duration|latency)\b/.test(assertionText);
2240
- return routeOnlySignal && !businessSignal;
2045
+ var hasStateChange = /\b(before|after|expected|observed|actual|same|changed|unchanged|proves?|asserts?|compares?)\b/.test(assertionText)
2046
+ || assertionText.length > 180;
2047
+ return routeOnlySignal && !hasStateChange;
2241
2048
  }
2242
2049
  function supportDiagnosisEvidenceLooksRouteOnly(entry) {
2243
2050
  var text = cleanText([entry.summary, entry.artifactPath].filter(Boolean).join(' '), 2200).toLowerCase();
@@ -2246,19 +2053,20 @@ function supportDiagnosisEvidenceLooksRouteOnly(entry) {
2246
2053
  }
2247
2054
  var routeOnlySignal = /\b(route|page|screen|dashboard|url|component|shell|screenshot|screen shot)\b/.test(text)
2248
2055
  && /\b(loads?|loaded|renders?|rendered|opens?|opened|visible|visibility|hydrates?|hydrated|captured|displayed)\b/.test(text);
2249
- var businessSignal = /\b(save|saved|persist|persisted|create|created|update|updated|delete|deleted|filter|filtered|exclude|excluded|include|included|row|rows|record|records|count|counts|total|totals|value|values|data|mongo|query|result|results|invoice|pdf|export|download|upload|import|dropdown|selection|selected|form|submit|submitted|validation|error message|customer|account|user|permission|auth|control|button|status|calculation|performance|duration|latency|before|after)\b/.test(text);
2250
- return routeOnlySignal && !businessSignal;
2056
+ var hasStateChange = /\b(before|after|expected|observed|actual|same|changed|unchanged|proves?|asserts?|compares?)\b/.test(text)
2057
+ || text.length > 220;
2058
+ return routeOnlySignal && !hasStateChange;
2251
2059
  }
2252
2060
  function supportDiagnosisEvidenceLooksBusinessSpecific(entry) {
2253
2061
  var text = cleanText([entry.summary, entry.artifactPath].filter(Boolean).join(' '), 2200).toLowerCase();
2254
2062
  if (!text || supportDiagnosisEvidenceLooksRouteOnly(entry)) {
2255
2063
  return false;
2256
2064
  }
2257
- return /\b(save|saved|persist|persisted|create|created|update|updated|delete|deleted|filter|filtered|exclude|excluded|include|included|row|rows|record|records|count|counts|total|totals|value|values|data|mongo|query|result|results|invoice|pdf|export|download|upload|import|dropdown|selection|selected|form|submit|submitted|validation|error message|customer|account|user|permission|auth|control|button|status|calculation|performance|duration|latency|before|after)\b/.test(text);
2065
+ return text.split(/\s+/).filter(Boolean).length >= 8
2066
+ || Boolean(cleanText(entry.artifactPath, 500) && !/\.(?:png|jpe?g|webp)$/i.test(cleanText(entry.artifactPath, 500)));
2258
2067
  }
2259
2068
  var SUPPORT_REPRODUCTION_EVIDENCE_TYPES = new Set(['browser', 'mongo', 'log', 'qa']);
2260
2069
  var SUPPORT_ROOT_CAUSE_EVIDENCE_TYPES = new Set(['browser', 'mongo', 'log', 'code', 'commit', 'qa']);
2261
- var SUPPORT_ARTIFACT_RECOMMENDED_EVIDENCE_TYPES = new Set(['browser', 'mongo', 'log', 'qa']);
2262
2070
  function supportDiagnosisEvidenceRef(entry) {
2263
2071
  return {
2264
2072
  evidenceId: entry.id || "evidence-".concat(hashResolveIOSupportV5Evidence(entry).slice(0, 12)),
@@ -2326,7 +2134,6 @@ function buildResolveIOSupportDiagnosisProofMatrix(value, now) {
2326
2134
  }
2327
2135
  var evidenceRefs = gate.evidence.map(supportDiagnosisEvidenceRef);
2328
2136
  var reproductionEvidence = evidenceRefs.filter(function (entry) { return SUPPORT_REPRODUCTION_EVIDENCE_TYPES.has(entry.type); });
2329
- var businessReproductionEvidence = reproductionEvidence.filter(supportDiagnosisEvidenceLooksBusinessSpecific);
2330
2137
  var rootCauseEvidence = evidenceRefs.filter(function (entry) { return SUPPORT_ROOT_CAUSE_EVIDENCE_TYPES.has(entry.type); });
2331
2138
  var ownerFileCoverage = supportDiagnosisOwnerFileCoverage(gate, evidenceRefs);
2332
2139
  var proofContract = gate.proof_plan.business_proof_contract;
@@ -2337,15 +2144,12 @@ function buildResolveIOSupportDiagnosisProofMatrix(value, now) {
2337
2144
  beforeActionAfter: !!((gate.proof_plan.before || gate.proof_plan.before_state_unavailable_reason) && gate.proof_plan.action && gate.proof_plan.after),
2338
2145
  businessAssertion: !!gate.proof_plan.business_assertion,
2339
2146
  businessProofContract: !!proofContract,
2340
- dataOrDomAssertion: !!(gate.proof_plan.data_assertion || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion))
2147
+ dataOrDomAssertion: !!(gate.proof_plan.data_assertion || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion) || gate.proof_plan.business_assertion)
2341
2148
  };
2342
2149
  var blockers = [];
2343
2150
  if (gate.issue_case.reproduction_status === 'reproduced' && !reproductionEvidence.length) {
2344
2151
  blockers.push('Proof matrix requires reproduction evidence for reproduced support diagnoses.');
2345
2152
  }
2346
- if (gate.issue_case.reproduction_status === 'reproduced' && reproductionEvidence.length && !businessReproductionEvidence.length) {
2347
- blockers.push('Proof matrix requires issue-specific business reproduction evidence; route-load or screenshot-only evidence cannot satisfy reproduction.');
2348
- }
2349
2153
  if (!rootCauseEvidence.length) {
2350
2154
  blockers.push('Proof matrix requires typed root-cause evidence before repair.');
2351
2155
  }
@@ -2353,11 +2157,8 @@ function buildResolveIOSupportDiagnosisProofMatrix(value, now) {
2353
2157
  if (uncoveredOwners.length) {
2354
2158
  blockers.push("Proof matrix owner_files are not tied to failing_path or structured evidence ownerFiles: ".concat(uncoveredOwners.join(', '), "."));
2355
2159
  }
2356
- if (!businessProofArtifacts.length) {
2357
- blockers.push('Proof matrix requires business proof artifacts from the diagnosis proof_plan.');
2358
- }
2359
- if (!proofPlanChecks.beforeActionAfter || !proofPlanChecks.businessAssertion || !proofPlanChecks.businessProofContract || !proofPlanChecks.dataOrDomAssertion) {
2360
- blockers.push('Proof matrix requires before/action/after, business assertion, business_proof_contract, and DOM/data assertion coverage.');
2160
+ if (!proofPlanChecks.beforeActionAfter || !proofPlanChecks.businessAssertion || !proofPlanChecks.dataOrDomAssertion) {
2161
+ blockers.push('Proof matrix requires a model-chosen before/action/after proof plan with a concrete business assertion.');
2361
2162
  }
2362
2163
  return {
2363
2164
  matrixId: "support-diagnosis-proof-matrix-".concat(hashResolveIOSupportV5Evidence({
@@ -2425,20 +2226,10 @@ function evaluateResolveIOSupportDiagnosisEvidenceQuality(value) {
2425
2226
  if (normalized.issue_case.reproduction_status === 'reproduced' && !hasReproductionEvidence) {
2426
2227
  blockers.push('Diagnosis reproduced issue_case requires browser, Mongo, log, or QA reproduction evidence before repair.');
2427
2228
  }
2428
- if (normalized.issue_case.reproduction_status === 'reproduced' && hasReproductionEvidence && !businessReproductionEvidenceCount) {
2429
- blockers.push('Diagnosis reproduced issue_case requires issue-specific business reproduction proof; route-load or screenshot-only evidence is route evidence only.');
2430
- }
2431
2229
  if (normalized.issue_case.reproduction_status === 'blocked'
2432
2230
  && !normalized.issue_case.reproduction_blocker) {
2433
2231
  blockers.push('Diagnosis blocked reproduction requires issue_case.reproduction_blocker.');
2434
2232
  }
2435
- var unartifactedRuntimeEvidence = evidence.filter(function (entry) { return SUPPORT_ARTIFACT_RECOMMENDED_EVIDENCE_TYPES.has(entry.type) && !entry.artifactPath; });
2436
- if (unartifactedRuntimeEvidence.length) {
2437
- blockers.push("Diagnosis runtime evidence must include artifactPath for replayable proof: ".concat(unartifactedRuntimeEvidence.map(function (entry) { return entry.type; }).join(', '), "."));
2438
- }
2439
- if (normalized.issue_case.reproduction_status === 'reproduced' && artifactBackedEvidenceCount < 1) {
2440
- blockers.push('Diagnosis reproduced issue_case requires at least one artifact-backed evidence item.');
2441
- }
2442
2233
  return {
2443
2234
  valid: blockers.length === 0,
2444
2235
  blockers: blockers,
@@ -2453,6 +2244,80 @@ function evaluateResolveIOSupportDiagnosisEvidenceQuality(value) {
2453
2244
  hasReproductionEvidence: hasReproductionEvidence
2454
2245
  };
2455
2246
  }
2247
+ function evaluateResolveIOSupportDiagnosisProductRepairReadiness(value) {
2248
+ var validation = validateResolveIOSupportDiagnosisGate(value);
2249
+ var gate = validation.normalized;
2250
+ if (!validation.valid || !gate) {
2251
+ var blockers = validation.blockers.length
2252
+ ? validation.blockers
2253
+ : ['SupportDiagnosisGate is missing or incomplete.'];
2254
+ return {
2255
+ ready: false,
2256
+ status: 'diagnosis_missing',
2257
+ nextAction: 'run_diagnosis_gate',
2258
+ reproductionStatus: gate === null || gate === void 0 ? void 0 : gate.issue_case.reproduction_status,
2259
+ reason: 'support_v5_diagnosis_required_before_product_repair',
2260
+ blockers: blockers,
2261
+ requiredEvidence: [
2262
+ 'valid SupportDiagnosisGate',
2263
+ 'issue_case with exact expected/observed/account context',
2264
+ 'accepted falsifiable hypothesis',
2265
+ 'owner_files and before/action/after proof_plan'
2266
+ ]
2267
+ };
2268
+ }
2269
+ if (gate.issue_case.reproduction_status === 'reproduced') {
2270
+ return {
2271
+ ready: true,
2272
+ status: 'ready',
2273
+ nextAction: 'run_owner_scoped_repair',
2274
+ reproductionStatus: gate.issue_case.reproduction_status,
2275
+ reason: 'support_v5_reproduced_business_issue_allows_owner_scoped_repair',
2276
+ blockers: [],
2277
+ requiredEvidence: [
2278
+ 'reproduced issue_case',
2279
+ 'ticket-specific reproduction or root-cause evidence',
2280
+ 'root-cause evidence',
2281
+ 'owner_files coverage',
2282
+ 'before/action/after proof_plan'
2283
+ ]
2284
+ };
2285
+ }
2286
+ if (gate.issue_case.reproduction_status === 'blocked') {
2287
+ var blocker = gate.issue_case.reproduction_blocker
2288
+ || 'Reproduction is blocked; customer/account context is missing.';
2289
+ return {
2290
+ ready: false,
2291
+ status: 'customer_clarification_required',
2292
+ nextAction: 'ask_customer_clarification',
2293
+ reproductionStatus: gate.issue_case.reproduction_status,
2294
+ reason: 'support_v5_reproduction_blocked_before_product_repair',
2295
+ blockers: [
2296
+ "Product-code repair is blocked because reproduction_status=blocked: ".concat(blocker)
2297
+ ],
2298
+ requiredEvidence: [
2299
+ 'customer/account clarification or missing fixture/context',
2300
+ 'revised SupportDiagnosisGate after clarification',
2301
+ 'ticket-specific reproduced evidence before owner-scoped repair'
2302
+ ]
2303
+ };
2304
+ }
2305
+ return {
2306
+ ready: false,
2307
+ status: 'reproduction_required',
2308
+ nextAction: 'collect_new_evidence',
2309
+ reproductionStatus: gate.issue_case.reproduction_status,
2310
+ reason: 'support_v5_classified_diagnosis_requires_reproduction_evidence_before_product_repair',
2311
+ blockers: [
2312
+ 'Product-code repair requires reproduction_status=reproduced; classified diagnoses are advisory only until a read-only probe captures business-specific evidence or records a true blocker.'
2313
+ ],
2314
+ requiredEvidence: [
2315
+ 'read-only reproduction probe or exact method/data replay',
2316
+ 'before-state business proof artifact or explicit blocked reproduction finding',
2317
+ 'revised SupportDiagnosisGate with reproduction_status=reproduced before source edits'
2318
+ ]
2319
+ };
2320
+ }
2456
2321
  function normalizeResolveIOSupportDiagnosisGate(value, now) {
2457
2322
  var _a, _b, _c;
2458
2323
  var rootSource = cleanObject(value);
@@ -2516,7 +2381,7 @@ function normalizeResolveIOSupportDiagnosisGate(value, now) {
2516
2381
  var proofPlanAction = pickText(proofPlanSource, ['action', 'browser_action', 'browserAction', 'steps'], 1000)
2517
2382
  || contractActionUnderTest
2518
2383
  || proofPlanRows.action
2519
- || (shouldDeriveLooseProofPlan ? 'Execute the issue-specific workflow and inspect the affected data/rendering path.' : '');
2384
+ || (shouldDeriveLooseProofPlan ? 'Execute the diagnosed workflow and inspect the affected data/rendering path.' : '');
2520
2385
  var proofPlanAfter = pickText(proofPlanSource, ['after', 'after_state', 'afterState', 'expected_after'], 1000)
2521
2386
  || contractExpectedChange
2522
2387
  || proofPlanRows.after
@@ -2529,23 +2394,15 @@ function normalizeResolveIOSupportDiagnosisGate(value, now) {
2529
2394
  var proofPlanDataAssertion = pickText(proofPlanSource, ['data_assertion', 'dataAssertion', 'mongo_delta', 'mongoDelta'], 1000)
2530
2395
  || contractDataAssertion
2531
2396
  || proofPlanRows.data_assertion
2532
- || (shouldDeriveLooseProofPlan ? 'DOM/data or Mongo proof shows the expected business value and does not show the reported wrong value.' : '');
2397
+ || (shouldDeriveLooseProofPlan ? 'A concrete business assertion proves the expected state and rules out the reported wrong state.' : '');
2533
2398
  var proofPlanArtifactExpectation = pickText(proofPlanSource, ['artifact_expectation', 'artifactExpectation', 'artifact', 'screenshot'], 1000)
2534
2399
  || contractArtifacts.join(' | ').slice(0, 1000)
2535
- || (shouldDeriveLooseProofPlan && proofPlanBusinessAssertion ? 'browser trace/screenshot plus persisted DOM/data or Mongo delta tied to the business assertion' : '');
2536
- var derivedBusinessProofContract = shouldDeriveLooseProofPlan && proofPlanBusinessAssertion ? {
2537
- issue_class: issueClass || source.issue_class || source.issueClass,
2538
- setup_state: proofPlanBeforeResolved || proofPlanBeforeUnavailable,
2539
- action_under_test: proofPlanAction,
2540
- expected_business_state_change: proofPlanAfter || proofPlanBusinessAssertion,
2541
- prohibited_false_pass: 'Route load, screenshot, scorecard, or model claim alone is not acceptance.',
2542
- proof_artifacts: [
2400
+ || (shouldDeriveLooseProofPlan && proofPlanBusinessAssertion ? 'business proof artifacts tied to the assertion and actual execution path' : '');
2401
+ var derivedBusinessProofContract = shouldDeriveLooseProofPlan && proofPlanBusinessAssertion ? __assign(__assign({}, (issueClass ? { issue_class: issueClass } : {})), { setup_state: proofPlanBeforeResolved || proofPlanBeforeUnavailable, action_under_test: proofPlanAction, expected_business_state_change: proofPlanAfter || proofPlanBusinessAssertion, prohibited_false_pass: 'Route load, screenshot, scorecard, or model claim alone is not acceptance.', proof_artifacts: [
2543
2402
  proofPlanArtifactExpectation,
2544
- 'DOM/data assertion artifact',
2545
- 'persisted record or Mongo delta proof'
2546
- ].filter(Boolean),
2547
- data_or_dom_assertion: proofPlanDataAssertion || proofPlanBusinessAssertion
2548
- } : undefined;
2403
+ 'business assertion artifact',
2404
+ 'state-change evidence artifact'
2405
+ ].filter(Boolean), data_or_dom_assertion: proofPlanDataAssertion || proofPlanBusinessAssertion }) : undefined;
2549
2406
  var businessProofContract = normalizeSupportDiagnosisBusinessProofContract(rawBusinessProofContract, issueClass || source.issue_class || source.issueClass) || normalizeSupportDiagnosisBusinessProofContract(derivedBusinessProofContract, issueClass || source.issue_class || source.issueClass);
2550
2407
  var rawOwnerFiles = cleanList(source.owner_files || source.ownerFiles, 20, 500)
2551
2408
  .map(normalizeOwnerFilePath)
@@ -2665,8 +2522,7 @@ function normalizeResolveIOSupportDiagnosisGate(value, now) {
2665
2522
  || hypothesisSource.falsifiableBy
2666
2523
  || hypothesisSource.falsifies_by
2667
2524
  || hypothesisSource.falsifiesBy, 8, 500).join(' | ').slice(0, 1000);
2668
- var gate = {
2669
- issue_case: {
2525
+ var gate = __assign(__assign({ issue_case: {
2670
2526
  customer_complaint: explicitCustomerComplaint || customerIssueCaseText,
2671
2527
  expected_result: expectedResult,
2672
2528
  observed_result: observedResult,
@@ -2676,9 +2532,7 @@ function normalizeResolveIOSupportDiagnosisGate(value, now) {
2676
2532
  ? normalizeReproductionStatus(rawReproductionStatus)
2677
2533
  : (inferredReproductionBlocker ? 'blocked' : (featureRequestClassified || !hasRuntimeReproductionEvidence ? 'classified' : 'reproduced')),
2678
2534
  reproduction_blocker: inferredReproductionBlocker
2679
- },
2680
- issue_class: issueClass || 'missing_wrong_data',
2681
- accepted_hypothesis: {
2535
+ } }, (issueClass ? { issue_class: issueClass } : {})), { accepted_hypothesis: {
2682
2536
  statement: pickText(hypothesisSource, ['statement', 'hypothesis', 'root_cause', 'rootCause', 'root_cause_theory', 'rootCauseTheory', 'theory', 'summary', 'why_accepted', 'whyAccepted'], 1200)
2683
2537
  || hypothesisText,
2684
2538
  falsifiable_test: pickText(hypothesisSource, ['falsifiable_test', 'falsifiableTest', 'falsification_method', 'falsificationMethod', 'falsifiable_method', 'falsifiableMethod', 'test', 'proof', 'falsifier'], 1000)
@@ -2687,17 +2541,13 @@ function normalizeResolveIOSupportDiagnosisGate(value, now) {
2687
2541
  evidence: explicitHypothesisEvidence.length
2688
2542
  ? explicitHypothesisEvidence
2689
2543
  : diagnosisEvidence.map(function (entry) { return [entry.artifactPath, entry.summary].filter(Boolean).join(': '); }).filter(Boolean).slice(0, 10)
2690
- },
2691
- rejected_alternatives: normalizeSupportDiagnosisRejectedAlternatives(source.rejected_alternatives || source.rejectedAlternatives),
2692
- failing_path: {
2544
+ }, rejected_alternatives: normalizeSupportDiagnosisRejectedAlternatives(source.rejected_alternatives || source.rejectedAlternatives), failing_path: {
2693
2545
  frontend: pickText(failingPathSource, ['frontend', 'frontend_path', 'frontendPath', 'eventPath', 'frontend_event_data_path', 'frontendEventDataPath'], 700),
2694
2546
  backend: pickText(failingPathSource, ['backend', 'backend_path', 'backendPath', 'methodPublicationPath', 'backend_method_publication_query_path', 'backendMethodPublicationQueryPath'], 700),
2695
2547
  shared_library: pickText(failingPathSource, ['shared_library', 'sharedLibrary', 'shared_library_path', 'sharedLibraryPath', 'library', 'lib'], 700),
2696
2548
  data_query: pickText(failingPathSource, ['data_query', 'dataQuery', 'query', 'data_path', 'dataPath'], 700),
2697
2549
  description: pickText(failingPathSource, ['description', 'path_chain', 'pathChain', 'chain', 'visibility_gate_trace', 'visibilityGateTrace', 'reported', 'verified', 'reported_path', 'reportedPath', 'verified_path', 'verifiedPath', 'path', 'assessment', 'summary', 'route', 'frontend_event_data_path', 'frontendEventDataPath', 'backend_method_publication_query_path', 'backendMethodPublicationQueryPath', 'data_path', 'dataPath'], 1200) || failingPathText
2698
- },
2699
- owner_files: ownerFiles,
2700
- proof_plan: {
2550
+ }, owner_files: ownerFiles, proof_plan: {
2701
2551
  before: proofPlanBeforeResolved,
2702
2552
  before_state_unavailable_reason: proofPlanBeforeUnavailable,
2703
2553
  action: proofPlanAction,
@@ -2707,13 +2557,7 @@ function normalizeResolveIOSupportDiagnosisGate(value, now) {
2707
2557
  data_assertion: proofPlanDataAssertion,
2708
2558
  artifact_expectation: proofPlanArtifactExpectation,
2709
2559
  business_proof_contract: businessProofContract
2710
- },
2711
- similar_tickets: normalizeSupportDiagnosisHints(source.similar_tickets || source.similarTickets),
2712
- similar_commits: normalizeSupportDiagnosisHints(source.similar_commits || source.similarCommits),
2713
- evidence: diagnosisEvidence,
2714
- status: cleanText(source.status, 80).toLowerCase() || 'incomplete',
2715
- updatedAt: isoNow(now || source.updatedAt || source.updated_at)
2716
- };
2560
+ }, similar_tickets: normalizeSupportDiagnosisHints(source.similar_tickets || source.similarTickets), similar_commits: normalizeSupportDiagnosisHints(source.similar_commits || source.similarCommits), evidence: diagnosisEvidence, status: cleanText(source.status, 80).toLowerCase() || 'incomplete', updatedAt: isoNow(now || source.updatedAt || source.updated_at) });
2717
2561
  if (!['missing', 'incomplete', 'blocked', 'passed'].includes(gate.status)) {
2718
2562
  gate.status = 'incomplete';
2719
2563
  }
@@ -2774,18 +2618,12 @@ function validateResolveIOSupportDiagnosisGate(value, options) {
2774
2618
  if (!normalized.issue_case.observed_result) {
2775
2619
  blockers.push('Diagnosis issue_case.observed_result is required.');
2776
2620
  }
2777
- if (!normalized.issue_case.route_module) {
2778
- blockers.push('Diagnosis issue_case.route_module is required.');
2779
- }
2780
2621
  if (!normalized.issue_case.account_customer_context) {
2781
2622
  blockers.push('Diagnosis issue_case.account_customer_context is required.');
2782
2623
  }
2783
2624
  if (normalized.issue_case.reproduction_status === 'blocked' && !normalized.issue_case.reproduction_blocker) {
2784
2625
  blockers.push('Diagnosis blocked reproduction requires issue_case.reproduction_blocker.');
2785
2626
  }
2786
- if (!normalizeIssueClass(normalized.issue_class)) {
2787
- blockers.push('Diagnosis issue_class must be one of the supported issue-class probes.');
2788
- }
2789
2627
  if (!normalized.accepted_hypothesis.statement) {
2790
2628
  blockers.push('Diagnosis accepted_hypothesis.statement is required.');
2791
2629
  }
@@ -2838,36 +2676,6 @@ function validateResolveIOSupportDiagnosisGate(value, options) {
2838
2676
  if (proofPlanLooksRouteOnly(normalized.proof_plan)) {
2839
2677
  blockers.push('Diagnosis proof_plan cannot be route-load, screen-visible, or screenshot-only; it must name the business state/data/control change that proves the issue is fixed.');
2840
2678
  }
2841
- var proofContract = normalized.proof_plan.business_proof_contract;
2842
- if (!proofContract) {
2843
- blockers.push('Diagnosis proof_plan.business_proof_contract is required.');
2844
- }
2845
- else {
2846
- if (proofContract.issue_class !== normalized.issue_class) {
2847
- blockers.push("Diagnosis proof_plan.business_proof_contract.issue_class (".concat(proofContract.issue_class, ") must match diagnosis issue_class (").concat(normalized.issue_class, ")."));
2848
- }
2849
- if (!proofContract.setup_state) {
2850
- blockers.push('Diagnosis proof_plan.business_proof_contract.setup_state is required.');
2851
- }
2852
- if (!proofContract.action_under_test) {
2853
- blockers.push('Diagnosis proof_plan.business_proof_contract.action_under_test is required.');
2854
- }
2855
- if (!proofContract.expected_business_state_change) {
2856
- blockers.push('Diagnosis proof_plan.business_proof_contract.expected_business_state_change is required.');
2857
- }
2858
- if (!proofContract.prohibited_false_pass) {
2859
- blockers.push('Diagnosis proof_plan.business_proof_contract.prohibited_false_pass is required.');
2860
- }
2861
- if (!proofContract.proof_artifacts.length) {
2862
- blockers.push('Diagnosis proof_plan.business_proof_contract.proof_artifacts must include at least one required artifact.');
2863
- }
2864
- else if (proofContract.proof_artifacts.every(supportProofArtifactLooksVague)) {
2865
- blockers.push('Diagnosis proof_plan.business_proof_contract.proof_artifacts are too generic; include replayable DOM/data/Mongo/network/artifact proof tied to the business assertion.');
2866
- }
2867
- if (!proofContract.data_or_dom_assertion) {
2868
- blockers.push('Diagnosis proof_plan.business_proof_contract.data_or_dom_assertion is required.');
2869
- }
2870
- }
2871
2679
  if (!normalized.evidence.length) {
2872
2680
  blockers.push('Diagnosis evidence must include ticket/code/browser/log/Mongo proof.');
2873
2681
  }
@@ -3299,7 +3107,7 @@ function evaluateResolveIOSupportBusinessProofReadiness(input) {
3299
3107
  'AIQaBusinessAssertion status=pass',
3300
3108
  'business assertion maps to diagnosis proof_plan/business_proof_contract',
3301
3109
  'artifact path for browser/data proof',
3302
- 'DOM/data proof or Mongo delta for the expected business state change'
3110
+ 'concrete proof for the expected business state change'
3303
3111
  ];
3304
3112
  if (!diagnosisValidation.valid || !gate) {
3305
3113
  return __assign({ ready: false, status: 'blocked', reason: 'support_business_proof_waiting_on_valid_diagnosis', blockers: diagnosisValidation.blockers.length ? diagnosisValidation.blockers : ['Valid SupportDiagnosisGate is required before business proof can accept the ticket.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields());
@@ -3330,7 +3138,7 @@ function evaluateResolveIOSupportBusinessProofReadiness(input) {
3330
3138
  }); });
3331
3139
  if (routeOnly) {
3332
3140
  var routeOnlyFingerprint = supportBusinessProofFingerprint(gate, routeOnly, artifactPaths);
3333
- return __assign(__assign({ ready: false, status: 'route_only', reason: 'support_business_proof_route_only_or_acceptance_blocked', blockers: ['Route probe, shell/screenshot, or acceptance_blocked proof cannot accept the ticket. Run the issue-class business assertion.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
3141
+ return __assign(__assign({ ready: false, status: 'route_only', reason: 'support_business_proof_route_only_or_acceptance_blocked', blockers: ['Route probe, shell/screenshot, or acceptance_blocked proof cannot accept the ticket. Run the business-proof assertion tied to the diagnosis.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
3334
3142
  artifactPaths: artifactPaths,
3335
3143
  proofFingerprint: routeOnlyFingerprint,
3336
3144
  artifactFingerprint: artifactFingerprint,
@@ -3352,7 +3160,7 @@ function evaluateResolveIOSupportBusinessProofReadiness(input) {
3352
3160
  if (sameProofAsPrevious || sameArtifactAsPrevious) {
3353
3161
  return __assign(__assign({ ready: false, status: 'stale', reason: sameProofAsPrevious
3354
3162
  ? 'support_business_proof_same_fingerprint_as_previous'
3355
- : 'support_business_proof_same_artifact_fingerprint_as_previous', blockers: ['Business proof did not produce a new proof/artifact fingerprint for this run. Rerun the issue-specific assertion and record fresh artifact proof.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
3163
+ : 'support_business_proof_same_artifact_fingerprint_as_previous', blockers: ['Business proof did not produce a new proof/artifact fingerprint for this run. Rerun the diagnosis-mapped assertion and record fresh artifact proof.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
3356
3164
  artifactPaths: proofArtifactPaths,
3357
3165
  proofFingerprint: proofFingerprint,
3358
3166
  artifactFingerprint: matchedArtifactFingerprint,
@@ -3371,7 +3179,7 @@ function evaluateResolveIOSupportBusinessProofReadiness(input) {
3371
3179
  || !!cleanText(matched.observed, 80)
3372
3180
  || !!cleanText(matched.after, 80);
3373
3181
  if (!hasDataOrDomProof) {
3374
- return __assign(__assign({ ready: false, status: 'weak', reason: 'support_business_proof_missing_dom_or_data_proof', blockers: ['Business proof must include DOM/data proof, observed result, after-state, or Mongo delta.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
3182
+ return __assign(__assign({ ready: false, status: 'weak', reason: 'support_business_proof_missing_dom_or_data_proof', blockers: ['Business proof must include observed result, after-state, or a concrete proof artifact.'], requiredEvidence: requiredEvidence }, defaultSupportBusinessProofReadinessFields({
3375
3183
  artifactPaths: proofArtifactPaths,
3376
3184
  proofFingerprint: proofFingerprint,
3377
3185
  artifactFingerprint: matchedArtifactFingerprint
@@ -3526,7 +3334,7 @@ function supportCustomerReplyReadinessStatusFromReason(reason) {
3526
3334
  support_reply_clarification_contract_invalid: 'internal_blocked',
3527
3335
  support_reply_waiting_on_customer_reproduction_detail: 'clarification_required',
3528
3336
  support_reply_blocked_until_diagnosis_gate_validates: 'blocked_until_diagnosis',
3529
- support_reply_requires_valid_issue_class_probe_plan: 'blocked_until_probe_plan',
3337
+ support_reply_requires_valid_business_proof_plan: 'blocked_until_probe_plan',
3530
3338
  support_reply_blocked_by_confidence_gate: 'blocked_until_confidence',
3531
3339
  support_reply_requires_high_confidence: 'blocked_until_confidence',
3532
3340
  support_reply_blocked_by_unresolved_runner_blocker: 'blocked_until_runner_blocker',
@@ -3552,7 +3360,7 @@ function supportCustomerReplyReadinessDefaultPrimaryCommand(status, policy) {
3552
3360
  case 'blocked_until_diagnosis':
3553
3361
  return 'run_support_v5_read_only_diagnosis_gate';
3554
3362
  case 'blocked_until_probe_plan':
3555
- return 'repair_support_issue_class_probe_plan';
3363
+ return 'repair_support_business_proof_plan';
3556
3364
  case 'blocked_until_confidence':
3557
3365
  return 'review_support_confidence_evidence';
3558
3366
  case 'blocked_until_release_hotfix':
@@ -3580,8 +3388,8 @@ function buildResolveIOSupportCustomerReplyReadinessContract(input) {
3580
3388
  || (policy.action === 'draft_resolution_reply' && (((_b = policy.draftBasis) === null || _b === void 0 ? void 0 : _b.artifactCount) || 0) > 0);
3581
3389
  var releaseReady = ((_c = input.releaseGate) === null || _c === void 0 ? void 0 : _c.blocked) !== true;
3582
3390
  var diagnosisReady = ((_d = input.diagnosisValidation) === null || _d === void 0 ? void 0 : _d.valid) === true || policy.action === 'draft_resolution_reply';
3583
- var issueClassProbePlanReady = ((_e = input.issueClassProbePlanValidation) === null || _e === void 0 ? void 0 : _e.valid) === true
3584
- || ((_f = policy.draftBasis) === null || _f === void 0 ? void 0 : _f.issueClassProbePlanStatus) === 'ready';
3391
+ var businessProofPlanReady = ((_e = input.issueClassProbePlanValidation) === null || _e === void 0 ? void 0 : _e.valid) === true
3392
+ || ((_f = policy.draftBasis) === null || _f === void 0 ? void 0 : _f.businessProofPlanStatus) === 'ready';
3585
3393
  var initialStatus = supportCustomerReplyReadinessStatusFromReason(reason);
3586
3394
  var status = rawCanSend
3587
3395
  ? 'blocked_until_human_approval'
@@ -3625,7 +3433,8 @@ function buildResolveIOSupportCustomerReplyReadinessContract(input) {
3625
3433
  businessProofReady: businessProofReady,
3626
3434
  releaseReady: releaseReady,
3627
3435
  diagnosisReady: diagnosisReady,
3628
- issueClassProbePlanReady: issueClassProbePlanReady,
3436
+ businessProofPlanReady: businessProofPlanReady,
3437
+ issueClassProbePlanReady: businessProofPlanReady,
3629
3438
  clarificationRequired: status === 'clarification_required',
3630
3439
  reason: reason,
3631
3440
  blockers: blockers,
@@ -3665,7 +3474,14 @@ function validateResolveIOSupportCustomerReplyReadinessContract(value) {
3665
3474
  businessProofReady: source.businessProofReady === true || source.business_proof_ready === true,
3666
3475
  releaseReady: source.releaseReady === true || source.release_ready === true,
3667
3476
  diagnosisReady: source.diagnosisReady === true || source.diagnosis_ready === true,
3668
- issueClassProbePlanReady: source.issueClassProbePlanReady === true || source.issue_class_probe_plan_ready === true,
3477
+ businessProofPlanReady: source.businessProofPlanReady === true
3478
+ || source.business_proof_plan_ready === true
3479
+ || source.issueClassProbePlanReady === true
3480
+ || source.issue_class_probe_plan_ready === true,
3481
+ issueClassProbePlanReady: source.businessProofPlanReady === true
3482
+ || source.business_proof_plan_ready === true
3483
+ || source.issueClassProbePlanReady === true
3484
+ || source.issue_class_probe_plan_ready === true,
3669
3485
  clarificationRequired: source.clarificationRequired === true || source.clarification_required === true,
3670
3486
  reason: cleanText(source.reason, 500),
3671
3487
  blockers: cleanList(source.blockers, 24, 500),
@@ -3726,7 +3542,7 @@ function supportAutonomousReviewTypeForAction(action) {
3726
3542
  }
3727
3543
  }
3728
3544
  function decideResolveIOSupportCustomerReplyPolicy(input) {
3729
- var _a, _b, _c;
3545
+ var _a, _b, _c, _d;
3730
3546
  if (input === void 0) { input = {}; }
3731
3547
  var diagnosisValidation = validateResolveIOSupportDiagnosisGate(input.diagnosisGate);
3732
3548
  var gate = diagnosisValidation.normalized;
@@ -3748,10 +3564,10 @@ function decideResolveIOSupportCustomerReplyPolicy(input) {
3748
3564
  var releaseGate = resolveSupportReplyReleaseGate(input);
3749
3565
  var requiredEvidence = [
3750
3566
  'valid SupportDiagnosisGate',
3751
- 'validated IssueClassProbePlan',
3567
+ 'validated business-proof plan',
3752
3568
  'high confidence with shouldBlockPr=false',
3753
3569
  'accepted outcome or passed business assertion',
3754
- 'business proof contract and artifact evidence',
3570
+ 'model-chosen business proof evidence',
3755
3571
  'no unresolved blocker or release blocker'
3756
3572
  ];
3757
3573
  var withReadiness = function (policy, issueClassProbePlanValidation) {
@@ -3845,9 +3661,9 @@ function decideResolveIOSupportCustomerReplyPolicy(input) {
3845
3661
  })
3846
3662
  });
3847
3663
  }
3848
- var explicitProbePlan = cleanObject(input.issueClassProbePlan);
3664
+ var explicitProbePlan = cleanObject(input.businessProofPlan || input.issueClassProbePlan);
3849
3665
  var generatedProbePlan = gate
3850
- ? buildResolveIOSupportIssueClassProbePlan(gate)
3666
+ ? buildResolveIOSupportBusinessProofPlan(gate)
3851
3667
  : undefined;
3852
3668
  var issueClassProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(Object.keys(explicitProbePlan).length ? explicitProbePlan : generatedProbePlan, gate);
3853
3669
  var issueClassProbePlan = issueClassProbePlanValidation.normalized || generatedProbePlan;
@@ -3858,20 +3674,20 @@ function decideResolveIOSupportCustomerReplyPolicy(input) {
3858
3674
  canSendCustomerReply: false,
3859
3675
  confidenceLevel: confidenceLevel,
3860
3676
  safety: 'internal_hold',
3861
- reason: 'support_reply_requires_valid_issue_class_probe_plan',
3677
+ reason: 'support_reply_requires_valid_business_proof_plan',
3862
3678
  requiredEvidence: requiredEvidence,
3863
3679
  humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
3864
3680
  reviewType: 'business_proof_qa',
3865
- title: 'Repair Issue-Class Probe Plan',
3866
- summary: 'Customer reply is blocked until the IssueClassProbePlan validates against the diagnosis proof plan.',
3867
- primaryAction: 'repair_support_issue_class_probe_plan',
3681
+ title: 'Repair Business-Proof Plan',
3682
+ summary: 'Customer reply is blocked until the business-proof plan validates against the diagnosis proof plan.',
3683
+ primaryAction: 'repair_support_business_proof_plan',
3868
3684
  safety: 'internal_hold',
3869
- reason: 'support_reply_requires_valid_issue_class_probe_plan',
3685
+ reason: 'support_reply_requires_valid_business_proof_plan',
3870
3686
  blockers: issueClassProbePlanValidation.blockers,
3871
3687
  requiredEvidence: requiredEvidence,
3872
3688
  evidenceRefs: (issueClassProbePlan === null || issueClassProbePlan === void 0 ? void 0 : issueClassProbePlan.requiredArtifacts) || [],
3873
- nextCommands: ['repair_issue_class_probe_plan', 'rerun_business_proof_qa', 'rerun_reply_policy'],
3874
- forbiddenActions: ['Do not draft a customer resolution from business proof that is not mapped to a validated IssueClassProbePlan.'],
3689
+ nextCommands: ['repair_business_proof_plan', 'rerun_business_proof_qa', 'rerun_reply_policy'],
3690
+ forbiddenActions: ['Do not draft a customer resolution from business proof that is not mapped to a validated business-proof plan.'],
3875
3691
  costRisk: 'free_or_deterministic'
3876
3692
  })
3877
3693
  }, issueClassProbePlanValidation);
@@ -3964,43 +3780,19 @@ function decideResolveIOSupportCustomerReplyPolicy(input) {
3964
3780
  humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
3965
3781
  reviewType: 'business_proof_qa',
3966
3782
  title: 'Run Business Proof QA',
3967
- summary: 'Customer reply is blocked until the issue-specific before/action/after assertion passes.',
3783
+ summary: 'Customer reply is blocked until the diagnosis-mapped before/action/after assertion passes.',
3968
3784
  primaryAction: 'run_support_v5_business_proof_qa_row',
3969
3785
  safety: 'internal_hold',
3970
3786
  reason: replyReason,
3971
3787
  blockers: businessProofReadiness.blockers,
3972
3788
  requiredEvidence: proofRequiredEvidence,
3973
3789
  evidenceRefs: businessProofReadiness.artifactPaths,
3974
- nextCommands: ['execute_issue_class_probe', 'record_before_action_after_artifacts', 'write_aiqa_business_assertion'],
3790
+ nextCommands: ['execute_business_proof', 'record_before_action_after_artifacts', 'write_aiqa_business_assertion'],
3975
3791
  forbiddenActions: ['Route probe pass remains route evidence only.'],
3976
3792
  costRisk: 'small_model_or_qa'
3977
3793
  })
3978
3794
  }, issueClassProbePlanValidation);
3979
3795
  }
3980
- if (!(gate === null || gate === void 0 ? void 0 : gate.proof_plan.business_proof_contract) || artifactCount < 1) {
3981
- return withReadiness({
3982
- action: 'hold_internal',
3983
- canDraftCustomerReply: false,
3984
- canSendCustomerReply: false,
3985
- confidenceLevel: confidenceLevel,
3986
- safety: 'internal_hold',
3987
- reason: 'support_reply_requires_business_proof_contract_artifact',
3988
- requiredEvidence: requiredEvidence,
3989
- humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
3990
- reviewType: 'business_proof_qa',
3991
- title: 'Attach Business Proof Artifact',
3992
- summary: 'Customer reply is blocked until the business proof contract and artifact are attached.',
3993
- primaryAction: 'record_business_proof_artifact',
3994
- safety: 'internal_hold',
3995
- reason: 'support_reply_requires_business_proof_contract_artifact',
3996
- requiredEvidence: requiredEvidence,
3997
- evidenceRefs: businessProofReadiness.artifactPaths,
3998
- nextCommands: ['attach_business_proof_contract', 'attach_artifact_path', 'rerun_reply_policy'],
3999
- forbiddenActions: ['Do not draft a resolution reply without a proof artifact.'],
4000
- costRisk: 'free_or_deterministic'
4001
- })
4002
- }, issueClassProbePlanValidation);
4003
- }
4004
3796
  return withReadiness({
4005
3797
  action: 'draft_resolution_reply',
4006
3798
  canDraftCustomerReply: true,
@@ -4012,7 +3804,7 @@ function decideResolveIOSupportCustomerReplyPolicy(input) {
4012
3804
  humanReviewPacket: buildResolveIOSupportHumanReviewPacket({
4013
3805
  reviewType: 'customer_resolution_reply',
4014
3806
  title: 'Review Customer Resolution Reply',
4015
- summary: "Business proof is ready for ".concat(gate.issue_class, "; draft a customer-facing resolution for human review."),
3807
+ summary: 'Business proof is ready; draft a customer-facing resolution for human review.',
4016
3808
  primaryAction: 'review_customer_reply',
4017
3809
  customerFacingDraftAllowed: true,
4018
3810
  safety: 'safe_to_draft',
@@ -4024,75 +3816,38 @@ function decideResolveIOSupportCustomerReplyPolicy(input) {
4024
3816
  costRisk: 'release_or_customer_send'
4025
3817
  }),
4026
3818
  draftBasis: {
4027
- issueClass: gate.issue_class,
4028
- issueClassProbePlanId: issueClassProbePlan === null || issueClassProbePlan === void 0 ? void 0 : issueClassProbePlan.planId,
4029
- issueClassProbePlanStatus: issueClassProbePlanValidation.status,
4030
- businessProof: gate.proof_plan.business_proof_contract.expected_business_state_change,
3819
+ businessProofPlanId: issueClassProbePlan === null || issueClassProbePlan === void 0 ? void 0 : issueClassProbePlan.planId,
3820
+ businessProofPlanStatus: issueClassProbePlanValidation.status,
3821
+ businessProof: ((_d = gate.proof_plan.business_proof_contract) === null || _d === void 0 ? void 0 : _d.expected_business_state_change)
3822
+ || gate.proof_plan.business_assertion
3823
+ || gate.proof_plan.after,
4031
3824
  artifactCount: artifactCount
4032
3825
  }
4033
3826
  }, issueClassProbePlanValidation);
4034
3827
  }
4035
3828
  function buildSupportIssueClassBrowserSteps(args) {
4036
3829
  var route = cleanText(args.route, 500) || 'the affected route/module';
4037
- var issueSteps = {
4038
- no_op_submit: [
4039
- 'Capture the form/action state before submit, including the target record id or validation state.',
4040
- 'Trigger the exact submit/action control reported by the customer.',
4041
- 'Verify the persisted state, success/validation message, or method/network result changed as expected.'
4042
- ],
4043
- missing_wrong_data: [
4044
- 'Load the named customer/account/record context before changing any filters or data.',
4045
- 'Compare visible DOM values against the persisted/source-of-truth data.',
4046
- 'Verify the corrected visible values remain tied to the same customer/account context.'
4047
- ],
4048
- filter_query_mismatch: [
4049
- 'Capture the unfiltered or before-filter row/count state for the affected dataset.',
4050
- 'Apply the exact reported filter/query/search inputs.',
4051
- 'Assert included rows/counts and excluded wrong rows against DOM plus data/query proof.'
4052
- ],
4053
- invoice_pdf_export: [
4054
- 'Open the affected invoice/report/export route and capture source rows/totals before export.',
4055
- 'Trigger the exact PDF/export/download action.',
4056
- 'Parse or inspect the generated artifact and verify expected rows, totals, fields, or file output.'
4057
- ],
4058
- upload_import: [
4059
- 'Attach the representative import file or fixture and capture pre-import row/count state.',
4060
- 'Run the upload/import action through the visible workflow.',
4061
- 'Verify result messaging plus persisted row/count delta or rejected-row evidence.'
4062
- ],
4063
- route_auth_hydration: [
4064
- 'Seed or replay auth for the affected user/account before route navigation.',
4065
- 'Open the exact route and wait for the functional screen, not only the shell/nav.',
4066
- 'Assert required controls/data are hydrated and capture console/network errors if hydration fails.'
4067
- ],
4068
- slow_query_performance: [
4069
- 'Capture before timing/log evidence for the reported query or workflow.',
4070
- 'Run the same query/workflow after repair with equivalent inputs and account context.',
4071
- 'Verify timing target or improvement while preserving result equivalence.'
4072
- ]
4073
- };
4074
- return __spreadArray(__spreadArray([
4075
- "Navigate to ".concat(route, " as the affected user/account context.")
4076
- ], __read((issueSteps[args.issueClass] || issueSteps.missing_wrong_data)), false), [
3830
+ return [
3831
+ "Navigate to ".concat(route, " as the affected user/account context."),
3832
+ 'Capture the relevant before state for the exact customer-reported behavior.',
3833
+ 'Perform the action described by the diagnosis proof plan.',
3834
+ 'Verify the resulting business state with proof chosen from the actual code path.',
4077
3835
  args.before ? "Before proof: ".concat(args.before) : '',
4078
3836
  args.action ? "Action under test: ".concat(args.action) : "Action under test: ".concat(args.action || 'execute the reported workflow action'),
4079
3837
  args.after ? "Expected after state: ".concat(args.after) : '',
4080
- args.assertion ? "DOM/data assertion: ".concat(args.assertion) : ''
4081
- ], false).map(function (entry) { return cleanText(entry, 500); })
3838
+ args.assertion ? "Business assertion: ".concat(args.assertion) : ''
3839
+ ]
3840
+ .map(function (entry) { return cleanText(entry, 500); })
4082
3841
  .filter(Boolean)
4083
3842
  .slice(0, 10);
4084
3843
  }
4085
3844
  function buildSupportIssueClassDataProofRequirements(args) {
4086
- var issueRequirements = {
4087
- no_op_submit: ['pre-submit state', 'submit action result', 'persisted state or validation delta'],
4088
- missing_wrong_data: ['expected source-of-truth record', 'visible DOM/data snapshot', 'same-account/customer proof'],
4089
- filter_query_mismatch: ['filter input values', 'included row/count proof', 'excluded wrong-row proof', 'query/publication proof when available'],
4090
- invoice_pdf_export: ['export trigger trace', 'generated file artifact path', 'parsed generated content proof'],
4091
- upload_import: ['input file fixture', 'import result message', 'persisted row/count delta'],
4092
- route_auth_hydration: ['auth context', 'hydrated DOM proof', 'console/network error log'],
4093
- slow_query_performance: ['before timing', 'after timing', 'result equivalence proof', 'query/log trace']
4094
- };
4095
- return Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read((issueRequirements[args.issueClass] || issueRequirements.missing_wrong_data)), false), __read(args.requiredArtifacts), false), [
3845
+ return Array.from(new Set(__spreadArray(__spreadArray([
3846
+ 'before state evidence',
3847
+ 'action trace',
3848
+ 'after state evidence',
3849
+ 'business assertion artifact chosen by the model from the diagnosis'
3850
+ ], __read(args.requiredArtifacts), false), [
4096
3851
  args.assertion
4097
3852
  ], false).map(function (entry) { return cleanText(entry, 260); }).filter(Boolean))).slice(0, 16);
4098
3853
  }
@@ -4110,36 +3865,18 @@ function buildSupportIssueClassProbeAssertionTemplate(args) {
4110
3865
  artifactPaths: args.requiredArtifacts,
4111
3866
  metadata: {
4112
3867
  supportDiagnosisProof: true,
4113
- issueClass: args.issueClass,
4114
- probePlanRequired: true,
3868
+ businessProofPlanRequired: true,
4115
3869
  routeOnlyIsFalsePass: true
4116
3870
  }
4117
3871
  };
4118
3872
  }
4119
3873
  function buildSupportIssueClassProbeQaRow(args) {
4120
- var rowId = "support-issue-probe-".concat(hashResolveIOSupportV5Evidence({
4121
- issueClass: args.issueClass,
3874
+ var rowId = "support-business-proof-".concat(hashResolveIOSupportV5Evidence({
4122
3875
  route: args.route,
4123
3876
  action: args.action,
4124
3877
  assertion: args.stateTransition.assertion
4125
3878
  }).slice(0, 16));
4126
- return {
4127
- row_id: rowId,
4128
- issue_class: args.issueClass,
4129
- probe_type: 'issue_class_probe',
4130
- route: cleanText(args.route, 500) || undefined,
4131
- action_under_test: args.action,
4132
- browser_steps: args.browserSteps,
4133
- expected_result: args.expected,
4134
- expected_dom_or_data_proof: args.expectedEvidence,
4135
- required_artifacts: args.requiredArtifacts,
4136
- false_pass_blockers: args.falsePassBlockers,
4137
- state_transition: args.stateTransition,
4138
- acceptance_gate: 'aiqa_business_assertion',
4139
- requires_aiqa_business_assertion: true,
4140
- route_only_is_false_pass: true,
4141
- mobile_viewport_required: args.issueClass === 'route_auth_hydration'
4142
- };
3879
+ return __assign(__assign({ row_id: rowId }, (args.issueClass ? { issue_class: args.issueClass } : {})), { probe_type: 'business_proof', route: cleanText(args.route, 500) || undefined, action_under_test: args.action, browser_steps: args.browserSteps, expected_result: args.expected, expected_dom_or_data_proof: args.expectedEvidence, required_artifacts: args.requiredArtifacts, false_pass_blockers: args.falsePassBlockers, state_transition: args.stateTransition, acceptance_gate: 'aiqa_business_assertion', requires_aiqa_business_assertion: true, route_only_is_false_pass: true, mobile_viewport_required: false });
4143
3880
  }
4144
3881
  function normalizeResolveIOSupportIssueClassProbeQaRow(value, fallback) {
4145
3882
  var source = cleanObject(value);
@@ -4156,32 +3893,17 @@ function normalizeResolveIOSupportIssueClassProbeQaRow(value, fallback) {
4156
3893
  var browserSteps = cleanList(source.browser_steps || source.browserSteps, 12, 500).length
4157
3894
  ? cleanList(source.browser_steps || source.browserSteps, 12, 500)
4158
3895
  : fallback.browserSteps;
4159
- return {
4160
- row_id: cleanText(source.row_id || source.rowId || source.id, 180) || "support-issue-probe-".concat(hashResolveIOSupportV5Evidence({
4161
- issueClass: fallback.issueClass,
3896
+ return __assign(__assign({ row_id: cleanText(source.row_id || source.rowId || source.id, 180) || "support-business-proof-".concat(hashResolveIOSupportV5Evidence({
4162
3897
  route: source.route || fallback.route,
4163
3898
  action: source.action_under_test || source.actionUnderTest || fallback.action,
4164
3899
  assertion: normalizedStateTransition.assertion
4165
- }).slice(0, 16)),
4166
- issue_class: (normalizeIssueClass(source.issue_class || source.issueClass) || fallback.issueClass),
4167
- probe_type: (cleanText(source.probe_type || source.probeType, 80) || 'issue_class_probe'),
4168
- route: cleanText(source.route, 500) || fallback.route,
4169
- action_under_test: cleanText(source.action_under_test || source.actionUnderTest || source.action, 1200) || fallback.action,
4170
- browser_steps: browserSteps,
4171
- expected_result: cleanText(source.expected_result || source.expectedResult, 1600) || fallback.expectedBusinessProof,
4172
- expected_dom_or_data_proof: cleanText(source.expected_dom_or_data_proof || source.expectedDomOrDataProof || source.expected_evidence || source.expectedEvidence, 1600) || fallback.expectedEvidence,
4173
- required_artifacts: cleanList(source.required_artifacts || source.requiredArtifacts, 16, 260).length
3900
+ }).slice(0, 16)) }, (normalizeIssueClass(source.issue_class || source.issueClass) || fallback.issueClass
3901
+ ? { issue_class: (normalizeIssueClass(source.issue_class || source.issueClass) || fallback.issueClass) }
3902
+ : {})), { probe_type: (cleanText(source.probe_type || source.probeType, 80) || 'business_proof'), route: cleanText(source.route, 500) || fallback.route, action_under_test: cleanText(source.action_under_test || source.actionUnderTest || source.action, 1200) || fallback.action, browser_steps: browserSteps, expected_result: cleanText(source.expected_result || source.expectedResult, 1600) || fallback.expectedBusinessProof, expected_dom_or_data_proof: cleanText(source.expected_dom_or_data_proof || source.expectedDomOrDataProof || source.expected_evidence || source.expectedEvidence, 1600) || fallback.expectedEvidence, required_artifacts: cleanList(source.required_artifacts || source.requiredArtifacts, 16, 260).length
4174
3903
  ? cleanList(source.required_artifacts || source.requiredArtifacts, 16, 260)
4175
- : fallback.requiredArtifacts,
4176
- false_pass_blockers: cleanList(source.false_pass_blockers || source.falsePassBlockers, 12, 260).length
3904
+ : fallback.requiredArtifacts, false_pass_blockers: cleanList(source.false_pass_blockers || source.falsePassBlockers, 12, 260).length
4177
3905
  ? cleanList(source.false_pass_blockers || source.falsePassBlockers, 12, 260)
4178
- : fallback.falsePassBlockers,
4179
- state_transition: normalizedStateTransition,
4180
- acceptance_gate: 'aiqa_business_assertion',
4181
- requires_aiqa_business_assertion: true,
4182
- route_only_is_false_pass: true,
4183
- mobile_viewport_required: source.mobile_viewport_required === true || source.mobileViewportRequired === true
4184
- };
3906
+ : fallback.falsePassBlockers, state_transition: normalizedStateTransition, acceptance_gate: 'aiqa_business_assertion', requires_aiqa_business_assertion: true, route_only_is_false_pass: true, mobile_viewport_required: source.mobile_viewport_required === true || source.mobileViewportRequired === true });
4185
3907
  }
4186
3908
  function normalizeResolveIOSupportIssueClassProbeAssertionTemplate(value, fallback) {
4187
3909
  var source = cleanObject(value);
@@ -4200,13 +3922,12 @@ function normalizeResolveIOSupportIssueClassProbeAssertionTemplate(value, fallba
4200
3922
  : fallback.requiredArtifacts,
4201
3923
  metadata: {
4202
3924
  supportDiagnosisProof: true,
4203
- issueClass: fallback.issueClass,
4204
- probePlanRequired: true,
3925
+ businessProofPlanRequired: true,
4205
3926
  routeOnlyIsFalsePass: true
4206
3927
  }
4207
3928
  };
4208
3929
  }
4209
- function buildResolveIOSupportIssueClassProbes(value) {
3930
+ function buildResolveIOSupportBusinessProofProbes(value) {
4210
3931
  var validation = validateResolveIOSupportDiagnosisGate(value);
4211
3932
  var gate = validation.normalized || normalizeResolveIOSupportDiagnosisGate(value);
4212
3933
  if (!gate) {
@@ -4217,79 +3938,34 @@ function buildResolveIOSupportIssueClassProbes(value) {
4217
3938
  var proof = (proofContract === null || proofContract === void 0 ? void 0 : proofContract.expected_business_state_change) || gate.proof_plan.business_assertion;
4218
3939
  var assertion = (proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion) || gate.proof_plan.data_assertion || gate.proof_plan.after;
4219
3940
  var contractArtifacts = cleanList(proofContract === null || proofContract === void 0 ? void 0 : proofContract.proof_artifacts, 8, 160);
4220
- var common = {
4221
- issue_class: gate.issue_class,
4222
- probe_type: 'issue_class_probe',
4223
- route: route,
4224
- state_transition: {
4225
- before: gate.proof_plan.before || gate.proof_plan.before_state_unavailable_reason || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.setup_state) || '',
4226
- action: gate.proof_plan.action || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.action_under_test) || '',
4227
- after: gate.proof_plan.after || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.expected_business_state_change) || '',
4228
- assertion: assertion || gate.proof_plan.business_assertion || ''
4229
- },
4230
- acceptance_gate: 'aiqa_business_assertion',
4231
- blocks_acceptance_without_business_assertion: true
4232
- };
4233
- var map = {
4234
- no_op_submit: {
4235
- action: "Submit the customer action on ".concat(route || 'the affected screen', " and assert a persisted state change or explicit validation message."),
4236
- expected: proof || 'Before/action/after proof shows the submit is no longer a no-op.',
4237
- failureClass: 'business',
4238
- requiredArtifacts: ['before form state', 'submit action trace', 'post-submit DOM/data proof', 'method/network result']
4239
- },
4240
- missing_wrong_data: {
4241
- action: "Load the named record/list on ".concat(route || 'the affected route', " and compare visible data to the expected persisted source."),
4242
- expected: proof || 'Visible data and persisted data match the customer expectation.',
4243
- failureClass: 'business',
4244
- requiredArtifacts: ['expected source record', 'visible DOM/data snapshot', 'persisted data comparison']
4245
- },
4246
- filter_query_mismatch: {
4247
- action: 'Apply the reported filter/query inputs and assert the returned rows/counts match the expected dataset.',
4248
- expected: proof || 'Filter/query output contains the correct included rows and excludes the wrong rows.',
4249
- failureClass: 'business',
4250
- requiredArtifacts: ['filter input trace', 'included/excluded row proof', 'query or publication result proof']
4251
- },
4252
- invoice_pdf_export: {
4253
- action: 'Generate the invoice/PDF/export from the affected route and inspect the downloaded/generated artifact.',
4254
- expected: proof || 'Generated artifact contains the expected customer-visible rows, totals, or fields.',
4255
- failureClass: 'business',
4256
- requiredArtifacts: ['export trigger trace', 'generated file artifact path', 'parsed artifact content proof']
4257
- },
4258
- upload_import: {
4259
- action: 'Run the upload/import workflow with a representative file and assert parsed plus persisted results.',
4260
- expected: proof || 'Import shows a success result and persisted rows/counts changed as expected.',
4261
- failureClass: 'business',
4262
- requiredArtifacts: ['input file fixture', 'import result message', 'persisted row/count delta']
4263
- },
4264
- route_auth_hydration: {
4265
- action: 'Open the route as the affected user and assert authenticated hydration reaches the functional screen, not a shell.',
4266
- expected: proof || 'Route hydrates with the required controls/data for the affected account.',
4267
- failureClass: 'route',
4268
- requiredArtifacts: ['auth context', 'hydrated DOM proof', 'console/network error log']
4269
- },
4270
- slow_query_performance: {
4271
- action: 'Run the reported query/workflow with timing/log evidence before and after the fix.',
4272
- expected: proof || 'Performance evidence shows the slow path improved without changing results.',
4273
- failureClass: 'business',
4274
- requiredArtifacts: ['before timing', 'after timing', 'result equivalence proof', 'query/log trace']
4275
- }
3941
+ var requiredArtifacts = Array.from(new Set(__spreadArray([
3942
+ 'diagnosis gate JSON',
3943
+ 'before/action/after evidence',
3944
+ 'AIQaBusinessAssertion JSON'
3945
+ ], __read(contractArtifacts), false)));
3946
+ var stateTransition = {
3947
+ before: gate.proof_plan.before || gate.proof_plan.before_state_unavailable_reason || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.setup_state) || '',
3948
+ action: gate.proof_plan.action || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.action_under_test) || '',
3949
+ after: gate.proof_plan.after || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.expected_business_state_change) || '',
3950
+ assertion: assertion || gate.proof_plan.business_assertion || ''
4276
3951
  };
4277
- var selected = map[gate.issue_class];
4278
- var catalog = SUPPORT_ISSUE_CLASS_PROBE_CATALOG.find(function (entry) { return entry.issue_class === gate.issue_class; });
4279
- var requiredArtifacts = Array.from(new Set(__spreadArray(__spreadArray([], __read(contractArtifacts), false), __read(selected.requiredArtifacts), false)));
4280
- var stateTransition = common.state_transition;
4281
- var action = proofContract
4282
- ? "".concat(proofContract.action_under_test, " ").concat(selected.action)
4283
- : selected.action;
4284
- var expectedEvidence = "".concat(selected.expected).concat(assertion ? " Assertion: ".concat(assertion, ".") : '').concat(requiredArtifacts.length ? " Required artifacts: ".concat(requiredArtifacts.join(', '), ".") : '').trim();
4285
- var objective = "Issue-class probe for ".concat(gate.issue_class, ": ").concat(gate.issue_case.customer_complaint);
4286
- var falsePassBlockers = (catalog === null || catalog === void 0 ? void 0 : catalog.false_pass_blockers) || [
3952
+ var action = (proofContract === null || proofContract === void 0 ? void 0 : proofContract.action_under_test)
3953
+ || gate.proof_plan.action
3954
+ || "Exercise the customer-reported behavior on ".concat(route || 'the affected route/module', " and prove the diagnosed business result.");
3955
+ var expectedEvidence = [
3956
+ proof || 'Before/action/after proof shows the customer-reported behavior is fixed.',
3957
+ assertion ? "Assertion: ".concat(assertion, ".") : '',
3958
+ requiredArtifacts.length ? "Required artifacts: ".concat(requiredArtifacts.join(', '), ".") : ''
3959
+ ].filter(Boolean).join(' ').trim();
3960
+ var objective = "Business proof for support diagnosis: ".concat(gate.issue_case.customer_complaint);
3961
+ var falsePassBlockers = [
4287
3962
  'route loaded only',
4288
3963
  'screenshot without business state proof',
4289
- 'model claim without DOM/data proof'
3964
+ 'model claim without business proof artifact'
4290
3965
  ];
3966
+ var issueClass = gate.issue_class;
4291
3967
  var browserSteps = buildSupportIssueClassBrowserSteps({
4292
- issueClass: gate.issue_class,
3968
+ issueClass: issueClass,
4293
3969
  route: route,
4294
3970
  action: stateTransition.action || action,
4295
3971
  before: stateTransition.before,
@@ -4297,12 +3973,12 @@ function buildResolveIOSupportIssueClassProbes(value) {
4297
3973
  assertion: stateTransition.assertion
4298
3974
  });
4299
3975
  var dataProofRequirements = buildSupportIssueClassDataProofRequirements({
4300
- issueClass: gate.issue_class,
3976
+ issueClass: issueClass,
4301
3977
  assertion: stateTransition.assertion,
4302
3978
  requiredArtifacts: requiredArtifacts
4303
3979
  });
4304
3980
  var qaRow = buildSupportIssueClassProbeQaRow({
4305
- issueClass: gate.issue_class,
3981
+ issueClass: issueClass,
4306
3982
  route: route,
4307
3983
  objective: objective,
4308
3984
  action: action,
@@ -4314,14 +3990,22 @@ function buildResolveIOSupportIssueClassProbes(value) {
4314
3990
  browserSteps: browserSteps
4315
3991
  });
4316
3992
  var assertionTemplate = buildSupportIssueClassProbeAssertionTemplate({
4317
- issueClass: gate.issue_class,
3993
+ issueClass: issueClass,
4318
3994
  route: route,
4319
3995
  objective: objective,
4320
3996
  expected: proof || gate.proof_plan.business_assertion,
4321
3997
  stateTransition: stateTransition,
4322
3998
  requiredArtifacts: requiredArtifacts
4323
3999
  });
4324
- return [__assign(__assign({}, common), { failure_class: selected.failureClass, objective: objective, action: action, browser_steps: browserSteps, expected_evidence: expectedEvidence, expected_business_proof: proof || gate.proof_plan.business_assertion, data_proof_requirements: dataProofRequirements, required_artifacts: requiredArtifacts, qa_rows: [qaRow], active_qa_row: qaRow, aiqa_business_assertion_template: assertionTemplate, false_pass_blockers: falsePassBlockers })];
4000
+ qaRow.probe_type = 'business_proof';
4001
+ var common = {
4002
+ probe_type: 'business_proof',
4003
+ route: route,
4004
+ state_transition: stateTransition,
4005
+ acceptance_gate: 'aiqa_business_assertion',
4006
+ blocks_acceptance_without_business_assertion: true
4007
+ };
4008
+ return [__assign(__assign({}, common), { failure_class: 'business', objective: objective, action: action, browser_steps: browserSteps, expected_evidence: expectedEvidence, expected_business_proof: proof || gate.proof_plan.business_assertion, data_proof_requirements: dataProofRequirements, required_artifacts: requiredArtifacts, qa_rows: [qaRow], active_qa_row: qaRow, aiqa_business_assertion_template: assertionTemplate, false_pass_blockers: falsePassBlockers })];
4325
4009
  }
4326
4010
  function normalizeResolveIOSupportIssueClassProbe(value, diagnosisGate) {
4327
4011
  var source = cleanObject(value);
@@ -4332,7 +4016,7 @@ function normalizeResolveIOSupportIssueClassProbe(value, diagnosisGate) {
4332
4016
  var stateTransition = cleanObject(source.state_transition || source.stateTransition);
4333
4017
  var route = cleanText(source.route, 500);
4334
4018
  var failureClass = cleanText(source.failure_class || source.failureClass || 'business', 80);
4335
- var normalizedIssueClass = (issueClass || (diagnosisGate === null || diagnosisGate === void 0 ? void 0 : diagnosisGate.issue_class) || 'missing_wrong_data');
4019
+ var normalizedIssueClass = (issueClass || normalizeIssueClass(diagnosisGate === null || diagnosisGate === void 0 ? void 0 : diagnosisGate.issue_class) || undefined);
4336
4020
  var action = cleanText(source.action, 1200);
4337
4021
  var expectedEvidence = cleanText(source.expected_evidence || source.expectedEvidence, 1600);
4338
4022
  var expectedBusinessProof = cleanText(source.expected_business_proof || source.expectedBusinessProof, 1600);
@@ -4413,29 +4097,10 @@ function normalizeResolveIOSupportIssueClassProbe(value, diagnosisGate) {
4413
4097
  stateTransition: normalizedStateTransition,
4414
4098
  requiredArtifacts: requiredArtifacts
4415
4099
  });
4416
- return {
4417
- issue_class: normalizedIssueClass,
4418
- probe_type: (cleanText(source.probe_type || source.probeType, 80) || 'issue_class_probe'),
4419
- failure_class: failureClass,
4420
- objective: cleanText(source.objective, 1000),
4421
- route: route,
4422
- action: action,
4423
- browser_steps: browserSteps,
4424
- expected_evidence: expectedEvidence,
4425
- expected_business_proof: expectedBusinessProof,
4426
- data_proof_requirements: dataProofRequirements,
4427
- required_artifacts: requiredArtifacts,
4428
- qa_rows: normalizedQaRows,
4429
- active_qa_row: normalizedQaRows[0],
4430
- aiqa_business_assertion_template: assertionTemplate,
4431
- state_transition: normalizedStateTransition,
4432
- acceptance_gate: cleanText(source.acceptance_gate || source.acceptanceGate, 120) === 'aiqa_business_assertion'
4100
+ return __assign(__assign({}, (normalizedIssueClass ? { issue_class: normalizedIssueClass } : {})), { probe_type: (cleanText(source.probe_type || source.probeType, 80) || 'business_proof'), failure_class: failureClass, objective: cleanText(source.objective, 1000), route: route, action: action, browser_steps: browserSteps, expected_evidence: expectedEvidence, expected_business_proof: expectedBusinessProof, data_proof_requirements: dataProofRequirements, required_artifacts: requiredArtifacts, qa_rows: normalizedQaRows, active_qa_row: normalizedQaRows[0], aiqa_business_assertion_template: assertionTemplate, state_transition: normalizedStateTransition, acceptance_gate: cleanText(source.acceptance_gate || source.acceptanceGate, 120) === 'aiqa_business_assertion'
4433
4101
  ? 'aiqa_business_assertion'
4434
- : 'aiqa_business_assertion',
4435
- blocks_acceptance_without_business_assertion: source.blocks_acceptance_without_business_assertion !== false
4436
- && source.blocksAcceptanceWithoutBusinessAssertion !== false,
4437
- false_pass_blockers: falsePassBlockers
4438
- };
4102
+ : 'aiqa_business_assertion', blocks_acceptance_without_business_assertion: source.blocks_acceptance_without_business_assertion !== false
4103
+ && source.blocksAcceptanceWithoutBusinessAssertion !== false, false_pass_blockers: falsePassBlockers });
4439
4104
  }
4440
4105
  function validateResolveIOSupportIssueClassProbePlan(value, diagnosisGate, now) {
4441
4106
  var diagnosisValidation = validateResolveIOSupportDiagnosisGate(diagnosisGate);
@@ -4457,10 +4122,8 @@ function validateResolveIOSupportIssueClassProbePlan(value, diagnosisGate, now)
4457
4122
  .filter(function (probe) { return !!probe; });
4458
4123
  var activeProbe = probes[0] || normalizeResolveIOSupportIssueClassProbe(source.activeProbe || source.active_probe, normalizedDiagnosis);
4459
4124
  var issueClass = normalizeIssueClass(source.issue_class || source.issueClass || (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.issue_class) || (normalizedDiagnosis === null || normalizedDiagnosis === void 0 ? void 0 : normalizedDiagnosis.issue_class));
4460
- var catalog = SUPPORT_ISSUE_CLASS_PROBE_CATALOG.find(function (entry) { return entry.issue_class === issueClass; });
4461
4125
  var planRequiredArtifacts = cleanList(source.requiredArtifacts || source.required_artifacts, 16, 220);
4462
- var activeRequiredArtifacts = cleanList(activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.required_artifacts, 16, 220);
4463
- var requiredArtifacts = planRequiredArtifacts.length ? planRequiredArtifacts : activeRequiredArtifacts;
4126
+ var requiredArtifacts = planRequiredArtifacts.length ? planRequiredArtifacts : cleanList(activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.required_artifacts, 16, 220);
4464
4127
  var planQaRows = Array.isArray(source.qaRows)
4465
4128
  ? source.qaRows
4466
4129
  : Array.isArray(source.qa_rows)
@@ -4468,13 +4131,13 @@ function validateResolveIOSupportIssueClassProbePlan(value, diagnosisGate, now)
4468
4131
  : [];
4469
4132
  var qaRows = (planQaRows.length ? planQaRows : probes.flatMap(function (probe) { return probe.qa_rows || []; }))
4470
4133
  .map(function (row) { return normalizeResolveIOSupportIssueClassProbeQaRow(row, {
4471
- issueClass: (issueClass || (normalizedDiagnosis === null || normalizedDiagnosis === void 0 ? void 0 : normalizedDiagnosis.issue_class) || 'missing_wrong_data'),
4134
+ issueClass: (issueClass || normalizeIssueClass(normalizedDiagnosis === null || normalizedDiagnosis === void 0 ? void 0 : normalizedDiagnosis.issue_class) || undefined),
4472
4135
  route: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.route,
4473
4136
  action: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.action) || '',
4474
4137
  expectedBusinessProof: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.expected_business_proof) || '',
4475
4138
  expectedEvidence: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.expected_evidence) || '',
4476
4139
  requiredArtifacts: requiredArtifacts,
4477
- falsePassBlockers: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.false_pass_blockers) || (catalog === null || catalog === void 0 ? void 0 : catalog.false_pass_blockers) || [],
4140
+ falsePassBlockers: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.false_pass_blockers) || [],
4478
4141
  stateTransition: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.state_transition) || { before: '', action: '', after: '', assertion: '' },
4479
4142
  browserSteps: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.browser_steps) || []
4480
4143
  }); })
@@ -4484,97 +4147,62 @@ function validateResolveIOSupportIssueClassProbePlan(value, diagnosisGate, now)
4484
4147
  ? cleanList(source.falsePassBlockers || source.false_pass_blockers, 12, 260)
4485
4148
  : cleanList(activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.false_pass_blockers, 12, 260).length
4486
4149
  ? cleanList(activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.false_pass_blockers, 12, 260)
4487
- : ((catalog === null || catalog === void 0 ? void 0 : catalog.false_pass_blockers) || []);
4150
+ : [];
4488
4151
  var blockers = [];
4489
4152
  if (!diagnosisValidation.valid || !normalizedDiagnosis) {
4490
- blockers.push('Valid SupportDiagnosisGate is required before issue-class probe QA.');
4153
+ blockers.push('Valid SupportDiagnosisGate is required before business-proof QA.');
4491
4154
  }
4492
4155
  if (!probes.length || !activeProbe) {
4493
- blockers.push('Issue-class probe plan must include at least one active probe.');
4494
- }
4495
- if (!issueClass) {
4496
- blockers.push('Issue-class probe plan must record a valid issue_class.');
4497
- }
4498
- if (normalizedDiagnosis && issueClass && issueClass !== normalizedDiagnosis.issue_class) {
4499
- blockers.push("Issue-class probe plan issue_class ".concat(issueClass, " does not match diagnosis issue_class ").concat(normalizedDiagnosis.issue_class, "."));
4156
+ blockers.push('Business-proof plan must include at least one active proof probe.');
4500
4157
  }
4501
4158
  if (activeProbe) {
4502
- if (!cleanText(activeProbe.route, 500)) {
4503
- blockers.push('Issue-class probe must include the exact route or module under test.');
4504
- }
4505
4159
  if (!cleanText(activeProbe.action, 1200)) {
4506
- blockers.push('Issue-class probe must include the exact action to perform.');
4160
+ blockers.push('Business-proof probe must include the exact action to perform.');
4507
4161
  }
4508
- if (!cleanText(activeProbe.expected_evidence, 1600)) {
4509
- blockers.push('Issue-class probe must include expected evidence.');
4510
- }
4511
- if (!cleanText(activeProbe.expected_business_proof, 1600)) {
4512
- blockers.push('Issue-class probe must include expected business proof.');
4513
- }
4514
- if (!cleanText(activeProbe.state_transition.before, 800)) {
4515
- blockers.push('Issue-class probe state_transition.before is required.');
4162
+ if (!cleanText(activeProbe.expected_evidence || activeProbe.expected_business_proof || activeProbe.state_transition.assertion, 1600)) {
4163
+ blockers.push('Business-proof probe must include model-chosen expected proof.');
4516
4164
  }
4517
4165
  if (!cleanText(activeProbe.state_transition.action, 800)) {
4518
- blockers.push('Issue-class probe state_transition.action is required.');
4166
+ blockers.push('Business-proof probe state_transition.action is required.');
4519
4167
  }
4520
4168
  if (!cleanText(activeProbe.state_transition.after, 800)) {
4521
- blockers.push('Issue-class probe state_transition.after is required.');
4169
+ blockers.push('Business-proof probe state_transition.after is required.');
4522
4170
  }
4523
4171
  if (!cleanText(activeProbe.state_transition.assertion, 1000)) {
4524
- blockers.push('Issue-class probe state_transition.assertion is required.');
4172
+ blockers.push('Business-proof probe state_transition.assertion is required.');
4525
4173
  }
4526
4174
  if (activeProbe.acceptance_gate !== 'aiqa_business_assertion') {
4527
- blockers.push('Issue-class probe acceptance_gate must be aiqa_business_assertion.');
4175
+ blockers.push('Business-proof probe acceptance_gate must be aiqa_business_assertion.');
4528
4176
  }
4529
4177
  if (activeProbe.blocks_acceptance_without_business_assertion !== true) {
4530
- blockers.push('Issue-class probe must block acceptance without AIQaBusinessAssertion.');
4531
- }
4532
- if (activeRequiredArtifacts.length < 2) {
4533
- blockers.push('Active issue-class probe must require at least two proof artifacts.');
4534
- }
4535
- if (cleanList(activeProbe.browser_steps, 12, 500).length < 3) {
4536
- blockers.push('Issue-class probe must include executable browser_steps for the business workflow.');
4537
- }
4538
- if (cleanList(activeProbe.data_proof_requirements, 16, 260).length < 2) {
4539
- blockers.push('Issue-class probe must include DOM/data proof requirements.');
4178
+ blockers.push('Business-proof probe must block acceptance without AIQaBusinessAssertion.');
4540
4179
  }
4541
4180
  }
4542
4181
  if (!qaRows.length || !activeQaRow) {
4543
- blockers.push('Issue-class probe plan must include at least one executable QA row.');
4182
+ blockers.push('Business-proof plan must include at least one executable QA row.');
4544
4183
  }
4545
4184
  if (activeQaRow) {
4546
4185
  if (activeQaRow.acceptance_gate !== 'aiqa_business_assertion' || activeQaRow.requires_aiqa_business_assertion !== true) {
4547
- blockers.push('Issue-class QA row must require AIQaBusinessAssertion.');
4186
+ blockers.push('Business-proof QA row must require AIQaBusinessAssertion.');
4548
4187
  }
4549
4188
  if (activeQaRow.route_only_is_false_pass !== true) {
4550
- blockers.push('Issue-class QA row must mark route-only evidence as a false pass.');
4551
- }
4552
- if (cleanList(activeQaRow.browser_steps, 12, 500).length < 3) {
4553
- blockers.push('Issue-class QA row must include executable browser steps.');
4189
+ blockers.push('Business-proof QA row must mark route-only evidence as a false pass.');
4554
4190
  }
4555
4191
  if (!cleanText(activeQaRow.expected_dom_or_data_proof, 1600)) {
4556
- blockers.push('Issue-class QA row must include expected DOM/data proof.');
4192
+ blockers.push('Business-proof QA row must include expected business proof.');
4557
4193
  }
4558
4194
  }
4559
- if (requiredArtifacts.length < 2) {
4560
- blockers.push('Issue-class probe plan must require at least two proof artifacts.');
4561
- }
4562
- if (!falsePassBlockers.length) {
4563
- blockers.push('Issue-class probe plan must record false-pass blockers.');
4564
- }
4565
4195
  var status = blockers.length
4566
4196
  ? (probes.length ? 'incomplete' : 'missing')
4567
4197
  : 'ready';
4568
4198
  var generatedAt = cleanText(source.generatedAt || source.generated_at, 120) || isoNow(now);
4569
4199
  var normalized = {
4570
- planId: cleanText(source.planId || source.plan_id, 160) || "support-probe-plan-".concat(hashResolveIOSupportV5Evidence({
4571
- issueClass: issueClass,
4200
+ planId: cleanText(source.planId || source.plan_id, 160) || "support-business-proof-plan-".concat(hashResolveIOSupportV5Evidence({
4572
4201
  route: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.route,
4573
4202
  action: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.action,
4574
4203
  expectedBusinessProof: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.expected_business_proof
4575
4204
  }).slice(0, 16)),
4576
4205
  status: status,
4577
- issue_class: issueClass || undefined,
4578
4206
  diagnosisValid: diagnosisValidation.valid === true,
4579
4207
  probes: probes,
4580
4208
  activeProbe: activeProbe,
@@ -4594,25 +4222,21 @@ function validateResolveIOSupportIssueClassProbePlan(value, diagnosisGate, now)
4594
4222
  activeProbe: activeProbe
4595
4223
  };
4596
4224
  }
4597
- function buildResolveIOSupportIssueClassProbePlan(diagnosisGate, now) {
4598
- var _a, _b;
4225
+ function buildResolveIOSupportBusinessProofPlan(diagnosisGate, now) {
4226
+ var _a;
4599
4227
  var diagnosisValidation = validateResolveIOSupportDiagnosisGate(diagnosisGate);
4600
4228
  var probes = diagnosisValidation.valid && diagnosisValidation.normalized
4601
- ? buildResolveIOSupportIssueClassProbes(diagnosisValidation.normalized)
4229
+ ? buildResolveIOSupportBusinessProofProbes(diagnosisValidation.normalized)
4602
4230
  : [];
4603
4231
  var activeProbe = probes[0];
4604
4232
  var qaRows = probes.flatMap(function (probe) { return probe.qa_rows || []; });
4605
- var issueClass = ((_a = diagnosisValidation.normalized) === null || _a === void 0 ? void 0 : _a.issue_class) || (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.issue_class);
4606
- var catalog = SUPPORT_ISSUE_CLASS_PROBE_CATALOG.find(function (entry) { return entry.issue_class === issueClass; });
4607
4233
  var provisional = {
4608
- planId: "support-probe-plan-".concat(hashResolveIOSupportV5Evidence({
4609
- issueClass: issueClass,
4234
+ planId: "support-business-proof-plan-".concat(hashResolveIOSupportV5Evidence({
4610
4235
  route: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.route,
4611
4236
  action: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.action,
4612
4237
  expectedBusinessProof: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.expected_business_proof
4613
4238
  }).slice(0, 16)),
4614
4239
  status: 'incomplete',
4615
- issue_class: issueClass,
4616
4240
  diagnosisValid: diagnosisValidation.valid === true,
4617
4241
  probes: probes,
4618
4242
  activeProbe: activeProbe,
@@ -4620,15 +4244,16 @@ function buildResolveIOSupportIssueClassProbePlan(diagnosisGate, now) {
4620
4244
  activeQaRow: qaRows[0],
4621
4245
  requiredArtifacts: cleanList(activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.required_artifacts, 16, 220),
4622
4246
  acceptanceGate: 'aiqa_business_assertion',
4623
- falsePassBlockers: ((_b = activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.false_pass_blockers) === null || _b === void 0 ? void 0 : _b.length)
4247
+ falsePassBlockers: ((_a = activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.false_pass_blockers) === null || _a === void 0 ? void 0 : _a.length)
4624
4248
  ? activeProbe.false_pass_blockers
4625
- : ((catalog === null || catalog === void 0 ? void 0 : catalog.false_pass_blockers) || []),
4249
+ : [],
4626
4250
  blockers: [],
4627
4251
  generatedAt: isoNow(now)
4628
4252
  };
4629
4253
  var validation = validateResolveIOSupportIssueClassProbePlan(provisional, diagnosisValidation.normalized || diagnosisGate, now);
4630
4254
  return validation.normalized || __assign(__assign({}, provisional), { status: validation.status, blockers: validation.blockers });
4631
4255
  }
4256
+ exports.buildResolveIOSupportIssueClassProbePlan = buildResolveIOSupportBusinessProofPlan;
4632
4257
  function hashResolveIOSupportV5Evidence(value) {
4633
4258
  var raw = typeof value === 'string' ? value : JSON.stringify(value || {});
4634
4259
  var normalized = cleanText(raw, 8000)
@@ -4762,7 +4387,7 @@ function supportManagerRequiredResetEvidenceForContract(contract) {
4762
4387
  }
4763
4388
  function validateResolveIOSupportNextActionContract(value) {
4764
4389
  var e_19, _a;
4765
- var _b, _c, _d, _e, _f;
4390
+ var _b, _c, _d, _e, _f, _g;
4766
4391
  var contract = cleanObject(value);
4767
4392
  var blockers = [];
4768
4393
  var warnings = [];
@@ -4777,7 +4402,7 @@ function validateResolveIOSupportNextActionContract(value) {
4777
4402
  ];
4778
4403
  try {
4779
4404
  for (var requiredStringFields_1 = __values(requiredStringFields), requiredStringFields_1_1 = requiredStringFields_1.next(); !requiredStringFields_1_1.done; requiredStringFields_1_1 = requiredStringFields_1.next()) {
4780
- var _g = __read(requiredStringFields_1_1.value, 2), field = _g[0], fieldValue = _g[1];
4405
+ var _h = __read(requiredStringFields_1_1.value, 2), field = _h[0], fieldValue = _h[1];
4781
4406
  if (!cleanText(fieldValue, 500)) {
4782
4407
  blockers.push("NextActionContract.".concat(field, " is required."));
4783
4408
  }
@@ -4831,15 +4456,15 @@ function validateResolveIOSupportNextActionContract(value) {
4831
4456
  }
4832
4457
  }
4833
4458
  if (action === 'run_business_proof_qa') {
4834
- if (((_b = contract.decisionBasis) === null || _b === void 0 ? void 0 : _b.issueClassProbePlanReady) !== true) {
4835
- blockers.push('Business proof QA requires issueClassProbePlanReady=true.');
4459
+ if (((_b = contract.decisionBasis) === null || _b === void 0 ? void 0 : _b.businessProofPlanReady) !== true && ((_c = contract.decisionBasis) === null || _c === void 0 ? void 0 : _c.issueClassProbePlanReady) !== true) {
4460
+ blockers.push('Business proof QA requires businessProofPlanReady=true.');
4836
4461
  }
4837
4462
  if (!contract.successEvidence.some(function (entry) { return /AIQaBusinessAssertion|business proof|before\/action\/after/i.test(entry); })) {
4838
4463
  blockers.push('Business proof QA must require AIQaBusinessAssertion or before/action/after proof.');
4839
4464
  }
4840
4465
  }
4841
4466
  if (action === 'create_pr') {
4842
- if (((_c = contract.decisionBasis) === null || _c === void 0 ? void 0 : _c.businessProofReady) !== true) {
4467
+ if (((_d = contract.decisionBasis) === null || _d === void 0 ? void 0 : _d.businessProofReady) !== true) {
4843
4468
  blockers.push('PR packaging requires businessProofReady=true.');
4844
4469
  }
4845
4470
  if (!contract.successEvidence.some(function (entry) { return /pull_request_url|PR|pull request/i.test(entry); })) {
@@ -4850,7 +4475,7 @@ function validateResolveIOSupportNextActionContract(value) {
4850
4475
  }
4851
4476
  }
4852
4477
  if (action === 'run_a_grade_pr_review') {
4853
- if (((_d = contract.decisionBasis) === null || _d === void 0 ? void 0 : _d.businessProofReady) !== true) {
4478
+ if (((_e = contract.decisionBasis) === null || _e === void 0 ? void 0 : _e.businessProofReady) !== true) {
4854
4479
  blockers.push('A-grade PR review requires businessProofReady=true.');
4855
4480
  }
4856
4481
  if (!contract.successEvidence.some(function (entry) { return /A-grade|execution\/artifacts\/pull_request|strict gate|grade/i.test(entry); })) {
@@ -4861,11 +4486,11 @@ function validateResolveIOSupportNextActionContract(value) {
4861
4486
  }
4862
4487
  }
4863
4488
  if (action === 'repair_release_hotfix_first') {
4864
- if (((_e = contract.decisionBasis) === null || _e === void 0 ? void 0 : _e.hotfixCommitRequired) === true
4489
+ if (((_f = contract.decisionBasis) === null || _f === void 0 ? void 0 : _f.hotfixCommitRequired) === true
4865
4490
  && !__spreadArray(__spreadArray(__spreadArray([], __read(contract.successEvidence), false), __read(contract.stopConditions), false), __read(contract.forbiddenActions), false).some(function (entry) { return /sourceCommitSha|githubCommitUrl|gitCommitStatus|gitPushStatus|GitHub commit/i.test(entry); })) {
4866
4491
  blockers.push('Hotfix release action requires GitHub commit and push proof before continuation.');
4867
4492
  }
4868
- if (((_f = contract.decisionBasis) === null || _f === void 0 ? void 0 : _f.liveHotfixBlockedUntilCommit) === true && contract.safeToAutoRun === true && primaryCommand !== 'record_hotfix_evidence') {
4493
+ if (((_g = contract.decisionBasis) === null || _g === void 0 ? void 0 : _g.liveHotfixBlockedUntilCommit) === true && contract.safeToAutoRun === true && primaryCommand !== 'record_hotfix_evidence') {
4869
4494
  warnings.push('Live hotfix is blocked until commit proof; manager should record evidence before any live apply.');
4870
4495
  }
4871
4496
  }
@@ -5277,21 +4902,18 @@ function validateResolveIOSupportEvidenceProbeContract(value) {
5277
4902
  if (!normalized.forbiddenActions.some(function (entry) { return /product-code|repair loop|source edit|owner_files/i.test(entry); })) {
5278
4903
  blockers.push('Evidence probe contract must explicitly forbid product-code repair/source edits.');
5279
4904
  }
5280
- if (normalized.probeType === 'issue_class_probe') {
5281
- if (!normalized.issueClass) {
5282
- blockers.push('Issue-class evidence probe requires issueClass.');
5283
- }
4905
+ if (normalized.probeType === 'business_proof' || normalized.probeType === 'issue_class_probe') {
5284
4906
  if (!normalized.activeRoute) {
5285
- blockers.push('Issue-class evidence probe requires activeRoute.');
4907
+ blockers.push('Business-proof evidence probe requires activeRoute.');
5286
4908
  }
5287
4909
  if (!normalized.actionUnderTest) {
5288
- blockers.push('Issue-class evidence probe requires actionUnderTest.');
4910
+ blockers.push('Business-proof evidence probe requires actionUnderTest.');
5289
4911
  }
5290
4912
  if (!normalized.expectedBusinessProof) {
5291
- blockers.push('Issue-class evidence probe requires expectedBusinessProof.');
4913
+ blockers.push('Business-proof evidence probe requires expectedBusinessProof.');
5292
4914
  }
5293
4915
  if (!normalized.acceptableEvidence.some(function (entry) { return /AIQaBusinessAssertion|before\/action\/after|DOM|Mongo|data/i.test(entry); })) {
5294
- blockers.push('Issue-class evidence probe must require AIQaBusinessAssertion or before/action/after DOM/data/Mongo proof.');
4916
+ blockers.push('Business-proof evidence probe must require AIQaBusinessAssertion or before/action/after proof.');
5295
4917
  }
5296
4918
  }
5297
4919
  normalized.blockers = Array.from(new Set(blockers)).slice(0, 20);
@@ -5317,7 +4939,7 @@ function buildResolveIOSupportEvidenceProbeContract(input) {
5317
4939
  evidenceHash: input.evidenceHash
5318
4940
  });
5319
4941
  var probeType = activeProbe
5320
- ? 'issue_class_probe'
4942
+ ? 'business_proof'
5321
4943
  : /^(infra|compile)$/i.test(freshness.failureClass)
5322
4944
  ? 'preflight'
5323
4945
  : /release/i.test(freshness.failureClass)
@@ -5329,19 +4951,21 @@ function buildResolveIOSupportEvidenceProbeContract(input) {
5329
4951
  'changed blockerFingerprint from the starting failure',
5330
4952
  'changed evidenceHash from the starting failure',
5331
4953
  'fresh artifact path not already attached to the repeated failure',
5332
- activeProbe ? 'AIQaBusinessAssertion mapped to the active IssueClassProbePlan' : 'fresh before/action/after proof artifact'
4954
+ activeProbe ? 'AIQaBusinessAssertion mapped to the active business-proof plan' : 'fresh before/action/after proof artifact'
5333
4955
  ], false))).slice(0, 20);
5334
4956
  var requiredArtifacts = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(cleanList(input.requiredEvidence, 20, 500)), false), __read(cleanList(activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.required_artifacts, 20, 500)), false), __read(cleanList((_b = issueClassProbePlanValidation.normalized) === null || _b === void 0 ? void 0 : _b.requiredArtifacts, 20, 500)), false), __read((probeType === 'preflight' ? ['preflight log with changed infra/compile status'] : [])), false), __read((probeType === 'release' ? ['release/hotfix gate result with changed status'] : [])), false), __read((activeProbe ? ['AIQaBusinessAssertion JSON artifact'] : [])), false))).slice(0, 20);
5335
4957
  var acceptableEvidence = Array.from(new Set([
5336
- activeProbe ? 'AIQaBusinessAssertion tied to the active issue-class probe' : 'before/action/after business proof artifact',
4958
+ activeProbe ? 'AIQaBusinessAssertion tied to the active business-proof probe' : 'before/action/after business proof artifact',
5337
4959
  activeProbe ? "state transition proof: ".concat(activeProbe.state_transition.before || 'before', " -> ").concat(activeProbe.state_transition.action || activeProbe.action, " -> ").concat(activeProbe.state_transition.after || 'after') : '',
5338
4960
  'changed blockerFingerprint or evidenceHash',
5339
- 'new DOM/data/Mongo/network artifact proving the blocker changed',
4961
+ 'new proof artifact showing the blocker changed',
5340
4962
  'new compile/infra/release proof only if the failure class changed'
5341
4963
  ].filter(Boolean))).slice(0, 20);
5342
- var blockers = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read((diagnosisValidation.valid ? [] : ['Valid SupportDiagnosisGate is required before bounded support evidence collection.'])), false), __read((probeType === 'issue_class_probe' && !issueClassProbePlanValidation.valid ? issueClassProbePlanValidation.blockers : [])), false), __read((freshness.mustCollectNewEvidence ? [] : ['Evidence probe contract is intended for repeated/stale failures that must collect new evidence.'])), false))).slice(0, 20);
4964
+ var blockers = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read((diagnosisValidation.valid ? [] : ['Valid SupportDiagnosisGate is required before bounded support evidence collection.'])), false), __read((probeType === 'business_proof' && !issueClassProbePlanValidation.valid ? issueClassProbePlanValidation.blockers : [])), false), __read((freshness.mustCollectNewEvidence || input.allowInitialEvidenceProbe === true
4965
+ ? []
4966
+ : ['Evidence probe contract is intended for repeated/stale failures or unreproduced diagnoses that must collect new evidence.'])), false))).slice(0, 20);
5343
4967
  var nextCommands = Array.from(new Set([
5344
- activeProbe ? 'execute_active_issue_class_probe_evidence_only' : 'collect_before_action_after_evidence_only',
4968
+ activeProbe ? 'execute_active_business_proof_evidence_only' : 'collect_before_action_after_evidence_only',
5345
4969
  'record_changed_blocker_or_evidence_hash',
5346
4970
  'write_aiqa_business_assertion_or_blocker_artifact',
5347
4971
  'return_to_diagnosis_or_owner_scoped_repair_only_after_probe_passes'
@@ -5398,7 +5022,7 @@ function buildResolveIOSupportContinuationProofCheckpoint(input) {
5398
5022
  ]
5399
5023
  : [])), false), __read((action === 'collect_new_evidence'
5400
5024
  ? [
5401
- 'fresh issue-class probe artifact',
5025
+ 'fresh business-proof artifact',
5402
5026
  'changed blockerFingerprint or evidenceHash',
5403
5027
  'AIQaBusinessAssertion or before/action/after blocker artifact'
5404
5028
  ]
@@ -5487,6 +5111,7 @@ function buildResolveIOSupportOwnerScopedRepairContract(input) {
5487
5111
  var diagnosisValidation = validateResolveIOSupportDiagnosisGate(input.diagnosisGate);
5488
5112
  var gate = diagnosisValidation.normalized;
5489
5113
  var proofMatrix = diagnosisValidation.proofMatrix || buildResolveIOSupportDiagnosisProofMatrix(input.diagnosisGate, input.now);
5114
+ var productRepairReadiness = evaluateResolveIOSupportDiagnosisProductRepairReadiness(input.diagnosisGate);
5490
5115
  var ownerFiles = (gate === null || gate === void 0 ? void 0 : gate.owner_files) || proofMatrix.ownerFiles || [];
5491
5116
  var changedFiles = cleanList(input.changedFiles, 120, 500)
5492
5117
  .map(normalizeOwnerFilePath)
@@ -5507,10 +5132,11 @@ function buildResolveIOSupportOwnerScopedRepairContract(input) {
5507
5132
  'no edits outside owner_files except explicitly allowed tests'
5508
5133
  ]
5509
5134
  }); });
5510
- var blockers = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(diagnosisValidation.blockers), false), __read(proofMatrix.blockers), false), __read((outsideOwnerFiles.length ? ["Repair contract changed files outside owner_files: ".concat(outsideOwnerFiles.join(', '))] : [])), false), __read((ownerFiles.length ? [] : ['Repair contract requires a non-empty owner_files set.'])), false), __read((patchUnits.length ? [] : ['Repair contract requires at least one owner-file patch unit.'])), false))).slice(0, 40);
5135
+ var blockers = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(diagnosisValidation.blockers), false), __read(proofMatrix.blockers), false), __read(productRepairReadiness.blockers), false), __read((outsideOwnerFiles.length ? ["Repair contract changed files outside owner_files: ".concat(outsideOwnerFiles.join(', '))] : [])), false), __read((ownerFiles.length ? [] : ['Repair contract requires a non-empty owner_files set.'])), false), __read((patchUnits.length ? [] : ['Repair contract requires at least one owner-file patch unit.'])), false))).slice(0, 40);
5511
5136
  var status = blockers.length ? 'blocked' : 'ready';
5512
5137
  var requiredEvidenceBeforeRepair = [
5513
5138
  'valid SupportDiagnosisGate',
5139
+ 'reproduction_status=reproduced with business-specific reproduction evidence',
5514
5140
  'ready SupportDiagnosisProofMatrix',
5515
5141
  'owner_files coverage for every patch unit',
5516
5142
  'preflight/compile gate not blocking product repair'
@@ -5519,7 +5145,7 @@ function buildResolveIOSupportOwnerScopedRepairContract(input) {
5519
5145
  'changed files are within owner_files',
5520
5146
  'compile or targeted unit gate passes',
5521
5147
  'fresh AIQaBusinessAssertion mapped to diagnosis proof_plan',
5522
- 'business proof artifacts include before/action/after DOM/data or Mongo proof'
5148
+ 'business proof artifacts include before/action/after proof tied to the diagnosis'
5523
5149
  ];
5524
5150
  var createdAt = isoNow(input.now);
5525
5151
  return {
@@ -5532,8 +5158,8 @@ function buildResolveIOSupportOwnerScopedRepairContract(input) {
5532
5158
  createdAt: createdAt.slice(0, 16)
5533
5159
  }).slice(0, 16)),
5534
5160
  status: status,
5535
- sourceEditsAllowed: status === 'ready',
5536
- canRunWithoutCodexMonitor: status === 'ready',
5161
+ sourceEditsAllowed: status === 'ready' && productRepairReadiness.ready === true,
5162
+ canRunWithoutCodexMonitor: status === 'ready' && productRepairReadiness.ready === true,
5537
5163
  issueClass: gate === null || gate === void 0 ? void 0 : gate.issue_class,
5538
5164
  ownerFiles: ownerFiles,
5539
5165
  proofMatrixId: proofMatrix.matrixId,
@@ -5550,15 +5176,17 @@ function buildResolveIOSupportOwnerScopedRepairContract(input) {
5550
5176
  ],
5551
5177
  forbiddenActions: [
5552
5178
  'Do not edit outside owner_files unless SupportDiagnosisGate is revised with new evidence.',
5179
+ 'Do not edit product code from a classified diagnosis; collect reproduction evidence first.',
5553
5180
  'Do not accept route-load, screenshot-only, scorecard-only, or model-claim proof.',
5554
5181
  'Do not draft a customer resolution until business proof readiness passes.'
5555
5182
  ],
5556
5183
  blockers: blockers,
5184
+ productRepairReadiness: productRepairReadiness,
5557
5185
  createdAt: createdAt
5558
5186
  };
5559
5187
  }
5560
5188
  function decideResolveIOSupportV5RepairGate(input) {
5561
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
5189
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
5562
5190
  var activeStepType = cleanText(input.activeStepType, 80);
5563
5191
  var failureClass = cleanText(input.failureClass, 80).toLowerCase();
5564
5192
  var preflightGate = evaluateResolveIOSupportPreflightGate(input.preflightGate);
@@ -5572,6 +5200,7 @@ function decideResolveIOSupportV5RepairGate(input) {
5572
5200
  changedFiles: input.changedFiles,
5573
5201
  allowTestsOutsideOwnerFiles: input.allowTestsOutsideOwnerFiles === true
5574
5202
  });
5203
+ var productRepairReadiness = ownerScopedRepairContract.productRepairReadiness;
5575
5204
  var repeatedFailure = ((_b = input.history) === null || _b === void 0 ? void 0 : _b.length) ? decideResolveIOSupportV5RepeatedFailureStop({
5576
5205
  history: input.history,
5577
5206
  failureClass: failureClass,
@@ -5666,12 +5295,16 @@ function decideResolveIOSupportV5RepairGate(input) {
5666
5295
  ? diagnosisValidation.blockers
5667
5296
  : ['SupportDiagnosisGate is required before product-code repair.'], ownerFiles: ownerFiles, issueClass: (_j = diagnosisValidation.normalized) === null || _j === void 0 ? void 0 : _j.issue_class, proofPlan: (_k = diagnosisValidation.normalized) === null || _k === void 0 ? void 0 : _k.proof_plan, ownerScopedRepairContract: ownerScopedRepairContract, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_4));
5668
5297
  }
5298
+ if (productRepairReadiness.ready !== true) {
5299
+ var recoveryPlan_5 = recoveryPlanFor(productRepairReadiness.nextAction === 'ask_customer_clarification' ? 'park_customer_clarification' : 'collect_new_evidence', productRepairReadiness.reason, 'diagnosis', false);
5300
+ return __assign({ action: 'diagnose_only', canEditProductCode: false, blockers: productRepairReadiness.blockers, ownerFiles: ownerFiles, issueClass: (_l = diagnosisValidation.normalized) === null || _l === void 0 ? void 0 : _l.issue_class, proofPlan: (_m = diagnosisValidation.normalized) === null || _m === void 0 ? void 0 : _m.proof_plan, ownerScopedRepairContract: ownerScopedRepairContract, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_5));
5301
+ }
5669
5302
  if (outsideOwnerFiles.length) {
5670
- var recoveryPlan_5 = recoveryPlanFor('continue', 'support_v5_out_of_scope_requires_diagnosis_revision', 'owner_scope', false);
5671
- return __assign({ action: 'reject_out_of_scope', canEditProductCode: false, blockers: ["Changed files outside diagnosis owner_files; revise diagnosis with new evidence before broadening edits: ".concat(outsideOwnerFiles.join(', '))], ownerFiles: ownerFiles, issueClass: (_l = diagnosisValidation.normalized) === null || _l === void 0 ? void 0 : _l.issue_class, proofPlan: (_m = diagnosisValidation.normalized) === null || _m === void 0 ? void 0 : _m.proof_plan, ownerScopedRepairContract: ownerScopedRepairContract, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_5));
5303
+ var recoveryPlan_6 = recoveryPlanFor('continue', 'support_v5_out_of_scope_requires_diagnosis_revision', 'owner_scope', false);
5304
+ return __assign({ action: 'reject_out_of_scope', canEditProductCode: false, blockers: ["Changed files outside diagnosis owner_files; revise diagnosis with new evidence before broadening edits: ".concat(outsideOwnerFiles.join(', '))], ownerFiles: ownerFiles, issueClass: (_o = diagnosisValidation.normalized) === null || _o === void 0 ? void 0 : _o.issue_class, proofPlan: (_p = diagnosisValidation.normalized) === null || _p === void 0 ? void 0 : _p.proof_plan, ownerScopedRepairContract: ownerScopedRepairContract, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_6));
5672
5305
  }
5673
5306
  var recoveryPlan = recoveryPlanFor('continue', 'support_v5_product_repair_allowed_after_diagnosis', failureClass || 'product_code', true);
5674
- return __assign({ action: 'allow_product_repair', canEditProductCode: true, blockers: [], ownerFiles: ownerFiles, issueClass: (_o = diagnosisValidation.normalized) === null || _o === void 0 ? void 0 : _o.issue_class, proofPlan: (_p = diagnosisValidation.normalized) === null || _p === void 0 ? void 0 : _p.proof_plan, ownerScopedRepairContract: ownerScopedRepairContract, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan));
5307
+ return __assign({ action: 'allow_product_repair', canEditProductCode: true, blockers: [], ownerFiles: ownerFiles, issueClass: (_q = diagnosisValidation.normalized) === null || _q === void 0 ? void 0 : _q.issue_class, proofPlan: (_r = diagnosisValidation.normalized) === null || _r === void 0 ? void 0 : _r.proof_plan, ownerScopedRepairContract: ownerScopedRepairContract, outsideOwnerFiles: outsideOwnerFiles, preflightGate: preflightGate, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan));
5675
5308
  }
5676
5309
  function applyResolveIOSupportDiagnosisGateToMicrotasks(bundle, diagnosisGate) {
5677
5310
  var _a;
@@ -5682,8 +5315,9 @@ function applyResolveIOSupportDiagnosisGateToMicrotasks(bundle, diagnosisGate) {
5682
5315
  }
5683
5316
  var now = isoNow();
5684
5317
  var ownerFiles = gate.owner_files;
5685
- var probes = buildResolveIOSupportIssueClassProbes(gate);
5686
- var probePlan = buildResolveIOSupportIssueClassProbePlan(gate, now);
5318
+ var productRepairReadiness = evaluateResolveIOSupportDiagnosisProductRepairReadiness(gate);
5319
+ var probes = buildResolveIOSupportBusinessProofProbes(gate);
5320
+ var probePlan = buildResolveIOSupportBusinessProofPlan(gate, now);
5687
5321
  var probePlanValidation = validateResolveIOSupportIssueClassProbePlan(probePlan, gate, now);
5688
5322
  var proofContract = gate.proof_plan.business_proof_contract;
5689
5323
  var activeProbe = probePlanValidation.activeProbe || probePlan.activeProbe || probes[0];
@@ -5710,7 +5344,7 @@ function applyResolveIOSupportDiagnosisGateToMicrotasks(bundle, diagnosisGate) {
5710
5344
  ].filter(Boolean).join(' '), 420);
5711
5345
  var looksLikeReadOnlyDiagnosisTask = function (task) {
5712
5346
  var text = "".concat(task.objective || '', "\n").concat(task.selfGate || '', "\n").concat(task.blocker || '');
5713
- if (!/\b(replicat|reproduc|diagnos|analy[sz]|investigat|inspect|review|classif|read[-\s]*only|attached\s+template|upload\s+issue)\b/i.test(text)) {
5347
+ if (!/\b(replicat|reproduc|diagnos|analy[sz]|investigat|inspect|review|classif|read[-\s]*only|attached\s+template|reported\s+issue|customer\s+issue|issue)\b/i.test(text)) {
5714
5348
  return false;
5715
5349
  }
5716
5350
  return !/\b(patch|repair|fix|implement|correct|update|change product-code|product-code change)\b/i.test(task.objective || '');
@@ -5724,18 +5358,26 @@ function applyResolveIOSupportDiagnosisGateToMicrotasks(bundle, diagnosisGate) {
5724
5358
  }
5725
5359
  if (task.lane === 'build' && /repair|product_repair|build_repair/i.test(String(task.type || ''))) {
5726
5360
  var staleDiagnosisTask = validation.valid && looksLikeReadOnlyDiagnosisTask(task);
5727
- return __assign(__assign({}, task), { status: staleDiagnosisTask ? 'pending' : task.status, objective: staleDiagnosisTask ? repairObjective : task.objective, targetFiles: ownerFiles, contextRefs: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.contextRefs || [])), false), ['supportV5DiagnosisGate', 'owner_files', 'proof_plan', 'accepted_hypothesis'], false))), selfGate: repairSelfGate, acceptanceProof: businessProof, dependsOn: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.dependsOn || [])), false), [diagnosisMicrotaskId], false))), attempts: staleDiagnosisTask ? 0 : task.attempts, blocker: staleDiagnosisTask ? '' : task.blocker, updatedAt: now });
5361
+ var repairBlockedUntilReproduced = validation.valid && productRepairReadiness.ready !== true;
5362
+ return __assign(__assign({}, task), { status: repairBlockedUntilReproduced
5363
+ ? 'blocked'
5364
+ : (staleDiagnosisTask ? 'pending' : task.status), objective: staleDiagnosisTask && !repairBlockedUntilReproduced ? repairObjective : task.objective, targetFiles: ownerFiles, contextRefs: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.contextRefs || [])), false), ['supportV5DiagnosisGate', 'owner_files', 'proof_plan', 'accepted_hypothesis'], false))), selfGate: repairBlockedUntilReproduced
5365
+ ? productRepairReadiness.blockers.join(' | ')
5366
+ : repairSelfGate, acceptanceProof: repairBlockedUntilReproduced
5367
+ ? productRepairReadiness.requiredEvidence.join(' | ')
5368
+ : businessProof, dependsOn: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.dependsOn || [])), false), [diagnosisMicrotaskId], false))), attempts: staleDiagnosisTask && !repairBlockedUntilReproduced ? 0 : task.attempts, blocker: repairBlockedUntilReproduced
5369
+ ? productRepairReadiness.blockers.join(' | ')
5370
+ : (staleDiagnosisTask ? '' : task.blocker), updatedAt: now });
5728
5371
  }
5729
5372
  if (task.lane === 'qa' && task.type === 'qa_row') {
5730
5373
  var staleQaTask = validation.valid && looksLikeReadOnlyDiagnosisTask(task);
5731
- return __assign(__assign({}, task), { objective: staleQaTask ? qaObjective : task.objective, contextRefs: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.contextRefs || [])), false), ['supportV5DiagnosisGate', 'supportV5IssueClassProbePlan', 'proof_plan'], false))), selfGate: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.action) || task.selfGate, acceptanceProof: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.expected_business_proof) || businessProof || task.acceptanceProof, targetFiles: ownerFiles, attempts: staleQaTask ? 0 : task.attempts, blocker: staleQaTask ? '' : task.blocker, updatedAt: now });
5374
+ return __assign(__assign({}, task), { objective: staleQaTask ? qaObjective : task.objective, contextRefs: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.contextRefs || []).filter(function (ref) { return ref !== 'supportV5IssueClassProbePlan'; })), false), ['supportV5DiagnosisGate', 'supportV5BusinessProofPlan', 'proof_plan'], false))), selfGate: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.action) || task.selfGate, acceptanceProof: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.expected_business_proof) || businessProof || task.acceptanceProof, targetFiles: ownerFiles, attempts: staleQaTask ? 0 : task.attempts, blocker: staleQaTask ? '' : task.blocker, updatedAt: now });
5732
5375
  }
5733
5376
  return task;
5734
5377
  });
5735
5378
  var nextActive = selectResolveIOSupportV5ActiveMicrotask(ledger, bundle.supportV5ActiveMicrotaskId);
5736
- return __assign(__assign({}, bundle), { supportV5DiagnosisGate: gate, supportV5IssueClassProbePlan: probePlanValidation.normalized || probePlan, supportV5MicrotaskLedger: ledger, supportV5ActiveMicrotaskId: nextActive === null || nextActive === void 0 ? void 0 : nextActive.microtaskId, supportV5LaneMemory: __assign(__assign({}, bundle.supportV5LaneMemory), { build: __assign(__assign({}, bundle.supportV5LaneMemory.build), { changedFiles: ownerFiles, scopeSummary: [
5379
+ return __assign(__assign({}, bundle), { supportV5DiagnosisGate: gate, supportV5BusinessProofPlan: probePlanValidation.normalized || probePlan, supportV5IssueClassProbePlan: probePlanValidation.normalized || probePlan, supportV5MicrotaskLedger: ledger, supportV5ActiveMicrotaskId: nextActive === null || nextActive === void 0 ? void 0 : nextActive.microtaskId, supportV5LaneMemory: __assign(__assign({}, bundle.supportV5LaneMemory), { build: __assign(__assign({}, bundle.supportV5LaneMemory.build), { changedFiles: ownerFiles, scopeSummary: [
5737
5380
  bundle.supportV5LaneMemory.build.scopeSummary,
5738
- "Diagnosis issue class: ".concat(gate.issue_class),
5739
5381
  "Accepted hypothesis: ".concat(gate.accepted_hypothesis.statement),
5740
5382
  "Owner files: ".concat(ownerFiles.join(', '))
5741
5383
  ].filter(Boolean).join(' | '), updatedAt: now }), qa: __assign(__assign({}, bundle.supportV5LaneMemory.qa), { activeQaRow: {
@@ -5843,7 +5485,7 @@ function buildResolveIOSupportV5MicrotaskLedger(input) {
5843
5485
  targetFiles: [],
5844
5486
  contextRefs: ['scope_digest', 'support_context', 'similar_tickets', 'similar_commits'],
5845
5487
  selfGate: 'Read-only diagnosis only: reproduce or explicitly classify the issue, accept one falsifiable root-cause hypothesis, reject alternatives, identify the failing path, cap owner_files, and define before/action/after business proof.',
5846
- acceptanceProof: 'Valid ResolveIOSupportDiagnosisGate JSON with issue_case, issue_class, accepted_hypothesis, rejected_alternatives, failing_path, owner_files, proof_plan, evidence, and status=passed.',
5488
+ acceptanceProof: 'Valid ResolveIOSupportDiagnosisGate JSON with issue_case, accepted_hypothesis, rejected_alternatives, failing_path, owner_files, proof_plan, evidence, and status=passed.',
5847
5489
  threadKey: input.buildThreadKey,
5848
5490
  promptTokenEstimate: existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.promptTokenEstimate,
5849
5491
  attempts: (existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.attempts) || 0,
@@ -5927,7 +5569,10 @@ function initializeResolveIOSupportV5State(input) {
5927
5569
  var existingDiagnosisGate = normalizeResolveIOSupportDiagnosisGate(existing.supportV5DiagnosisGate);
5928
5570
  var existingPreflightGate = evaluateResolveIOSupportPreflightGate(existing.supportV5PreflightGate || existing.support_v5_preflight_gate, now);
5929
5571
  var diagnosisValidation = validateResolveIOSupportDiagnosisGate(existingDiagnosisGate);
5930
- var existingProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(existing.supportV5IssueClassProbePlan || existing.support_v5_issue_class_probe_plan, diagnosisValidation.normalized || existingDiagnosisGate, now);
5572
+ var existingProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(existing.supportV5BusinessProofPlan
5573
+ || existing.support_v5_business_proof_plan
5574
+ || existing.supportV5IssueClassProbePlan
5575
+ || existing.support_v5_issue_class_probe_plan, diagnosisValidation.normalized || existingDiagnosisGate, now);
5931
5576
  var scopeDigest = cleanText(existing.supportV5ScopeDigest, 4000) || buildResolveIOSupportV5ScopeDigest({
5932
5577
  goal: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.currentGoal) || "Resolve support ticket ".concat(ticketLabel),
5933
5578
  approvedScope: scope,
@@ -5961,6 +5606,7 @@ function initializeResolveIOSupportV5State(input) {
5961
5606
  },
5962
5607
  supportV5DiagnosisGate: diagnosisValidation.valid ? diagnosisValidation.normalized : existingDiagnosisGate,
5963
5608
  supportV5DiagnosisEvidencePack: existing.supportV5DiagnosisEvidencePack || existing.support_v5_diagnosis_evidence_pack,
5609
+ supportV5BusinessProofPlan: existingProbePlanValidation.normalized,
5964
5610
  supportV5IssueClassProbePlan: existingProbePlanValidation.normalized,
5965
5611
  supportV5PreflightGate: existingPreflightGate.status === 'unknown' && existingPreflightGate.checks.length === 0
5966
5612
  ? undefined
@@ -6177,34 +5823,34 @@ function decideResolveIOSupportV5Continuation(bundle) {
6177
5823
  };
6178
5824
  };
6179
5825
  if (budgetExceeded) {
6180
- var recoveryPlan_6 = recoveryPlanFor('manual_handoff', 'support_v5_budget_guard', {
5826
+ var recoveryPlan_7 = recoveryPlanFor('manual_handoff', 'support_v5_budget_guard', {
6181
5827
  productRepairFailure: false
6182
5828
  });
6183
- return __assign({ action: 'park', reason: 'support_v5_budget_guard', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_6));
5829
+ return __assign({ action: 'park', reason: 'support_v5_budget_guard', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_7));
6184
5830
  }
6185
5831
  var lastFailureClass = cleanText(last === null || last === void 0 ? void 0 : last.failureClass, 80).toLowerCase();
6186
5832
  var materialEvidenceRetryAllowed = (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) === false
6187
5833
  && repeatedFailure.newEvidence === true
6188
5834
  && repeatedFailure.materialEvidence === true;
6189
5835
  if (repeatedNoProgressCount > budget.maxRepeatedNoProgress && /^(infra|compile)$/.test(lastFailureClass)) {
6190
- var recoveryPlan_7 = recoveryPlanFor('retry_infra', 'support_v5_infra_or_compile_repair_required', {
5836
+ var recoveryPlan_8 = recoveryPlanFor('retry_infra', 'support_v5_infra_or_compile_repair_required', {
6191
5837
  failureClass: lastFailureClass,
6192
5838
  productRepairFailure: false
6193
5839
  });
6194
- return __assign({ action: 'continue', reason: 'support_v5_infra_or_compile_repair_required', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'compile_check', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_7));
5840
+ return __assign({ action: 'continue', reason: 'support_v5_infra_or_compile_repair_required', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'compile_check', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_8));
6195
5841
  }
6196
5842
  if (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) {
6197
- var recoveryPlan_8 = recoveryPlanFor(repeatedFailure.reason === 'support_v5_ping_pong_failure_loop' ? 'park_ping_pong' : 'park_repeated_failure', repeatedFailure.reason, {
5843
+ var recoveryPlan_9 = recoveryPlanFor(repeatedFailure.reason === 'support_v5_ping_pong_failure_loop' ? 'park_ping_pong' : 'park_repeated_failure', repeatedFailure.reason, {
6198
5844
  failureClass: repeatedFailure.failureClass,
6199
5845
  productRepairFailure: true
6200
5846
  });
6201
- return __assign({ action: 'park', reason: repeatedFailure.reason, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedFailure.repeatedCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_8));
5847
+ return __assign({ action: 'park', reason: repeatedFailure.reason, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedFailure.repeatedCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_9));
6202
5848
  }
6203
5849
  if (repeatedNoProgressCount > budget.maxRepeatedNoProgress && !materialEvidenceRetryAllowed) {
6204
- var recoveryPlan_9 = recoveryPlanFor('park_repeated_failure', 'support_v5_repeated_no_progress', {
5850
+ var recoveryPlan_10 = recoveryPlanFor('park_repeated_failure', 'support_v5_repeated_no_progress', {
6205
5851
  productRepairFailure: true
6206
5852
  });
6207
- return __assign({ action: 'park', reason: 'support_v5_repeated_no_progress', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_9));
5853
+ return __assign({ action: 'park', reason: 'support_v5_repeated_no_progress', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_10));
6208
5854
  }
6209
5855
  var recoveryPlan = recoveryPlanFor('continue', 'support_v5_continue');
6210
5856
  return __assign({ action: 'continue', reason: 'support_v5_continue', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.supportV5SupervisorState.activeStep, repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, recoveryFieldsFor(recoveryPlan));
@@ -6232,10 +5878,12 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6232
5878
  maxOwnerFiles: input.maxOwnerFiles,
6233
5879
  allowTestsOutsideOwnerFiles: true
6234
5880
  });
5881
+ var productRepairReadiness = repairGate.ownerScopedRepairContract.productRepairReadiness
5882
+ || evaluateResolveIOSupportDiagnosisProductRepairReadiness(bundle.supportV5DiagnosisGate);
6235
5883
  var continuation = decideResolveIOSupportV5Continuation(bundle);
6236
5884
  var customerReplyPolicy = decideResolveIOSupportCustomerReplyPolicy({
6237
5885
  diagnosisGate: bundle.supportV5DiagnosisGate,
6238
- issueClassProbePlan: bundle.supportV5IssueClassProbePlan,
5886
+ businessProofPlan: bundle.supportV5BusinessProofPlan || bundle.supportV5IssueClassProbePlan,
6239
5887
  outcomeLabel: input.outcomeLabel,
6240
5888
  confidence: input.confidence,
6241
5889
  businessAssertionStatus: input.businessAssertionStatus,
@@ -6279,12 +5927,12 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6279
5927
  || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.acceptanceProof)
6280
5928
  || '';
6281
5929
  var issueClassProbes = diagnosisValidation.valid && diagnosisValidation.normalized
6282
- ? buildResolveIOSupportIssueClassProbes(diagnosisValidation.normalized)
5930
+ ? buildResolveIOSupportBusinessProofProbes(diagnosisValidation.normalized)
6283
5931
  : [];
6284
5932
  var generatedProbePlan = diagnosisValidation.valid && diagnosisValidation.normalized
6285
- ? buildResolveIOSupportIssueClassProbePlan(diagnosisValidation.normalized, input.now)
5933
+ ? buildResolveIOSupportBusinessProofPlan(diagnosisValidation.normalized, input.now)
6286
5934
  : undefined;
6287
- var storedProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(bundle.supportV5IssueClassProbePlan, diagnosisValidation.normalized, input.now);
5935
+ var storedProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(bundle.supportV5BusinessProofPlan || bundle.supportV5IssueClassProbePlan, diagnosisValidation.normalized, input.now);
6288
5936
  var issueClassProbePlanValidation = storedProbePlanValidation.valid
6289
5937
  ? storedProbePlanValidation
6290
5938
  : validateResolveIOSupportIssueClassProbePlan(generatedProbePlan, diagnosisValidation.normalized, input.now);
@@ -6292,8 +5940,8 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6292
5940
  var activeIssueClassProbe = issueClassProbePlanValidation.activeProbe || (issueClassProbePlan === null || issueClassProbePlan === void 0 ? void 0 : issueClassProbePlan.activeProbe) || issueClassProbes[0];
6293
5941
  var issueClassProbeEvidence = activeIssueClassProbe
6294
5942
  ? Array.from(new Set(__spreadArray([
6295
- "IssueClassProbePlan ".concat((issueClassProbePlan === null || issueClassProbePlan === void 0 ? void 0 : issueClassProbePlan.planId) || 'generated', " status=").concat(issueClassProbePlanValidation.status),
6296
- "AIQaBusinessAssertion mapped to ".concat(activeIssueClassProbe.issue_class),
5943
+ "BusinessProofPlan ".concat((issueClassProbePlan === null || issueClassProbePlan === void 0 ? void 0 : issueClassProbePlan.planId) || 'generated', " status=").concat(issueClassProbePlanValidation.status),
5944
+ 'AIQaBusinessAssertion mapped to the diagnosis proof plan',
6297
5945
  "state transition: ".concat(activeIssueClassProbe.state_transition.before || 'before', " -> ").concat(activeIssueClassProbe.state_transition.action || activeIssueClassProbe.action, " -> ").concat(activeIssueClassProbe.state_transition.after || 'after')
6298
5946
  ], __read(activeIssueClassProbe.required_artifacts.map(function (artifact) { return "artifact: ".concat(artifact); })), false)))
6299
5947
  : [];
@@ -6334,10 +5982,11 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6334
5982
  var ownerFilesReady = diagnosisValid && ownerFiles.length > 0;
6335
5983
  var proofPlanReady = diagnosisValid && !!proofContract;
6336
5984
  var proofMatrixReady = diagnosisProofMatrix.status === 'ready';
5985
+ var productRepairReadinessReady = productRepairReadiness.ready === true;
6337
5986
  var ownerScopedRepairContractReady = repairGate.ownerScopedRepairContract.status === 'ready';
6338
- var issueClassProbePlanReady = issueClassProbePlanValidation.valid === true;
5987
+ var businessProofPlanReady = issueClassProbePlanValidation.valid === true;
6339
5988
  var preflightReady = preflightGate.blocksProductRepair !== true;
6340
- var rootCauseFirstSatisfied = diagnosisValid && ownerFilesReady && proofPlanReady && proofMatrixReady && issueClassProbePlanReady && preflightReady;
5989
+ var rootCauseFirstSatisfied = diagnosisValid && ownerFilesReady && proofPlanReady && proofMatrixReady && productRepairReadinessReady && businessProofPlanReady && preflightReady;
6341
5990
  var sameFailureParked = evidenceFreshness.mustCollectNewEvidence === true
6342
5991
  || (action === 'collect_new_evidence' && /repeated|no_progress|ping_pong|same failure|same evidence/i.test(reason));
6343
5992
  return {
@@ -6349,6 +5998,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6349
5998
  ownerFilesReady: ownerFilesReady,
6350
5999
  proofPlanReady: proofPlanReady,
6351
6000
  proofMatrixReady: proofMatrixReady,
6001
+ productRepairReadinessReady: productRepairReadinessReady,
6352
6002
  ownerScopedRepairContractReady: ownerScopedRepairContractReady,
6353
6003
  businessProofReady: businessProofReadiness.ready === true,
6354
6004
  infraOnly: action === 'repair_infra_only',
@@ -6360,16 +6010,18 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6360
6010
  canDraftCustomerReply: (action === 'draft_customer_reply' && businessProofReadiness.ready === true)
6361
6011
  || action === 'ask_customer_clarification',
6362
6012
  requiresHumanDecision: action === 'park_manual' || fields.canRunAutonomously !== true,
6363
- issueClassProbePlanReady: issueClassProbePlanReady,
6013
+ businessProofPlanReady: businessProofPlanReady,
6014
+ issueClassProbePlanReady: businessProofPlanReady,
6364
6015
  preflightReady: preflightReady,
6365
6016
  preflightStatus: preflightGate.status,
6366
6017
  preflightFailureClass: preflightGate.failureClass,
6367
6018
  reason: reason,
6368
- blockers: Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(blockers), false), __read(diagnosisProofMatrix.blockers), false), __read(repairGate.ownerScopedRepairContract.blockers), false), __read(issueClassProbePlanValidation.blockers), false), __read(preflightGate.blockers), false))),
6019
+ blockers: Array.from(new Set(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(blockers), false), __read(productRepairReadiness.blockers), false), __read(diagnosisProofMatrix.blockers), false), __read(repairGate.ownerScopedRepairContract.blockers), false), __read(issueClassProbePlanValidation.blockers), false), __read(preflightGate.blockers), false))),
6369
6020
  ownerFiles: ownerFiles,
6370
6021
  issueClass: ((_a = diagnosisValidation.normalized) === null || _a === void 0 ? void 0 : _a.issue_class) || repairGate.issueClass,
6371
6022
  expectedProof: expectedProof,
6372
6023
  issueClassProbes: issueClassProbes,
6024
+ businessProofPlan: issueClassProbePlan,
6373
6025
  issueClassProbePlan: issueClassProbePlan,
6374
6026
  proofMatrix: diagnosisProofMatrix,
6375
6027
  ownerScopedRepairContract: repairGate.ownerScopedRepairContract,
@@ -6377,7 +6029,8 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6377
6029
  proofFingerprint: businessProofReadiness.proofFingerprint,
6378
6030
  artifactFingerprint: businessProofReadiness.artifactFingerprint,
6379
6031
  proofFreshness: businessProofReadiness.proofFreshness,
6380
- preflightGate: preflightGate
6032
+ preflightGate: preflightGate,
6033
+ productRepairReadiness: productRepairReadiness
6381
6034
  };
6382
6035
  };
6383
6036
  var nextActionExpectedTransition = function (action, primaryCommand) {
@@ -6397,7 +6050,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6397
6050
  return 'Only diagnosis owner_files change, a compile/unit gate is recorded, and the next state is business proof QA rather than acceptance.';
6398
6051
  }
6399
6052
  if (action === 'run_business_proof_qa') {
6400
- return 'A fresh AIQaBusinessAssertion maps to the validated IssueClassProbePlan and records before/action/after DOM, data, or Mongo proof.';
6053
+ return 'A fresh AIQaBusinessAssertion maps to the validated business-proof plan and records before/action/after proof.';
6401
6054
  }
6402
6055
  if (action === 'create_pr') {
6403
6056
  return 'A support PR is created or updated from the proof-ready run, with merge/release/customer-send still blocked behind human/release gates.';
@@ -6422,7 +6075,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6422
6075
  return 'The runner stays parked until a human changes scope, budget, evidence, or autonomy policy.';
6423
6076
  };
6424
6077
  var buildNextActionContract = function (action, label, reason, fields, rootCauseReadiness, continuationProofCheckpoint, primaryCommand, nextCommands, requiredEvidence, forbiddenActions, blockers, evidenceProbeContract, autonomyApproval, productRepairDispatchGuard, autopilotCompletionProgress) {
6425
- var _a, _b, _c, _d, _e, _f;
6078
+ var _a, _b, _c, _d, _e, _f, _g;
6426
6079
  var lane = (fields.lane || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) || 'supervisor');
6427
6080
  var stepType = (fields.stepType || activeStepType);
6428
6081
  var liveHotfixBlockedUntilCommit = fields.liveHotfixBlockedUntilCommit === true;
@@ -6447,7 +6100,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6447
6100
  && !baseRequiresHumanApproval
6448
6101
  && !autonomyBlocksAutoRun
6449
6102
  && (action !== 'run_owner_scoped_repair' || (rootCauseReadiness.rootCauseFirstSatisfied === true && rootCauseReadiness.ownerScopedRepairContractReady === true && evidenceFreshness.mustCollectNewEvidence !== true))
6450
- && (action !== 'run_business_proof_qa' || rootCauseReadiness.issueClassProbePlanReady === true)
6103
+ && (action !== 'run_business_proof_qa' || rootCauseReadiness.businessProofPlanReady === true || rootCauseReadiness.issueClassProbePlanReady === true)
6451
6104
  && (action !== 'collect_new_evidence' || (evidenceProbeContract === null || evidenceProbeContract === void 0 ? void 0 : evidenceProbeContract.status) === 'ready')
6452
6105
  && (action !== 'repair_release_hotfix_first' || primaryCommand !== 'apply_backend_hotfix_only_after_commit_proof' || liveHotfixBlockedUntilCommit !== true);
6453
6106
  var costRisk = requiresHumanApproval
@@ -6474,7 +6127,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6474
6127
  var preconditions = Array.from(new Set(__spreadArray([
6475
6128
  action !== 'run_diagnosis_gate' ? 'SupportDiagnosisGate validation checked before action.' : 'Diagnosis is read-only and cannot edit source files.',
6476
6129
  action === 'run_owner_scoped_repair' ? 'Root-cause-first gate is satisfied and owner_files are the only editable product files.' : '',
6477
- action === 'run_business_proof_qa' ? 'Business proof QA must use the diagnosis proof_plan and validated IssueClassProbePlan.' : '',
6130
+ action === 'run_business_proof_qa' ? 'Business proof QA must use the diagnosis proof_plan and validated business-proof plan.' : '',
6478
6131
  action === 'create_pr' ? 'Business proof and changed-file evidence are ready; this action only packages/updates the support PR.' : '',
6479
6132
  action === 'run_a_grade_pr_review' ? 'A support PR exists and must pass strict A-grade review before any merge, release, deploy, or customer reply.' : '',
6480
6133
  action === 'repair_release_hotfix_first' ? 'Live backend hotfix is blocked until GitHub commit proof is recorded and passed.' : '',
@@ -6523,8 +6176,10 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6523
6176
  proofPlanReady: rootCauseReadiness.proofPlanReady === true,
6524
6177
  proofMatrixReady: rootCauseReadiness.proofMatrixReady === true,
6525
6178
  proofMatrixId: (_e = rootCauseReadiness.proofMatrix) === null || _e === void 0 ? void 0 : _e.matrixId,
6179
+ productRepairReadinessReady: rootCauseReadiness.productRepairReadinessReady === true,
6180
+ reproductionStatus: (_f = rootCauseReadiness.productRepairReadiness) === null || _f === void 0 ? void 0 : _f.reproductionStatus,
6526
6181
  ownerScopedRepairContractReady: rootCauseReadiness.ownerScopedRepairContractReady === true,
6527
- ownerScopedRepairContractId: (_f = rootCauseReadiness.ownerScopedRepairContract) === null || _f === void 0 ? void 0 : _f.contractId,
6182
+ ownerScopedRepairContractId: (_g = rootCauseReadiness.ownerScopedRepairContract) === null || _g === void 0 ? void 0 : _g.contractId,
6528
6183
  businessProofReady: businessProofReadiness.ready === true,
6529
6184
  evidenceFreshnessStatus: evidenceFreshness.status,
6530
6185
  evidenceStrength: evidenceFreshness.evidenceStrength,
@@ -6532,7 +6187,8 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6532
6187
  blockerFingerprint: cleanText(fields.blockerFingerprint || evidenceFreshness.blockerFingerprint, 180),
6533
6188
  evidenceHash: cleanText(fields.evidenceHash || evidenceFreshness.evidenceHash, 180),
6534
6189
  sameFailureCount: evidenceFreshness.sameFailureCount,
6535
- issueClassProbePlanReady: rootCauseReadiness.issueClassProbePlanReady === true,
6190
+ businessProofPlanReady: rootCauseReadiness.businessProofPlanReady === true || rootCauseReadiness.issueClassProbePlanReady === true,
6191
+ issueClassProbePlanReady: rootCauseReadiness.businessProofPlanReady === true || rootCauseReadiness.issueClassProbePlanReady === true,
6536
6192
  preflightReady: rootCauseReadiness.preflightReady === true,
6537
6193
  preflightStatus: preflightGate.status,
6538
6194
  preflightFailureClass: preflightGate.failureClass,
@@ -6630,7 +6286,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6630
6286
  choiceId: 'run_bounded_evidence_probe',
6631
6287
  label: 'Run Evidence Probe',
6632
6288
  action: 'collect_new_evidence',
6633
- description: 'Collect changed issue-specific evidence only; product-code repair remains blocked until blockerFingerprint, evidenceHash, or business proof changes.',
6289
+ description: 'Collect changed diagnosis-mapped evidence only; product-code repair remains blocked until blockerFingerprint, evidenceHash, or business proof changes.',
6634
6290
  safety: 'low',
6635
6291
  requiresConfirmation: false,
6636
6292
  nextCommand: nextActionContract.primaryCommand || 'run_support_v5_recovery_evidence_probe',
@@ -6794,6 +6450,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6794
6450
  issueClassProbePlan: issueClassProbePlan,
6795
6451
  evidenceFreshness: evidenceFreshness,
6796
6452
  requiredEvidence: requiredEvidence,
6453
+ allowInitialEvidenceProbe: productRepairReadiness.ready !== true && productRepairReadiness.nextAction === 'collect_new_evidence',
6797
6454
  now: input.now
6798
6455
  })
6799
6456
  : undefined;
@@ -6858,6 +6515,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6858
6515
  issueClass: ((_e = diagnosisValidation.normalized) === null || _e === void 0 ? void 0 : _e.issue_class) || repairGate.issueClass,
6859
6516
  expectedProof: expectedProof,
6860
6517
  issueClassProbes: issueClassProbes,
6518
+ businessProofPlan: issueClassProbePlan,
6861
6519
  issueClassProbePlan: issueClassProbePlan,
6862
6520
  issueClassProbePlanValidation: issueClassProbePlanValidation,
6863
6521
  activeMicrotask: activeMicrotask,
@@ -6928,6 +6586,47 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
6928
6586
  humanReviewPacket: customerReplyPolicy.humanReviewPacket
6929
6587
  });
6930
6588
  }
6589
+ if (diagnosisValidation.valid && productRepairReadiness.ready !== true && productRepairReadiness.nextAction === 'collect_new_evidence') {
6590
+ return makeDecision('collect_new_evidence', 'Collect Reproduction Evidence', productRepairReadiness.reason, {
6591
+ canRunAutonomously: true,
6592
+ canRunModel: false,
6593
+ canRunQa: true,
6594
+ canEditProductCode: false,
6595
+ lane: 'qa',
6596
+ stepType: 'reproduction_probe',
6597
+ primaryCommand: 'run_support_v5_reproduction_evidence_probe',
6598
+ nextCommands: [
6599
+ 'execute_business_proof_read_only',
6600
+ 'run_exact_method_or_query_replay',
6601
+ 'record_before_state_business_artifact',
6602
+ 'revise_support_diagnosis_gate_to_reproduced_or_blocked'
6603
+ ],
6604
+ requiredEvidence: productRepairReadiness.requiredEvidence,
6605
+ blockers: productRepairReadiness.blockers,
6606
+ forbiddenActions: [
6607
+ 'Do not edit product code from a classified diagnosis.',
6608
+ 'Do not run owner-scoped repair until SupportDiagnosisGate reproduction_status is reproduced.'
6609
+ ]
6610
+ });
6611
+ }
6612
+ if (diagnosisValidation.valid && productRepairReadiness.ready !== true && productRepairReadiness.nextAction === 'ask_customer_clarification') {
6613
+ return makeDecision('ask_customer_clarification', 'Ask Customer Clarification', productRepairReadiness.reason, {
6614
+ canRunAutonomously: false,
6615
+ canRunModel: false,
6616
+ canEditProductCode: false,
6617
+ canDraftCustomerReply: true,
6618
+ lane: 'customer',
6619
+ stepType: 'customer_reply',
6620
+ primaryCommand: 'review_customer_clarification',
6621
+ nextCommands: ['edit_clarification_question', 'send_after_human_review', 'park_ticket_until_customer_reply'],
6622
+ requiredEvidence: productRepairReadiness.requiredEvidence,
6623
+ blockers: productRepairReadiness.blockers,
6624
+ forbiddenActions: [
6625
+ 'Do not run repair from a blocked reproduction path.',
6626
+ 'Do not send customer email without explicit human approval.'
6627
+ ]
6628
+ });
6629
+ }
6931
6630
  if (repairGate.action === 'diagnose_only' || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.type) === 'diagnosis_gate' || !diagnosisValidation.valid) {
6932
6631
  return makeDecision('run_diagnosis_gate', 'Run Diagnosis Gate', 'support_v5_root_cause_first_required', {
6933
6632
  canRunAutonomously: true,
@@ -7012,10 +6711,10 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
7012
6711
  lane: (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) || 'qa',
7013
6712
  stepType: activeStepType,
7014
6713
  primaryCommand: 'run_support_v5_recovery_evidence_probe',
7015
- nextCommands: ['execute_issue_class_probe', 'record_changed_blocker_or_business_proof', 'write_aiqa_business_assertion_or_blocker_artifact'],
6714
+ nextCommands: ['execute_business_proof', 'record_changed_blocker_or_business_proof', 'write_aiqa_business_assertion_or_blocker_artifact'],
7016
6715
  requiredEvidence: evidenceFreshness.requiredResetEvidence.length
7017
6716
  ? evidenceFreshness.requiredResetEvidence
7018
- : ['changed blockerFingerprint or evidenceHash', 'fresh issue-specific business proof artifact'],
6717
+ : ['changed blockerFingerprint or evidenceHash', 'fresh business proof artifact derived from the current diagnosis'],
7019
6718
  blockers: [evidenceFreshness.reason || 'Repeated failure needs fresh evidence before owner-scoped repair.'],
7020
6719
  forbiddenActions: ['Do not edit product code in this recovery; collect changed browser/data/business-proof evidence only.']
7021
6720
  });
@@ -7124,8 +6823,8 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
7124
6823
  lane: 'qa',
7125
6824
  stepType: /^(qa_row|qa_retest|business_proof|route_probe|issue_class_probe)$/.test(activeStepType) ? activeStepType : 'qa_row',
7126
6825
  primaryCommand: 'run_support_v5_business_proof_qa_row',
7127
- nextCommands: ['start_local_stack_if_needed', 'execute_issue_class_probe', 'record_before_action_after_artifacts', 'write_aiqa_business_assertion'],
7128
- requiredEvidence: Array.from(new Set(__spreadArray(['AIQaBusinessAssertion pass', 'DOM/data proof', 'artifact path', 'Mongo delta when data-changing'], __read(issueClassProbeEvidence), false))),
6826
+ nextCommands: ['start_local_stack_if_needed', 'execute_business_proof', 'record_before_action_after_artifacts', 'write_aiqa_business_assertion'],
6827
+ requiredEvidence: Array.from(new Set(__spreadArray(['AIQaBusinessAssertion pass', 'business proof artifact', 'artifact path'], __read(issueClassProbeEvidence), false))),
7129
6828
  forbiddenActions: ['Route probe pass alone remains route evidence only.']
7130
6829
  });
7131
6830
  }
@@ -7151,7 +6850,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
7151
6850
  lane: 'qa',
7152
6851
  stepType: 'business_proof',
7153
6852
  primaryCommand: 'run_support_v5_business_proof_qa_row',
7154
- nextCommands: ['execute_issue_class_probe', 'record_before_action_after_artifacts', 'write_aiqa_business_assertion'],
6853
+ nextCommands: ['execute_business_proof', 'record_before_action_after_artifacts', 'write_aiqa_business_assertion'],
7155
6854
  requiredEvidence: Array.from(new Set(__spreadArray(__spreadArray([], __read(businessProofReadiness.requiredEvidence), false), __read(issueClassProbeEvidence), false))),
7156
6855
  blockers: businessProofReadiness.blockers,
7157
6856
  forbiddenActions: ['Do not run release or customer reply until businessProofReadiness.ready=true.']
@@ -7214,7 +6913,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
7214
6913
  lane: 'qa',
7215
6914
  stepType: 'business_proof',
7216
6915
  primaryCommand: 'run_support_v5_business_proof_qa_row',
7217
- nextCommands: ['execute_issue_class_probe', 'record_before_action_after_artifacts', 'write_aiqa_business_assertion', 'rerun_support_a_grade_pr_review'],
6916
+ nextCommands: ['execute_business_proof', 'record_before_action_after_artifacts', 'write_aiqa_business_assertion', 'rerun_support_a_grade_pr_review'],
7218
6917
  requiredEvidence: Array.from(new Set(__spreadArray([
7219
6918
  'AIQaBusinessAssertion before/action/after proof',
7220
6919
  'QA screenshot or trace artifact'
@@ -7400,11 +7099,11 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
7400
7099
  now: input.now
7401
7100
  })
7402
7101
  : undefined;
7403
- var promptProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(input.bundle.supportV5IssueClassProbePlan, diagnosisValidation.normalized || diagnosisGate, input.now);
7102
+ var promptProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(input.bundle.supportV5BusinessProofPlan || input.bundle.supportV5IssueClassProbePlan, diagnosisValidation.normalized || diagnosisGate, input.now);
7404
7103
  var promptProbePlan = promptProbePlanValidation.valid
7405
7104
  ? promptProbePlanValidation.normalized
7406
7105
  : diagnosisValidation.valid
7407
- ? buildResolveIOSupportIssueClassProbePlan(diagnosisValidation.normalized || diagnosisGate, input.now)
7106
+ ? buildResolveIOSupportBusinessProofPlan(diagnosisValidation.normalized || diagnosisGate, input.now)
7408
7107
  : undefined;
7409
7108
  var similarCaseSelection = diagnosisEvidencePack.similarCaseSelection;
7410
7109
  var similarCaseHintsText = ((_d = similarCaseSelection === null || similarCaseSelection === void 0 ? void 0 : similarCaseSelection.ranked) === null || _d === void 0 ? void 0 : _d.length)
@@ -7416,7 +7115,6 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
7416
7115
  "".concat(index + 1, ". source=").concat(hint.source || 'unknown', " score=").concat(Number(hint.score || 0)),
7417
7116
  hint.ticketNumber ? "ticket=".concat(hint.ticketNumber) : '',
7418
7117
  hint.commitSha ? "commit=".concat(hint.commitSha) : '',
7419
- hint.issueClass ? "issue_class=".concat(hint.issueClass) : '',
7420
7118
  ((_a = hint.ownerFiles) === null || _a === void 0 ? void 0 : _a.length) ? "owner_files=".concat(hint.ownerFiles.slice(0, 4).join(', ')) : '',
7421
7119
  hint.reason ? "signals=".concat(hint.reason) : '',
7422
7120
  hint.title ? "title=".concat(cleanText(hint.title, 180)) : ''
@@ -7446,20 +7144,18 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
7446
7144
  name: 'root_cause_first_diagnosis_contract',
7447
7145
  text: [
7448
7146
  'Before any product-code repair, produce strict JSON only:',
7449
- 'Required JSON shape: {"support_diagnosis_gate":{"issue_case":{"customer_complaint":"concrete customer complaint","expected_result":"concrete expected business result","observed_result":"concrete observed/reproduced behavior","route_module":"exact route/module/workflow","account_customer_context":"affected client/account/user","reproduction_status":"reproduced|blocked|classified","reproduction_blocker":"required only when blocked"},"issue_class":"no_op_submit|missing_wrong_data|filter_query_mismatch|invoice_pdf_export|upload_import|route_auth_hydration|slow_query_performance","accepted_hypothesis":{"statement":"one falsifiable root-cause theory","falsifiable_test":"exact test that could disprove it","evidence":["typed evidence with artifact path or concrete code/data citation"]},"rejected_alternatives":["rejected theory plus why"],"failing_path":{"frontend":"frontend event/path if applicable","backend":"method/publication/query if applicable","shared_library":"shared library path if applicable","data_query":"data/query path if applicable","description":"end-to-end failing path"},"owner_files":["small/exact/product-file.ts"],"proof_plan":{"before":"before-state business proof","before_state_unavailable_reason":"only if before proof cannot exist","action":"exact user/system action","after":"expected after-state business proof","business_assertion":"pass/fail assertion tied to customer issue","route":"route/workflow under test","data_assertion":"DOM/data/Mongo assertion","artifact_expectation":"specific artifacts to capture","business_proof_contract":{"issue_class":"same as diagnosis issue_class","setup_state":"setup state","action_under_test":"action under test","expected_business_state_change":"expected state change","prohibited_false_pass":"Route load, screenshot, scorecard, or model claim alone is not acceptance.","proof_artifacts":["specific DOM/data/Mongo/network/screenshot artifacts"],"data_or_dom_assertion":"assertion checked in DOM/data/Mongo"}},"similar_tickets":[],"similar_commits":[],"evidence":[{"type":"ticket|browser|mongo|log|code|commit|qa|other","summary":"concrete evidence summary","artifactPath":"path or code reference"}],"status":"passed"}}',
7450
- 'Do not copy schema/example wording into the output. Empty strings, TODOs, placeholders, route-only proof, and ticket-only proof will fail validation.',
7147
+ 'Required JSON shape: {"support_diagnosis_gate":{"issue_case":{"customer_complaint":"concrete customer complaint","expected_result":"concrete expected business result","observed_result":"concrete observed/reproduced behavior","route_module":"route/module/workflow if known","account_customer_context":"affected client/account/user","reproduction_status":"reproduced|blocked|classified","reproduction_blocker":"required only when blocked"},"accepted_hypothesis":{"statement":"one falsifiable root-cause theory","falsifiable_test":"exact test that could disprove it","evidence":["typed evidence or concrete code/data citation"]},"rejected_alternatives":["rejected theory plus why"],"failing_path":{"frontend":"frontend event/path if applicable","backend":"method/publication/query if applicable","shared_library":"shared library path if applicable","data_query":"data/query path if applicable","description":"end-to-end failing path"},"owner_files":["small/exact/product-file.ts"],"proof_plan":{"before":"before-state proof or empty with unavailable reason","before_state_unavailable_reason":"only if before proof cannot exist","action":"exact user/system action","after":"expected after-state business result","business_assertion":"pass/fail assertion tied to customer issue","route":"optional route/workflow under test","data_assertion":"optional data/DOM/output assertion","artifact_expectation":"optional model-chosen evidence to capture"},"similar_tickets":[],"similar_commits":[],"evidence":[{"type":"ticket|browser|mongo|log|code|commit|qa|other","summary":"concrete evidence summary","artifactPath":"optional path or code reference"}],"status":"passed"}}',
7148
+ 'Do not copy schema/example wording into the output. Empty strings, TODOs, placeholders, route-only proof, and ticket-only proof can fail validation.',
7451
7149
  'Owner files must be a small exact editable set, not directories, globs, generated wrappers, or broad repo areas.',
7452
7150
  'The accepted hypothesis must be falsifiable and backed by evidence; prior similar tickets or commits are hints only and cannot bypass fresh diagnosis.',
7453
- 'For reproduction_status="reproduced", evidence must include at least one browser, Mongo, log, or QA evidence object with artifactPath so the runner can replay the proof.',
7151
+ 'For reproduction_status="reproduced", include browser, Mongo, log, or QA evidence when available; code/data evidence can carry root-cause proof.',
7454
7152
  'For reproduction_status="classified", evidence must still include non-ticket root-cause proof such as code, commit, Mongo, log, browser, or QA evidence.',
7455
7153
  'Ticket text and similar-ticket hints are context, not root-cause proof by themselves.',
7456
- 'The proof plan must be before/action/after business proof plus business_proof_contract. If before-state proof is impossible, explain exactly why in before_state_unavailable_reason.',
7457
- 'The business_proof_contract must name the setup state, action under test, expected business state change, prohibited false pass, required artifacts, and DOM/data assertion.'
7154
+ 'The model chooses the proof mechanics. The only hard rule is that final acceptance needs an AIQaBusinessAssertion tied to this proof plan, not route load or a model claim alone.'
7458
7155
  ].join('\n')
7459
7156
  } : {
7460
7157
  name: 'diagnosis_gate_context',
7461
7158
  text: diagnosisValidation.valid && diagnosisGate ? [
7462
- "Diagnosis issue class: ".concat(diagnosisGate.issue_class),
7463
7159
  "Accepted hypothesis: ".concat(diagnosisGate.accepted_hypothesis.statement),
7464
7160
  "Failing path: ".concat(diagnosisGate.failing_path.description || diagnosisGate.failing_path.frontend || diagnosisGate.failing_path.backend || ''),
7465
7161
  "Owner files: ".concat(diagnosisGate.owner_files.join(', ')),
@@ -7486,8 +7182,8 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
7486
7182
  diagnosisValid: diagnosisEvidencePack.diagnosisValid,
7487
7183
  diagnosisStatus: diagnosisEvidencePack.diagnosisStatus,
7488
7184
  validationBlockers: diagnosisEvidencePack.validationBlockers,
7489
- issueClassHint: diagnosisEvidencePack.issueClassHint,
7490
7185
  ownerFileHints: diagnosisEvidencePack.ownerFileHints,
7186
+ businessProofGuidance: diagnosisEvidencePack.businessProofGuidance,
7491
7187
  activeMicrotaskId: diagnosisEvidencePack.activeMicrotaskId,
7492
7188
  structuredFacts: diagnosisEvidencePack.structuredFacts,
7493
7189
  proofMatrix: diagnosisEvidencePack.proofMatrix,
@@ -7496,19 +7192,11 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
7496
7192
  similarCaseSelection: {
7497
7193
  ranked: diagnosisEvidencePack.similarCaseSelection.ranked.slice(0, 6)
7498
7194
  },
7499
- issueClassProbeCatalog: diagnosisEvidencePack.issueClassProbeCatalog.map(function (entry) { return ({
7500
- issue_class: entry.issue_class,
7501
- action: entry.action,
7502
- proof_required: entry.proof_required,
7503
- acceptance_gate: entry.acceptance_gate,
7504
- false_pass_blockers: entry.false_pass_blockers
7505
- }); }),
7506
7195
  persistedEvidencePack: input.bundle.supportV5DiagnosisEvidencePack
7507
7196
  ? {
7508
7197
  packId: input.bundle.supportV5DiagnosisEvidencePack.packId,
7509
7198
  status: input.bundle.supportV5DiagnosisEvidencePack.status,
7510
7199
  validationBlockers: input.bundle.supportV5DiagnosisEvidencePack.validationBlockers,
7511
- issueClassHint: input.bundle.supportV5DiagnosisEvidencePack.issueClassHint,
7512
7200
  ownerFileHints: input.bundle.supportV5DiagnosisEvidencePack.ownerFileHints,
7513
7201
  structuredFacts: input.bundle.supportV5DiagnosisEvidencePack.structuredFacts,
7514
7202
  proofMatrix: input.bundle.supportV5DiagnosisEvidencePack.proofMatrix
@@ -7526,9 +7214,9 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
7526
7214
  text: similarCaseHintsText
7527
7215
  } : undefined,
7528
7216
  !diagnosisActive && input.lane === 'qa' && promptProbePlan ? {
7529
- name: 'issue_class_probe_plan',
7217
+ name: 'business_proof_plan',
7530
7218
  text: [
7531
- "IssueClassProbePlan ".concat(promptProbePlan.planId, " status=").concat(promptProbePlan.status, " issue_class=").concat(promptProbePlan.issue_class || '', " gate=").concat(promptProbePlan.acceptanceGate),
7219
+ "BusinessProofPlan ".concat(promptProbePlan.planId, " status=").concat(promptProbePlan.status, " gate=").concat(promptProbePlan.acceptanceGate),
7532
7220
  "route=".concat(cleanText((_h = promptProbePlan.activeProbe) === null || _h === void 0 ? void 0 : _h.route, 180)),
7533
7221
  "action=".concat(cleanText(((_j = promptProbePlan.activeProbe) === null || _j === void 0 ? void 0 : _j.state_transition.action) || ((_k = promptProbePlan.activeProbe) === null || _k === void 0 ? void 0 : _k.action), 260)),
7534
7222
  "assertion=".concat(cleanText((_l = promptProbePlan.activeProbe) === null || _l === void 0 ? void 0 : _l.state_transition.assertion, 260)),
@@ -7583,9 +7271,9 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
7583
7271
  'Before passing, confirm `qa-artifacts/auth-bootstrap-result.json` used the ticket reporter or named affected user when available. If it used generic admin/dev while `qa-live-data-seed-result.json.selected.qa_user_context` names a reporter/affected user, rerun auth as that user or return needs-fix.',
7584
7272
  'Drive the visible customer workflow for this one row. Capture a new customer-facing screenshot/caption and update `qa-artifacts/qa-coverage-matrix.json` with workflow, route, data id/name, assertion, screenshot path, caption, and pass/failed/blocked status.',
7585
7273
  'Also write `qa-artifacts/aiqa-business-assertion.json` with one AIQaBusinessAssertion object: assertion, status, workflow, route, before, action, expected, after/observed, dataProof or mongoDelta, artifactPaths, and metadata.supportDiagnosisProof=true only when it maps to the active SupportDiagnosisGate proof_plan.',
7586
- 'After selecting any From/To, source/target, dropdown, combobox, rio-select, filter, item, customer, yard, chemical, or treatment-plan value, read the visible control text back from the DOM. If it still contains placeholder text such as Select Chemical, Select Yard, Select Customer, Select Treatment Plan Type, Loading..., empty, null, or undefined, do not click the action button and do not mark pass. Capture the selected-state blocker screenshot/DOM text and return needs-fix.',
7587
- 'If the row needs persisted data proof, create that proof yourself in the same bounded QA command by querying localhost QA Mongo through process.env.MONGO_URL after the visible UI action. Write the result under qa-artifacts/ as JSON and reference that path in the matrix. Do not ask for a missing post-action DB artifact while the local QA stack is running; either write it or return needs-fix with the exact query/script error. For update-interchangeables rows, the JSON must include concrete non-placeholder fromText and toText, before/after counts or sample documents for treatment plans and tank/interchangeable records, and must fail if either selected value is only an arrow/placeholder or if the persisted collections are empty.',
7588
- 'If the row names multiple concrete entities such as assets, units, BOLs, invoices, chemicals, customers, yards, or numbered records, prove every named entity. Do not pass by proving only one representative record.',
7274
+ 'After selecting any visible control value, read the visible control text back from the DOM. If it is still a placeholder/loading/empty value, do not click the final action and do not mark pass. Capture the blocker screenshot/DOM text and return needs-fix.',
7275
+ 'If the row needs persisted data proof, create that proof yourself in the same bounded QA command by querying localhost QA Mongo through process.env.MONGO_URL after the visible UI action. Write the result under qa-artifacts/ as JSON and reference that path in the matrix. Do not ask for a missing post-action DB artifact while the local QA stack is running; either write it or return needs-fix with the exact query/script error.',
7276
+ 'If the active row names multiple concrete records, prove every named record. Do not pass by proving only one representative record.',
7589
7277
  'For customer-reported data bugs, use production-seeded localhost records from `qa-live-data-seed-result.json`. If the exact named record is missing from the seed, fail the row as a seed/query blocker instead of testing a substitute record.',
7590
7278
  'Route-ready, auth-bootstrap, shell, header-only, and empty-list screenshots do not satisfy this microtask. If the row cannot be proven, capture the blocker screenshot/DOM state and return needs-fix with that exact blocker.',
7591
7279
  'Do not run compile/startup/npm install, do not spawn another server/client/Mongo, and do not inspect broad source trees before the first browser evidence command.'