From cf74ec1d2e3e7a45e4d7885c99a123e0656dd4cb Mon Sep 17 00:00:00 2001 From: Pranav Mathad Date: Sun, 29 Nov 2026 03:29:36 +0100 Subject: [PATCH] Say checked by simulation only when the fix removes its link --- spec.md | 2 +- web/src/screens/decisions/FixFirst.tsx | 10 +++++++++- web/src/screens/grid/FixPanel.tsx | 7 ++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/spec.md b/spec.md index 76af4365..01596581 100644 --- a/spec.md +++ b/spec.md @@ -480,7 +480,7 @@ For `move_symbol`, and for fixes that remove a specific link, the tool applies t "links_removed": 1, "links_added": 0, "new_exceptions": []} ``` -The report shows "fix checked by simulation" with these numbers. Other fix types are shown as "not simulated". A fix whose simulation creates new exceptions is shown with that warning. +The report shows "fix checked by simulation" with these numbers. A simulated fix that does not remove the link it targets is shown as "simulated: the link remains", not as "fix checked by simulation". Other fix types are shown as "not simulated". A fix whose simulation creates new exceptions is shown with that warning. `split_by_responsibility` is shown as "not simulated". diff --git a/web/src/screens/decisions/FixFirst.tsx b/web/src/screens/decisions/FixFirst.tsx index 69d2f909..1b24d6a1 100644 --- a/web/src/screens/decisions/FixFirst.tsx +++ b/web/src/screens/decisions/FixFirst.tsx @@ -176,8 +176,14 @@ export function FixFirst({ ); } +/** True when the fix was simulated but the link it targets is still on the map. */ +export function linkRemains(simulation: Simulation | null | undefined): boolean { + return Boolean(simulation?.simulated) && simulation?.target_link_removed === false; +} + function simulationShort(simulation: Simulation | null): string { if (!simulation?.simulated) return "Not simulated"; + if (linkRemains(simulation)) return "Simulated: the link remains"; if (simulation.new_exceptions.length > 0) return "Simulated, adds exceptions"; return "Checked by simulation"; } @@ -386,9 +392,11 @@ function SimulationText({ simulation }: { simulation: Simulation | null }) { ? `loops ${num(simulation.loops_before)} to ${num(simulation.loops_after)}` : "loops not counted"; const added = simulation.new_exceptions.length; + const remains = linkRemains(simulation); return ( <> - Fix checked by simulation: {loops}, {num(simulation.links_removed)} link + {remains ? "Simulated: the link remains. " : "Fix checked by simulation: "} + {remains ? loops[0].toUpperCase() + loops.slice(1) : loops}, {num(simulation.links_removed)} link {simulation.links_removed === 1 ? "" : "s"} removed, {num(simulation.links_added)} added.{" "} {added === 0 ? "No new exceptions." diff --git a/web/src/screens/grid/FixPanel.tsx b/web/src/screens/grid/FixPanel.tsx index 1a2e1340..d9e5f7de 100644 --- a/web/src/screens/grid/FixPanel.tsx +++ b/web/src/screens/grid/FixPanel.tsx @@ -3,6 +3,7 @@ import { Badge } from "../../components/Badge"; import type { BatchSimulation, Finding } from "../../contracts/generated"; import type { View } from "../../data/view"; +import { linkRemains } from "../decisions/FixFirst"; interface Props { finding: Finding | undefined; @@ -43,7 +44,11 @@ export function FixPanel({ finding, batch, fix, setFix }: Props) {

- {oneOn ? "Fix checked by simulation" : `The fix for finding ${finding.priority.rank}`} + {oneOn + ? linkRemains(simulation) + ? "Fix simulated: the link remains" + : "Fix checked by simulation" + : `The fix for finding ${finding.priority.rank}`}

{!canTry && (