@replay-kit/core 0.0.1

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.
Files changed (151) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -0
  3. package/dist/app_event.cjs +4 -0
  4. package/dist/app_event.d.cts +7 -0
  5. package/dist/app_event.d.ts +7 -0
  6. package/dist/app_event.js +4 -0
  7. package/dist/cli.cjs +46 -0
  8. package/dist/cli.d.cts +1 -0
  9. package/dist/cli.d.ts +1 -0
  10. package/dist/cli.js +46 -0
  11. package/dist/enum/index.cjs +1 -0
  12. package/dist/enum/index.d.cts +1 -0
  13. package/dist/enum/index.d.ts +1 -0
  14. package/dist/enum/index.js +1 -0
  15. package/dist/enum/log_level.enum.cjs +1 -0
  16. package/dist/enum/log_level.enum.d.cts +7 -0
  17. package/dist/enum/log_level.enum.d.ts +7 -0
  18. package/dist/enum/log_level.enum.js +1 -0
  19. package/dist/error_handle.helper-CQsPSbuz.d.cts +75 -0
  20. package/dist/error_handle.helper-CQsPSbuz.d.ts +75 -0
  21. package/dist/helper/crypto.helper.cjs +1 -0
  22. package/dist/helper/crypto.helper.d.cts +3 -0
  23. package/dist/helper/crypto.helper.d.ts +3 -0
  24. package/dist/helper/crypto.helper.js +1 -0
  25. package/dist/helper/error_handle.helper.cjs +3 -0
  26. package/dist/helper/error_handle.helper.d.cts +2 -0
  27. package/dist/helper/error_handle.helper.d.ts +2 -0
  28. package/dist/helper/error_handle.helper.js +3 -0
  29. package/dist/helper/index.cjs +4 -0
  30. package/dist/helper/index.d.cts +4 -0
  31. package/dist/helper/index.d.ts +4 -0
  32. package/dist/helper/index.js +4 -0
  33. package/dist/helper/stack.helper.cjs +2 -0
  34. package/dist/helper/stack.helper.d.cts +9 -0
  35. package/dist/helper/stack.helper.d.ts +9 -0
  36. package/dist/helper/stack.helper.js +2 -0
  37. package/dist/index-8u1_ya-u.d.ts +36 -0
  38. package/dist/index-MBKv_hsI.d.cts +36 -0
  39. package/dist/index.cjs +4 -0
  40. package/dist/index.d.cts +7 -0
  41. package/dist/index.d.ts +7 -0
  42. package/dist/index.js +4 -0
  43. package/dist/logger/actions/index.cjs +3 -0
  44. package/dist/logger/actions/index.d.cts +4 -0
  45. package/dist/logger/actions/index.d.ts +4 -0
  46. package/dist/logger/actions/index.js +3 -0
  47. package/dist/logger/actions/record.action.cjs +2 -0
  48. package/dist/logger/actions/record.action.d.cts +4 -0
  49. package/dist/logger/actions/record.action.d.ts +4 -0
  50. package/dist/logger/actions/record.action.js +2 -0
  51. package/dist/logger/actions/view_many.action.cjs +2 -0
  52. package/dist/logger/actions/view_many.action.d.cts +4 -0
  53. package/dist/logger/actions/view_many.action.d.ts +4 -0
  54. package/dist/logger/actions/view_many.action.js +2 -0
  55. package/dist/logger/handler.cjs +3 -0
  56. package/dist/logger/handler.d.cts +4 -0
  57. package/dist/logger/handler.d.ts +4 -0
  58. package/dist/logger/handler.js +3 -0
  59. package/dist/logger/index.cjs +3 -0
  60. package/dist/logger/index.d.cts +4 -0
  61. package/dist/logger/index.d.ts +4 -0
  62. package/dist/logger/index.js +3 -0
  63. package/dist/replay/base.cjs +1 -0
  64. package/dist/replay/base.d.cts +18 -0
  65. package/dist/replay/base.d.ts +18 -0
  66. package/dist/replay/base.js +1 -0
  67. package/dist/replay/handler.cjs +25 -0
  68. package/dist/replay/handler.d.cts +24 -0
  69. package/dist/replay/handler.d.ts +24 -0
  70. package/dist/replay/handler.js +25 -0
  71. package/dist/replay/helper.cjs +1 -0
  72. package/dist/replay/helper.d.cts +34 -0
  73. package/dist/replay/helper.d.ts +34 -0
  74. package/dist/replay/helper.js +1 -0
  75. package/dist/replay/index.cjs +25 -0
  76. package/dist/replay/index.d.cts +6 -0
  77. package/dist/replay/index.d.ts +6 -0
  78. package/dist/replay/index.js +25 -0
  79. package/dist/replay/mode/advance/index.cjs +22 -0
  80. package/dist/replay/mode/advance/index.d.cts +11 -0
  81. package/dist/replay/mode/advance/index.d.ts +11 -0
  82. package/dist/replay/mode/advance/index.js +22 -0
  83. package/dist/replay/mode/advance/reasons/assigner_cases/base.cjs +14 -0
  84. package/dist/replay/mode/advance/reasons/assigner_cases/base.d.cts +137 -0
  85. package/dist/replay/mode/advance/reasons/assigner_cases/base.d.ts +137 -0
  86. package/dist/replay/mode/advance/reasons/assigner_cases/base.js +14 -0
  87. package/dist/replay/mode/advance/reasons/assigner_cases/business_logic_rejection_case/index.cjs +14 -0
  88. package/dist/replay/mode/advance/reasons/assigner_cases/business_logic_rejection_case/index.d.cts +19 -0
  89. package/dist/replay/mode/advance/reasons/assigner_cases/business_logic_rejection_case/index.d.ts +19 -0
  90. package/dist/replay/mode/advance/reasons/assigner_cases/business_logic_rejection_case/index.js +14 -0
  91. package/dist/replay/mode/advance/reasons/assigner_cases/index.cjs +14 -0
  92. package/dist/replay/mode/advance/reasons/assigner_cases/index.d.cts +15 -0
  93. package/dist/replay/mode/advance/reasons/assigner_cases/index.d.ts +15 -0
  94. package/dist/replay/mode/advance/reasons/assigner_cases/index.js +14 -0
  95. package/dist/replay/mode/advance/reasons/assigner_cases/post_trace_response_mutation_case/index.cjs +14 -0
  96. package/dist/replay/mode/advance/reasons/assigner_cases/post_trace_response_mutation_case/index.d.cts +18 -0
  97. package/dist/replay/mode/advance/reasons/assigner_cases/post_trace_response_mutation_case/index.d.ts +18 -0
  98. package/dist/replay/mode/advance/reasons/assigner_cases/post_trace_response_mutation_case/index.js +14 -0
  99. package/dist/replay/mode/advance/reasons/assigner_cases/trace_divergence_case/index.cjs +14 -0
  100. package/dist/replay/mode/advance/reasons/assigner_cases/trace_divergence_case/index.d.cts +18 -0
  101. package/dist/replay/mode/advance/reasons/assigner_cases/trace_divergence_case/index.d.ts +18 -0
  102. package/dist/replay/mode/advance/reasons/assigner_cases/trace_divergence_case/index.js +14 -0
  103. package/dist/replay/mode/advance/reasons/index.cjs +21 -0
  104. package/dist/replay/mode/advance/reasons/index.d.cts +17 -0
  105. package/dist/replay/mode/advance/reasons/index.d.ts +17 -0
  106. package/dist/replay/mode/advance/reasons/index.js +21 -0
  107. package/dist/replay/mode/advance/reasons/reason_assigner.cjs +14 -0
  108. package/dist/replay/mode/advance/reasons/reason_assigner.d.cts +25 -0
  109. package/dist/replay/mode/advance/reasons/reason_assigner.d.ts +25 -0
  110. package/dist/replay/mode/advance/reasons/reason_assigner.js +14 -0
  111. package/dist/replay/mode/advance/reasons/reason_printer.cjs +8 -0
  112. package/dist/replay/mode/advance/reasons/reason_printer.d.cts +25 -0
  113. package/dist/replay/mode/advance/reasons/reason_printer.d.ts +25 -0
  114. package/dist/replay/mode/advance/reasons/reason_printer.js +8 -0
  115. package/dist/replay/mode/advance/reasons/reason_signal.cjs +1 -0
  116. package/dist/replay/mode/advance/reasons/reason_signal.d.cts +87 -0
  117. package/dist/replay/mode/advance/reasons/reason_signal.d.ts +87 -0
  118. package/dist/replay/mode/advance/reasons/reason_signal.js +1 -0
  119. package/dist/replay/mode/advance/replay.cjs +22 -0
  120. package/dist/replay/mode/advance/replay.d.cts +57 -0
  121. package/dist/replay/mode/advance/replay.d.ts +57 -0
  122. package/dist/replay/mode/advance/replay.js +22 -0
  123. package/dist/replay/mode/index.cjs +25 -0
  124. package/dist/replay/mode/index.d.cts +12 -0
  125. package/dist/replay/mode/index.d.ts +12 -0
  126. package/dist/replay/mode/index.js +25 -0
  127. package/dist/replay/mode/smart.replay.cjs +4 -0
  128. package/dist/replay/mode/smart.replay.d.cts +18 -0
  129. package/dist/replay/mode/smart.replay.d.ts +18 -0
  130. package/dist/replay/mode/smart.replay.js +4 -0
  131. package/dist/setup.cjs +7 -0
  132. package/dist/setup.d.cts +27 -0
  133. package/dist/setup.d.ts +27 -0
  134. package/dist/setup.js +7 -0
  135. package/dist/trace/builder.cjs +1 -0
  136. package/dist/trace/builder.d.cts +6 -0
  137. package/dist/trace/builder.d.ts +6 -0
  138. package/dist/trace/builder.js +1 -0
  139. package/dist/trace/context.cjs +2 -0
  140. package/dist/trace/context.d.cts +2 -0
  141. package/dist/trace/context.d.ts +2 -0
  142. package/dist/trace/context.js +2 -0
  143. package/dist/trace/filter.cjs +1 -0
  144. package/dist/trace/filter.d.cts +21 -0
  145. package/dist/trace/filter.d.ts +21 -0
  146. package/dist/trace/filter.js +1 -0
  147. package/dist/trace/index.cjs +2 -0
  148. package/dist/trace/index.d.cts +7 -0
  149. package/dist/trace/index.d.ts +7 -0
  150. package/dist/trace/index.js +2 -0
  151. package/package.json +81 -0
@@ -0,0 +1,14 @@
1
+ "use strict";var P=Object.create;var c=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var n=(e,t)=>c(e,"name",{value:t,configurable:!0});var T=(e,t)=>{for(var s in t)c(e,s,{get:t[s],enumerable:!0})},d=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of x(t))!M.call(e,a)&&a!==s&&c(e,a,{get:()=>t[a],enumerable:!(r=R(t,a))||r.enumerable});return e};var S=(e,t,s)=>(s=e!=null?P($(e)):{},d(t||!e||!e.__esModule?c(s,"default",{value:e,enumerable:!0}):s,e)),k=e=>d(c({},"__esModule",{value:!0}),e);var O={};T(O,{BusinessLogicRejectionCase:()=>p});module.exports=k(O);var b=S(require("http"),1);var y={trace_step_match:n((e=.1)=>({weight:e,serverity:o(e),message:`trace_match (+${e}) \u2192 trace fully matches replay`}),"trace_step_match"),trace_step_not_match:n((e=.25)=>({weight:e,serverity:o(e),message:`trace_step_not_match (+${e}) \u2192 trace partially matches replay`}),"trace_step_not_match"),trace_return_data_match:n((e=.1)=>({weight:e,serverity:o(e),message:`trace_return_data_match (+${e}) \u2192 trace return data is consistent`}),"trace_return_data_match"),trace_return_data_not_match:n((e=.25)=>({weight:e,serverity:o(e),message:`trace_return_data_not_match (+${e}) \u2192 trace return data is inconsistent`}),"trace_return_data_not_match"),response_match:n((e=.1)=>({weight:e,serverity:o(e),message:`response_match (+${e}) \u2192 response is consistent`}),"response_match"),response_not_match:n((e=.25)=>({weight:e,serverity:o(e),message:`response_not_match (+${e}) \u2192 response is inconsistent`}),"response_not_match"),response_status_match:n((e=.1)=>({weight:e,serverity:o(e),message:`response_status_match (+${e}) \u2192 response status is consistent`}),"response_status_match"),response_status_not_match:n((e=.25)=>({weight:e,serverity:o(e),message:`response_status_not_match (+${e}) \u2192 response status is inconsistent`}),"response_status_not_match"),logic_error_indicator:n((e=.6)=>({weight:e,serverity:o(e),message:`logic_error_indicator (+${e}) \u2192 original response status >= 400 triggered logic flag`}),"logic_error_indicator")},v={trace_match:{value:!0,message:"flow is clean"},trace_not_match:{value:!1,message:"flow is not clean"},trace_step_match:{value:!0,message:"no mismatch"},trace_step_not_match:{value:!1,message:"mismatch"},trace_return_data_match:{value:!0,message:"no mismatch"},trace_return_data_not_match:{value:!1,message:"mismatch"},response_match:{value:!0,message:"no mismatch"},response_not_match:{value:!1,message:"mismatch"}};function o(e){return e>.75?"high":e>.55?"medium":"low"}n(o,"getSignalLevel");var i=S(require("chalk"),1);var m=class{static{n(this,"BaseAssignerCase")}get evidenceSource(){return v}get signalSource(){return y}getTraceDivergenceSection(t){let s=t.traceDiff.issues;if(s.length===0)return"No divergence";let r=`
2
+ `;for(let a of s)a.type==="missing_step"&&(r+=i.default.yellow(`
3
+ * ${a.name}(missing_step):
4
+ `),r+=i.default.green(` \u2192 original: exists
5
+ `),r+=i.default.red(" \u2192 replay: missing"),r+=`
6
+ `),a.type==="extra_step"&&(r+=i.default.yellow(`
7
+ * ${a.name}(extra_step):
8
+ `),r+=i.default.green(` \u2192 original: none
9
+ `),r+=i.default.red(" \u2192 replay: exists"),r+=`
10
+ `);return r.trim()}getMessageEdvidence(t){return`${this.evidenceSource[t].value} (${this.evidenceSource[t].message})`}getStatusEdvidence(t){let s=b.default.STATUS_CODES[t]||"Unknown";return`${t} (${s})`}isTraceMatch(t){return!t.traceDiff.isDifferent}isTraceStepMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="missing_step"||s.type==="extra_step"):!0}isTraceReturnDataMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="trace_return_data_mismatch"):!0}isResponseMatch(t){return!t.responseDiff.isDifferent}isResponseStatusMatch(t){let{originalStatus:s,replayStatus:r}=this.resolveStatus(t);return s===r}resolveStatus(t){return{originalStatus:Number(t.log.response.status),replayStatus:t.replayResultStatus}}getResponseDiffSection(t){let s=t.responseDiff.issues;if(s.length===0)return"No diff";let r=s.length>1?1:0,a=t.responseDiff.issues[r].not_matched;if(!a)return"No diff";let u=a.original||{},_=a.replay||{},D=new Set([...Object.keys(u),...Object.keys(_)]),l=`
11
+ `;for(let g of D){let f=u[g],h=_[g];f!==h&&(l+=i.default.yellow(` * ${g}:
12
+ `),l+=i.default.green(` \u2192 original: ${JSON.stringify(f)}
13
+ `),l+=i.default.red(` \u2192 replay: ${JSON.stringify(h)}
14
+ `))}return l}};var p=class extends m{static{n(this,"BusinessLogicRejectionCase")}condition(t,s){return this.isTraceMatch(t)&&this.isResponseMatch(t)&&s.originalStatus>=400&&s.replayStatus>=400}assign(t){try{let s=this.resolveStatus(t);if(this.condition(t,s)){let r=t.log.trace?.find(u=>u.parentId===null);return{type:"Business Logic Rejection Case (logic_suspicious)",message:"Response indicates error, but execution original and replay result match expected behavior",possibleCauses:["Business rule might not align with actual execution flow","Or validation logic is too strict / misaligned"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),finalResponse:typeof r?.returnData=="object"?JSON.stringify(r.returnData,null,2):r?.returnData},confidence:{signals:{trace_match:this.signalSource.trace_step_match(.3),response_match:this.signalSource.response_match(.3),logic_error_indicator:this.signalSource.logic_error_indicator(.2)},result:0},finalMessage:["This is NOT a runtime bug","This is likely a business logic issue"],references:t.log.stack}}}catch(s){throw s}}};0&&(module.exports={BusinessLogicRejectionCase});
@@ -0,0 +1,19 @@
1
+ import { PrintParams, RootCauseReason } from '../../../replay.cjs';
2
+ import { BaseAssignerCase, ResolveStatus } from '../base.cjs';
3
+ import '../../../../../handler.cjs';
4
+ import '../../../../../../error_handle.helper-CQsPSbuz.cjs';
5
+ import 'async_hooks';
6
+ import '../../../../../../setup.cjs';
7
+ import '../../../../../../index-MBKv_hsI.cjs';
8
+ import '../../../../../../enum/log_level.enum.cjs';
9
+ import '../../../../../base.cjs';
10
+ import '../../../../../../trace/filter.cjs';
11
+ import '../../../../../helper.cjs';
12
+ import '../../reason_signal.cjs';
13
+
14
+ declare class BusinessLogicRejectionCase extends BaseAssignerCase {
15
+ condition(params: PrintParams, resolveStatus: ResolveStatus): boolean;
16
+ assign(params: PrintParams): RootCauseReason | undefined;
17
+ }
18
+
19
+ export { BusinessLogicRejectionCase };
@@ -0,0 +1,19 @@
1
+ import { PrintParams, RootCauseReason } from '../../../replay.js';
2
+ import { BaseAssignerCase, ResolveStatus } from '../base.js';
3
+ import '../../../../../handler.js';
4
+ import '../../../../../../error_handle.helper-CQsPSbuz.js';
5
+ import 'async_hooks';
6
+ import '../../../../../../setup.js';
7
+ import '../../../../../../index-8u1_ya-u.js';
8
+ import '../../../../../../enum/log_level.enum.js';
9
+ import '../../../../../base.js';
10
+ import '../../../../../../trace/filter.js';
11
+ import '../../../../../helper.js';
12
+ import '../../reason_signal.js';
13
+
14
+ declare class BusinessLogicRejectionCase extends BaseAssignerCase {
15
+ condition(params: PrintParams, resolveStatus: ResolveStatus): boolean;
16
+ assign(params: PrintParams): RootCauseReason | undefined;
17
+ }
18
+
19
+ export { BusinessLogicRejectionCase };
@@ -0,0 +1,14 @@
1
+ var y=Object.defineProperty;var a=(e,t)=>y(e,"name",{value:t,configurable:!0});import v from"http";var f={trace_step_match:a((e=.1)=>({weight:e,serverity:i(e),message:`trace_match (+${e}) \u2192 trace fully matches replay`}),"trace_step_match"),trace_step_not_match:a((e=.25)=>({weight:e,serverity:i(e),message:`trace_step_not_match (+${e}) \u2192 trace partially matches replay`}),"trace_step_not_match"),trace_return_data_match:a((e=.1)=>({weight:e,serverity:i(e),message:`trace_return_data_match (+${e}) \u2192 trace return data is consistent`}),"trace_return_data_match"),trace_return_data_not_match:a((e=.25)=>({weight:e,serverity:i(e),message:`trace_return_data_not_match (+${e}) \u2192 trace return data is inconsistent`}),"trace_return_data_not_match"),response_match:a((e=.1)=>({weight:e,serverity:i(e),message:`response_match (+${e}) \u2192 response is consistent`}),"response_match"),response_not_match:a((e=.25)=>({weight:e,serverity:i(e),message:`response_not_match (+${e}) \u2192 response is inconsistent`}),"response_not_match"),response_status_match:a((e=.1)=>({weight:e,serverity:i(e),message:`response_status_match (+${e}) \u2192 response status is consistent`}),"response_status_match"),response_status_not_match:a((e=.25)=>({weight:e,serverity:i(e),message:`response_status_not_match (+${e}) \u2192 response status is inconsistent`}),"response_status_not_match"),logic_error_indicator:a((e=.6)=>({weight:e,serverity:i(e),message:`logic_error_indicator (+${e}) \u2192 original response status >= 400 triggered logic flag`}),"logic_error_indicator")},h={trace_match:{value:!0,message:"flow is clean"},trace_not_match:{value:!1,message:"flow is not clean"},trace_step_match:{value:!0,message:"no mismatch"},trace_step_not_match:{value:!1,message:"mismatch"},trace_return_data_match:{value:!0,message:"no mismatch"},trace_return_data_not_match:{value:!1,message:"mismatch"},response_match:{value:!0,message:"no mismatch"},response_not_match:{value:!1,message:"mismatch"}};function i(e){return e>.75?"high":e>.55?"medium":"low"}a(i,"getSignalLevel");import o from"chalk";var l=class{static{a(this,"BaseAssignerCase")}get evidenceSource(){return h}get signalSource(){return f}getTraceDivergenceSection(t){let s=t.traceDiff.issues;if(s.length===0)return"No divergence";let r=`
2
+ `;for(let n of s)n.type==="missing_step"&&(r+=o.yellow(`
3
+ * ${n.name}(missing_step):
4
+ `),r+=o.green(` \u2192 original: exists
5
+ `),r+=o.red(" \u2192 replay: missing"),r+=`
6
+ `),n.type==="extra_step"&&(r+=o.yellow(`
7
+ * ${n.name}(extra_step):
8
+ `),r+=o.green(` \u2192 original: none
9
+ `),r+=o.red(" \u2192 replay: exists"),r+=`
10
+ `);return r.trim()}getMessageEdvidence(t){return`${this.evidenceSource[t].value} (${this.evidenceSource[t].message})`}getStatusEdvidence(t){let s=v.STATUS_CODES[t]||"Unknown";return`${t} (${s})`}isTraceMatch(t){return!t.traceDiff.isDifferent}isTraceStepMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="missing_step"||s.type==="extra_step"):!0}isTraceReturnDataMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="trace_return_data_mismatch"):!0}isResponseMatch(t){return!t.responseDiff.isDifferent}isResponseStatusMatch(t){let{originalStatus:s,replayStatus:r}=this.resolveStatus(t);return s===r}resolveStatus(t){return{originalStatus:Number(t.log.response.status),replayStatus:t.replayResultStatus}}getResponseDiffSection(t){let s=t.responseDiff.issues;if(s.length===0)return"No diff";let r=s.length>1?1:0,n=t.responseDiff.issues[r].not_matched;if(!n)return"No diff";let c=n.original||{},g=n.replay||{},S=new Set([...Object.keys(c),...Object.keys(g)]),u=`
11
+ `;for(let m of S){let p=c[m],_=g[m];p!==_&&(u+=o.yellow(` * ${m}:
12
+ `),u+=o.green(` \u2192 original: ${JSON.stringify(p)}
13
+ `),u+=o.red(` \u2192 replay: ${JSON.stringify(_)}
14
+ `))}return u}};var d=class extends l{static{a(this,"BusinessLogicRejectionCase")}condition(t,s){return this.isTraceMatch(t)&&this.isResponseMatch(t)&&s.originalStatus>=400&&s.replayStatus>=400}assign(t){try{let s=this.resolveStatus(t);if(this.condition(t,s)){let r=t.log.trace?.find(c=>c.parentId===null);return{type:"Business Logic Rejection Case (logic_suspicious)",message:"Response indicates error, but execution original and replay result match expected behavior",possibleCauses:["Business rule might not align with actual execution flow","Or validation logic is too strict / misaligned"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),finalResponse:typeof r?.returnData=="object"?JSON.stringify(r.returnData,null,2):r?.returnData},confidence:{signals:{trace_match:this.signalSource.trace_step_match(.3),response_match:this.signalSource.response_match(.3),logic_error_indicator:this.signalSource.logic_error_indicator(.2)},result:0},finalMessage:["This is NOT a runtime bug","This is likely a business logic issue"],references:t.log.stack}}}catch(s){throw s}}};export{d as BusinessLogicRejectionCase};
@@ -0,0 +1,14 @@
1
+ "use strict";var P=Object.create;var u=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var a=(t,e)=>u(t,"name",{value:e,configurable:!0});var E=(t,e)=>{for(var s in e)u(t,s,{get:e[s],enumerable:!0})},y=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of T(e))!C.call(t,n)&&n!==s&&u(t,n,{get:()=>e[n],enumerable:!(r=M(e,n))||r.enumerable});return t};var v=(t,e,s)=>(s=t!=null?P($(t)):{},y(e||!t||!t.__esModule?u(s,"default",{value:t,enumerable:!0}):s,t)),k=t=>y(u({},"__esModule",{value:!0}),t);var w={};E(w,{BusinessLogicRejectionCase:()=>h,PostTraceResponseMutationCase:()=>p,TraceDivergenceCase:()=>f});module.exports=k(w);var D=v(require("http"),1);var b={trace_step_match:a((t=.1)=>({weight:t,serverity:o(t),message:`trace_match (+${t}) \u2192 trace fully matches replay`}),"trace_step_match"),trace_step_not_match:a((t=.25)=>({weight:t,serverity:o(t),message:`trace_step_not_match (+${t}) \u2192 trace partially matches replay`}),"trace_step_not_match"),trace_return_data_match:a((t=.1)=>({weight:t,serverity:o(t),message:`trace_return_data_match (+${t}) \u2192 trace return data is consistent`}),"trace_return_data_match"),trace_return_data_not_match:a((t=.25)=>({weight:t,serverity:o(t),message:`trace_return_data_not_match (+${t}) \u2192 trace return data is inconsistent`}),"trace_return_data_not_match"),response_match:a((t=.1)=>({weight:t,serverity:o(t),message:`response_match (+${t}) \u2192 response is consistent`}),"response_match"),response_not_match:a((t=.25)=>({weight:t,serverity:o(t),message:`response_not_match (+${t}) \u2192 response is inconsistent`}),"response_not_match"),response_status_match:a((t=.1)=>({weight:t,serverity:o(t),message:`response_status_match (+${t}) \u2192 response status is consistent`}),"response_status_match"),response_status_not_match:a((t=.25)=>({weight:t,serverity:o(t),message:`response_status_not_match (+${t}) \u2192 response status is inconsistent`}),"response_status_not_match"),logic_error_indicator:a((t=.6)=>({weight:t,serverity:o(t),message:`logic_error_indicator (+${t}) \u2192 original response status >= 400 triggered logic flag`}),"logic_error_indicator")},R={trace_match:{value:!0,message:"flow is clean"},trace_not_match:{value:!1,message:"flow is not clean"},trace_step_match:{value:!0,message:"no mismatch"},trace_step_not_match:{value:!1,message:"mismatch"},trace_return_data_match:{value:!0,message:"no mismatch"},trace_return_data_not_match:{value:!1,message:"mismatch"},response_match:{value:!0,message:"no mismatch"},response_not_match:{value:!1,message:"mismatch"}};function o(t){return t>.75?"high":t>.55?"medium":"low"}a(o,"getSignalLevel");var i=v(require("chalk"),1);var c=class{static{a(this,"BaseAssignerCase")}get evidenceSource(){return R}get signalSource(){return b}getTraceDivergenceSection(e){let s=e.traceDiff.issues;if(s.length===0)return"No divergence";let r=`
2
+ `;for(let n of s)n.type==="missing_step"&&(r+=i.default.yellow(`
3
+ * ${n.name}(missing_step):
4
+ `),r+=i.default.green(` \u2192 original: exists
5
+ `),r+=i.default.red(" \u2192 replay: missing"),r+=`
6
+ `),n.type==="extra_step"&&(r+=i.default.yellow(`
7
+ * ${n.name}(extra_step):
8
+ `),r+=i.default.green(` \u2192 original: none
9
+ `),r+=i.default.red(" \u2192 replay: exists"),r+=`
10
+ `);return r.trim()}getMessageEdvidence(e){return`${this.evidenceSource[e].value} (${this.evidenceSource[e].message})`}getStatusEdvidence(e){let s=D.default.STATUS_CODES[e]||"Unknown";return`${e} (${s})`}isTraceMatch(e){return!e.traceDiff.isDifferent}isTraceStepMatch(e){return e.traceDiff.issues.length>0?!e.traceDiff.issues.some(s=>s.type==="missing_step"||s.type==="extra_step"):!0}isTraceReturnDataMatch(e){return e.traceDiff.issues.length>0?!e.traceDiff.issues.some(s=>s.type==="trace_return_data_mismatch"):!0}isResponseMatch(e){return!e.responseDiff.isDifferent}isResponseStatusMatch(e){let{originalStatus:s,replayStatus:r}=this.resolveStatus(e);return s===r}resolveStatus(e){return{originalStatus:Number(e.log.response.status),replayStatus:e.replayResultStatus}}getResponseDiffSection(e){let s=e.responseDiff.issues;if(s.length===0)return"No diff";let r=s.length>1?1:0,n=e.responseDiff.issues[r].not_matched;if(!n)return"No diff";let l=n.original||{},_=n.replay||{},x=new Set([...Object.keys(l),...Object.keys(_)]),g=`
11
+ `;for(let m of x){let d=l[m],S=_[m];d!==S&&(g+=i.default.yellow(` * ${m}:
12
+ `),g+=i.default.green(` \u2192 original: ${JSON.stringify(d)}
13
+ `),g+=i.default.red(` \u2192 replay: ${JSON.stringify(S)}
14
+ `))}return g}};var h=class extends c{static{a(this,"BusinessLogicRejectionCase")}condition(e,s){return this.isTraceMatch(e)&&this.isResponseMatch(e)&&s.originalStatus>=400&&s.replayStatus>=400}assign(e){try{let s=this.resolveStatus(e);if(this.condition(e,s)){let r=e.log.trace?.find(l=>l.parentId===null);return{type:"Business Logic Rejection Case (logic_suspicious)",message:"Response indicates error, but execution original and replay result match expected behavior",possibleCauses:["Business rule might not align with actual execution flow","Or validation logic is too strict / misaligned"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),finalResponse:typeof r?.returnData=="object"?JSON.stringify(r.returnData,null,2):r?.returnData},confidence:{signals:{trace_match:this.signalSource.trace_step_match(.3),response_match:this.signalSource.response_match(.3),logic_error_indicator:this.signalSource.logic_error_indicator(.2)},result:0},finalMessage:["This is NOT a runtime bug","This is likely a business logic issue"],references:e.log.stack}}}catch(s){throw s}}};var p=class extends c{static{a(this,"PostTraceResponseMutationCase")}assign(e){try{let s=this.resolveStatus(e);if(this.isTraceStepMatch(e)&&!this.isResponseMatch(e)&&this.isTraceReturnDataMatch(e))return{type:"Response Mismatch Case (post_processing_suspicious)",message:"Execution flow is identical, but response output differs",possibleCauses:["Post-processing logic may be inconsistent","Response mapping or transformation may be incorrect","Data changes may affect the final result.","Non-deterministic behavior (e.g. random, time-based, shared state)"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),responseDiff:this.getResponseDiffSection(e)},confidence:{signals:{trace_step_match:this.signalSource.trace_step_match(.3),response_mismatch:this.signalSource.response_not_match(.2),trace_return_data_match:this.signalSource.trace_return_data_match(.3)},result:0},finalMessage:["Execution logic is stable, but output is inconsistent","This may indicate issues in response transformation or side effects","This may occur after the business logic is execute complete."],references:e.log.stack}}catch(s){throw s}}};var f=class extends c{static{a(this,"TraceDivergenceCase")}assign(e){try{let s=this.resolveStatus(e);if(!this.isTraceStepMatch(e)&&!this.isResponseMatch(e)&&!this.isTraceReturnDataMatch(e)&&!this.isResponseStatusMatch(e))return{type:"Trace Divergence Case (execution_path_mismatch)",message:"Execution path diverged between original and replay",possibleCauses:["Conditional branch logic may behave differently","Environment or shared state may affect execution flow","Request context may not be deterministic","Replay execution may enter different logic branches","Hidden dependencies or side effects may exist"],evidence:{traceMatch:this.getMessageEdvidence("trace_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),traceDivergence:this.getTraceDivergenceSection(e),responseDiff:this.getResponseDiffSection(e)},confidence:{signals:{trace_step_not_match:this.signalSource.trace_step_not_match(.45),trace_return_data_not_match:this.signalSource.trace_return_data_not_match(.25),response_not_match:this.signalSource.response_not_match(.15),response_status_not_match:this.signalSource.response_status_not_match(.1)},result:0},finalMessage:["Replay execution diverged from the original execution flow","This may indicate unstable conditions or branch inconsistency","Root cause likely exists before response generation"],references:e.log.stack}}catch(s){throw s}}};0&&(module.exports={BusinessLogicRejectionCase,PostTraceResponseMutationCase,TraceDivergenceCase});
@@ -0,0 +1,15 @@
1
+ export { BusinessLogicRejectionCase } from './business_logic_rejection_case/index.cjs';
2
+ export { PostTraceResponseMutationCase } from './post_trace_response_mutation_case/index.cjs';
3
+ export { TraceDivergenceCase } from './trace_divergence_case/index.cjs';
4
+ import '../../replay.cjs';
5
+ import '../../../../handler.cjs';
6
+ import '../../../../../error_handle.helper-CQsPSbuz.cjs';
7
+ import 'async_hooks';
8
+ import '../../../../../setup.cjs';
9
+ import '../../../../../index-MBKv_hsI.cjs';
10
+ import '../../../../../enum/log_level.enum.cjs';
11
+ import '../../../../base.cjs';
12
+ import '../../../../../trace/filter.cjs';
13
+ import '../../../../helper.cjs';
14
+ import '../reason_signal.cjs';
15
+ import './base.cjs';
@@ -0,0 +1,15 @@
1
+ export { BusinessLogicRejectionCase } from './business_logic_rejection_case/index.js';
2
+ export { PostTraceResponseMutationCase } from './post_trace_response_mutation_case/index.js';
3
+ export { TraceDivergenceCase } from './trace_divergence_case/index.js';
4
+ import '../../replay.js';
5
+ import '../../../../handler.js';
6
+ import '../../../../../error_handle.helper-CQsPSbuz.js';
7
+ import 'async_hooks';
8
+ import '../../../../../setup.js';
9
+ import '../../../../../index-8u1_ya-u.js';
10
+ import '../../../../../enum/log_level.enum.js';
11
+ import '../../../../base.js';
12
+ import '../../../../../trace/filter.js';
13
+ import '../../../../helper.js';
14
+ import '../reason_signal.js';
15
+ import './base.js';
@@ -0,0 +1,14 @@
1
+ var b=Object.defineProperty;var a=(t,e)=>b(t,"name",{value:e,configurable:!0});import R from"http";var f={trace_step_match:a((t=.1)=>({weight:t,serverity:i(t),message:`trace_match (+${t}) \u2192 trace fully matches replay`}),"trace_step_match"),trace_step_not_match:a((t=.25)=>({weight:t,serverity:i(t),message:`trace_step_not_match (+${t}) \u2192 trace partially matches replay`}),"trace_step_not_match"),trace_return_data_match:a((t=.1)=>({weight:t,serverity:i(t),message:`trace_return_data_match (+${t}) \u2192 trace return data is consistent`}),"trace_return_data_match"),trace_return_data_not_match:a((t=.25)=>({weight:t,serverity:i(t),message:`trace_return_data_not_match (+${t}) \u2192 trace return data is inconsistent`}),"trace_return_data_not_match"),response_match:a((t=.1)=>({weight:t,serverity:i(t),message:`response_match (+${t}) \u2192 response is consistent`}),"response_match"),response_not_match:a((t=.25)=>({weight:t,serverity:i(t),message:`response_not_match (+${t}) \u2192 response is inconsistent`}),"response_not_match"),response_status_match:a((t=.1)=>({weight:t,serverity:i(t),message:`response_status_match (+${t}) \u2192 response status is consistent`}),"response_status_match"),response_status_not_match:a((t=.25)=>({weight:t,serverity:i(t),message:`response_status_not_match (+${t}) \u2192 response status is inconsistent`}),"response_status_not_match"),logic_error_indicator:a((t=.6)=>({weight:t,serverity:i(t),message:`logic_error_indicator (+${t}) \u2192 original response status >= 400 triggered logic flag`}),"logic_error_indicator")},_={trace_match:{value:!0,message:"flow is clean"},trace_not_match:{value:!1,message:"flow is not clean"},trace_step_match:{value:!0,message:"no mismatch"},trace_step_not_match:{value:!1,message:"mismatch"},trace_return_data_match:{value:!0,message:"no mismatch"},trace_return_data_not_match:{value:!1,message:"mismatch"},response_match:{value:!0,message:"no mismatch"},response_not_match:{value:!1,message:"mismatch"}};function i(t){return t>.75?"high":t>.55?"medium":"low"}a(i,"getSignalLevel");import o from"chalk";var c=class{static{a(this,"BaseAssignerCase")}get evidenceSource(){return _}get signalSource(){return f}getTraceDivergenceSection(e){let s=e.traceDiff.issues;if(s.length===0)return"No divergence";let r=`
2
+ `;for(let n of s)n.type==="missing_step"&&(r+=o.yellow(`
3
+ * ${n.name}(missing_step):
4
+ `),r+=o.green(` \u2192 original: exists
5
+ `),r+=o.red(" \u2192 replay: missing"),r+=`
6
+ `),n.type==="extra_step"&&(r+=o.yellow(`
7
+ * ${n.name}(extra_step):
8
+ `),r+=o.green(` \u2192 original: none
9
+ `),r+=o.red(" \u2192 replay: exists"),r+=`
10
+ `);return r.trim()}getMessageEdvidence(e){return`${this.evidenceSource[e].value} (${this.evidenceSource[e].message})`}getStatusEdvidence(e){let s=R.STATUS_CODES[e]||"Unknown";return`${e} (${s})`}isTraceMatch(e){return!e.traceDiff.isDifferent}isTraceStepMatch(e){return e.traceDiff.issues.length>0?!e.traceDiff.issues.some(s=>s.type==="missing_step"||s.type==="extra_step"):!0}isTraceReturnDataMatch(e){return e.traceDiff.issues.length>0?!e.traceDiff.issues.some(s=>s.type==="trace_return_data_mismatch"):!0}isResponseMatch(e){return!e.responseDiff.isDifferent}isResponseStatusMatch(e){let{originalStatus:s,replayStatus:r}=this.resolveStatus(e);return s===r}resolveStatus(e){return{originalStatus:Number(e.log.response.status),replayStatus:e.replayResultStatus}}getResponseDiffSection(e){let s=e.responseDiff.issues;if(s.length===0)return"No diff";let r=s.length>1?1:0,n=e.responseDiff.issues[r].not_matched;if(!n)return"No diff";let u=n.original||{},m=n.replay||{},v=new Set([...Object.keys(u),...Object.keys(m)]),l=`
11
+ `;for(let g of v){let h=u[g],p=m[g];h!==p&&(l+=o.yellow(` * ${g}:
12
+ `),l+=o.green(` \u2192 original: ${JSON.stringify(h)}
13
+ `),l+=o.red(` \u2192 replay: ${JSON.stringify(p)}
14
+ `))}return l}};var d=class extends c{static{a(this,"BusinessLogicRejectionCase")}condition(e,s){return this.isTraceMatch(e)&&this.isResponseMatch(e)&&s.originalStatus>=400&&s.replayStatus>=400}assign(e){try{let s=this.resolveStatus(e);if(this.condition(e,s)){let r=e.log.trace?.find(u=>u.parentId===null);return{type:"Business Logic Rejection Case (logic_suspicious)",message:"Response indicates error, but execution original and replay result match expected behavior",possibleCauses:["Business rule might not align with actual execution flow","Or validation logic is too strict / misaligned"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),finalResponse:typeof r?.returnData=="object"?JSON.stringify(r.returnData,null,2):r?.returnData},confidence:{signals:{trace_match:this.signalSource.trace_step_match(.3),response_match:this.signalSource.response_match(.3),logic_error_indicator:this.signalSource.logic_error_indicator(.2)},result:0},finalMessage:["This is NOT a runtime bug","This is likely a business logic issue"],references:e.log.stack}}}catch(s){throw s}}};var S=class extends c{static{a(this,"PostTraceResponseMutationCase")}assign(e){try{let s=this.resolveStatus(e);if(this.isTraceStepMatch(e)&&!this.isResponseMatch(e)&&this.isTraceReturnDataMatch(e))return{type:"Response Mismatch Case (post_processing_suspicious)",message:"Execution flow is identical, but response output differs",possibleCauses:["Post-processing logic may be inconsistent","Response mapping or transformation may be incorrect","Data changes may affect the final result.","Non-deterministic behavior (e.g. random, time-based, shared state)"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),responseDiff:this.getResponseDiffSection(e)},confidence:{signals:{trace_step_match:this.signalSource.trace_step_match(.3),response_mismatch:this.signalSource.response_not_match(.2),trace_return_data_match:this.signalSource.trace_return_data_match(.3)},result:0},finalMessage:["Execution logic is stable, but output is inconsistent","This may indicate issues in response transformation or side effects","This may occur after the business logic is execute complete."],references:e.log.stack}}catch(s){throw s}}};var y=class extends c{static{a(this,"TraceDivergenceCase")}assign(e){try{let s=this.resolveStatus(e);if(!this.isTraceStepMatch(e)&&!this.isResponseMatch(e)&&!this.isTraceReturnDataMatch(e)&&!this.isResponseStatusMatch(e))return{type:"Trace Divergence Case (execution_path_mismatch)",message:"Execution path diverged between original and replay",possibleCauses:["Conditional branch logic may behave differently","Environment or shared state may affect execution flow","Request context may not be deterministic","Replay execution may enter different logic branches","Hidden dependencies or side effects may exist"],evidence:{traceMatch:this.getMessageEdvidence("trace_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),traceDivergence:this.getTraceDivergenceSection(e),responseDiff:this.getResponseDiffSection(e)},confidence:{signals:{trace_step_not_match:this.signalSource.trace_step_not_match(.45),trace_return_data_not_match:this.signalSource.trace_return_data_not_match(.25),response_not_match:this.signalSource.response_not_match(.15),response_status_not_match:this.signalSource.response_status_not_match(.1)},result:0},finalMessage:["Replay execution diverged from the original execution flow","This may indicate unstable conditions or branch inconsistency","Root cause likely exists before response generation"],references:e.log.stack}}catch(s){throw s}}};export{d as BusinessLogicRejectionCase,S as PostTraceResponseMutationCase,y as TraceDivergenceCase};
@@ -0,0 +1,14 @@
1
+ "use strict";var P=Object.create;var c=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var a=(e,t)=>c(e,"name",{value:t,configurable:!0});var T=(e,t)=>{for(var s in t)c(e,s,{get:t[s],enumerable:!0})},d=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of x(t))!M.call(e,n)&&n!==s&&c(e,n,{get:()=>t[n],enumerable:!(r=R(t,n))||r.enumerable});return e};var S=(e,t,s)=>(s=e!=null?P($(e)):{},d(t||!e||!e.__esModule?c(s,"default",{value:e,enumerable:!0}):s,e)),k=e=>d(c({},"__esModule",{value:!0}),e);var E={};T(E,{PostTraceResponseMutationCase:()=>g});module.exports=k(E);var b=S(require("http"),1);var y={trace_step_match:a((e=.1)=>({weight:e,serverity:o(e),message:`trace_match (+${e}) \u2192 trace fully matches replay`}),"trace_step_match"),trace_step_not_match:a((e=.25)=>({weight:e,serverity:o(e),message:`trace_step_not_match (+${e}) \u2192 trace partially matches replay`}),"trace_step_not_match"),trace_return_data_match:a((e=.1)=>({weight:e,serverity:o(e),message:`trace_return_data_match (+${e}) \u2192 trace return data is consistent`}),"trace_return_data_match"),trace_return_data_not_match:a((e=.25)=>({weight:e,serverity:o(e),message:`trace_return_data_not_match (+${e}) \u2192 trace return data is inconsistent`}),"trace_return_data_not_match"),response_match:a((e=.1)=>({weight:e,serverity:o(e),message:`response_match (+${e}) \u2192 response is consistent`}),"response_match"),response_not_match:a((e=.25)=>({weight:e,serverity:o(e),message:`response_not_match (+${e}) \u2192 response is inconsistent`}),"response_not_match"),response_status_match:a((e=.1)=>({weight:e,serverity:o(e),message:`response_status_match (+${e}) \u2192 response status is consistent`}),"response_status_match"),response_status_not_match:a((e=.25)=>({weight:e,serverity:o(e),message:`response_status_not_match (+${e}) \u2192 response status is inconsistent`}),"response_status_not_match"),logic_error_indicator:a((e=.6)=>({weight:e,serverity:o(e),message:`logic_error_indicator (+${e}) \u2192 original response status >= 400 triggered logic flag`}),"logic_error_indicator")},v={trace_match:{value:!0,message:"flow is clean"},trace_not_match:{value:!1,message:"flow is not clean"},trace_step_match:{value:!0,message:"no mismatch"},trace_step_not_match:{value:!1,message:"mismatch"},trace_return_data_match:{value:!0,message:"no mismatch"},trace_return_data_not_match:{value:!1,message:"mismatch"},response_match:{value:!0,message:"no mismatch"},response_not_match:{value:!1,message:"mismatch"}};function o(e){return e>.75?"high":e>.55?"medium":"low"}a(o,"getSignalLevel");var i=S(require("chalk"),1);var l=class{static{a(this,"BaseAssignerCase")}get evidenceSource(){return v}get signalSource(){return y}getTraceDivergenceSection(t){let s=t.traceDiff.issues;if(s.length===0)return"No divergence";let r=`
2
+ `;for(let n of s)n.type==="missing_step"&&(r+=i.default.yellow(`
3
+ * ${n.name}(missing_step):
4
+ `),r+=i.default.green(` \u2192 original: exists
5
+ `),r+=i.default.red(" \u2192 replay: missing"),r+=`
6
+ `),n.type==="extra_step"&&(r+=i.default.yellow(`
7
+ * ${n.name}(extra_step):
8
+ `),r+=i.default.green(` \u2192 original: none
9
+ `),r+=i.default.red(" \u2192 replay: exists"),r+=`
10
+ `);return r.trim()}getMessageEdvidence(t){return`${this.evidenceSource[t].value} (${this.evidenceSource[t].message})`}getStatusEdvidence(t){let s=b.default.STATUS_CODES[t]||"Unknown";return`${t} (${s})`}isTraceMatch(t){return!t.traceDiff.isDifferent}isTraceStepMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="missing_step"||s.type==="extra_step"):!0}isTraceReturnDataMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="trace_return_data_mismatch"):!0}isResponseMatch(t){return!t.responseDiff.isDifferent}isResponseStatusMatch(t){let{originalStatus:s,replayStatus:r}=this.resolveStatus(t);return s===r}resolveStatus(t){return{originalStatus:Number(t.log.response.status),replayStatus:t.replayResultStatus}}getResponseDiffSection(t){let s=t.responseDiff.issues;if(s.length===0)return"No diff";let r=s.length>1?1:0,n=t.responseDiff.issues[r].not_matched;if(!n)return"No diff";let p=n.original||{},f=n.replay||{},D=new Set([...Object.keys(p),...Object.keys(f)]),u=`
11
+ `;for(let m of D){let _=p[m],h=f[m];_!==h&&(u+=i.default.yellow(` * ${m}:
12
+ `),u+=i.default.green(` \u2192 original: ${JSON.stringify(_)}
13
+ `),u+=i.default.red(` \u2192 replay: ${JSON.stringify(h)}
14
+ `))}return u}};var g=class extends l{static{a(this,"PostTraceResponseMutationCase")}assign(t){try{let s=this.resolveStatus(t);if(this.isTraceStepMatch(t)&&!this.isResponseMatch(t)&&this.isTraceReturnDataMatch(t))return{type:"Response Mismatch Case (post_processing_suspicious)",message:"Execution flow is identical, but response output differs",possibleCauses:["Post-processing logic may be inconsistent","Response mapping or transformation may be incorrect","Data changes may affect the final result.","Non-deterministic behavior (e.g. random, time-based, shared state)"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),responseDiff:this.getResponseDiffSection(t)},confidence:{signals:{trace_step_match:this.signalSource.trace_step_match(.3),response_mismatch:this.signalSource.response_not_match(.2),trace_return_data_match:this.signalSource.trace_return_data_match(.3)},result:0},finalMessage:["Execution logic is stable, but output is inconsistent","This may indicate issues in response transformation or side effects","This may occur after the business logic is execute complete."],references:t.log.stack}}catch(s){throw s}}};0&&(module.exports={PostTraceResponseMutationCase});
@@ -0,0 +1,18 @@
1
+ import { PrintParams, RootCauseReason } from '../../../replay.cjs';
2
+ import { BaseAssignerCase } from '../base.cjs';
3
+ import '../../../../../handler.cjs';
4
+ import '../../../../../../error_handle.helper-CQsPSbuz.cjs';
5
+ import 'async_hooks';
6
+ import '../../../../../../setup.cjs';
7
+ import '../../../../../../index-MBKv_hsI.cjs';
8
+ import '../../../../../../enum/log_level.enum.cjs';
9
+ import '../../../../../base.cjs';
10
+ import '../../../../../../trace/filter.cjs';
11
+ import '../../../../../helper.cjs';
12
+ import '../../reason_signal.cjs';
13
+
14
+ declare class PostTraceResponseMutationCase extends BaseAssignerCase {
15
+ assign(params: PrintParams): RootCauseReason | undefined;
16
+ }
17
+
18
+ export { PostTraceResponseMutationCase };
@@ -0,0 +1,18 @@
1
+ import { PrintParams, RootCauseReason } from '../../../replay.js';
2
+ import { BaseAssignerCase } from '../base.js';
3
+ import '../../../../../handler.js';
4
+ import '../../../../../../error_handle.helper-CQsPSbuz.js';
5
+ import 'async_hooks';
6
+ import '../../../../../../setup.js';
7
+ import '../../../../../../index-8u1_ya-u.js';
8
+ import '../../../../../../enum/log_level.enum.js';
9
+ import '../../../../../base.js';
10
+ import '../../../../../../trace/filter.js';
11
+ import '../../../../../helper.js';
12
+ import '../../reason_signal.js';
13
+
14
+ declare class PostTraceResponseMutationCase extends BaseAssignerCase {
15
+ assign(params: PrintParams): RootCauseReason | undefined;
16
+ }
17
+
18
+ export { PostTraceResponseMutationCase };
@@ -0,0 +1,14 @@
1
+ var y=Object.defineProperty;var r=(e,t)=>y(e,"name",{value:t,configurable:!0});import v from"http";var _={trace_step_match:r((e=.1)=>({weight:e,serverity:n(e),message:`trace_match (+${e}) \u2192 trace fully matches replay`}),"trace_step_match"),trace_step_not_match:r((e=.25)=>({weight:e,serverity:n(e),message:`trace_step_not_match (+${e}) \u2192 trace partially matches replay`}),"trace_step_not_match"),trace_return_data_match:r((e=.1)=>({weight:e,serverity:n(e),message:`trace_return_data_match (+${e}) \u2192 trace return data is consistent`}),"trace_return_data_match"),trace_return_data_not_match:r((e=.25)=>({weight:e,serverity:n(e),message:`trace_return_data_not_match (+${e}) \u2192 trace return data is inconsistent`}),"trace_return_data_not_match"),response_match:r((e=.1)=>({weight:e,serverity:n(e),message:`response_match (+${e}) \u2192 response is consistent`}),"response_match"),response_not_match:r((e=.25)=>({weight:e,serverity:n(e),message:`response_not_match (+${e}) \u2192 response is inconsistent`}),"response_not_match"),response_status_match:r((e=.1)=>({weight:e,serverity:n(e),message:`response_status_match (+${e}) \u2192 response status is consistent`}),"response_status_match"),response_status_not_match:r((e=.25)=>({weight:e,serverity:n(e),message:`response_status_not_match (+${e}) \u2192 response status is inconsistent`}),"response_status_not_match"),logic_error_indicator:r((e=.6)=>({weight:e,serverity:n(e),message:`logic_error_indicator (+${e}) \u2192 original response status >= 400 triggered logic flag`}),"logic_error_indicator")},h={trace_match:{value:!0,message:"flow is clean"},trace_not_match:{value:!1,message:"flow is not clean"},trace_step_match:{value:!0,message:"no mismatch"},trace_step_not_match:{value:!1,message:"mismatch"},trace_return_data_match:{value:!0,message:"no mismatch"},trace_return_data_not_match:{value:!1,message:"mismatch"},response_match:{value:!0,message:"no mismatch"},response_not_match:{value:!1,message:"mismatch"}};function n(e){return e>.75?"high":e>.55?"medium":"low"}r(n,"getSignalLevel");import i from"chalk";var u=class{static{r(this,"BaseAssignerCase")}get evidenceSource(){return h}get signalSource(){return _}getTraceDivergenceSection(t){let s=t.traceDiff.issues;if(s.length===0)return"No divergence";let a=`
2
+ `;for(let o of s)o.type==="missing_step"&&(a+=i.yellow(`
3
+ * ${o.name}(missing_step):
4
+ `),a+=i.green(` \u2192 original: exists
5
+ `),a+=i.red(" \u2192 replay: missing"),a+=`
6
+ `),o.type==="extra_step"&&(a+=i.yellow(`
7
+ * ${o.name}(extra_step):
8
+ `),a+=i.green(` \u2192 original: none
9
+ `),a+=i.red(" \u2192 replay: exists"),a+=`
10
+ `);return a.trim()}getMessageEdvidence(t){return`${this.evidenceSource[t].value} (${this.evidenceSource[t].message})`}getStatusEdvidence(t){let s=v.STATUS_CODES[t]||"Unknown";return`${t} (${s})`}isTraceMatch(t){return!t.traceDiff.isDifferent}isTraceStepMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="missing_step"||s.type==="extra_step"):!0}isTraceReturnDataMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="trace_return_data_mismatch"):!0}isResponseMatch(t){return!t.responseDiff.isDifferent}isResponseStatusMatch(t){let{originalStatus:s,replayStatus:a}=this.resolveStatus(t);return s===a}resolveStatus(t){return{originalStatus:Number(t.log.response.status),replayStatus:t.replayResultStatus}}getResponseDiffSection(t){let s=t.responseDiff.issues;if(s.length===0)return"No diff";let a=s.length>1?1:0,o=t.responseDiff.issues[a].not_matched;if(!o)return"No diff";let m=o.original||{},g=o.replay||{},S=new Set([...Object.keys(m),...Object.keys(g)]),c=`
11
+ `;for(let l of S){let p=m[l],f=g[l];p!==f&&(c+=i.yellow(` * ${l}:
12
+ `),c+=i.green(` \u2192 original: ${JSON.stringify(p)}
13
+ `),c+=i.red(` \u2192 replay: ${JSON.stringify(f)}
14
+ `))}return c}};var d=class extends u{static{r(this,"PostTraceResponseMutationCase")}assign(t){try{let s=this.resolveStatus(t);if(this.isTraceStepMatch(t)&&!this.isResponseMatch(t)&&this.isTraceReturnDataMatch(t))return{type:"Response Mismatch Case (post_processing_suspicious)",message:"Execution flow is identical, but response output differs",possibleCauses:["Post-processing logic may be inconsistent","Response mapping or transformation may be incorrect","Data changes may affect the final result.","Non-deterministic behavior (e.g. random, time-based, shared state)"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),responseDiff:this.getResponseDiffSection(t)},confidence:{signals:{trace_step_match:this.signalSource.trace_step_match(.3),response_mismatch:this.signalSource.response_not_match(.2),trace_return_data_match:this.signalSource.trace_return_data_match(.3)},result:0},finalMessage:["Execution logic is stable, but output is inconsistent","This may indicate issues in response transformation or side effects","This may occur after the business logic is execute complete."],references:t.log.stack}}catch(s){throw s}}};export{d as PostTraceResponseMutationCase};
@@ -0,0 +1,14 @@
1
+ "use strict";var R=Object.create;var c=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var n=(e,t)=>c(e,"name",{value:t,configurable:!0});var T=(e,t)=>{for(var s in t)c(e,s,{get:t[s],enumerable:!0})},d=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of P(t))!M.call(e,a)&&a!==s&&c(e,a,{get:()=>t[a],enumerable:!(r=x(t,a))||r.enumerable});return e};var y=(e,t,s)=>(s=e!=null?R($(e)):{},d(t||!e||!e.__esModule?c(s,"default",{value:e,enumerable:!0}):s,e)),k=e=>d(c({},"__esModule",{value:!0}),e);var w={};T(w,{TraceDivergenceCase:()=>g});module.exports=k(w);var b=y(require("http"),1);var S={trace_step_match:n((e=.1)=>({weight:e,serverity:o(e),message:`trace_match (+${e}) \u2192 trace fully matches replay`}),"trace_step_match"),trace_step_not_match:n((e=.25)=>({weight:e,serverity:o(e),message:`trace_step_not_match (+${e}) \u2192 trace partially matches replay`}),"trace_step_not_match"),trace_return_data_match:n((e=.1)=>({weight:e,serverity:o(e),message:`trace_return_data_match (+${e}) \u2192 trace return data is consistent`}),"trace_return_data_match"),trace_return_data_not_match:n((e=.25)=>({weight:e,serverity:o(e),message:`trace_return_data_not_match (+${e}) \u2192 trace return data is inconsistent`}),"trace_return_data_not_match"),response_match:n((e=.1)=>({weight:e,serverity:o(e),message:`response_match (+${e}) \u2192 response is consistent`}),"response_match"),response_not_match:n((e=.25)=>({weight:e,serverity:o(e),message:`response_not_match (+${e}) \u2192 response is inconsistent`}),"response_not_match"),response_status_match:n((e=.1)=>({weight:e,serverity:o(e),message:`response_status_match (+${e}) \u2192 response status is consistent`}),"response_status_match"),response_status_not_match:n((e=.25)=>({weight:e,serverity:o(e),message:`response_status_not_match (+${e}) \u2192 response status is inconsistent`}),"response_status_not_match"),logic_error_indicator:n((e=.6)=>({weight:e,serverity:o(e),message:`logic_error_indicator (+${e}) \u2192 original response status >= 400 triggered logic flag`}),"logic_error_indicator")},v={trace_match:{value:!0,message:"flow is clean"},trace_not_match:{value:!1,message:"flow is not clean"},trace_step_match:{value:!0,message:"no mismatch"},trace_step_not_match:{value:!1,message:"mismatch"},trace_return_data_match:{value:!0,message:"no mismatch"},trace_return_data_not_match:{value:!1,message:"mismatch"},response_match:{value:!0,message:"no mismatch"},response_not_match:{value:!1,message:"mismatch"}};function o(e){return e>.75?"high":e>.55?"medium":"low"}n(o,"getSignalLevel");var i=y(require("chalk"),1);var l=class{static{n(this,"BaseAssignerCase")}get evidenceSource(){return v}get signalSource(){return S}getTraceDivergenceSection(t){let s=t.traceDiff.issues;if(s.length===0)return"No divergence";let r=`
2
+ `;for(let a of s)a.type==="missing_step"&&(r+=i.default.yellow(`
3
+ * ${a.name}(missing_step):
4
+ `),r+=i.default.green(` \u2192 original: exists
5
+ `),r+=i.default.red(" \u2192 replay: missing"),r+=`
6
+ `),a.type==="extra_step"&&(r+=i.default.yellow(`
7
+ * ${a.name}(extra_step):
8
+ `),r+=i.default.green(` \u2192 original: none
9
+ `),r+=i.default.red(" \u2192 replay: exists"),r+=`
10
+ `);return r.trim()}getMessageEdvidence(t){return`${this.evidenceSource[t].value} (${this.evidenceSource[t].message})`}getStatusEdvidence(t){let s=b.default.STATUS_CODES[t]||"Unknown";return`${t} (${s})`}isTraceMatch(t){return!t.traceDiff.isDifferent}isTraceStepMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="missing_step"||s.type==="extra_step"):!0}isTraceReturnDataMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="trace_return_data_mismatch"):!0}isResponseMatch(t){return!t.responseDiff.isDifferent}isResponseStatusMatch(t){let{originalStatus:s,replayStatus:r}=this.resolveStatus(t);return s===r}resolveStatus(t){return{originalStatus:Number(t.log.response.status),replayStatus:t.replayResultStatus}}getResponseDiffSection(t){let s=t.responseDiff.issues;if(s.length===0)return"No diff";let r=s.length>1?1:0,a=t.responseDiff.issues[r].not_matched;if(!a)return"No diff";let p=a.original||{},_=a.replay||{},D=new Set([...Object.keys(p),...Object.keys(_)]),u=`
11
+ `;for(let m of D){let f=p[m],h=_[m];f!==h&&(u+=i.default.yellow(` * ${m}:
12
+ `),u+=i.default.green(` \u2192 original: ${JSON.stringify(f)}
13
+ `),u+=i.default.red(` \u2192 replay: ${JSON.stringify(h)}
14
+ `))}return u}};var g=class extends l{static{n(this,"TraceDivergenceCase")}assign(t){try{let s=this.resolveStatus(t);if(!this.isTraceStepMatch(t)&&!this.isResponseMatch(t)&&!this.isTraceReturnDataMatch(t)&&!this.isResponseStatusMatch(t))return{type:"Trace Divergence Case (execution_path_mismatch)",message:"Execution path diverged between original and replay",possibleCauses:["Conditional branch logic may behave differently","Environment or shared state may affect execution flow","Request context may not be deterministic","Replay execution may enter different logic branches","Hidden dependencies or side effects may exist"],evidence:{traceMatch:this.getMessageEdvidence("trace_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),traceDivergence:this.getTraceDivergenceSection(t),responseDiff:this.getResponseDiffSection(t)},confidence:{signals:{trace_step_not_match:this.signalSource.trace_step_not_match(.45),trace_return_data_not_match:this.signalSource.trace_return_data_not_match(.25),response_not_match:this.signalSource.response_not_match(.15),response_status_not_match:this.signalSource.response_status_not_match(.1)},result:0},finalMessage:["Replay execution diverged from the original execution flow","This may indicate unstable conditions or branch inconsistency","Root cause likely exists before response generation"],references:t.log.stack}}catch(s){throw s}}};0&&(module.exports={TraceDivergenceCase});
@@ -0,0 +1,18 @@
1
+ import { PrintParams, RootCauseReason } from '../../../replay.cjs';
2
+ import { BaseAssignerCase } from '../base.cjs';
3
+ import '../../../../../handler.cjs';
4
+ import '../../../../../../error_handle.helper-CQsPSbuz.cjs';
5
+ import 'async_hooks';
6
+ import '../../../../../../setup.cjs';
7
+ import '../../../../../../index-MBKv_hsI.cjs';
8
+ import '../../../../../../enum/log_level.enum.cjs';
9
+ import '../../../../../base.cjs';
10
+ import '../../../../../../trace/filter.cjs';
11
+ import '../../../../../helper.cjs';
12
+ import '../../reason_signal.cjs';
13
+
14
+ declare class TraceDivergenceCase extends BaseAssignerCase {
15
+ assign(params: PrintParams): RootCauseReason | undefined;
16
+ }
17
+
18
+ export { TraceDivergenceCase };
@@ -0,0 +1,18 @@
1
+ import { PrintParams, RootCauseReason } from '../../../replay.js';
2
+ import { BaseAssignerCase } from '../base.js';
3
+ import '../../../../../handler.js';
4
+ import '../../../../../../error_handle.helper-CQsPSbuz.js';
5
+ import 'async_hooks';
6
+ import '../../../../../../setup.js';
7
+ import '../../../../../../index-8u1_ya-u.js';
8
+ import '../../../../../../enum/log_level.enum.js';
9
+ import '../../../../../base.js';
10
+ import '../../../../../../trace/filter.js';
11
+ import '../../../../../helper.js';
12
+ import '../../reason_signal.js';
13
+
14
+ declare class TraceDivergenceCase extends BaseAssignerCase {
15
+ assign(params: PrintParams): RootCauseReason | undefined;
16
+ }
17
+
18
+ export { TraceDivergenceCase };
@@ -0,0 +1,14 @@
1
+ var S=Object.defineProperty;var r=(e,t)=>S(e,"name",{value:t,configurable:!0});import v from"http";var f={trace_step_match:r((e=.1)=>({weight:e,serverity:a(e),message:`trace_match (+${e}) \u2192 trace fully matches replay`}),"trace_step_match"),trace_step_not_match:r((e=.25)=>({weight:e,serverity:a(e),message:`trace_step_not_match (+${e}) \u2192 trace partially matches replay`}),"trace_step_not_match"),trace_return_data_match:r((e=.1)=>({weight:e,serverity:a(e),message:`trace_return_data_match (+${e}) \u2192 trace return data is consistent`}),"trace_return_data_match"),trace_return_data_not_match:r((e=.25)=>({weight:e,serverity:a(e),message:`trace_return_data_not_match (+${e}) \u2192 trace return data is inconsistent`}),"trace_return_data_not_match"),response_match:r((e=.1)=>({weight:e,serverity:a(e),message:`response_match (+${e}) \u2192 response is consistent`}),"response_match"),response_not_match:r((e=.25)=>({weight:e,serverity:a(e),message:`response_not_match (+${e}) \u2192 response is inconsistent`}),"response_not_match"),response_status_match:r((e=.1)=>({weight:e,serverity:a(e),message:`response_status_match (+${e}) \u2192 response status is consistent`}),"response_status_match"),response_status_not_match:r((e=.25)=>({weight:e,serverity:a(e),message:`response_status_not_match (+${e}) \u2192 response status is inconsistent`}),"response_status_not_match"),logic_error_indicator:r((e=.6)=>({weight:e,serverity:a(e),message:`logic_error_indicator (+${e}) \u2192 original response status >= 400 triggered logic flag`}),"logic_error_indicator")},h={trace_match:{value:!0,message:"flow is clean"},trace_not_match:{value:!1,message:"flow is not clean"},trace_step_match:{value:!0,message:"no mismatch"},trace_step_not_match:{value:!1,message:"mismatch"},trace_return_data_match:{value:!0,message:"no mismatch"},trace_return_data_not_match:{value:!1,message:"mismatch"},response_match:{value:!0,message:"no mismatch"},response_not_match:{value:!1,message:"mismatch"}};function a(e){return e>.75?"high":e>.55?"medium":"low"}r(a,"getSignalLevel");import i from"chalk";var u=class{static{r(this,"BaseAssignerCase")}get evidenceSource(){return h}get signalSource(){return f}getTraceDivergenceSection(t){let s=t.traceDiff.issues;if(s.length===0)return"No divergence";let n=`
2
+ `;for(let o of s)o.type==="missing_step"&&(n+=i.yellow(`
3
+ * ${o.name}(missing_step):
4
+ `),n+=i.green(` \u2192 original: exists
5
+ `),n+=i.red(" \u2192 replay: missing"),n+=`
6
+ `),o.type==="extra_step"&&(n+=i.yellow(`
7
+ * ${o.name}(extra_step):
8
+ `),n+=i.green(` \u2192 original: none
9
+ `),n+=i.red(" \u2192 replay: exists"),n+=`
10
+ `);return n.trim()}getMessageEdvidence(t){return`${this.evidenceSource[t].value} (${this.evidenceSource[t].message})`}getStatusEdvidence(t){let s=v.STATUS_CODES[t]||"Unknown";return`${t} (${s})`}isTraceMatch(t){return!t.traceDiff.isDifferent}isTraceStepMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="missing_step"||s.type==="extra_step"):!0}isTraceReturnDataMatch(t){return t.traceDiff.issues.length>0?!t.traceDiff.issues.some(s=>s.type==="trace_return_data_mismatch"):!0}isResponseMatch(t){return!t.responseDiff.isDifferent}isResponseStatusMatch(t){let{originalStatus:s,replayStatus:n}=this.resolveStatus(t);return s===n}resolveStatus(t){return{originalStatus:Number(t.log.response.status),replayStatus:t.replayResultStatus}}getResponseDiffSection(t){let s=t.responseDiff.issues;if(s.length===0)return"No diff";let n=s.length>1?1:0,o=t.responseDiff.issues[n].not_matched;if(!o)return"No diff";let m=o.original||{},g=o.replay||{},y=new Set([...Object.keys(m),...Object.keys(g)]),c=`
11
+ `;for(let l of y){let p=m[l],_=g[l];p!==_&&(c+=i.yellow(` * ${l}:
12
+ `),c+=i.green(` \u2192 original: ${JSON.stringify(p)}
13
+ `),c+=i.red(` \u2192 replay: ${JSON.stringify(_)}
14
+ `))}return c}};var d=class extends u{static{r(this,"TraceDivergenceCase")}assign(t){try{let s=this.resolveStatus(t);if(!this.isTraceStepMatch(t)&&!this.isResponseMatch(t)&&!this.isTraceReturnDataMatch(t)&&!this.isResponseStatusMatch(t))return{type:"Trace Divergence Case (execution_path_mismatch)",message:"Execution path diverged between original and replay",possibleCauses:["Conditional branch logic may behave differently","Environment or shared state may affect execution flow","Request context may not be deterministic","Replay execution may enter different logic branches","Hidden dependencies or side effects may exist"],evidence:{traceMatch:this.getMessageEdvidence("trace_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),traceDivergence:this.getTraceDivergenceSection(t),responseDiff:this.getResponseDiffSection(t)},confidence:{signals:{trace_step_not_match:this.signalSource.trace_step_not_match(.45),trace_return_data_not_match:this.signalSource.trace_return_data_not_match(.25),response_not_match:this.signalSource.response_not_match(.15),response_status_not_match:this.signalSource.response_status_not_match(.1)},result:0},finalMessage:["Replay execution diverged from the original execution flow","This may indicate unstable conditions or branch inconsistency","Root cause likely exists before response generation"],references:t.log.stack}}catch(s){throw s}}};export{d as TraceDivergenceCase};
@@ -0,0 +1,21 @@
1
+ "use strict";var $=Object.create;var u=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var n=(t,e)=>u(t,"name",{value:e,configurable:!0});var O=(t,e)=>{for(var s in e)u(t,s,{get:e[s],enumerable:!0})},M=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of E(e))!B.call(t,o)&&o!==s&&u(t,o,{get:()=>e[o],enumerable:!(r=T(e,o))||r.enumerable});return t};var S=(t,e,s)=>(s=t!=null?$(k(t)):{},M(e||!t||!t.__esModule?u(s,"default",{value:t,enumerable:!0}):s,t)),N=t=>M(u({},"__esModule",{value:!0}),t);var j={};O(j,{ReasonAssigner:()=>R,ReasonPrinter:()=>b,ReasonSignalCls:()=>g,evidenceSource:()=>v,signalSource:()=>p});module.exports=N(j);var C=S(require("http"),1);var p={trace_step_match:n((t=.1)=>({weight:t,serverity:c(t),message:`trace_match (+${t}) \u2192 trace fully matches replay`}),"trace_step_match"),trace_step_not_match:n((t=.25)=>({weight:t,serverity:c(t),message:`trace_step_not_match (+${t}) \u2192 trace partially matches replay`}),"trace_step_not_match"),trace_return_data_match:n((t=.1)=>({weight:t,serverity:c(t),message:`trace_return_data_match (+${t}) \u2192 trace return data is consistent`}),"trace_return_data_match"),trace_return_data_not_match:n((t=.25)=>({weight:t,serverity:c(t),message:`trace_return_data_not_match (+${t}) \u2192 trace return data is inconsistent`}),"trace_return_data_not_match"),response_match:n((t=.1)=>({weight:t,serverity:c(t),message:`response_match (+${t}) \u2192 response is consistent`}),"response_match"),response_not_match:n((t=.25)=>({weight:t,serverity:c(t),message:`response_not_match (+${t}) \u2192 response is inconsistent`}),"response_not_match"),response_status_match:n((t=.1)=>({weight:t,serverity:c(t),message:`response_status_match (+${t}) \u2192 response status is consistent`}),"response_status_match"),response_status_not_match:n((t=.25)=>({weight:t,serverity:c(t),message:`response_status_not_match (+${t}) \u2192 response status is inconsistent`}),"response_status_not_match"),logic_error_indicator:n((t=.6)=>({weight:t,serverity:c(t),message:`logic_error_indicator (+${t}) \u2192 original response status >= 400 triggered logic flag`}),"logic_error_indicator")},v={trace_match:{value:!0,message:"flow is clean"},trace_not_match:{value:!1,message:"flow is not clean"},trace_step_match:{value:!0,message:"no mismatch"},trace_step_not_match:{value:!1,message:"mismatch"},trace_return_data_match:{value:!0,message:"no mismatch"},trace_return_data_not_match:{value:!1,message:"mismatch"},response_match:{value:!0,message:"no mismatch"},response_not_match:{value:!1,message:"mismatch"}};function c(t){return t>.75?"high":t>.55?"medium":"low"}n(c,"getSignalLevel");var g=class{static{n(this,"ReasonSignalCls")}findSignalByType(e){try{return p[e]}catch(s){throw s}}sumSignalWeights(e){try{return Object.values(e).reduce((s,r)=>s+r.weight,0)}catch(s){throw s}}};var a=S(require("chalk"),1);var l=class{static{n(this,"BaseAssignerCase")}get evidenceSource(){return v}get signalSource(){return p}getTraceDivergenceSection(e){let s=e.traceDiff.issues;if(s.length===0)return"No divergence";let r=`
2
+ `;for(let o of s)o.type==="missing_step"&&(r+=a.default.yellow(`
3
+ * ${o.name}(missing_step):
4
+ `),r+=a.default.green(` \u2192 original: exists
5
+ `),r+=a.default.red(" \u2192 replay: missing"),r+=`
6
+ `),o.type==="extra_step"&&(r+=a.default.yellow(`
7
+ * ${o.name}(extra_step):
8
+ `),r+=a.default.green(` \u2192 original: none
9
+ `),r+=a.default.red(" \u2192 replay: exists"),r+=`
10
+ `);return r.trim()}getMessageEdvidence(e){return`${this.evidenceSource[e].value} (${this.evidenceSource[e].message})`}getStatusEdvidence(e){let s=C.default.STATUS_CODES[e]||"Unknown";return`${e} (${s})`}isTraceMatch(e){return!e.traceDiff.isDifferent}isTraceStepMatch(e){return e.traceDiff.issues.length>0?!e.traceDiff.issues.some(s=>s.type==="missing_step"||s.type==="extra_step"):!0}isTraceReturnDataMatch(e){return e.traceDiff.issues.length>0?!e.traceDiff.issues.some(s=>s.type==="trace_return_data_mismatch"):!0}isResponseMatch(e){return!e.responseDiff.isDifferent}isResponseStatusMatch(e){let{originalStatus:s,replayStatus:r}=this.resolveStatus(e);return s===r}resolveStatus(e){return{originalStatus:Number(e.log.response.status),replayStatus:e.replayResultStatus}}getResponseDiffSection(e){let s=e.responseDiff.issues;if(s.length===0)return"No diff";let r=s.length>1?1:0,o=e.responseDiff.issues[r].not_matched;if(!o)return"No diff";let h=o.original||{},x=o.replay||{},w=new Set([...Object.keys(h),...Object.keys(x)]),m=`
11
+ `;for(let y of w){let D=h[y],P=x[y];D!==P&&(m+=a.default.yellow(` * ${y}:
12
+ `),m+=a.default.green(` \u2192 original: ${JSON.stringify(D)}
13
+ `),m+=a.default.red(` \u2192 replay: ${JSON.stringify(P)}
14
+ `))}return m}};var f=class extends l{static{n(this,"BusinessLogicRejectionCase")}condition(e,s){return this.isTraceMatch(e)&&this.isResponseMatch(e)&&s.originalStatus>=400&&s.replayStatus>=400}assign(e){try{let s=this.resolveStatus(e);if(this.condition(e,s)){let r=e.log.trace?.find(h=>h.parentId===null);return{type:"Business Logic Rejection Case (logic_suspicious)",message:"Response indicates error, but execution original and replay result match expected behavior",possibleCauses:["Business rule might not align with actual execution flow","Or validation logic is too strict / misaligned"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),finalResponse:typeof r?.returnData=="object"?JSON.stringify(r.returnData,null,2):r?.returnData},confidence:{signals:{trace_match:this.signalSource.trace_step_match(.3),response_match:this.signalSource.response_match(.3),logic_error_indicator:this.signalSource.logic_error_indicator(.2)},result:0},finalMessage:["This is NOT a runtime bug","This is likely a business logic issue"],references:e.log.stack}}}catch(s){throw s}}};var d=class extends l{static{n(this,"PostTraceResponseMutationCase")}assign(e){try{let s=this.resolveStatus(e);if(this.isTraceStepMatch(e)&&!this.isResponseMatch(e)&&this.isTraceReturnDataMatch(e))return{type:"Response Mismatch Case (post_processing_suspicious)",message:"Execution flow is identical, but response output differs",possibleCauses:["Post-processing logic may be inconsistent","Response mapping or transformation may be incorrect","Data changes may affect the final result.","Non-deterministic behavior (e.g. random, time-based, shared state)"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),responseDiff:this.getResponseDiffSection(e)},confidence:{signals:{trace_step_match:this.signalSource.trace_step_match(.3),response_mismatch:this.signalSource.response_not_match(.2),trace_return_data_match:this.signalSource.trace_return_data_match(.3)},result:0},finalMessage:["Execution logic is stable, but output is inconsistent","This may indicate issues in response transformation or side effects","This may occur after the business logic is execute complete."],references:e.log.stack}}catch(s){throw s}}};var _=class extends l{static{n(this,"TraceDivergenceCase")}assign(e){try{let s=this.resolveStatus(e);if(!this.isTraceStepMatch(e)&&!this.isResponseMatch(e)&&!this.isTraceReturnDataMatch(e)&&!this.isResponseStatusMatch(e))return{type:"Trace Divergence Case (execution_path_mismatch)",message:"Execution path diverged between original and replay",possibleCauses:["Conditional branch logic may behave differently","Environment or shared state may affect execution flow","Request context may not be deterministic","Replay execution may enter different logic branches","Hidden dependencies or side effects may exist"],evidence:{traceMatch:this.getMessageEdvidence("trace_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),traceDivergence:this.getTraceDivergenceSection(e),responseDiff:this.getResponseDiffSection(e)},confidence:{signals:{trace_step_not_match:this.signalSource.trace_step_not_match(.45),trace_return_data_not_match:this.signalSource.trace_return_data_not_match(.25),response_not_match:this.signalSource.response_not_match(.15),response_status_not_match:this.signalSource.response_status_not_match(.1)},result:0},finalMessage:["Replay execution diverged from the original execution flow","This may indicate unstable conditions or branch inconsistency","Root cause likely exists before response generation"],references:e.log.stack}}catch(s){throw s}}};var R=class{static{n(this,"ReasonAssigner")}get case(){return{business_logic_rejection:new f,post_trace_response_mutation:new d,trace_divergence:new _}}};var i=S(require("chalk"),1);var b=class{static{n(this,"ReasonPrinter")}get reasonSignal(){return new g}title(e){console.log(i.default.yellowBright("** Reason Title:")),console.log(`[!] ${e}`)}description(e){console.log(i.default.yellowBright("** Description:")),console.log(e)}possibleCauses(e){console.log(i.default.yellowBright("** What I think happened:")),e.forEach(s=>{console.log(` \u2192 ${s}`)})}evidence(e){let s=Object.keys(e);console.log(i.default.yellowBright("** Evidence I saw:")),s.forEach(r=>{console.log(` \u2192 ${r}: ${e[r]}`)})}confidence(e){console.log(i.default.yellowBright("** Confidence Reason (why I think this): ")),e.signals&&Object.keys(e.signals).forEach(o=>{console.log(` \u2192 ${e.signals[o].message}`)}),e.result=this.reasonSignal.sumSignalWeights(e.signals);let s=Math.round(e.result*100);console.log(`
15
+ `),console.log(i.default.yellowBright("** Confidence Result: ")),console.log(i.default.green.italic.bold(` * score: ${e.result.toFixed(2)} / 1 `)),console.log(i.default.green.italic.bold(` * percent: ${s} / 100 (%) `))}finalMessage(e){e.length!=0&&(console.log(i.default.yellowBright("** Final Call:")),e.forEach(s=>{console.log(` \u2192 ${s}`)}))}referencePosition(e){if(e&&(console.log(i.default.yellowBright("* Reference Position: ")),console.log(" \u2192 Suspected position:",i.default.red.underline(e.primary?.full_path)),e.context&&e.context.length>0)){let s=e.context.length-1;e.context.forEach((r,o)=>{console.log(` \u2192 (Context ${s-o}): ${r.full_path}`)})}}printReason(e){try{if(!e)return;console.log(i.default.red.italic.bold(`
16
+ Aeeaeae yohh BUT...`)),this.title(e.type),console.log(`
17
+ `),this.description(e.message),console.log(`
18
+ `),this.possibleCauses(e.possibleCauses),console.log(`
19
+ `),this.evidence(e.evidence),console.log(`
20
+ `),this.confidence(e.confidence),console.log(`
21
+ `),this.finalMessage(e.finalMessage||[]),this.referencePosition(e.references)}catch(s){throw s}}};0&&(module.exports={ReasonAssigner,ReasonPrinter,ReasonSignalCls,evidenceSource,signalSource});
@@ -0,0 +1,17 @@
1
+ export { ReasonAssigner } from './reason_assigner.cjs';
2
+ export { ReasonPrinter } from './reason_printer.cjs';
3
+ export { ReasonSignal, ReasonSignalCls, SignalDetails, SignalTypes, evidenceSource, signalSource } from './reason_signal.cjs';
4
+ import './assigner_cases/business_logic_rejection_case/index.cjs';
5
+ import '../replay.cjs';
6
+ import '../../../handler.cjs';
7
+ import '../../../../error_handle.helper-CQsPSbuz.cjs';
8
+ import 'async_hooks';
9
+ import '../../../../setup.cjs';
10
+ import '../../../../index-MBKv_hsI.cjs';
11
+ import '../../../../enum/log_level.enum.cjs';
12
+ import '../../../base.cjs';
13
+ import '../../../../trace/filter.cjs';
14
+ import '../../../helper.cjs';
15
+ import './assigner_cases/base.cjs';
16
+ import './assigner_cases/post_trace_response_mutation_case/index.cjs';
17
+ import './assigner_cases/trace_divergence_case/index.cjs';
@@ -0,0 +1,17 @@
1
+ export { ReasonAssigner } from './reason_assigner.js';
2
+ export { ReasonPrinter } from './reason_printer.js';
3
+ export { ReasonSignal, ReasonSignalCls, SignalDetails, SignalTypes, evidenceSource, signalSource } from './reason_signal.js';
4
+ import './assigner_cases/business_logic_rejection_case/index.js';
5
+ import '../replay.js';
6
+ import '../../../handler.js';
7
+ import '../../../../error_handle.helper-CQsPSbuz.js';
8
+ import 'async_hooks';
9
+ import '../../../../setup.js';
10
+ import '../../../../index-8u1_ya-u.js';
11
+ import '../../../../enum/log_level.enum.js';
12
+ import '../../../base.js';
13
+ import '../../../../trace/filter.js';
14
+ import '../../../helper.js';
15
+ import './assigner_cases/base.js';
16
+ import './assigner_cases/post_trace_response_mutation_case/index.js';
17
+ import './assigner_cases/trace_divergence_case/index.js';
@@ -0,0 +1,21 @@
1
+ var P=Object.defineProperty;var n=(s,e)=>P(s,"name",{value:e,configurable:!0});import M from"http";var _={trace_step_match:n((s=.1)=>({weight:s,serverity:a(s),message:`trace_match (+${s}) \u2192 trace fully matches replay`}),"trace_step_match"),trace_step_not_match:n((s=.25)=>({weight:s,serverity:a(s),message:`trace_step_not_match (+${s}) \u2192 trace partially matches replay`}),"trace_step_not_match"),trace_return_data_match:n((s=.1)=>({weight:s,serverity:a(s),message:`trace_return_data_match (+${s}) \u2192 trace return data is consistent`}),"trace_return_data_match"),trace_return_data_not_match:n((s=.25)=>({weight:s,serverity:a(s),message:`trace_return_data_not_match (+${s}) \u2192 trace return data is inconsistent`}),"trace_return_data_not_match"),response_match:n((s=.1)=>({weight:s,serverity:a(s),message:`response_match (+${s}) \u2192 response is consistent`}),"response_match"),response_not_match:n((s=.25)=>({weight:s,serverity:a(s),message:`response_not_match (+${s}) \u2192 response is inconsistent`}),"response_not_match"),response_status_match:n((s=.1)=>({weight:s,serverity:a(s),message:`response_status_match (+${s}) \u2192 response status is consistent`}),"response_status_match"),response_status_not_match:n((s=.25)=>({weight:s,serverity:a(s),message:`response_status_not_match (+${s}) \u2192 response status is inconsistent`}),"response_status_not_match"),logic_error_indicator:n((s=.6)=>({weight:s,serverity:a(s),message:`logic_error_indicator (+${s}) \u2192 original response status >= 400 triggered logic flag`}),"logic_error_indicator")},R={trace_match:{value:!0,message:"flow is clean"},trace_not_match:{value:!1,message:"flow is not clean"},trace_step_match:{value:!0,message:"no mismatch"},trace_step_not_match:{value:!1,message:"mismatch"},trace_return_data_match:{value:!0,message:"no mismatch"},trace_return_data_not_match:{value:!1,message:"mismatch"},response_match:{value:!0,message:"no mismatch"},response_not_match:{value:!1,message:"mismatch"}};function a(s){return s>.75?"high":s>.55?"medium":"low"}n(a,"getSignalLevel");var h=class{static{n(this,"ReasonSignalCls")}findSignalByType(e){try{return _[e]}catch(t){throw t}}sumSignalWeights(e){try{return Object.values(e).reduce((t,r)=>t+r.weight,0)}catch(t){throw t}}};import c from"chalk";var l=class{static{n(this,"BaseAssignerCase")}get evidenceSource(){return R}get signalSource(){return _}getTraceDivergenceSection(e){let t=e.traceDiff.issues;if(t.length===0)return"No divergence";let r=`
2
+ `;for(let o of t)o.type==="missing_step"&&(r+=c.yellow(`
3
+ * ${o.name}(missing_step):
4
+ `),r+=c.green(` \u2192 original: exists
5
+ `),r+=c.red(" \u2192 replay: missing"),r+=`
6
+ `),o.type==="extra_step"&&(r+=c.yellow(`
7
+ * ${o.name}(extra_step):
8
+ `),r+=c.green(` \u2192 original: none
9
+ `),r+=c.red(" \u2192 replay: exists"),r+=`
10
+ `);return r.trim()}getMessageEdvidence(e){return`${this.evidenceSource[e].value} (${this.evidenceSource[e].message})`}getStatusEdvidence(e){let t=M.STATUS_CODES[e]||"Unknown";return`${e} (${t})`}isTraceMatch(e){return!e.traceDiff.isDifferent}isTraceStepMatch(e){return e.traceDiff.issues.length>0?!e.traceDiff.issues.some(t=>t.type==="missing_step"||t.type==="extra_step"):!0}isTraceReturnDataMatch(e){return e.traceDiff.issues.length>0?!e.traceDiff.issues.some(t=>t.type==="trace_return_data_mismatch"):!0}isResponseMatch(e){return!e.responseDiff.isDifferent}isResponseStatusMatch(e){let{originalStatus:t,replayStatus:r}=this.resolveStatus(e);return t===r}resolveStatus(e){return{originalStatus:Number(e.log.response.status),replayStatus:e.replayResultStatus}}getResponseDiffSection(e){let t=e.responseDiff.issues;if(t.length===0)return"No diff";let r=t.length>1?1:0,o=e.responseDiff.issues[r].not_matched;if(!o)return"No diff";let u=o.original||{},y=o.replay||{},D=new Set([...Object.keys(u),...Object.keys(y)]),g=`
11
+ `;for(let d of D){let S=u[d],v=y[d];S!==v&&(g+=c.yellow(` * ${d}:
12
+ `),g+=c.green(` \u2192 original: ${JSON.stringify(S)}
13
+ `),g+=c.red(` \u2192 replay: ${JSON.stringify(v)}
14
+ `))}return g}};var m=class extends l{static{n(this,"BusinessLogicRejectionCase")}condition(e,t){return this.isTraceMatch(e)&&this.isResponseMatch(e)&&t.originalStatus>=400&&t.replayStatus>=400}assign(e){try{let t=this.resolveStatus(e);if(this.condition(e,t)){let r=e.log.trace?.find(u=>u.parentId===null);return{type:"Business Logic Rejection Case (logic_suspicious)",message:"Response indicates error, but execution original and replay result match expected behavior",possibleCauses:["Business rule might not align with actual execution flow","Or validation logic is too strict / misaligned"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_match"),originalStatus:this.getStatusEdvidence(t.originalStatus),finalResponse:typeof r?.returnData=="object"?JSON.stringify(r.returnData,null,2):r?.returnData},confidence:{signals:{trace_match:this.signalSource.trace_step_match(.3),response_match:this.signalSource.response_match(.3),logic_error_indicator:this.signalSource.logic_error_indicator(.2)},result:0},finalMessage:["This is NOT a runtime bug","This is likely a business logic issue"],references:e.log.stack}}}catch(t){throw t}}};var p=class extends l{static{n(this,"PostTraceResponseMutationCase")}assign(e){try{let t=this.resolveStatus(e);if(this.isTraceStepMatch(e)&&!this.isResponseMatch(e)&&this.isTraceReturnDataMatch(e))return{type:"Response Mismatch Case (post_processing_suspicious)",message:"Execution flow is identical, but response output differs",possibleCauses:["Post-processing logic may be inconsistent","Response mapping or transformation may be incorrect","Data changes may affect the final result.","Non-deterministic behavior (e.g. random, time-based, shared state)"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_not_match"),originalStatus:this.getStatusEdvidence(t.originalStatus),responseDiff:this.getResponseDiffSection(e)},confidence:{signals:{trace_step_match:this.signalSource.trace_step_match(.3),response_mismatch:this.signalSource.response_not_match(.2),trace_return_data_match:this.signalSource.trace_return_data_match(.3)},result:0},finalMessage:["Execution logic is stable, but output is inconsistent","This may indicate issues in response transformation or side effects","This may occur after the business logic is execute complete."],references:e.log.stack}}catch(t){throw t}}};var f=class extends l{static{n(this,"TraceDivergenceCase")}assign(e){try{let t=this.resolveStatus(e);if(!this.isTraceStepMatch(e)&&!this.isResponseMatch(e)&&!this.isTraceReturnDataMatch(e)&&!this.isResponseStatusMatch(e))return{type:"Trace Divergence Case (execution_path_mismatch)",message:"Execution path diverged between original and replay",possibleCauses:["Conditional branch logic may behave differently","Environment or shared state may affect execution flow","Request context may not be deterministic","Replay execution may enter different logic branches","Hidden dependencies or side effects may exist"],evidence:{traceMatch:this.getMessageEdvidence("trace_not_match"),originalStatus:this.getStatusEdvidence(t.originalStatus),traceDivergence:this.getTraceDivergenceSection(e),responseDiff:this.getResponseDiffSection(e)},confidence:{signals:{trace_step_not_match:this.signalSource.trace_step_not_match(.45),trace_return_data_not_match:this.signalSource.trace_return_data_not_match(.25),response_not_match:this.signalSource.response_not_match(.15),response_status_not_match:this.signalSource.response_status_not_match(.1)},result:0},finalMessage:["Replay execution diverged from the original execution flow","This may indicate unstable conditions or branch inconsistency","Root cause likely exists before response generation"],references:e.log.stack}}catch(t){throw t}}};var b=class{static{n(this,"ReasonAssigner")}get case(){return{business_logic_rejection:new m,post_trace_response_mutation:new p,trace_divergence:new f}}};import i from"chalk";var x=class{static{n(this,"ReasonPrinter")}get reasonSignal(){return new h}title(e){console.log(i.yellowBright("** Reason Title:")),console.log(`[!] ${e}`)}description(e){console.log(i.yellowBright("** Description:")),console.log(e)}possibleCauses(e){console.log(i.yellowBright("** What I think happened:")),e.forEach(t=>{console.log(` \u2192 ${t}`)})}evidence(e){let t=Object.keys(e);console.log(i.yellowBright("** Evidence I saw:")),t.forEach(r=>{console.log(` \u2192 ${r}: ${e[r]}`)})}confidence(e){console.log(i.yellowBright("** Confidence Reason (why I think this): ")),e.signals&&Object.keys(e.signals).forEach(o=>{console.log(` \u2192 ${e.signals[o].message}`)}),e.result=this.reasonSignal.sumSignalWeights(e.signals);let t=Math.round(e.result*100);console.log(`
15
+ `),console.log(i.yellowBright("** Confidence Result: ")),console.log(i.green.italic.bold(` * score: ${e.result.toFixed(2)} / 1 `)),console.log(i.green.italic.bold(` * percent: ${t} / 100 (%) `))}finalMessage(e){e.length!=0&&(console.log(i.yellowBright("** Final Call:")),e.forEach(t=>{console.log(` \u2192 ${t}`)}))}referencePosition(e){if(e&&(console.log(i.yellowBright("* Reference Position: ")),console.log(" \u2192 Suspected position:",i.red.underline(e.primary?.full_path)),e.context&&e.context.length>0)){let t=e.context.length-1;e.context.forEach((r,o)=>{console.log(` \u2192 (Context ${t-o}): ${r.full_path}`)})}}printReason(e){try{if(!e)return;console.log(i.red.italic.bold(`
16
+ Aeeaeae yohh BUT...`)),this.title(e.type),console.log(`
17
+ `),this.description(e.message),console.log(`
18
+ `),this.possibleCauses(e.possibleCauses),console.log(`
19
+ `),this.evidence(e.evidence),console.log(`
20
+ `),this.confidence(e.confidence),console.log(`
21
+ `),this.finalMessage(e.finalMessage||[]),this.referencePosition(e.references)}catch(t){throw t}}};export{b as ReasonAssigner,x as ReasonPrinter,h as ReasonSignalCls,R as evidenceSource,_ as signalSource};
@@ -0,0 +1,14 @@
1
+ "use strict";var M=Object.create;var u=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var a=(t,e)=>u(t,"name",{value:e,configurable:!0});var E=(t,e)=>{for(var s in e)u(t,s,{get:e[s],enumerable:!0})},v=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of C(e))!w.call(t,n)&&n!==s&&u(t,n,{get:()=>e[n],enumerable:!(r=T(e,n))||r.enumerable});return t};var b=(t,e,s)=>(s=t!=null?M($(t)):{},v(e||!t||!t.__esModule?u(s,"default",{value:t,enumerable:!0}):s,t)),k=t=>v(u({},"__esModule",{value:!0}),t);var N={};E(N,{ReasonAssigner:()=>f});module.exports=k(N);var x=b(require("http"),1);var R={trace_step_match:a((t=.1)=>({weight:t,serverity:o(t),message:`trace_match (+${t}) \u2192 trace fully matches replay`}),"trace_step_match"),trace_step_not_match:a((t=.25)=>({weight:t,serverity:o(t),message:`trace_step_not_match (+${t}) \u2192 trace partially matches replay`}),"trace_step_not_match"),trace_return_data_match:a((t=.1)=>({weight:t,serverity:o(t),message:`trace_return_data_match (+${t}) \u2192 trace return data is consistent`}),"trace_return_data_match"),trace_return_data_not_match:a((t=.25)=>({weight:t,serverity:o(t),message:`trace_return_data_not_match (+${t}) \u2192 trace return data is inconsistent`}),"trace_return_data_not_match"),response_match:a((t=.1)=>({weight:t,serverity:o(t),message:`response_match (+${t}) \u2192 response is consistent`}),"response_match"),response_not_match:a((t=.25)=>({weight:t,serverity:o(t),message:`response_not_match (+${t}) \u2192 response is inconsistent`}),"response_not_match"),response_status_match:a((t=.1)=>({weight:t,serverity:o(t),message:`response_status_match (+${t}) \u2192 response status is consistent`}),"response_status_match"),response_status_not_match:a((t=.25)=>({weight:t,serverity:o(t),message:`response_status_not_match (+${t}) \u2192 response status is inconsistent`}),"response_status_not_match"),logic_error_indicator:a((t=.6)=>({weight:t,serverity:o(t),message:`logic_error_indicator (+${t}) \u2192 original response status >= 400 triggered logic flag`}),"logic_error_indicator")},D={trace_match:{value:!0,message:"flow is clean"},trace_not_match:{value:!1,message:"flow is not clean"},trace_step_match:{value:!0,message:"no mismatch"},trace_step_not_match:{value:!1,message:"mismatch"},trace_return_data_match:{value:!0,message:"no mismatch"},trace_return_data_not_match:{value:!1,message:"mismatch"},response_match:{value:!0,message:"no mismatch"},response_not_match:{value:!1,message:"mismatch"}};function o(t){return t>.75?"high":t>.55?"medium":"low"}a(o,"getSignalLevel");var i=b(require("chalk"),1);var c=class{static{a(this,"BaseAssignerCase")}get evidenceSource(){return D}get signalSource(){return R}getTraceDivergenceSection(e){let s=e.traceDiff.issues;if(s.length===0)return"No divergence";let r=`
2
+ `;for(let n of s)n.type==="missing_step"&&(r+=i.default.yellow(`
3
+ * ${n.name}(missing_step):
4
+ `),r+=i.default.green(` \u2192 original: exists
5
+ `),r+=i.default.red(" \u2192 replay: missing"),r+=`
6
+ `),n.type==="extra_step"&&(r+=i.default.yellow(`
7
+ * ${n.name}(extra_step):
8
+ `),r+=i.default.green(` \u2192 original: none
9
+ `),r+=i.default.red(" \u2192 replay: exists"),r+=`
10
+ `);return r.trim()}getMessageEdvidence(e){return`${this.evidenceSource[e].value} (${this.evidenceSource[e].message})`}getStatusEdvidence(e){let s=x.default.STATUS_CODES[e]||"Unknown";return`${e} (${s})`}isTraceMatch(e){return!e.traceDiff.isDifferent}isTraceStepMatch(e){return e.traceDiff.issues.length>0?!e.traceDiff.issues.some(s=>s.type==="missing_step"||s.type==="extra_step"):!0}isTraceReturnDataMatch(e){return e.traceDiff.issues.length>0?!e.traceDiff.issues.some(s=>s.type==="trace_return_data_mismatch"):!0}isResponseMatch(e){return!e.responseDiff.isDifferent}isResponseStatusMatch(e){let{originalStatus:s,replayStatus:r}=this.resolveStatus(e);return s===r}resolveStatus(e){return{originalStatus:Number(e.log.response.status),replayStatus:e.replayResultStatus}}getResponseDiffSection(e){let s=e.responseDiff.issues;if(s.length===0)return"No diff";let r=s.length>1?1:0,n=e.responseDiff.issues[r].not_matched;if(!n)return"No diff";let l=n.original||{},d=n.replay||{},P=new Set([...Object.keys(l),...Object.keys(d)]),g=`
11
+ `;for(let _ of P){let S=l[_],y=d[_];S!==y&&(g+=i.default.yellow(` * ${_}:
12
+ `),g+=i.default.green(` \u2192 original: ${JSON.stringify(S)}
13
+ `),g+=i.default.red(` \u2192 replay: ${JSON.stringify(y)}
14
+ `))}return g}};var m=class extends c{static{a(this,"BusinessLogicRejectionCase")}condition(e,s){return this.isTraceMatch(e)&&this.isResponseMatch(e)&&s.originalStatus>=400&&s.replayStatus>=400}assign(e){try{let s=this.resolveStatus(e);if(this.condition(e,s)){let r=e.log.trace?.find(l=>l.parentId===null);return{type:"Business Logic Rejection Case (logic_suspicious)",message:"Response indicates error, but execution original and replay result match expected behavior",possibleCauses:["Business rule might not align with actual execution flow","Or validation logic is too strict / misaligned"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),finalResponse:typeof r?.returnData=="object"?JSON.stringify(r.returnData,null,2):r?.returnData},confidence:{signals:{trace_match:this.signalSource.trace_step_match(.3),response_match:this.signalSource.response_match(.3),logic_error_indicator:this.signalSource.logic_error_indicator(.2)},result:0},finalMessage:["This is NOT a runtime bug","This is likely a business logic issue"],references:e.log.stack}}}catch(s){throw s}}};var h=class extends c{static{a(this,"PostTraceResponseMutationCase")}assign(e){try{let s=this.resolveStatus(e);if(this.isTraceStepMatch(e)&&!this.isResponseMatch(e)&&this.isTraceReturnDataMatch(e))return{type:"Response Mismatch Case (post_processing_suspicious)",message:"Execution flow is identical, but response output differs",possibleCauses:["Post-processing logic may be inconsistent","Response mapping or transformation may be incorrect","Data changes may affect the final result.","Non-deterministic behavior (e.g. random, time-based, shared state)"],evidence:{traceMatch:this.getMessageEdvidence("trace_match"),responseMatch:this.getMessageEdvidence("response_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),responseDiff:this.getResponseDiffSection(e)},confidence:{signals:{trace_step_match:this.signalSource.trace_step_match(.3),response_mismatch:this.signalSource.response_not_match(.2),trace_return_data_match:this.signalSource.trace_return_data_match(.3)},result:0},finalMessage:["Execution logic is stable, but output is inconsistent","This may indicate issues in response transformation or side effects","This may occur after the business logic is execute complete."],references:e.log.stack}}catch(s){throw s}}};var p=class extends c{static{a(this,"TraceDivergenceCase")}assign(e){try{let s=this.resolveStatus(e);if(!this.isTraceStepMatch(e)&&!this.isResponseMatch(e)&&!this.isTraceReturnDataMatch(e)&&!this.isResponseStatusMatch(e))return{type:"Trace Divergence Case (execution_path_mismatch)",message:"Execution path diverged between original and replay",possibleCauses:["Conditional branch logic may behave differently","Environment or shared state may affect execution flow","Request context may not be deterministic","Replay execution may enter different logic branches","Hidden dependencies or side effects may exist"],evidence:{traceMatch:this.getMessageEdvidence("trace_not_match"),originalStatus:this.getStatusEdvidence(s.originalStatus),traceDivergence:this.getTraceDivergenceSection(e),responseDiff:this.getResponseDiffSection(e)},confidence:{signals:{trace_step_not_match:this.signalSource.trace_step_not_match(.45),trace_return_data_not_match:this.signalSource.trace_return_data_not_match(.25),response_not_match:this.signalSource.response_not_match(.15),response_status_not_match:this.signalSource.response_status_not_match(.1)},result:0},finalMessage:["Replay execution diverged from the original execution flow","This may indicate unstable conditions or branch inconsistency","Root cause likely exists before response generation"],references:e.log.stack}}catch(s){throw s}}};var f=class{static{a(this,"ReasonAssigner")}get case(){return{business_logic_rejection:new m,post_trace_response_mutation:new h,trace_divergence:new p}}};0&&(module.exports={ReasonAssigner});
@@ -0,0 +1,25 @@
1
+ import { BusinessLogicRejectionCase } from './assigner_cases/business_logic_rejection_case/index.cjs';
2
+ import { PostTraceResponseMutationCase } from './assigner_cases/post_trace_response_mutation_case/index.cjs';
3
+ import { TraceDivergenceCase } from './assigner_cases/trace_divergence_case/index.cjs';
4
+ import '../replay.cjs';
5
+ import '../../../handler.cjs';
6
+ import '../../../../error_handle.helper-CQsPSbuz.cjs';
7
+ import 'async_hooks';
8
+ import '../../../../setup.cjs';
9
+ import '../../../../index-MBKv_hsI.cjs';
10
+ import '../../../../enum/log_level.enum.cjs';
11
+ import '../../../base.cjs';
12
+ import '../../../../trace/filter.cjs';
13
+ import '../../../helper.cjs';
14
+ import './reason_signal.cjs';
15
+ import './assigner_cases/base.cjs';
16
+
17
+ declare class ReasonAssigner {
18
+ get case(): {
19
+ business_logic_rejection: BusinessLogicRejectionCase;
20
+ post_trace_response_mutation: PostTraceResponseMutationCase;
21
+ trace_divergence: TraceDivergenceCase;
22
+ };
23
+ }
24
+
25
+ export { ReasonAssigner };
@@ -0,0 +1,25 @@
1
+ import { BusinessLogicRejectionCase } from './assigner_cases/business_logic_rejection_case/index.js';
2
+ import { PostTraceResponseMutationCase } from './assigner_cases/post_trace_response_mutation_case/index.js';
3
+ import { TraceDivergenceCase } from './assigner_cases/trace_divergence_case/index.js';
4
+ import '../replay.js';
5
+ import '../../../handler.js';
6
+ import '../../../../error_handle.helper-CQsPSbuz.js';
7
+ import 'async_hooks';
8
+ import '../../../../setup.js';
9
+ import '../../../../index-8u1_ya-u.js';
10
+ import '../../../../enum/log_level.enum.js';
11
+ import '../../../base.js';
12
+ import '../../../../trace/filter.js';
13
+ import '../../../helper.js';
14
+ import './reason_signal.js';
15
+ import './assigner_cases/base.js';
16
+
17
+ declare class ReasonAssigner {
18
+ get case(): {
19
+ business_logic_rejection: BusinessLogicRejectionCase;
20
+ post_trace_response_mutation: PostTraceResponseMutationCase;
21
+ trace_divergence: TraceDivergenceCase;
22
+ };
23
+ }
24
+
25
+ export { ReasonAssigner };