@resolveio/server-lib 22.3.209 → 22.3.211

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.
@@ -104,10 +104,78 @@ function isoNow(value) {
104
104
  }
105
105
  function cleanText(value, max) {
106
106
  if (max === void 0) { max = 2000; }
107
+ if (value === undefined || value === null) {
108
+ return '';
109
+ }
110
+ if (Array.isArray(value)) {
111
+ return value
112
+ .map(function (entry) { return cleanListEntryText(entry, max); })
113
+ .filter(Boolean)
114
+ .join(' ')
115
+ .replace(/\s+/g, ' ')
116
+ .trim()
117
+ .slice(0, max);
118
+ }
119
+ if (typeof value === 'object') {
120
+ if (value instanceof Date) {
121
+ return value.toISOString().slice(0, max);
122
+ }
123
+ return '';
124
+ }
107
125
  return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
108
126
  }
109
- function cleanList(values, limit, max) {
127
+ function cleanListEntryText(value, max) {
110
128
  var e_1, _a;
129
+ if (max === void 0) { max = 500; }
130
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
131
+ var source = value;
132
+ var hypothesis = cleanListEntryText(source.hypothesis, Math.floor(max / 2));
133
+ var whyRejected = cleanListEntryText(source.why_rejected || source.whyRejected || source.reason_rejected || source.reasonRejected, Math.floor(max / 2));
134
+ if (hypothesis && whyRejected) {
135
+ return "".concat(hypothesis, " rejected because ").concat(whyRejected).slice(0, max);
136
+ }
137
+ try {
138
+ for (var _b = __values([
139
+ 'path',
140
+ 'file',
141
+ 'filePath',
142
+ 'file_path',
143
+ 'ownerFile',
144
+ 'owner_file',
145
+ 'targetFile',
146
+ 'target_file',
147
+ 'sourceFile',
148
+ 'source_file',
149
+ 'artifactPath',
150
+ 'artifact_path',
151
+ 'summary',
152
+ 'message',
153
+ 'description',
154
+ 'reason',
155
+ 'value',
156
+ 'label',
157
+ 'id'
158
+ ]), _c = _b.next(); !_c.done; _c = _b.next()) {
159
+ var field = _c.value;
160
+ var candidate = cleanListEntryText(source[field], max);
161
+ if (candidate) {
162
+ return candidate;
163
+ }
164
+ }
165
+ }
166
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
167
+ finally {
168
+ try {
169
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
170
+ }
171
+ finally { if (e_1) throw e_1.error; }
172
+ }
173
+ return '';
174
+ }
175
+ return cleanText(value, max);
176
+ }
177
+ function cleanList(values, limit, max) {
178
+ var e_2, _a;
111
179
  if (limit === void 0) { limit = 20; }
112
180
  if (max === void 0) { max = 500; }
113
181
  if (!Array.isArray(values)) {
@@ -117,7 +185,7 @@ function cleanList(values, limit, max) {
117
185
  try {
118
186
  for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
119
187
  var value = values_1_1.value;
120
- var normalized = cleanText(value, max);
188
+ var normalized = cleanListEntryText(value, max);
121
189
  if (normalized && !result.includes(normalized)) {
122
190
  result.push(normalized);
123
191
  }
@@ -126,12 +194,12 @@ function cleanList(values, limit, max) {
126
194
  }
127
195
  }
128
196
  }
129
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
197
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
130
198
  finally {
131
199
  try {
132
200
  if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
133
201
  }
134
- finally { if (e_1) throw e_1.error; }
202
+ finally { if (e_2) throw e_2.error; }
135
203
  }
136
204
  return result;
137
205
  }
@@ -816,7 +884,7 @@ function evaluateResolveIOSupportPreflightGate(input, nowValue) {
816
884
  };
817
885
  }
818
886
  function pickText(source, fields, max) {
819
- var e_2, _a;
887
+ var e_3, _a;
820
888
  if (max === void 0) { max = 1000; }
821
889
  try {
822
890
  for (var fields_1 = __values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
@@ -827,12 +895,12 @@ function pickText(source, fields, max) {
827
895
  }
828
896
  }
829
897
  }
830
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
898
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
831
899
  finally {
832
900
  try {
833
901
  if (fields_1_1 && !fields_1_1.done && (_a = fields_1.return)) _a.call(fields_1);
834
902
  }
835
- finally { if (e_2) throw e_2.error; }
903
+ finally { if (e_3) throw e_3.error; }
836
904
  }
837
905
  return '';
838
906
  }
@@ -861,7 +929,12 @@ function normalizeIssueClass(value) {
861
929
  route_auth_hydration: 'route_auth_hydration',
862
930
  slow_query: 'slow_query_performance',
863
931
  performance: 'slow_query_performance',
864
- slow_query_performance: 'slow_query_performance'
932
+ slow_query_performance: 'slow_query_performance',
933
+ feature: 'missing_wrong_data',
934
+ feature_request: 'missing_wrong_data',
935
+ request_new_feature: 'missing_wrong_data',
936
+ requested_behavior_change: 'missing_wrong_data',
937
+ new_feature: 'missing_wrong_data'
865
938
  };
866
939
  return aliases[normalized] || '';
867
940
  }
@@ -899,12 +972,40 @@ function normalizeSupportDiagnosisEvidence(values) {
899
972
  .filter(function (entry) { return entry && typeof entry === 'object' && !Array.isArray(entry); })
900
973
  .map(function (entry) {
901
974
  var type = cleanText(entry.type, 80).toLowerCase();
902
- var normalizedType = (allowed.has(type) ? type : 'other');
903
- var summary = cleanText(entry.summary || entry.message || entry.evidence || entry.reason, 1200);
904
975
  var artifactPath = cleanText(entry.artifactPath || entry.artifact_path || entry.path || entry.file, 500);
976
+ var inferredType = (function () {
977
+ if (allowed.has(type)) {
978
+ return type;
979
+ }
980
+ if (/\b(ticket|manual-ticket|support-context|email\.metadata)\b/i.test(artifactPath)) {
981
+ return 'ticket';
982
+ }
983
+ if (/\b(commit|git)\b/i.test(artifactPath)) {
984
+ return 'commit';
985
+ }
986
+ if (/\b(mongo|query|database|collection)\b/i.test(artifactPath)) {
987
+ return 'mongo';
988
+ }
989
+ if (/\b(log|trace)\b/i.test(artifactPath)) {
990
+ return 'log';
991
+ }
992
+ if (/\b(angular|server|client|src|methods|publications|routing|permission|component)\b/i.test(artifactPath)) {
993
+ return 'code';
994
+ }
995
+ return 'other';
996
+ })();
997
+ var normalizedType = inferredType;
998
+ var summary = cleanText(entry.summary || entry.message || entry.evidence || entry.reason || entry.fact || entry.description, 1200)
999
+ || (artifactPath ? "Evidence from ".concat(artifactPath) : '');
905
1000
  var ownerFiles = cleanList(entry.ownerFiles || entry.owner_files || entry.files, 12, 500)
906
1001
  .map(normalizeOwnerFilePath)
907
1002
  .filter(Boolean);
1003
+ if (normalizedType === 'code' && artifactPath) {
1004
+ var sourcePath = normalizeOwnerFilePath(artifactPath);
1005
+ if (sourcePath && !ownerFiles.includes(sourcePath)) {
1006
+ ownerFiles.push(sourcePath);
1007
+ }
1008
+ }
908
1009
  var evidenceRefs = cleanList(entry.evidenceRefs || entry.evidence_refs || entry.refs, 12, 500);
909
1010
  return {
910
1011
  id: cleanText(entry.id || entry.evidenceId || entry.evidence_id, 160)
@@ -1045,7 +1146,7 @@ function normalizeResolveIOSupportSimilarCaseCandidate(value) {
1045
1146
  return candidate;
1046
1147
  }
1047
1148
  function selectResolveIOSupportSimilarCaseHints(input) {
1048
- var e_3, _a;
1149
+ var e_4, _a;
1049
1150
  if (input === void 0) { input = {}; }
1050
1151
  var issueClass = normalizeIssueClass(input.issueClass);
1051
1152
  var ownerFiles = cleanList(input.ownerFiles, 12, 300).map(normalizeOwnerFilePath).filter(Boolean);
@@ -1117,12 +1218,12 @@ function selectResolveIOSupportSimilarCaseHints(input) {
1117
1218
  });
1118
1219
  }
1119
1220
  }
1120
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1221
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1121
1222
  finally {
1122
1223
  try {
1123
1224
  if (normalized_1_1 && !normalized_1_1.done && (_a = normalized_1.return)) _a.call(normalized_1);
1124
1225
  }
1125
- finally { if (e_3) throw e_3.error; }
1226
+ finally { if (e_4) throw e_4.error; }
1126
1227
  }
1127
1228
  var sorted = ranked
1128
1229
  .sort(function (a, b) { return b.score - a.score || String(b.ticketNumber || b.commitSha || '').localeCompare(String(a.ticketNumber || a.commitSha || '')); })
@@ -1375,19 +1476,162 @@ function normalizeSupportDiagnosisBusinessProofContract(value, issueClassHint) {
1375
1476
  data_or_dom_assertion: pickText(source, ['data_or_dom_assertion', 'dataOrDomAssertion', 'data_assertion', 'dataAssertion', 'dom_assertion', 'domAssertion', 'assertion'], 1000)
1376
1477
  };
1377
1478
  }
1479
+ function supportDiagnosisNarrativeText(value, max) {
1480
+ if (max === void 0) { max = 1200; }
1481
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
1482
+ return cleanText(value, max);
1483
+ }
1484
+ if (Array.isArray(value)) {
1485
+ return cleanList(value, 12, Math.max(80, Math.floor(max / 2))).join(' ').slice(0, max);
1486
+ }
1487
+ var source = cleanObject(value);
1488
+ if (!Object.keys(source).length) {
1489
+ return '';
1490
+ }
1491
+ var direct = pickText(source, [
1492
+ 'summary',
1493
+ 'description',
1494
+ 'statement',
1495
+ 'issue_case',
1496
+ 'issueCase',
1497
+ 'customer_complaint',
1498
+ 'customerComplaint',
1499
+ 'expected_result',
1500
+ 'expectedResult',
1501
+ 'observed_result',
1502
+ 'observedResult',
1503
+ 'path',
1504
+ 'reason',
1505
+ 'fact'
1506
+ ], max);
1507
+ if (direct) {
1508
+ return direct;
1509
+ }
1510
+ var hypothesis = cleanText(source.hypothesis, Math.floor(max / 2));
1511
+ var whyRejected = cleanText(source.why_rejected || source.whyRejected || source.reason_rejected || source.reasonRejected, Math.floor(max / 2));
1512
+ if (hypothesis && whyRejected) {
1513
+ return "".concat(hypothesis, " rejected because ").concat(whyRejected).slice(0, max);
1514
+ }
1515
+ var routeModulePermission = cleanText(source.route_module_permission_gate || source.routeModulePermissionGate, Math.floor(max / 2));
1516
+ var templateGate = cleanText(source.template_conditional_rendering_gate || source.templateConditionalRenderingGate, Math.floor(max / 2));
1517
+ var backingGate = cleanText(source.backing_role_group_config_publications_gate || source.backingRoleGroupConfigPublicationsGate, Math.floor(max / 2));
1518
+ return [routeModulePermission, templateGate, backingGate].filter(Boolean).join(' | ').slice(0, max);
1519
+ }
1520
+ function supportDiagnosisLooksLikeClassifiedFeatureRequest(source, issueCaseText, failingPathText, hypothesisText) {
1521
+ var classificationText = supportDiagnosisNarrativeText(source.classification || source.classification_reason || source.classificationReason, 700);
1522
+ var issueClassText = cleanText(source.issue_class || source.issueClass, 160);
1523
+ var combined = [
1524
+ issueClassText,
1525
+ classificationText,
1526
+ issueCaseText,
1527
+ failingPathText,
1528
+ hypothesisText
1529
+ ].join(' ').toLowerCase();
1530
+ return /\b(feature request|feature_request|new feature|requested behavior change|net-new|net new|not implemented|no existing|none_existing|does not exist|no .*route)\b/i.test(combined);
1531
+ }
1532
+ function normalizeSupportDiagnosisRejectedAlternatives(values) {
1533
+ var e_5, _a;
1534
+ if (!Array.isArray(values)) {
1535
+ return cleanList(values, 10, 700);
1536
+ }
1537
+ var result = [];
1538
+ try {
1539
+ for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
1540
+ var value = values_2_1.value;
1541
+ var text = supportDiagnosisNarrativeText(value, 700);
1542
+ if (text && !result.includes(text)) {
1543
+ result.push(text);
1544
+ }
1545
+ if (result.length >= 10) {
1546
+ break;
1547
+ }
1548
+ }
1549
+ }
1550
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
1551
+ finally {
1552
+ try {
1553
+ if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
1554
+ }
1555
+ finally { if (e_5) throw e_5.error; }
1556
+ }
1557
+ return result;
1558
+ }
1559
+ function normalizeSupportDiagnosisProofPlanRows(values) {
1560
+ var e_6, _a;
1561
+ if (!Array.isArray(values)) {
1562
+ return {};
1563
+ }
1564
+ var actions = [];
1565
+ var proofRequired = [];
1566
+ try {
1567
+ for (var values_3 = __values(values), values_3_1 = values_3.next(); !values_3_1.done; values_3_1 = values_3.next()) {
1568
+ var row = values_3_1.value;
1569
+ var source = cleanObject(row);
1570
+ var action = pickText(source, ['action', 'step', 'browser_action', 'browserAction', 'task'], 500) || supportDiagnosisNarrativeText(row, 500);
1571
+ var proof = pickText(source, ['proof_required', 'proofRequired', 'expected', 'expected_result', 'expectedResult', 'assertion', 'business_assertion', 'businessAssertion'], 700);
1572
+ if (action) {
1573
+ actions.push(action);
1574
+ }
1575
+ if (proof) {
1576
+ proofRequired.push(proof);
1577
+ }
1578
+ }
1579
+ }
1580
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1581
+ finally {
1582
+ try {
1583
+ if (values_3_1 && !values_3_1.done && (_a = values_3.return)) _a.call(values_3);
1584
+ }
1585
+ finally { if (e_6) throw e_6.error; }
1586
+ }
1587
+ return {
1588
+ action: actions.join(' | ').slice(0, 1000),
1589
+ after: proofRequired.join(' | ').slice(0, 1000),
1590
+ business_assertion: proofRequired.join(' | ').slice(0, 1000),
1591
+ data_assertion: proofRequired.join(' | ').slice(0, 1000)
1592
+ };
1593
+ }
1378
1594
  function normalizeOwnerFilePath(value) {
1379
- return cleanText(value, 500)
1595
+ var e_7, _a;
1596
+ var normalized = cleanListEntryText(value, 500)
1380
1597
  .replace(/\\/g, '/')
1381
1598
  .replace(/^\.\/+/, '')
1382
1599
  .replace(/^\/+/, '')
1383
1600
  .replace(/\s+$/g, '');
1601
+ try {
1602
+ for (var _b = __values([
1603
+ /(?:^|\/)resolveio-ai-workspace\/[^/]+\/resolveio-all\//i,
1604
+ /(?:^|\/)ai-workspace\/[^/]+\/resolveio-all\//i,
1605
+ /(?:^|\/)resolveio-all\//i,
1606
+ /(?:^|\/)resolveio-server-lib\//i,
1607
+ /(?:^|\/)resolveio-client-lib\//i
1608
+ ]), _c = _b.next(); !_c.done; _c = _b.next()) {
1609
+ var pattern = _c.value;
1610
+ var match = normalized.match(pattern);
1611
+ if ((match === null || match === void 0 ? void 0 : match.index) !== undefined) {
1612
+ var start = match.index + match[0].length;
1613
+ var stripped = normalized.slice(start).replace(/^\/+/, '');
1614
+ if (stripped) {
1615
+ return stripped;
1616
+ }
1617
+ }
1618
+ }
1619
+ }
1620
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
1621
+ finally {
1622
+ try {
1623
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1624
+ }
1625
+ finally { if (e_7) throw e_7.error; }
1626
+ }
1627
+ return normalized;
1384
1628
  }
1385
1629
  function isResolveIOSupportGeneratedAngularWrapperPath(value) {
1386
1630
  var normalized = normalizeOwnerFilePath(value).replace(/^geochem\//i, '');
1387
1631
  return /(?:^|\/)angular\/app\/(?:methods|publications)\.ts$/i.test(normalized);
1388
1632
  }
1389
1633
  function ownerFileComparablePathKeys(value) {
1390
- var e_4, _a;
1634
+ var e_8, _a;
1391
1635
  var normalized = normalizeOwnerFilePath(value);
1392
1636
  if (!normalized) {
1393
1637
  return [];
@@ -1409,12 +1653,12 @@ function ownerFileComparablePathKeys(value) {
1409
1653
  }
1410
1654
  }
1411
1655
  }
1412
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
1656
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
1413
1657
  finally {
1414
1658
  try {
1415
1659
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1416
1660
  }
1417
- finally { if (e_4) throw e_4.error; }
1661
+ finally { if (e_8) throw e_8.error; }
1418
1662
  }
1419
1663
  return Array.from(keys);
1420
1664
  }
@@ -1448,7 +1692,7 @@ function ownerFileLooksNonProductEvidence(value) {
1448
1692
  var normalized = normalizeOwnerFilePath(value);
1449
1693
  return /(^|\/)(qa-artifacts?|screenshots?|screen-shots?|traces?|logs?|tmp|temp|coverage|dist|build|docs?)(\/|$)/i.test(normalized)
1450
1694
  || /(^|\/)(?:support-diagnosis-pack-[^/]+|diagnosis-evidence-pack|aiqa-business-assertion)\.json$/i.test(normalized)
1451
- || /(^|\/)\.resolveio-(?:support|context|runner|qa)(\/|$)/i.test(normalized)
1695
+ || /(^|\/)\.resolveio-(?:support-context|support|context|runner|qa)(\/|$)/i.test(normalized)
1452
1696
  || /(^|\/)(__tests__|tests?|spec)(\/|$)|\.(?:spec|test)\.[jt]sx?$/i.test(normalized)
1453
1697
  || /\.(?:png|jpe?g|gif|webp|svg|pdf|log|txt|md|markdown)$/i.test(normalized);
1454
1698
  }
@@ -1752,59 +1996,131 @@ function evaluateResolveIOSupportDiagnosisEvidenceQuality(value) {
1752
1996
  };
1753
1997
  }
1754
1998
  function normalizeResolveIOSupportDiagnosisGate(value, now) {
1755
- var source = cleanObject(value);
1999
+ var rootSource = cleanObject(value);
2000
+ var source = cleanObject(rootSource.support_diagnosis_gate
2001
+ || rootSource.supportDiagnosisGate
2002
+ || rootSource.diagnosis_gate
2003
+ || rootSource.diagnosisGate
2004
+ || rootSource);
1756
2005
  if (!Object.keys(source).length) {
1757
2006
  return undefined;
1758
2007
  }
1759
- var issueCaseSource = cleanObject(source.issue_case || source.issueCase);
2008
+ var rawIssueCase = source.issue_case || source.issueCase;
2009
+ var rawHypothesis = source.accepted_hypothesis || source.acceptedHypothesis;
2010
+ var rawFailingPath = source.failing_path || source.failingPath;
2011
+ var rawProofPlan = source.proof_plan || source.proofPlan;
2012
+ var issueCaseSource = cleanObject(rawIssueCase);
1760
2013
  var hypothesisSource = cleanObject(source.accepted_hypothesis || source.acceptedHypothesis);
1761
2014
  var failingPathSource = cleanObject(source.failing_path || source.failingPath);
1762
2015
  var proofPlanSource = cleanObject(source.proof_plan || source.proofPlan);
2016
+ var issueCaseText = supportDiagnosisNarrativeText(rawIssueCase, 1200);
2017
+ var hypothesisText = supportDiagnosisNarrativeText(rawHypothesis, 1200);
2018
+ var failingPathText = supportDiagnosisNarrativeText(rawFailingPath, 1200);
2019
+ var proofPlanRows = normalizeSupportDiagnosisProofPlanRows(rawProofPlan);
1763
2020
  var issueClass = normalizeIssueClass(source.issue_class || source.issueClass);
1764
- var businessProofContract = normalizeSupportDiagnosisBusinessProofContract(proofPlanSource.business_proof_contract || proofPlanSource.businessProofContract || source.business_proof_contract || source.businessProofContract, issueClass || source.issue_class || source.issueClass);
1765
- var ownerFiles = cleanList(source.owner_files || source.ownerFiles, 20, 500)
2021
+ var featureRequestClassified = supportDiagnosisLooksLikeClassifiedFeatureRequest(source, issueCaseText, failingPathText, hypothesisText);
2022
+ var shouldDeriveLooseProofPlan = Array.isArray(rawProofPlan) || featureRequestClassified;
2023
+ var proofPlanBefore = pickText(proofPlanSource, ['before', 'before_state', 'beforeState', 'precondition'], 1000);
2024
+ var proofPlanBeforeUnavailable = pickText(proofPlanSource, ['before_state_unavailable_reason', 'beforeStateUnavailableReason', 'before_unavailable_reason'], 1000)
2025
+ || (featureRequestClassified ? 'Before-state business proof is not available because this is classified as net-new feature scope; current evidence proves the requested route/workflow is not implemented yet.' : '');
2026
+ var proofPlanAction = pickText(proofPlanSource, ['action', 'browser_action', 'browserAction', 'steps'], 1000) || proofPlanRows.action;
2027
+ var proofPlanAfter = pickText(proofPlanSource, ['after', 'after_state', 'afterState', 'expected_after'], 1000) || proofPlanRows.after;
2028
+ var proofPlanBusinessAssertion = pickText(proofPlanSource, ['business_assertion', 'businessAssertion', 'assertion'], 1000) || proofPlanRows.business_assertion;
2029
+ var proofPlanDataAssertion = pickText(proofPlanSource, ['data_assertion', 'dataAssertion', 'mongo_delta', 'mongoDelta'], 1000) || proofPlanRows.data_assertion;
2030
+ var proofPlanArtifactExpectation = pickText(proofPlanSource, ['artifact_expectation', 'artifactExpectation', 'artifact', 'screenshot'], 1000)
2031
+ || (shouldDeriveLooseProofPlan && proofPlanBusinessAssertion ? 'browser trace/screenshot plus persisted DOM/data or Mongo delta tied to the business assertion' : '');
2032
+ var derivedBusinessProofContract = shouldDeriveLooseProofPlan && proofPlanBusinessAssertion ? {
2033
+ issue_class: issueClass || source.issue_class || source.issueClass,
2034
+ setup_state: proofPlanBefore || proofPlanBeforeUnavailable,
2035
+ action_under_test: proofPlanAction,
2036
+ expected_business_state_change: proofPlanAfter || proofPlanBusinessAssertion,
2037
+ prohibited_false_pass: 'Route load, screenshot, scorecard, or model claim alone is not acceptance.',
2038
+ proof_artifacts: [
2039
+ proofPlanArtifactExpectation,
2040
+ 'DOM/data assertion artifact',
2041
+ 'persisted record or Mongo delta proof'
2042
+ ].filter(Boolean),
2043
+ data_or_dom_assertion: proofPlanDataAssertion || proofPlanBusinessAssertion
2044
+ } : undefined;
2045
+ var businessProofContract = normalizeSupportDiagnosisBusinessProofContract(proofPlanSource.business_proof_contract || proofPlanSource.businessProofContract || source.business_proof_contract || source.businessProofContract, issueClass || source.issue_class || source.issueClass) || normalizeSupportDiagnosisBusinessProofContract(derivedBusinessProofContract, issueClass || source.issue_class || source.issueClass);
2046
+ var rawOwnerFiles = cleanList(source.owner_files || source.ownerFiles, 20, 500)
1766
2047
  .map(normalizeOwnerFilePath)
1767
2048
  .filter(Boolean);
2049
+ var productOwnerFiles = rawOwnerFiles.filter(function (ownerFile) { return !ownerFileLooksNonProductEvidence(ownerFile); });
2050
+ var ownerFiles = productOwnerFiles.length ? productOwnerFiles : rawOwnerFiles;
2051
+ var explicitEvidence = normalizeSupportDiagnosisEvidence(source.evidence);
2052
+ var derivedFeatureRequestEvidence = !explicitEvidence.length && featureRequestClassified ? __spreadArray(__spreadArray([], __read((issueCaseText ? [{
2053
+ id: "evidence-".concat(hashResolveIOSupportV5Evidence({ type: 'ticket', summary: issueCaseText }).slice(0, 12)),
2054
+ type: 'ticket',
2055
+ summary: issueCaseText
2056
+ }] : [])), false), __read(ownerFiles.map(function (ownerFile) { return ({
2057
+ id: "evidence-".concat(hashResolveIOSupportV5Evidence({ type: 'code', ownerFile: ownerFile, failingPathText: failingPathText, hypothesisText: hypothesisText }).slice(0, 12)),
2058
+ type: 'code',
2059
+ summary: cleanText([
2060
+ "Owner file inspected for classified feature-request scope: ".concat(ownerFile, "."),
2061
+ failingPathText || hypothesisText || 'No implemented route/module path was identified.'
2062
+ ].filter(Boolean).join(' '), 1200),
2063
+ artifactPath: ownerFile,
2064
+ ownerFiles: [ownerFile]
2065
+ }); })), false) : [];
2066
+ var diagnosisEvidence = explicitEvidence.length ? explicitEvidence : derivedFeatureRequestEvidence;
2067
+ var routeModule = pickText(issueCaseSource, ['route_module', 'routeModule', 'route', 'module', 'screen'], 500)
2068
+ || pickText(source, ['route_module', 'routeModule', 'module', 'screen'], 500)
2069
+ || pickText(failingPathSource, ['route', 'module', 'path', 'description'], 500)
2070
+ || (featureRequestClassified ? 'net-new support feature workflow' : '');
2071
+ var expectedResult = pickText(issueCaseSource, ['expected_result', 'expectedResult', 'expected'], 1000)
2072
+ || pickText(source, ['expected_result', 'expectedResult', 'expected', 'primary_goal', 'primaryGoal', 'requested_behavior', 'requestedBehavior'], 1000)
2073
+ || (featureRequestClassified && issueCaseText ? "Implement the requested workflow: ".concat(issueCaseText) : '');
2074
+ var observedResult = pickText(issueCaseSource, ['observed_result', 'observedResult', 'observed', 'actual'], 1000)
2075
+ || pickText(source, ['observed_result', 'observedResult', 'observed', 'actual', 'current_state', 'currentState'], 1000)
2076
+ || (featureRequestClassified ? "Current repo evidence indicates no implemented route/module for ".concat(routeModule || 'the requested workflow', ".") : '');
2077
+ var accountCustomerContext = pickText(issueCaseSource, ['account_customer_context', 'accountCustomerContext', 'account', 'customer', 'user', 'context'], 800)
2078
+ || pickText(source, ['account_customer_context', 'accountCustomerContext', 'affected_account_user', 'affectedAccountUser', 'account', 'customer', 'client', 'user', 'context'], 800)
2079
+ || (featureRequestClassified ? 'Customer/account context from support ticket intake.' : '');
2080
+ var rawReproductionStatus = issueCaseSource.reproduction_status || issueCaseSource.reproductionStatus || source.reproduction_status;
1768
2081
  var gate = {
1769
2082
  issue_case: {
1770
- customer_complaint: pickText(issueCaseSource, ['customer_complaint', 'customerComplaint', 'complaint', 'request', 'summary'], 1200),
1771
- expected_result: pickText(issueCaseSource, ['expected_result', 'expectedResult', 'expected'], 1000),
1772
- observed_result: pickText(issueCaseSource, ['observed_result', 'observedResult', 'observed', 'actual'], 1000),
1773
- route_module: pickText(issueCaseSource, ['route_module', 'routeModule', 'route', 'module', 'screen'], 500),
1774
- account_customer_context: pickText(issueCaseSource, ['account_customer_context', 'accountCustomerContext', 'account', 'customer', 'user', 'context'], 800),
1775
- reproduction_status: normalizeReproductionStatus(issueCaseSource.reproduction_status || issueCaseSource.reproductionStatus || source.reproduction_status),
2083
+ customer_complaint: pickText(issueCaseSource, ['customer_complaint', 'customerComplaint', 'complaint', 'request', 'summary'], 1200) || issueCaseText,
2084
+ expected_result: expectedResult,
2085
+ observed_result: observedResult,
2086
+ route_module: routeModule,
2087
+ account_customer_context: accountCustomerContext,
2088
+ reproduction_status: rawReproductionStatus ? normalizeReproductionStatus(rawReproductionStatus) : (featureRequestClassified ? 'classified' : normalizeReproductionStatus(rawReproductionStatus)),
1776
2089
  reproduction_blocker: pickText(issueCaseSource, ['reproduction_blocker', 'reproductionBlocker', 'blocked_reason', 'blockedReason'], 1000)
1777
2090
  },
1778
2091
  issue_class: issueClass || 'missing_wrong_data',
1779
2092
  accepted_hypothesis: {
1780
2093
  statement: pickText(hypothesisSource, ['statement', 'hypothesis', 'root_cause', 'rootCause', 'summary'], 1200)
1781
- || (typeof source.accepted_hypothesis === 'string' ? cleanText(source.accepted_hypothesis, 1200) : ''),
1782
- falsifiable_test: pickText(hypothesisSource, ['falsifiable_test', 'falsifiableTest', 'test', 'proof', 'falsifier'], 1000),
1783
- evidence: cleanList(hypothesisSource.evidence || source.hypothesis_evidence || source.hypothesisEvidence, 10, 800)
2094
+ || hypothesisText,
2095
+ falsifiable_test: pickText(hypothesisSource, ['falsifiable_test', 'falsifiableTest', 'test', 'proof', 'falsifier'], 1000)
2096
+ || (failingPathText ? "Verify the accepted hypothesis against the failing path evidence: ".concat(failingPathText) : ''),
2097
+ evidence: cleanList(hypothesisSource.evidence || source.hypothesis_evidence || source.hypothesisEvidence, 10, 800).length
2098
+ ? cleanList(hypothesisSource.evidence || source.hypothesis_evidence || source.hypothesisEvidence, 10, 800)
2099
+ : diagnosisEvidence.map(function (entry) { return [entry.artifactPath, entry.summary].filter(Boolean).join(': '); }).filter(Boolean).slice(0, 10)
1784
2100
  },
1785
- rejected_alternatives: cleanList(source.rejected_alternatives || source.rejectedAlternatives, 10, 700),
2101
+ rejected_alternatives: normalizeSupportDiagnosisRejectedAlternatives(source.rejected_alternatives || source.rejectedAlternatives),
1786
2102
  failing_path: {
1787
2103
  frontend: pickText(failingPathSource, ['frontend', 'frontend_path', 'frontendPath', 'eventPath'], 700),
1788
2104
  backend: pickText(failingPathSource, ['backend', 'backend_path', 'backendPath', 'methodPublicationPath'], 700),
1789
2105
  shared_library: pickText(failingPathSource, ['shared_library', 'sharedLibrary', 'library', 'lib'], 700),
1790
2106
  data_query: pickText(failingPathSource, ['data_query', 'dataQuery', 'query'], 700),
1791
- description: pickText(failingPathSource, ['description', 'path', 'summary'], 1200) || cleanText(source.failing_path, 1200)
2107
+ description: pickText(failingPathSource, ['description', 'path', 'summary'], 1200) || failingPathText
1792
2108
  },
1793
2109
  owner_files: ownerFiles,
1794
2110
  proof_plan: {
1795
- before: pickText(proofPlanSource, ['before', 'before_state', 'beforeState', 'precondition'], 1000),
1796
- before_state_unavailable_reason: pickText(proofPlanSource, ['before_state_unavailable_reason', 'beforeStateUnavailableReason', 'before_unavailable_reason'], 1000),
1797
- action: pickText(proofPlanSource, ['action', 'browser_action', 'browserAction', 'steps'], 1000),
1798
- after: pickText(proofPlanSource, ['after', 'after_state', 'afterState', 'expected_after'], 1000),
1799
- business_assertion: pickText(proofPlanSource, ['business_assertion', 'businessAssertion', 'assertion'], 1000),
2111
+ before: proofPlanBefore,
2112
+ before_state_unavailable_reason: proofPlanBeforeUnavailable,
2113
+ action: proofPlanAction,
2114
+ after: proofPlanAfter,
2115
+ business_assertion: proofPlanBusinessAssertion,
1800
2116
  route: pickText(proofPlanSource, ['route', 'url'], 500),
1801
- data_assertion: pickText(proofPlanSource, ['data_assertion', 'dataAssertion', 'mongo_delta', 'mongoDelta'], 1000),
1802
- artifact_expectation: pickText(proofPlanSource, ['artifact_expectation', 'artifactExpectation', 'artifact', 'screenshot'], 1000),
2117
+ data_assertion: proofPlanDataAssertion,
2118
+ artifact_expectation: proofPlanArtifactExpectation,
1803
2119
  business_proof_contract: businessProofContract
1804
2120
  },
1805
2121
  similar_tickets: normalizeSupportDiagnosisHints(source.similar_tickets || source.similarTickets),
1806
2122
  similar_commits: normalizeSupportDiagnosisHints(source.similar_commits || source.similarCommits),
1807
- evidence: normalizeSupportDiagnosisEvidence(source.evidence),
2123
+ evidence: diagnosisEvidence,
1808
2124
  status: cleanText(source.status, 80).toLowerCase() || 'incomplete',
1809
2125
  updatedAt: isoNow(now || source.updatedAt || source.updated_at)
1810
2126
  };
@@ -1814,7 +2130,7 @@ function normalizeResolveIOSupportDiagnosisGate(value, now) {
1814
2130
  return gate;
1815
2131
  }
1816
2132
  function extractResolveIOSupportDiagnosisGateFromText(value, now) {
1817
- var e_5, _a;
2133
+ var e_9, _a;
1818
2134
  var text = String(value || '').trim();
1819
2135
  if (!text) {
1820
2136
  return undefined;
@@ -1842,12 +2158,12 @@ function extractResolveIOSupportDiagnosisGateFromText(value, now) {
1842
2158
  }
1843
2159
  }
1844
2160
  }
1845
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
2161
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
1846
2162
  finally {
1847
2163
  try {
1848
2164
  if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
1849
2165
  }
1850
- finally { if (e_5) throw e_5.error; }
2166
+ finally { if (e_9) throw e_9.error; }
1851
2167
  }
1852
2168
  return undefined;
1853
2169
  }
@@ -2010,7 +2326,7 @@ function supportStatusLooksPassed(value) {
2010
2326
  return /\b(pass|passed|success|succeeded|complete|completed|ready|not_required|not required)\b/i.test(cleanText(value, 200));
2011
2327
  }
2012
2328
  function nestedObject(source) {
2013
- var e_6, _a;
2329
+ var e_10, _a;
2014
2330
  var keys = [];
2015
2331
  for (var _i = 1; _i < arguments.length; _i++) {
2016
2332
  keys[_i - 1] = arguments[_i];
@@ -2024,17 +2340,17 @@ function nestedObject(source) {
2024
2340
  }
2025
2341
  }
2026
2342
  }
2027
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
2343
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
2028
2344
  finally {
2029
2345
  try {
2030
2346
  if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
2031
2347
  }
2032
- finally { if (e_6) throw e_6.error; }
2348
+ finally { if (e_10) throw e_10.error; }
2033
2349
  }
2034
2350
  return {};
2035
2351
  }
2036
2352
  function resolveSupportReplyReleaseGate(input) {
2037
- var e_7, _a;
2353
+ var e_11, _a;
2038
2354
  var _b;
2039
2355
  var releaseEvidence = cleanObject(input.releaseEvidence);
2040
2356
  var releaseStatus = cleanText(input.releaseStatus
@@ -2105,12 +2421,12 @@ function resolveSupportReplyReleaseGate(input) {
2105
2421
  blockers.push("missing_".concat(field));
2106
2422
  }
2107
2423
  }
2108
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
2424
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
2109
2425
  finally {
2110
2426
  try {
2111
2427
  if (missingCommitProofFields_1_1 && !missingCommitProofFields_1_1.done && (_a = missingCommitProofFields_1.return)) _a.call(missingCommitProofFields_1);
2112
2428
  }
2113
- finally { if (e_7) throw e_7.error; }
2429
+ finally { if (e_11) throw e_11.error; }
2114
2430
  }
2115
2431
  var shouldEvaluateHotfix = statusBlocked || commitProofRequired || Object.keys(hotfixEvidence).length > 0;
2116
2432
  var hotfixContinuation = shouldEvaluateHotfix
@@ -2156,7 +2472,7 @@ function supportBusinessAssertionRouteOnly(value) {
2156
2472
  return /^(route_probe_pass|route_only_pass|route_pass|route_probe|route_loaded)$/i.test(cleanText(value, 80));
2157
2473
  }
2158
2474
  function normalizeSupportBusinessProofAssertions(input) {
2159
- var e_8, _a;
2475
+ var e_12, _a;
2160
2476
  var gate = normalizeResolveIOSupportDiagnosisGate(input.diagnosisGate);
2161
2477
  var proofPlan = gate === null || gate === void 0 ? void 0 : gate.proof_plan;
2162
2478
  var proofContract = proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.business_proof_contract;
@@ -2190,12 +2506,12 @@ function normalizeSupportBusinessProofAssertions(input) {
2190
2506
  });
2191
2507
  }
2192
2508
  }
2193
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
2509
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
2194
2510
  finally {
2195
2511
  try {
2196
2512
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2197
2513
  }
2198
- finally { if (e_8) throw e_8.error; }
2514
+ finally { if (e_12) throw e_12.error; }
2199
2515
  }
2200
2516
  var status = cleanText(input.businessAssertionStatus || input.outcomeLabel, 80);
2201
2517
  if (!assertions.length && (supportBusinessAssertionPassed(status) || supportBusinessAssertionRouteOnly(status) || supportBusinessAssertionFailed(status))) {
@@ -2285,7 +2601,7 @@ function supportBusinessProofAssertionHasStructuredContractMapping(assertion, ga
2285
2601
  return routeMatches && actionMatches && expectedStateMatches && hasBusinessDataProof;
2286
2602
  }
2287
2603
  function supportBusinessProofAssertionMatchesContract(assertion, gate) {
2288
- var e_9, _a;
2604
+ var e_13, _a;
2289
2605
  if (!gate) {
2290
2606
  return false;
2291
2607
  }
@@ -2325,12 +2641,12 @@ function supportBusinessProofAssertionMatchesContract(assertion, gate) {
2325
2641
  }
2326
2642
  }
2327
2643
  }
2328
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
2644
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
2329
2645
  finally {
2330
2646
  try {
2331
2647
  if (proofWords_1_1 && !proofWords_1_1.done && (_a = proofWords_1.return)) _a.call(proofWords_1);
2332
2648
  }
2333
- finally { if (e_9) throw e_9.error; }
2649
+ finally { if (e_13) throw e_13.error; }
2334
2650
  }
2335
2651
  return overlap >= Math.min(5, Math.max(3, Math.ceil(proofWords.size * 0.45)));
2336
2652
  }
@@ -3855,7 +4171,7 @@ function supportManagerRequiredResetEvidenceForContract(contract) {
3855
4171
  ], false))).slice(0, 16);
3856
4172
  }
3857
4173
  function validateResolveIOSupportNextActionContract(value) {
3858
- var e_10, _a;
4174
+ var e_14, _a;
3859
4175
  var _b, _c, _d, _e, _f;
3860
4176
  var contract = cleanObject(value);
3861
4177
  var blockers = [];
@@ -3877,12 +4193,12 @@ function validateResolveIOSupportNextActionContract(value) {
3877
4193
  }
3878
4194
  }
3879
4195
  }
3880
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
4196
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
3881
4197
  finally {
3882
4198
  try {
3883
4199
  if (requiredStringFields_1_1 && !requiredStringFields_1_1.done && (_a = requiredStringFields_1.return)) _a.call(requiredStringFields_1);
3884
4200
  }
3885
- finally { if (e_10) throw e_10.error; }
4201
+ finally { if (e_14) throw e_14.error; }
3886
4202
  }
3887
4203
  if (!Array.isArray(contract.nextCommands) || !contract.nextCommands.length) {
3888
4204
  blockers.push('NextActionContract.nextCommands must include at least the primary command.');
@@ -4901,7 +5217,7 @@ function buildResolveIOSupportV5ScopeDigest(input) {
4901
5217
  return raw.slice(0, maxChars);
4902
5218
  }
4903
5219
  function buildResolveIOSupportV5MicrotaskLedger(input) {
4904
- var e_11, _a;
5220
+ var e_15, _a;
4905
5221
  var existing = Array.isArray(input.existing) ? input.existing : [];
4906
5222
  var completedByObjective = new Map();
4907
5223
  try {
@@ -4912,12 +5228,12 @@ function buildResolveIOSupportV5MicrotaskLedger(input) {
4912
5228
  }
4913
5229
  }
4914
5230
  }
4915
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
5231
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
4916
5232
  finally {
4917
5233
  try {
4918
5234
  if (existing_1_1 && !existing_1_1.done && (_a = existing_1.return)) _a.call(existing_1);
4919
5235
  }
4920
- finally { if (e_11) throw e_11.error; }
5236
+ finally { if (e_15) throw e_15.error; }
4921
5237
  }
4922
5238
  var now = isoNow(input.now);
4923
5239
  var requirements = cleanList(input.requirements, 30, 240);
@@ -6708,7 +7024,7 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
6708
7024
  };
6709
7025
  }
6710
7026
  function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6711
- var e_12, _a, e_13, _b;
7027
+ var e_16, _a, e_17, _b;
6712
7028
  var byMicrotask = new Map();
6713
7029
  var bySection = new Map();
6714
7030
  var totalPromptTokenEstimate = 0;
@@ -6723,17 +7039,17 @@ function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6723
7039
  existing.calls += 1;
6724
7040
  byMicrotask.set(usage.microtaskId, existing);
6725
7041
  try {
6726
- for (var _e = (e_13 = void 0, __values(usage.promptSections || [])), _f = _e.next(); !_f.done; _f = _e.next()) {
7042
+ for (var _e = (e_17 = void 0, __values(usage.promptSections || [])), _f = _e.next(); !_f.done; _f = _e.next()) {
6727
7043
  var section = _f.value;
6728
7044
  bySection.set(section.name, (bySection.get(section.name) || 0) + section.tokenEstimate);
6729
7045
  }
6730
7046
  }
6731
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
7047
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
6732
7048
  finally {
6733
7049
  try {
6734
7050
  if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
6735
7051
  }
6736
- finally { if (e_13) throw e_13.error; }
7052
+ finally { if (e_17) throw e_17.error; }
6737
7053
  }
6738
7054
  var hardCap = usage.lane === 'qa' ? promptBudget.qaMicrotaskHardCap : promptBudget.buildMicrotaskHardCap;
6739
7055
  if ((usage.promptTokenEstimate || 0) > hardCap) {
@@ -6741,12 +7057,12 @@ function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6741
7057
  }
6742
7058
  }
6743
7059
  }
6744
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
7060
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
6745
7061
  finally {
6746
7062
  try {
6747
7063
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
6748
7064
  }
6749
- finally { if (e_12) throw e_12.error; }
7065
+ finally { if (e_16) throw e_16.error; }
6750
7066
  }
6751
7067
  return {
6752
7068
  totalPromptTokenEstimate: totalPromptTokenEstimate,