Use singular verb agreement when one existing issue remains

The patrol run-row drill-down rendered "1 existing issue remain"
because the pluralization only toggled the noun, not the verb.
Visible whenever an errored or unchanged run still had exactly one
active finding (e.g. the Provider analysis error scenario observed
in the wild).

Adds a singular-case test alongside the existing plural one with a
regression guard against the previous wording.
This commit is contained in:
rcourtman
2026-05-10 19:35:59 +01:00
parent a343ba0126
commit a0ddd97267
2 changed files with 36 additions and 1 deletions
@@ -273,7 +273,7 @@ export function RunHistoryEntry(props: RunHistoryEntryProps) {
) : run.existing_findings > 0 ? (
<>
No new issues, but <strong>{run.existing_findings}</strong> existing issue
{run.existing_findings !== 1 ? 's' : ''} remain.
{run.existing_findings !== 1 ? 's remain' : ' remains'}.
</>
) : !hasFindingsSnapshot ? (
<span class="text-blue-600 dark:text-blue-400">
@@ -378,6 +378,41 @@ describe('RunHistoryEntry', () => {
expect(screen.queryByText(/^All clear$/)).not.toBeInTheDocument();
});
it('uses singular verb agreement when a single existing issue remains', () => {
render(() => (
<RunHistoryEntry
run={{
...run,
id: 'run-existing-issue-singular',
existing_findings: 1,
status: 'issues_found',
findings_summary: 'One existing issue remains',
}}
isLive={false}
patrolStream={patrolStream}
selected={true}
onSelect={vi.fn()}
/>
));
expect(
screen.getByText(
(_, element) =>
element?.tagName === 'P' &&
(element.textContent?.includes('No new issues, but 1 existing issue remains.') ?? false),
),
).toBeInTheDocument();
// Guard against the regression: the prior wording was "1 existing issue remain."
expect(
screen.queryByText(
(_, element) =>
element?.tagName === 'P' &&
(element.textContent?.includes('existing issue remain.') ?? false) &&
!(element.textContent?.includes('remains.') ?? false),
),
).not.toBeInTheDocument();
});
it('surfaces deterministic triage runs that skipped the llm', () => {
render(() => (
<RunHistoryEntry