@resolveio/server-lib 22.3.154 → 22.3.156

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.
@@ -81,6 +81,18 @@ export interface ResolveIOSupportDiagnosisGateValidation {
81
81
  status: ResolveIOSupportDiagnosisGateStatus;
82
82
  blockers: string[];
83
83
  normalized?: ResolveIOSupportDiagnosisGate;
84
+ evidenceQuality?: ResolveIOSupportDiagnosisEvidenceQuality;
85
+ }
86
+ export interface ResolveIOSupportDiagnosisEvidenceQuality {
87
+ valid: boolean;
88
+ blockers: string[];
89
+ evidenceTypes: ResolveIOSupportDiagnosisEvidence['type'][];
90
+ reproductionEvidenceTypes: ResolveIOSupportDiagnosisEvidence['type'][];
91
+ rootCauseEvidenceTypes: ResolveIOSupportDiagnosisEvidence['type'][];
92
+ artifactBackedEvidenceCount: number;
93
+ hasTicketContext: boolean;
94
+ hasRootCauseEvidence: boolean;
95
+ hasReproductionEvidence: boolean;
84
96
  }
85
97
  export type ResolveIOSupportCustomerReplyAction = 'draft_resolution_reply' | 'ask_clarification' | 'hold_internal';
86
98
  export interface ResolveIOSupportCustomerReplyPolicyInput {
@@ -362,6 +374,7 @@ export interface ResolveIOSupportV5ContinuationDecision {
362
374
  recoveryEvidenceProbe: ResolveIOAIManagerRecoveryEvidenceProbe;
363
375
  recoveryAction: ResolveIOAIManagerRecoveryActionPacket;
364
376
  }
377
+ export declare function evaluateResolveIOSupportDiagnosisEvidenceQuality(value: any): ResolveIOSupportDiagnosisEvidenceQuality;
365
378
  export declare function normalizeResolveIOSupportDiagnosisGate(value: any, now?: Date | string): ResolveIOSupportDiagnosisGate | undefined;
366
379
  export declare function extractResolveIOSupportDiagnosisGateFromText(value: string, now?: Date | string): ResolveIOSupportDiagnosisGate | undefined;
367
380
  export declare function validateResolveIOSupportDiagnosisGate(value: any, options?: {
@@ -47,6 +47,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
47
47
  return to.concat(ar || Array.prototype.slice.call(from));
48
48
  };
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.evaluateResolveIOSupportDiagnosisEvidenceQuality = evaluateResolveIOSupportDiagnosisEvidenceQuality;
50
51
  exports.normalizeResolveIOSupportDiagnosisGate = normalizeResolveIOSupportDiagnosisGate;
51
52
  exports.extractResolveIOSupportDiagnosisGateFromText = extractResolveIOSupportDiagnosisGateFromText;
52
53
  exports.validateResolveIOSupportDiagnosisGate = validateResolveIOSupportDiagnosisGate;
@@ -276,6 +277,73 @@ function proofPlanLooksRouteOnly(proofPlan) {
276
277
  var businessSignal = /\b(save|saved|persist|persisted|create|created|update|updated|delete|deleted|filter|filtered|exclude|excluded|include|included|row|rows|record|records|count|counts|total|totals|value|values|data|mongo|query|result|results|invoice|pdf|export|download|upload|import|dropdown|selection|selected|form|submit|submitted|validation|error message|customer|account|user|permission|auth|control|button|status|calculation|performance|duration|latency)\b/.test(assertionText);
277
278
  return routeOnlySignal && !businessSignal;
278
279
  }
280
+ var SUPPORT_REPRODUCTION_EVIDENCE_TYPES = new Set(['browser', 'mongo', 'log', 'qa']);
281
+ var SUPPORT_ROOT_CAUSE_EVIDENCE_TYPES = new Set(['browser', 'mongo', 'log', 'code', 'commit', 'qa']);
282
+ var SUPPORT_ARTIFACT_RECOMMENDED_EVIDENCE_TYPES = new Set(['browser', 'mongo', 'log', 'qa']);
283
+ function evaluateResolveIOSupportDiagnosisEvidenceQuality(value) {
284
+ var normalized = normalizeResolveIOSupportDiagnosisGate(value);
285
+ if (!normalized) {
286
+ return {
287
+ valid: false,
288
+ blockers: ['SupportDiagnosisGate is missing.'],
289
+ evidenceTypes: [],
290
+ reproductionEvidenceTypes: [],
291
+ rootCauseEvidenceTypes: [],
292
+ artifactBackedEvidenceCount: 0,
293
+ hasTicketContext: false,
294
+ hasRootCauseEvidence: false,
295
+ hasReproductionEvidence: false
296
+ };
297
+ }
298
+ var evidence = normalized.evidence || [];
299
+ var evidenceTypes = Array.from(new Set(evidence.map(function (entry) { return entry.type; })));
300
+ var reproductionEvidenceTypes = Array.from(new Set(evidence
301
+ .filter(function (entry) { return SUPPORT_REPRODUCTION_EVIDENCE_TYPES.has(entry.type); })
302
+ .map(function (entry) { return entry.type; })));
303
+ var rootCauseEvidenceTypes = Array.from(new Set(evidence
304
+ .filter(function (entry) { return SUPPORT_ROOT_CAUSE_EVIDENCE_TYPES.has(entry.type); })
305
+ .map(function (entry) { return entry.type; })));
306
+ var artifactBackedEvidenceCount = evidence.filter(function (entry) { return !!entry.artifactPath; }).length;
307
+ var hasTicketContext = evidence.some(function (entry) { return entry.type === 'ticket'; })
308
+ || Boolean(normalized.issue_case.customer_complaint && normalized.issue_case.account_customer_context);
309
+ var hasRootCauseEvidence = rootCauseEvidenceTypes.length > 0;
310
+ var hasReproductionEvidence = reproductionEvidenceTypes.length > 0;
311
+ var blockers = [];
312
+ if (!evidence.length) {
313
+ blockers.push('Diagnosis evidence must include typed ticket/code/browser/log/Mongo/QA proof.');
314
+ }
315
+ if (!hasRootCauseEvidence) {
316
+ blockers.push('Diagnosis evidence must include at least one non-ticket root-cause proof item: code, commit, browser, Mongo, log, or QA.');
317
+ }
318
+ if (!hasTicketContext) {
319
+ blockers.push('Diagnosis evidence must preserve the customer/ticket context used for reproduction.');
320
+ }
321
+ if (normalized.issue_case.reproduction_status === 'reproduced' && !hasReproductionEvidence) {
322
+ blockers.push('Diagnosis reproduced issue_case requires browser, Mongo, log, or QA reproduction evidence before repair.');
323
+ }
324
+ if (normalized.issue_case.reproduction_status === 'blocked'
325
+ && !normalized.issue_case.reproduction_blocker) {
326
+ blockers.push('Diagnosis blocked reproduction requires issue_case.reproduction_blocker.');
327
+ }
328
+ var unartifactedRuntimeEvidence = evidence.filter(function (entry) { return SUPPORT_ARTIFACT_RECOMMENDED_EVIDENCE_TYPES.has(entry.type) && !entry.artifactPath; });
329
+ if (unartifactedRuntimeEvidence.length) {
330
+ blockers.push("Diagnosis runtime evidence must include artifactPath for replayable proof: ".concat(unartifactedRuntimeEvidence.map(function (entry) { return entry.type; }).join(', '), "."));
331
+ }
332
+ if (normalized.issue_case.reproduction_status === 'reproduced' && artifactBackedEvidenceCount < 1) {
333
+ blockers.push('Diagnosis reproduced issue_case requires at least one artifact-backed evidence item.');
334
+ }
335
+ return {
336
+ valid: blockers.length === 0,
337
+ blockers: blockers,
338
+ evidenceTypes: evidenceTypes,
339
+ reproductionEvidenceTypes: reproductionEvidenceTypes,
340
+ rootCauseEvidenceTypes: rootCauseEvidenceTypes,
341
+ artifactBackedEvidenceCount: artifactBackedEvidenceCount,
342
+ hasTicketContext: hasTicketContext,
343
+ hasRootCauseEvidence: hasRootCauseEvidence,
344
+ hasReproductionEvidence: hasReproductionEvidence
345
+ };
346
+ }
279
347
  function normalizeResolveIOSupportDiagnosisGate(value, now) {
280
348
  var source = cleanObject(value);
281
349
  if (!Object.keys(source).length) {
@@ -479,12 +547,15 @@ function validateResolveIOSupportDiagnosisGate(value, options) {
479
547
  if (!normalized.evidence.length) {
480
548
  blockers.push('Diagnosis evidence must include ticket/code/browser/log/Mongo proof.');
481
549
  }
550
+ var evidenceQuality = evaluateResolveIOSupportDiagnosisEvidenceQuality(normalized);
551
+ blockers.push.apply(blockers, __spreadArray([], __read(evidenceQuality.blockers), false));
482
552
  normalized.status = blockers.length ? 'incomplete' : 'passed';
483
553
  return {
484
554
  valid: blockers.length === 0,
485
555
  status: normalized.status,
486
556
  blockers: blockers,
487
- normalized: normalized
557
+ normalized: normalized,
558
+ evidenceQuality: evidenceQuality
488
559
  };
489
560
  }
490
561
  function normalizeSupportConfidenceLevel(value) {
@@ -1511,6 +1582,9 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
1511
1582
  '{"support_diagnosis_gate":{"issue_case":{"customer_complaint":"","expected_result":"","observed_result":"","route_module":"","account_customer_context":"","reproduction_status":"reproduced|blocked|classified","reproduction_blocker":""},"issue_class":"no_op_submit|missing_wrong_data|filter_query_mismatch|invoice_pdf_export|upload_import|route_auth_hydration|slow_query_performance","accepted_hypothesis":{"statement":"","falsifiable_test":"","evidence":[""]},"rejected_alternatives":[""],"failing_path":{"frontend":"","backend":"","shared_library":"","data_query":"","description":""},"owner_files":["small/exact/file.ts"],"proof_plan":{"before":"","before_state_unavailable_reason":"","action":"","after":"","business_assertion":"","route":"","data_assertion":"","artifact_expectation":"","business_proof_contract":{"issue_class":"same as diagnosis issue_class","setup_state":"","action_under_test":"","expected_business_state_change":"","prohibited_false_pass":"Route load, screenshot, scorecard, or model claim alone is not acceptance.","proof_artifacts":["browser trace/screenshot/json/mongo delta"],"data_or_dom_assertion":""}},"similar_tickets":[],"similar_commits":[],"evidence":[{"type":"ticket|browser|mongo|log|code|commit|qa|other","summary":"","artifactPath":""}],"status":"passed"}}',
1512
1583
  'Owner files must be a small exact editable set, not directories, globs, generated wrappers, or broad repo areas.',
1513
1584
  'The accepted hypothesis must be falsifiable and backed by evidence; prior similar tickets or commits are hints only and cannot bypass fresh diagnosis.',
1585
+ 'For reproduction_status="reproduced", evidence must include at least one browser, Mongo, log, or QA evidence object with artifactPath so the runner can replay the proof.',
1586
+ 'For reproduction_status="classified", evidence must still include non-ticket root-cause proof such as code, commit, Mongo, log, browser, or QA evidence.',
1587
+ 'Ticket text and similar-ticket hints are context, not root-cause proof by themselves.',
1514
1588
  'The proof plan must be before/action/after business proof plus business_proof_contract. If before-state proof is impossible, explain exactly why in before_state_unavailable_reason.',
1515
1589
  'The business_proof_contract must name the setup state, action under test, expected business state change, prohibited false pass, required artifacts, and DOM/data assertion.'
1516
1590
  ].join('\n')