@resolveio/server-lib 22.3.160 → 22.3.162
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
|
@@ -267,10 +267,48 @@ function hotfixEvidenceGate(evidence, now) {
|
|
|
267
267
|
fullDeployBlocked: validation.fullDeployBlocked,
|
|
268
268
|
hotfixSatisfied: validation.hotfixSatisfied,
|
|
269
269
|
blockers: validation.blockers,
|
|
270
|
+
githubCommitGuard: validation.githubCommitGuard,
|
|
270
271
|
target: (_b = validation.normalized) === null || _b === void 0 ? void 0 : _b.target
|
|
271
272
|
}
|
|
272
273
|
};
|
|
273
274
|
}
|
|
275
|
+
function hotfixCommitProofGate(evidence, now) {
|
|
276
|
+
var _a;
|
|
277
|
+
var validation = (0, ai_runner_manager_policy_1.validateResolveIOAIManagerHotfixEvidence)(evidence);
|
|
278
|
+
var guard = validation.githubCommitGuard;
|
|
279
|
+
if (!guard.required) {
|
|
280
|
+
return undefined;
|
|
281
|
+
}
|
|
282
|
+
var status = guard.passed
|
|
283
|
+
? 'pass'
|
|
284
|
+
: guard.status === 'invalid'
|
|
285
|
+
? 'fail'
|
|
286
|
+
: 'blocked';
|
|
287
|
+
return {
|
|
288
|
+
key: 'hotfix_commit_proof',
|
|
289
|
+
label: 'Hotfix GitHub commit proof',
|
|
290
|
+
status: status,
|
|
291
|
+
reason: guard.passed
|
|
292
|
+
? 'Hotfix has matching sourceCommitSha, GitHub commit URL, and passed gitPushStatus/gitCommitStatus.'
|
|
293
|
+
: (guard.blockers.join('; ') || 'Manager hotfix is blocked until sourceCommitSha, githubCommitUrl, and passed gitPushStatus prove the hotfix is pushed to GitHub.'),
|
|
294
|
+
evidenceRefs: cleanStringList([guard.githubCommitUrl], 1, 500),
|
|
295
|
+
recordedAt: isoNow(now || ((_a = validation.normalized) === null || _a === void 0 ? void 0 : _a.recordedAt)),
|
|
296
|
+
metadata: {
|
|
297
|
+
channel: guard.channel || validation.channel,
|
|
298
|
+
status: guard.status,
|
|
299
|
+
passed: guard.passed,
|
|
300
|
+
managerMustCommitBeforeHotfix: guard.managerMustCommitBeforeHotfix,
|
|
301
|
+
sourceCommitSha: guard.sourceCommitSha,
|
|
302
|
+
githubCommitUrl: guard.githubCommitUrl,
|
|
303
|
+
githubCommitSha: guard.githubCommitSha,
|
|
304
|
+
gitCommitStatus: guard.gitCommitStatus,
|
|
305
|
+
gitPushStatus: guard.gitPushStatus,
|
|
306
|
+
blockers: guard.blockers,
|
|
307
|
+
nextCommands: guard.nextCommands,
|
|
308
|
+
requiredEvidence: guard.requiredEvidence
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
}
|
|
274
312
|
function collectHotfixEvidenceEvents(sources, events, gates, now) {
|
|
275
313
|
var e_6, _a;
|
|
276
314
|
var _b, _c;
|
|
@@ -297,6 +335,7 @@ function collectHotfixEvidenceEvents(sources, events, gates, now) {
|
|
|
297
335
|
fullDeployBlocked: validation.fullDeployBlocked,
|
|
298
336
|
hotfixSatisfied: validation.hotfixSatisfied,
|
|
299
337
|
blockers: validation.blockers,
|
|
338
|
+
githubCommitGuard: validation.githubCommitGuard,
|
|
300
339
|
target: (_c = validation.normalized) === null || _c === void 0 ? void 0 : _c.target
|
|
301
340
|
}
|
|
302
341
|
});
|
|
@@ -304,6 +343,18 @@ function collectHotfixEvidenceEvents(sources, events, gates, now) {
|
|
|
304
343
|
if (gate) {
|
|
305
344
|
gates.push(gate);
|
|
306
345
|
}
|
|
346
|
+
var commitProofGate = hotfixCommitProofGate(evidence, now);
|
|
347
|
+
if (commitProofGate) {
|
|
348
|
+
gates.push(commitProofGate);
|
|
349
|
+
pushEvent(events, {
|
|
350
|
+
type: 'log',
|
|
351
|
+
category: 'hotfix_commit_proof',
|
|
352
|
+
message: commitProofGate.reason,
|
|
353
|
+
artifactPaths: commitProofGate.evidenceRefs,
|
|
354
|
+
recordedAt: commitProofGate.recordedAt,
|
|
355
|
+
metadata: commitProofGate.metadata
|
|
356
|
+
});
|
|
357
|
+
}
|
|
307
358
|
}
|
|
308
359
|
}
|
|
309
360
|
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
@@ -741,6 +792,94 @@ function supportDiagnosisProofGateResult(diagnosisGate, now) {
|
|
|
741
792
|
}
|
|
742
793
|
};
|
|
743
794
|
}
|
|
795
|
+
var SUPPORT_ROOT_CAUSE_ENTRY_REQUIRED_FIELDS = [
|
|
796
|
+
'issue_case',
|
|
797
|
+
'issue_class',
|
|
798
|
+
'accepted_hypothesis',
|
|
799
|
+
'rejected_alternatives',
|
|
800
|
+
'failing_path',
|
|
801
|
+
'owner_files',
|
|
802
|
+
'proof_plan',
|
|
803
|
+
'evidence'
|
|
804
|
+
];
|
|
805
|
+
var SUPPORT_ROOT_CAUSE_ENTRY_ISSUE_CLASSES = [
|
|
806
|
+
'no_op_submit',
|
|
807
|
+
'missing_wrong_data',
|
|
808
|
+
'filter_query_mismatch',
|
|
809
|
+
'invoice_pdf_export',
|
|
810
|
+
'upload_import',
|
|
811
|
+
'route_auth_hydration',
|
|
812
|
+
'slow_query_performance'
|
|
813
|
+
];
|
|
814
|
+
function supportRootCauseEntryContractGate(contract, now) {
|
|
815
|
+
if (!contract || !Object.keys(contract).length) {
|
|
816
|
+
return undefined;
|
|
817
|
+
}
|
|
818
|
+
var requiredOutput = plainObject(contract.required_output || contract.requiredOutput);
|
|
819
|
+
var ownerPolicy = plainObject(contract.owner_file_policy || contract.ownerFilePolicy);
|
|
820
|
+
var businessProofPolicy = plainObject(contract.business_proof_policy || contract.businessProofPolicy);
|
|
821
|
+
var failurePolicy = plainObject(contract.failure_policy || contract.failurePolicy);
|
|
822
|
+
var probes = asArray(contract.issue_class_probes || contract.issueClassProbes);
|
|
823
|
+
var requiredFields = cleanStringList(requiredOutput.required_fields || requiredOutput.requiredFields, 30, 160);
|
|
824
|
+
var issueClasses = probes.map(function (probe) { return cleanText(probe.issue_class || probe.issueClass, 120); }).filter(Boolean);
|
|
825
|
+
var missingRequiredFields = SUPPORT_ROOT_CAUSE_ENTRY_REQUIRED_FIELDS.filter(function (field) { return !requiredFields.includes(field); });
|
|
826
|
+
var missingIssueClasses = SUPPORT_ROOT_CAUSE_ENTRY_ISSUE_CLASSES.filter(function (issueClass) { return !issueClasses.includes(issueClass); });
|
|
827
|
+
var blockers = [];
|
|
828
|
+
if (!cleanText(contract.contract_id || contract.contractId, 160)) {
|
|
829
|
+
blockers.push('Root-cause entry contract is missing contract_id.');
|
|
830
|
+
}
|
|
831
|
+
if (cleanText(requiredOutput.object_key || requiredOutput.objectKey, 120) !== 'support_diagnosis_gate') {
|
|
832
|
+
blockers.push('Root-cause entry contract must require support_diagnosis_gate output.');
|
|
833
|
+
}
|
|
834
|
+
if (missingRequiredFields.length) {
|
|
835
|
+
blockers.push("Root-cause entry contract missing required output fields: ".concat(missingRequiredFields.join(', '), "."));
|
|
836
|
+
}
|
|
837
|
+
var ownerFileMax = Number(ownerPolicy.max_files || ownerPolicy.maxFiles || 0);
|
|
838
|
+
if (!Number.isFinite(ownerFileMax) || ownerFileMax <= 0 || ownerFileMax > 12) {
|
|
839
|
+
blockers.push('Root-cause entry contract must cap owner_files to a small exact file set.');
|
|
840
|
+
}
|
|
841
|
+
if (ownerPolicy.edits_outside_owner_files_require_revised_diagnosis !== true && ownerPolicy.editsOutsideOwnerFilesRequireRevisedDiagnosis !== true) {
|
|
842
|
+
blockers.push('Root-cause entry contract must require revised diagnosis before edits outside owner_files.');
|
|
843
|
+
}
|
|
844
|
+
if (businessProofPolicy.requires_aiqa_business_assertion !== true && businessProofPolicy.requiresAiqaBusinessAssertion !== true) {
|
|
845
|
+
blockers.push('Root-cause entry contract must require AIQaBusinessAssertion business proof.');
|
|
846
|
+
}
|
|
847
|
+
if (businessProofPolicy.route_load_screenshot_scorecard_model_claim_not_acceptance !== true && businessProofPolicy.routeLoadScreenshotScorecardModelClaimNotAcceptance !== true) {
|
|
848
|
+
blockers.push('Root-cause entry contract must reject route-load/screenshot/scorecard/model-claim acceptance.');
|
|
849
|
+
}
|
|
850
|
+
if (failurePolicy.repeated_failure_without_new_evidence_parks_run !== true && failurePolicy.repeatedFailureWithoutNewEvidenceParksRun !== true) {
|
|
851
|
+
blockers.push('Root-cause entry contract must park repeated failures without new evidence.');
|
|
852
|
+
}
|
|
853
|
+
if (missingIssueClasses.length) {
|
|
854
|
+
blockers.push("Root-cause entry contract missing issue-class probes: ".concat(missingIssueClasses.join(', '), "."));
|
|
855
|
+
}
|
|
856
|
+
var status = blockers.length ? 'fail' : 'pass';
|
|
857
|
+
return {
|
|
858
|
+
key: 'support_root_cause_entry_contract',
|
|
859
|
+
label: 'Root-cause entry contract',
|
|
860
|
+
status: status,
|
|
861
|
+
reason: blockers.length
|
|
862
|
+
? blockers.join(' ')
|
|
863
|
+
: 'Support run has a structured root-cause-first entry contract with issue-class probes, owner-file policy, and business-proof policy.',
|
|
864
|
+
evidenceRefs: cleanStringList(businessProofPolicy.required_artifacts || businessProofPolicy.requiredArtifacts, 20, 500),
|
|
865
|
+
recordedAt: isoNow(now),
|
|
866
|
+
metadata: {
|
|
867
|
+
contractId: cleanText(contract.contract_id || contract.contractId, 160),
|
|
868
|
+
version: cleanText(contract.version, 120),
|
|
869
|
+
status: cleanText(contract.status, 120),
|
|
870
|
+
requiredOutputKey: cleanText(requiredOutput.object_key || requiredOutput.objectKey, 120),
|
|
871
|
+
requiredFields: requiredFields,
|
|
872
|
+
missingRequiredFields: missingRequiredFields,
|
|
873
|
+
ownerFileMax: ownerFileMax,
|
|
874
|
+
requiresRevisedDiagnosisForOutOfScopeEdits: ownerPolicy.edits_outside_owner_files_require_revised_diagnosis === true || ownerPolicy.editsOutsideOwnerFilesRequireRevisedDiagnosis === true,
|
|
875
|
+
requiresBusinessAssertion: businessProofPolicy.requires_aiqa_business_assertion === true || businessProofPolicy.requiresAiqaBusinessAssertion === true,
|
|
876
|
+
routeOnlyAcceptanceRejected: businessProofPolicy.route_load_screenshot_scorecard_model_claim_not_acceptance === true || businessProofPolicy.routeLoadScreenshotScorecardModelClaimNotAcceptance === true,
|
|
877
|
+
issueClassProbeCount: issueClasses.length,
|
|
878
|
+
issueClasses: issueClasses,
|
|
879
|
+
missingIssueClasses: missingIssueClasses
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
}
|
|
744
883
|
function applySupportDiagnosisProofGate(qa, diagnosisGate, now) {
|
|
745
884
|
var proofPlan = diagnosisGate.proof_plan || diagnosisGate.proofPlan || {};
|
|
746
885
|
var requiredBusinessAssertion = cleanText(proofPlan.business_assertion || proofPlan.businessAssertion, 1000);
|
|
@@ -1454,7 +1593,7 @@ function applyAssistantAnswerQualityGate(qa, decision, now) {
|
|
|
1454
1593
|
}
|
|
1455
1594
|
function buildSupportAIRunFromEvidence(input) {
|
|
1456
1595
|
var e_22, _a, e_23, _b;
|
|
1457
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1596
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
1458
1597
|
var ticket = input.ticket || {};
|
|
1459
1598
|
var job = input.job || {};
|
|
1460
1599
|
var evidence = buildSupportQaEvidence(input);
|
|
@@ -1466,8 +1605,8 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
1466
1605
|
addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
|
|
1467
1606
|
addSourceId(sourceIds, 'buildPlanId', job.buildPlanId || ticket.buildPlanId);
|
|
1468
1607
|
try {
|
|
1469
|
-
for (var
|
|
1470
|
-
var event_1 =
|
|
1608
|
+
for (var _s = __values(asArray(input.taskEvents)), _t = _s.next(); !_t.done; _t = _s.next()) {
|
|
1609
|
+
var event_1 = _t.value;
|
|
1471
1610
|
pushEvent(events, {
|
|
1472
1611
|
type: event_1.type === 'human_intervention' ? 'human_intervention' : 'log',
|
|
1473
1612
|
category: cleanText(event_1.category || event_1.phase || event_1.type, 160),
|
|
@@ -1484,13 +1623,13 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
1484
1623
|
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
1485
1624
|
finally {
|
|
1486
1625
|
try {
|
|
1487
|
-
if (
|
|
1626
|
+
if (_t && !_t.done && (_a = _s.return)) _a.call(_s);
|
|
1488
1627
|
}
|
|
1489
1628
|
finally { if (e_22) throw e_22.error; }
|
|
1490
1629
|
}
|
|
1491
1630
|
try {
|
|
1492
|
-
for (var
|
|
1493
|
-
var aiJob =
|
|
1631
|
+
for (var _u = __values(asArray(input.aiJobs)), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1632
|
+
var aiJob = _v.value;
|
|
1494
1633
|
pushEvent(events, {
|
|
1495
1634
|
type: aiJob.model ? 'model_call' : 'log',
|
|
1496
1635
|
category: cleanText(aiJob.category || aiJob.phase || aiJob.runner, 160),
|
|
@@ -1508,7 +1647,7 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
1508
1647
|
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
1509
1648
|
finally {
|
|
1510
1649
|
try {
|
|
1511
|
-
if (
|
|
1650
|
+
if (_v && !_v.done && (_b = _u.return)) _b.call(_u);
|
|
1512
1651
|
}
|
|
1513
1652
|
finally { if (e_23) throw e_23.error; }
|
|
1514
1653
|
}
|
|
@@ -1540,6 +1679,21 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
1540
1679
|
metadata: customerReplyPolicyGate.metadata
|
|
1541
1680
|
});
|
|
1542
1681
|
}
|
|
1682
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
1683
|
+
var ticketManagerState = plainObject(ticketAutomation.manager || ticket.manager);
|
|
1684
|
+
var rootCauseEntryContract = evidenceObject(job.supportRootCauseEntryContract, job.support_root_cause_entry_contract, job.rootCauseEntryContract, ticket.supportRootCauseEntryContract, ticket.rootCauseEntryContract, ticketManagerState.root_cause_entry_contract, ticketManagerState.rootCauseEntryContract, evidence.rootCauseEntryContract, evidence.root_cause_entry_contract);
|
|
1685
|
+
var rootCauseEntryContractGate = supportRootCauseEntryContractGate(rootCauseEntryContract, input.now);
|
|
1686
|
+
if (rootCauseEntryContractGate) {
|
|
1687
|
+
gates.push(rootCauseEntryContractGate);
|
|
1688
|
+
pushEvent(events, {
|
|
1689
|
+
type: 'log',
|
|
1690
|
+
category: 'support_root_cause_entry_contract',
|
|
1691
|
+
message: rootCauseEntryContractGate.reason,
|
|
1692
|
+
artifactPaths: rootCauseEntryContractGate.evidenceRefs,
|
|
1693
|
+
recordedAt: rootCauseEntryContractGate.recordedAt,
|
|
1694
|
+
metadata: rootCauseEntryContractGate.metadata
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1543
1697
|
var cost = collectUsageEvents(asArray(input.usageLedger), events);
|
|
1544
1698
|
var diagnosisGate = evidenceObject(job.supportV5DiagnosisGate, job.support_v5_diagnosis_gate, job.diagnosisGate, ticket.supportV5DiagnosisGate, ticket.diagnosisGate, evidence.diagnosisGate, evidence.supportV5DiagnosisGate);
|
|
1545
1699
|
var qa = applySupportDiagnosisProofGate(buildQaFromEvidence(evidence, input.now), diagnosisGate, input.now);
|
|
@@ -1582,11 +1736,20 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
1582
1736
|
metadata: {
|
|
1583
1737
|
versionCount: asArray(input.versions).length,
|
|
1584
1738
|
buildPlanCount: asArray(input.buildPlans).length,
|
|
1739
|
+
rootCauseEntryContract: Object.keys(rootCauseEntryContract).length ? {
|
|
1740
|
+
contractId: cleanText(rootCauseEntryContract.contract_id || rootCauseEntryContract.contractId, 160),
|
|
1741
|
+
version: cleanText(rootCauseEntryContract.version, 120),
|
|
1742
|
+
status: cleanText(rootCauseEntryContract.status, 120),
|
|
1743
|
+
issueClassProbeCount: asArray(rootCauseEntryContract.issue_class_probes || rootCauseEntryContract.issueClassProbes).length,
|
|
1744
|
+
ownerFileMax: Number(((_e = rootCauseEntryContract.owner_file_policy) === null || _e === void 0 ? void 0 : _e.max_files) || ((_f = rootCauseEntryContract.ownerFilePolicy) === null || _f === void 0 ? void 0 : _f.maxFiles) || 0) || 0,
|
|
1745
|
+
requiresBusinessAssertion: ((_g = rootCauseEntryContract.business_proof_policy) === null || _g === void 0 ? void 0 : _g.requires_aiqa_business_assertion) === true
|
|
1746
|
+
|| ((_h = rootCauseEntryContract.businessProofPolicy) === null || _h === void 0 ? void 0 : _h.requiresAiqaBusinessAssertion) === true
|
|
1747
|
+
} : undefined,
|
|
1585
1748
|
diagnosis: Object.keys(diagnosisGate).length ? {
|
|
1586
1749
|
status: cleanText(diagnosisGate.status, 80),
|
|
1587
1750
|
issueClass: diagnosisIssueClass,
|
|
1588
1751
|
ownerFiles: diagnosisOwnerFiles,
|
|
1589
|
-
acceptedHypothesis: cleanText(((
|
|
1752
|
+
acceptedHypothesis: cleanText(((_j = diagnosisGate.accepted_hypothesis) === null || _j === void 0 ? void 0 : _j.statement) || ((_k = diagnosisGate.acceptedHypothesis) === null || _k === void 0 ? void 0 : _k.statement), 1000),
|
|
1590
1753
|
proofPlan: diagnosisGate.proof_plan || diagnosisGate.proofPlan
|
|
1591
1754
|
} : undefined,
|
|
1592
1755
|
businessProofReadiness: Object.keys(businessProofReadiness).length ? {
|
|
@@ -1601,12 +1764,12 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
1601
1764
|
canDraftCustomerReply: customerReplyPolicy.canDraftCustomerReply === true || customerReplyPolicy.can_draft_customer_reply === true,
|
|
1602
1765
|
canSendCustomerReply: customerReplyPolicy.canSendCustomerReply === true || customerReplyPolicy.can_send_customer_reply === true,
|
|
1603
1766
|
reason: cleanText(customerReplyPolicy.reason, 1000),
|
|
1604
|
-
reviewType: cleanText(((
|
|
1605
|
-
|| ((
|
|
1606
|
-
|| ((
|
|
1607
|
-
primaryAction: cleanText(((
|
|
1608
|
-
|| ((
|
|
1609
|
-
|| ((
|
|
1767
|
+
reviewType: cleanText(((_l = customerReplyPolicy.humanReviewPacket) === null || _l === void 0 ? void 0 : _l.reviewType)
|
|
1768
|
+
|| ((_m = customerReplyPolicy.human_review_packet) === null || _m === void 0 ? void 0 : _m.review_type)
|
|
1769
|
+
|| ((_o = customerReplyPolicy.human_review_packet) === null || _o === void 0 ? void 0 : _o.reviewType), 160),
|
|
1770
|
+
primaryAction: cleanText(((_p = customerReplyPolicy.humanReviewPacket) === null || _p === void 0 ? void 0 : _p.primaryAction)
|
|
1771
|
+
|| ((_q = customerReplyPolicy.human_review_packet) === null || _q === void 0 ? void 0 : _q.primary_action)
|
|
1772
|
+
|| ((_r = customerReplyPolicy.human_review_packet) === null || _r === void 0 ? void 0 : _r.primaryAction), 160)
|
|
1610
1773
|
} : undefined
|
|
1611
1774
|
}
|
|
1612
1775
|
});
|