@resolveio/server-lib 22.3.210 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "22.3.210",
3
+ "version": "22.3.211",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -129,6 +129,11 @@ function cleanListEntryText(value, max) {
129
129
  if (max === void 0) { max = 500; }
130
130
  if (value && typeof value === 'object' && !Array.isArray(value)) {
131
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
+ }
132
137
  try {
133
138
  for (var _b = __values([
134
139
  'path',
@@ -924,7 +929,12 @@ function normalizeIssueClass(value) {
924
929
  route_auth_hydration: 'route_auth_hydration',
925
930
  slow_query: 'slow_query_performance',
926
931
  performance: 'slow_query_performance',
927
- 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'
928
938
  };
929
939
  return aliases[normalized] || '';
930
940
  }
@@ -962,12 +972,40 @@ function normalizeSupportDiagnosisEvidence(values) {
962
972
  .filter(function (entry) { return entry && typeof entry === 'object' && !Array.isArray(entry); })
963
973
  .map(function (entry) {
964
974
  var type = cleanText(entry.type, 80).toLowerCase();
965
- var normalizedType = (allowed.has(type) ? type : 'other');
966
- var summary = cleanText(entry.summary || entry.message || entry.evidence || entry.reason, 1200);
967
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) : '');
968
1000
  var ownerFiles = cleanList(entry.ownerFiles || entry.owner_files || entry.files, 12, 500)
969
1001
  .map(normalizeOwnerFilePath)
970
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
+ }
971
1009
  var evidenceRefs = cleanList(entry.evidenceRefs || entry.evidence_refs || entry.refs, 12, 500);
972
1010
  return {
973
1011
  id: cleanText(entry.id || entry.evidenceId || entry.evidence_id, 160)
@@ -1438,19 +1476,162 @@ function normalizeSupportDiagnosisBusinessProofContract(value, issueClassHint) {
1438
1476
  data_or_dom_assertion: pickText(source, ['data_or_dom_assertion', 'dataOrDomAssertion', 'data_assertion', 'dataAssertion', 'dom_assertion', 'domAssertion', 'assertion'], 1000)
1439
1477
  };
1440
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
+ }
1441
1594
  function normalizeOwnerFilePath(value) {
1442
- return cleanListEntryText(value, 500)
1595
+ var e_7, _a;
1596
+ var normalized = cleanListEntryText(value, 500)
1443
1597
  .replace(/\\/g, '/')
1444
1598
  .replace(/^\.\/+/, '')
1445
1599
  .replace(/^\/+/, '')
1446
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;
1447
1628
  }
1448
1629
  function isResolveIOSupportGeneratedAngularWrapperPath(value) {
1449
1630
  var normalized = normalizeOwnerFilePath(value).replace(/^geochem\//i, '');
1450
1631
  return /(?:^|\/)angular\/app\/(?:methods|publications)\.ts$/i.test(normalized);
1451
1632
  }
1452
1633
  function ownerFileComparablePathKeys(value) {
1453
- var e_5, _a;
1634
+ var e_8, _a;
1454
1635
  var normalized = normalizeOwnerFilePath(value);
1455
1636
  if (!normalized) {
1456
1637
  return [];
@@ -1472,12 +1653,12 @@ function ownerFileComparablePathKeys(value) {
1472
1653
  }
1473
1654
  }
1474
1655
  }
1475
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1656
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
1476
1657
  finally {
1477
1658
  try {
1478
1659
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1479
1660
  }
1480
- finally { if (e_5) throw e_5.error; }
1661
+ finally { if (e_8) throw e_8.error; }
1481
1662
  }
1482
1663
  return Array.from(keys);
1483
1664
  }
@@ -1511,7 +1692,7 @@ function ownerFileLooksNonProductEvidence(value) {
1511
1692
  var normalized = normalizeOwnerFilePath(value);
1512
1693
  return /(^|\/)(qa-artifacts?|screenshots?|screen-shots?|traces?|logs?|tmp|temp|coverage|dist|build|docs?)(\/|$)/i.test(normalized)
1513
1694
  || /(^|\/)(?:support-diagnosis-pack-[^/]+|diagnosis-evidence-pack|aiqa-business-assertion)\.json$/i.test(normalized)
1514
- || /(^|\/)\.resolveio-(?:support|context|runner|qa)(\/|$)/i.test(normalized)
1695
+ || /(^|\/)\.resolveio-(?:support-context|support|context|runner|qa)(\/|$)/i.test(normalized)
1515
1696
  || /(^|\/)(__tests__|tests?|spec)(\/|$)|\.(?:spec|test)\.[jt]sx?$/i.test(normalized)
1516
1697
  || /\.(?:png|jpe?g|gif|webp|svg|pdf|log|txt|md|markdown)$/i.test(normalized);
1517
1698
  }
@@ -1815,59 +1996,131 @@ function evaluateResolveIOSupportDiagnosisEvidenceQuality(value) {
1815
1996
  };
1816
1997
  }
1817
1998
  function normalizeResolveIOSupportDiagnosisGate(value, now) {
1818
- 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);
1819
2005
  if (!Object.keys(source).length) {
1820
2006
  return undefined;
1821
2007
  }
1822
- 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);
1823
2013
  var hypothesisSource = cleanObject(source.accepted_hypothesis || source.acceptedHypothesis);
1824
2014
  var failingPathSource = cleanObject(source.failing_path || source.failingPath);
1825
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);
1826
2020
  var issueClass = normalizeIssueClass(source.issue_class || source.issueClass);
1827
- var businessProofContract = normalizeSupportDiagnosisBusinessProofContract(proofPlanSource.business_proof_contract || proofPlanSource.businessProofContract || source.business_proof_contract || source.businessProofContract, issueClass || source.issue_class || source.issueClass);
1828
- 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)
1829
2047
  .map(normalizeOwnerFilePath)
1830
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;
1831
2081
  var gate = {
1832
2082
  issue_case: {
1833
- customer_complaint: pickText(issueCaseSource, ['customer_complaint', 'customerComplaint', 'complaint', 'request', 'summary'], 1200),
1834
- expected_result: pickText(issueCaseSource, ['expected_result', 'expectedResult', 'expected'], 1000),
1835
- observed_result: pickText(issueCaseSource, ['observed_result', 'observedResult', 'observed', 'actual'], 1000),
1836
- route_module: pickText(issueCaseSource, ['route_module', 'routeModule', 'route', 'module', 'screen'], 500),
1837
- account_customer_context: pickText(issueCaseSource, ['account_customer_context', 'accountCustomerContext', 'account', 'customer', 'user', 'context'], 800),
1838
- 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)),
1839
2089
  reproduction_blocker: pickText(issueCaseSource, ['reproduction_blocker', 'reproductionBlocker', 'blocked_reason', 'blockedReason'], 1000)
1840
2090
  },
1841
2091
  issue_class: issueClass || 'missing_wrong_data',
1842
2092
  accepted_hypothesis: {
1843
2093
  statement: pickText(hypothesisSource, ['statement', 'hypothesis', 'root_cause', 'rootCause', 'summary'], 1200)
1844
- || (typeof source.accepted_hypothesis === 'string' ? cleanText(source.accepted_hypothesis, 1200) : ''),
1845
- falsifiable_test: pickText(hypothesisSource, ['falsifiable_test', 'falsifiableTest', 'test', 'proof', 'falsifier'], 1000),
1846
- 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)
1847
2100
  },
1848
- rejected_alternatives: cleanList(source.rejected_alternatives || source.rejectedAlternatives, 10, 700),
2101
+ rejected_alternatives: normalizeSupportDiagnosisRejectedAlternatives(source.rejected_alternatives || source.rejectedAlternatives),
1849
2102
  failing_path: {
1850
2103
  frontend: pickText(failingPathSource, ['frontend', 'frontend_path', 'frontendPath', 'eventPath'], 700),
1851
2104
  backend: pickText(failingPathSource, ['backend', 'backend_path', 'backendPath', 'methodPublicationPath'], 700),
1852
2105
  shared_library: pickText(failingPathSource, ['shared_library', 'sharedLibrary', 'library', 'lib'], 700),
1853
2106
  data_query: pickText(failingPathSource, ['data_query', 'dataQuery', 'query'], 700),
1854
- description: pickText(failingPathSource, ['description', 'path', 'summary'], 1200) || cleanText(source.failing_path, 1200)
2107
+ description: pickText(failingPathSource, ['description', 'path', 'summary'], 1200) || failingPathText
1855
2108
  },
1856
2109
  owner_files: ownerFiles,
1857
2110
  proof_plan: {
1858
- before: pickText(proofPlanSource, ['before', 'before_state', 'beforeState', 'precondition'], 1000),
1859
- before_state_unavailable_reason: pickText(proofPlanSource, ['before_state_unavailable_reason', 'beforeStateUnavailableReason', 'before_unavailable_reason'], 1000),
1860
- action: pickText(proofPlanSource, ['action', 'browser_action', 'browserAction', 'steps'], 1000),
1861
- after: pickText(proofPlanSource, ['after', 'after_state', 'afterState', 'expected_after'], 1000),
1862
- 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,
1863
2116
  route: pickText(proofPlanSource, ['route', 'url'], 500),
1864
- data_assertion: pickText(proofPlanSource, ['data_assertion', 'dataAssertion', 'mongo_delta', 'mongoDelta'], 1000),
1865
- artifact_expectation: pickText(proofPlanSource, ['artifact_expectation', 'artifactExpectation', 'artifact', 'screenshot'], 1000),
2117
+ data_assertion: proofPlanDataAssertion,
2118
+ artifact_expectation: proofPlanArtifactExpectation,
1866
2119
  business_proof_contract: businessProofContract
1867
2120
  },
1868
2121
  similar_tickets: normalizeSupportDiagnosisHints(source.similar_tickets || source.similarTickets),
1869
2122
  similar_commits: normalizeSupportDiagnosisHints(source.similar_commits || source.similarCommits),
1870
- evidence: normalizeSupportDiagnosisEvidence(source.evidence),
2123
+ evidence: diagnosisEvidence,
1871
2124
  status: cleanText(source.status, 80).toLowerCase() || 'incomplete',
1872
2125
  updatedAt: isoNow(now || source.updatedAt || source.updated_at)
1873
2126
  };
@@ -1877,7 +2130,7 @@ function normalizeResolveIOSupportDiagnosisGate(value, now) {
1877
2130
  return gate;
1878
2131
  }
1879
2132
  function extractResolveIOSupportDiagnosisGateFromText(value, now) {
1880
- var e_6, _a;
2133
+ var e_9, _a;
1881
2134
  var text = String(value || '').trim();
1882
2135
  if (!text) {
1883
2136
  return undefined;
@@ -1905,12 +2158,12 @@ function extractResolveIOSupportDiagnosisGateFromText(value, now) {
1905
2158
  }
1906
2159
  }
1907
2160
  }
1908
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
2161
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
1909
2162
  finally {
1910
2163
  try {
1911
2164
  if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
1912
2165
  }
1913
- finally { if (e_6) throw e_6.error; }
2166
+ finally { if (e_9) throw e_9.error; }
1914
2167
  }
1915
2168
  return undefined;
1916
2169
  }
@@ -2073,7 +2326,7 @@ function supportStatusLooksPassed(value) {
2073
2326
  return /\b(pass|passed|success|succeeded|complete|completed|ready|not_required|not required)\b/i.test(cleanText(value, 200));
2074
2327
  }
2075
2328
  function nestedObject(source) {
2076
- var e_7, _a;
2329
+ var e_10, _a;
2077
2330
  var keys = [];
2078
2331
  for (var _i = 1; _i < arguments.length; _i++) {
2079
2332
  keys[_i - 1] = arguments[_i];
@@ -2087,17 +2340,17 @@ function nestedObject(source) {
2087
2340
  }
2088
2341
  }
2089
2342
  }
2090
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
2343
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
2091
2344
  finally {
2092
2345
  try {
2093
2346
  if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
2094
2347
  }
2095
- finally { if (e_7) throw e_7.error; }
2348
+ finally { if (e_10) throw e_10.error; }
2096
2349
  }
2097
2350
  return {};
2098
2351
  }
2099
2352
  function resolveSupportReplyReleaseGate(input) {
2100
- var e_8, _a;
2353
+ var e_11, _a;
2101
2354
  var _b;
2102
2355
  var releaseEvidence = cleanObject(input.releaseEvidence);
2103
2356
  var releaseStatus = cleanText(input.releaseStatus
@@ -2168,12 +2421,12 @@ function resolveSupportReplyReleaseGate(input) {
2168
2421
  blockers.push("missing_".concat(field));
2169
2422
  }
2170
2423
  }
2171
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
2424
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
2172
2425
  finally {
2173
2426
  try {
2174
2427
  if (missingCommitProofFields_1_1 && !missingCommitProofFields_1_1.done && (_a = missingCommitProofFields_1.return)) _a.call(missingCommitProofFields_1);
2175
2428
  }
2176
- finally { if (e_8) throw e_8.error; }
2429
+ finally { if (e_11) throw e_11.error; }
2177
2430
  }
2178
2431
  var shouldEvaluateHotfix = statusBlocked || commitProofRequired || Object.keys(hotfixEvidence).length > 0;
2179
2432
  var hotfixContinuation = shouldEvaluateHotfix
@@ -2219,7 +2472,7 @@ function supportBusinessAssertionRouteOnly(value) {
2219
2472
  return /^(route_probe_pass|route_only_pass|route_pass|route_probe|route_loaded)$/i.test(cleanText(value, 80));
2220
2473
  }
2221
2474
  function normalizeSupportBusinessProofAssertions(input) {
2222
- var e_9, _a;
2475
+ var e_12, _a;
2223
2476
  var gate = normalizeResolveIOSupportDiagnosisGate(input.diagnosisGate);
2224
2477
  var proofPlan = gate === null || gate === void 0 ? void 0 : gate.proof_plan;
2225
2478
  var proofContract = proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.business_proof_contract;
@@ -2253,12 +2506,12 @@ function normalizeSupportBusinessProofAssertions(input) {
2253
2506
  });
2254
2507
  }
2255
2508
  }
2256
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
2509
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
2257
2510
  finally {
2258
2511
  try {
2259
2512
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2260
2513
  }
2261
- finally { if (e_9) throw e_9.error; }
2514
+ finally { if (e_12) throw e_12.error; }
2262
2515
  }
2263
2516
  var status = cleanText(input.businessAssertionStatus || input.outcomeLabel, 80);
2264
2517
  if (!assertions.length && (supportBusinessAssertionPassed(status) || supportBusinessAssertionRouteOnly(status) || supportBusinessAssertionFailed(status))) {
@@ -2348,7 +2601,7 @@ function supportBusinessProofAssertionHasStructuredContractMapping(assertion, ga
2348
2601
  return routeMatches && actionMatches && expectedStateMatches && hasBusinessDataProof;
2349
2602
  }
2350
2603
  function supportBusinessProofAssertionMatchesContract(assertion, gate) {
2351
- var e_10, _a;
2604
+ var e_13, _a;
2352
2605
  if (!gate) {
2353
2606
  return false;
2354
2607
  }
@@ -2388,12 +2641,12 @@ function supportBusinessProofAssertionMatchesContract(assertion, gate) {
2388
2641
  }
2389
2642
  }
2390
2643
  }
2391
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
2644
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
2392
2645
  finally {
2393
2646
  try {
2394
2647
  if (proofWords_1_1 && !proofWords_1_1.done && (_a = proofWords_1.return)) _a.call(proofWords_1);
2395
2648
  }
2396
- finally { if (e_10) throw e_10.error; }
2649
+ finally { if (e_13) throw e_13.error; }
2397
2650
  }
2398
2651
  return overlap >= Math.min(5, Math.max(3, Math.ceil(proofWords.size * 0.45)));
2399
2652
  }
@@ -3918,7 +4171,7 @@ function supportManagerRequiredResetEvidenceForContract(contract) {
3918
4171
  ], false))).slice(0, 16);
3919
4172
  }
3920
4173
  function validateResolveIOSupportNextActionContract(value) {
3921
- var e_11, _a;
4174
+ var e_14, _a;
3922
4175
  var _b, _c, _d, _e, _f;
3923
4176
  var contract = cleanObject(value);
3924
4177
  var blockers = [];
@@ -3940,12 +4193,12 @@ function validateResolveIOSupportNextActionContract(value) {
3940
4193
  }
3941
4194
  }
3942
4195
  }
3943
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
4196
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
3944
4197
  finally {
3945
4198
  try {
3946
4199
  if (requiredStringFields_1_1 && !requiredStringFields_1_1.done && (_a = requiredStringFields_1.return)) _a.call(requiredStringFields_1);
3947
4200
  }
3948
- finally { if (e_11) throw e_11.error; }
4201
+ finally { if (e_14) throw e_14.error; }
3949
4202
  }
3950
4203
  if (!Array.isArray(contract.nextCommands) || !contract.nextCommands.length) {
3951
4204
  blockers.push('NextActionContract.nextCommands must include at least the primary command.');
@@ -4964,7 +5217,7 @@ function buildResolveIOSupportV5ScopeDigest(input) {
4964
5217
  return raw.slice(0, maxChars);
4965
5218
  }
4966
5219
  function buildResolveIOSupportV5MicrotaskLedger(input) {
4967
- var e_12, _a;
5220
+ var e_15, _a;
4968
5221
  var existing = Array.isArray(input.existing) ? input.existing : [];
4969
5222
  var completedByObjective = new Map();
4970
5223
  try {
@@ -4975,12 +5228,12 @@ function buildResolveIOSupportV5MicrotaskLedger(input) {
4975
5228
  }
4976
5229
  }
4977
5230
  }
4978
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
5231
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
4979
5232
  finally {
4980
5233
  try {
4981
5234
  if (existing_1_1 && !existing_1_1.done && (_a = existing_1.return)) _a.call(existing_1);
4982
5235
  }
4983
- finally { if (e_12) throw e_12.error; }
5236
+ finally { if (e_15) throw e_15.error; }
4984
5237
  }
4985
5238
  var now = isoNow(input.now);
4986
5239
  var requirements = cleanList(input.requirements, 30, 240);
@@ -6771,7 +7024,7 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
6771
7024
  };
6772
7025
  }
6773
7026
  function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6774
- var e_13, _a, e_14, _b;
7027
+ var e_16, _a, e_17, _b;
6775
7028
  var byMicrotask = new Map();
6776
7029
  var bySection = new Map();
6777
7030
  var totalPromptTokenEstimate = 0;
@@ -6786,17 +7039,17 @@ function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6786
7039
  existing.calls += 1;
6787
7040
  byMicrotask.set(usage.microtaskId, existing);
6788
7041
  try {
6789
- for (var _e = (e_14 = 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()) {
6790
7043
  var section = _f.value;
6791
7044
  bySection.set(section.name, (bySection.get(section.name) || 0) + section.tokenEstimate);
6792
7045
  }
6793
7046
  }
6794
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
7047
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
6795
7048
  finally {
6796
7049
  try {
6797
7050
  if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
6798
7051
  }
6799
- finally { if (e_14) throw e_14.error; }
7052
+ finally { if (e_17) throw e_17.error; }
6800
7053
  }
6801
7054
  var hardCap = usage.lane === 'qa' ? promptBudget.qaMicrotaskHardCap : promptBudget.buildMicrotaskHardCap;
6802
7055
  if ((usage.promptTokenEstimate || 0) > hardCap) {
@@ -6804,12 +7057,12 @@ function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6804
7057
  }
6805
7058
  }
6806
7059
  }
6807
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
7060
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
6808
7061
  finally {
6809
7062
  try {
6810
7063
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
6811
7064
  }
6812
- finally { if (e_13) throw e_13.error; }
7065
+ finally { if (e_16) throw e_16.error; }
6813
7066
  }
6814
7067
  return {
6815
7068
  totalPromptTokenEstimate: totalPromptTokenEstimate,