fix(replay): show a step's own violations in both panels, no next-step bleed

This commit is contained in:
pj committed 2026-07-13 16:00:42 +05:30
1 parent 626158fece
commit 1a893c570d
1 file changed
+17 -16
+17 -16
View File
@@ -113,12 +113,13 @@ export default function RunDetail() {
return <div className="status-block">loading run...</div>; return <div className="status-block">loading run...</div>;
} }
const violationsBefore = currentStep?.violations ?? []; // A violation belongs to the action that caused it (relocateViolationsToCause
const violationsAfter = nextStep?.violations ?? violationsBefore; // already anchored it to that step), so show this step's own violations in
// both panels rather than bleeding the next step's record into "after".
const stepViolations = currentStep?.violations ?? [];
const stepWitnesses = currentStep?.witnesses;
const residualsBefore = currentStep?.residuals; const residualsBefore = currentStep?.residuals;
const residualsAfter = nextStep?.residuals ?? residualsBefore; const residualsAfter = nextStep?.residuals ?? residualsBefore;
const witnessesBefore = currentStep?.witnesses;
const witnessesAfter = nextStep?.witnesses ?? witnessesBefore;
const exceptionsForStep = currentStep?.exceptions; const exceptionsForStep = currentStep?.exceptions;
const beforeSpace = deviceSpaceOf(currentStep?.hierarchy); const beforeSpace = deviceSpaceOf(currentStep?.hierarchy);
const afterSpace = deviceSpaceOf(nextStep?.hierarchy ?? currentStep?.hierarchy); const afterSpace = deviceSpaceOf(nextStep?.hierarchy ?? currentStep?.hierarchy);
@@ -157,9 +158,9 @@ export default function RunDetail() {
content: ( content: (
<ViolationsPanel <ViolationsPanel
propertyNames={history?.names ?? []} propertyNames={history?.names ?? []}
violations={violationsBefore} violations={stepViolations}
residuals={residualsBefore} residuals={residualsBefore}
witnesses={witnessesBefore} witnesses={stepWitnesses}
onJumpToFirstViolation={jumpToFirstViolation} onJumpToFirstViolation={jumpToFirstViolation}
hasFirstViolation={history?.firstViolationStep !== undefined} hasFirstViolation={history?.firstViolationStep !== undefined}
onJumpToStep={goTo} onJumpToStep={goTo}
@@ -170,17 +171,17 @@ export default function RunDetail() {
id: "violations", id: "violations",
label: "Violations", label: "Violations",
badge: badge:
violationsBefore.length > 0 ? ( stepViolations.length > 0 ? (
<span className="tabs-badge" data-kind="violation"> <span className="tabs-badge" data-kind="violation">
{violationsBefore.length} {stepViolations.length}
</span> </span>
) : undefined, ) : undefined,
content: ( content: (
<ViolationsPanel <ViolationsPanel
propertyNames={history?.names ?? []} propertyNames={history?.names ?? []}
violations={violationsBefore} violations={stepViolations}
residuals={residualsBefore} residuals={residualsBefore}
witnesses={witnessesBefore} witnesses={stepWitnesses}
onJumpToFirstViolation={jumpToFirstViolation} onJumpToFirstViolation={jumpToFirstViolation}
hasFirstViolation={history?.firstViolationStep !== undefined} hasFirstViolation={history?.firstViolationStep !== undefined}
onJumpToStep={goTo} onJumpToStep={goTo}
@@ -224,9 +225,9 @@ export default function RunDetail() {
content: ( content: (
<ViolationsPanel <ViolationsPanel
propertyNames={history?.names ?? []} propertyNames={history?.names ?? []}
violations={violationsAfter} violations={stepViolations}
residuals={residualsAfter} residuals={residualsAfter}
witnesses={witnessesAfter} witnesses={stepWitnesses}
onJumpToFirstViolation={jumpToFirstViolation} onJumpToFirstViolation={jumpToFirstViolation}
hasFirstViolation={history?.firstViolationStep !== undefined} hasFirstViolation={history?.firstViolationStep !== undefined}
onJumpToStep={goTo} onJumpToStep={goTo}
@@ -237,17 +238,17 @@ export default function RunDetail() {
id: "violations", id: "violations",
label: "Violations", label: "Violations",
badge: badge:
violationsAfter.length > 0 ? ( stepViolations.length > 0 ? (
<span className="tabs-badge" data-kind="violation"> <span className="tabs-badge" data-kind="violation">
{violationsAfter.length} {stepViolations.length}
</span> </span>
) : undefined, ) : undefined,
content: ( content: (
<ViolationsPanel <ViolationsPanel
propertyNames={history?.names ?? []} propertyNames={history?.names ?? []}
violations={violationsAfter} violations={stepViolations}
residuals={residualsAfter} residuals={residualsAfter}
witnesses={witnessesAfter} witnesses={stepWitnesses}
onJumpToFirstViolation={jumpToFirstViolation} onJumpToFirstViolation={jumpToFirstViolation}
hasFirstViolation={history?.firstViolationStep !== undefined} hasFirstViolation={history?.firstViolationStep !== undefined}
onJumpToStep={goTo} onJumpToStep={goTo}