Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -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".

Expand Down
10 changes: 9 additions & 1 deletion web/src/screens/decisions/FixFirst.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down Expand Up @@ -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."
Expand Down
7 changes: 6 additions & 1 deletion web/src/screens/grid/FixPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -43,7 +44,11 @@ export function FixPanel({ finding, batch, fix, setFix }: Props) {
<div className="fix-panel__text">
<p className="fix-panel__title">
<Badge origin="computed" />
{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}`}
</p>
{!canTry && (
<p className="muted small">
Expand Down