Count visible incidents and high-severity incidents from a fixed severity queue.

incident queue A small severity queue keeps replay deterministic while showing how a report threshold changes output.

Incident Queue Reliability Report

minSeverity
incident_queue.js
Replay: real traced execution (multi-file project)
const minSeverity = 2;
let visible = 0;
let high = 0;

for (const severity of [1, 2, 3, 3]) {
    if (severity >= minSeverity) {
        visible += 1;
    }
    if (severity >= 3) {
        high += 1;
    }
}

console.log(`min=${minSeverity} visible=${visible} high=${high}`);
const minSeverity = 1;
let visible = 0;
let high = 0;

for (const severity of [1, 2, 3, 3]) {
    if (severity >= minSeverity) {
        visible += 1;
    }
    if (severity >= 3) {
        high += 1;
    }
}

console.log(`min=${minSeverity} visible=${visible} high=${high}`);
const minSeverity = 3;
let visible = 0;
let high = 0;

for (const severity of [1, 2, 3, 3]) {
    if (severity >= minSeverity) {
        visible += 1;
    }
    if (severity >= 3) {
        high += 1;
    }
}

console.log(`min=${minSeverity} visible=${visible} high=${high}`);
  1. minSeverity ← 2, visible ← 0, high ← 0

    1const minSeverity→ 2 = 2;  //@minSeverity=1, 32let visible→ 0 = 0;3let high→ 0 = 0;
  2. if (severity >= minSeverity)

    pass 1 of 3
    5for (const severity of [1, 2, 3, 3]) {6    if (severity2 >= minSeverity2) {7        visible += 1;8    }
    All 3 passes — pass 1 is the card above
    passseverity
    12
    23
    33
  3. if (severity >= 3)

    pass 1 of 2
    7    visible += 1;8}9if (severity3 >= 3) {10    high += 1;11}
  4. if (severity >= 3)

    pass 2 of 2
    7    visible += 1;8}9if (severity3 >= 3) {10    high += 1;11}
  5. console.log(`min=${minSeverity} visible=${visible} high=${high}`);

    11    }12}1314console.log(`min=${minSeverity2} visible=${visible3} high=${high2}`);
    outputmin=2 visible=3 high=2
  1. minSeverity ← 1, visible ← 0, high ← 0

    1const minSeverity→ 1 = 1;2let visible→ 0 = 0;3let high→ 0 = 0;
  2. if (severity >= minSeverity)

    pass 1 of 4
    5for (const severity of [1, 2, 3, 3]) {6    if (severity1 >= minSeverity1) {7        visible += 1;8    }
    All 4 passes — pass 1 is the card above
    passseverity
    11
    22
    33
    43
  3. if (severity >= 3)

    pass 1 of 2
    7    visible += 1;8}9if (severity3 >= 3) {10    high += 1;11}
  4. if (severity >= 3)

    pass 2 of 2
    7    visible += 1;8}9if (severity3 >= 3) {10    high += 1;11}
  5. console.log(`min=${minSeverity} visible=${visible} high=${high}`);

    11    }12}1314console.log(`min=${minSeverity1} visible=${visible4} high=${high2}`);
    outputmin=1 visible=4 high=2
  1. minSeverity ← 3, visible ← 0, high ← 0

    1const minSeverity→ 3 = 3;2let visible→ 0 = 0;3let high→ 0 = 0;
  2. if (severity >= minSeverity)

    pass 1 of 2
    5for (const severity of [1, 2, 3, 3]) {6    if (severity3 >= minSeverity3) {7        visible += 1;8    }
  3. if (severity >= 3)

    pass 1 of 2
    7    visible += 1;8}9if (severity3 >= 3) {10    high += 1;11}
  4. if (severity >= minSeverity)

    pass 2 of 2
    5for (const severity of [1, 2, 3, 3]) {6    if (severity3 >= minSeverity3) {7        visible += 1;8    }
  5. if (severity >= 3)

    pass 2 of 2
    7    visible += 1;8}9if (severity3 >= 3) {10    high += 1;11}
  6. console.log(`min=${minSeverity} visible=${visible} high=${high}`);

    11    }12}1314console.log(`min=${minSeverity3} visible=${visible2} high=${high2}`);
    outputmin=3 visible=2 high=2