Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

fix(history): use the singular for one finding or reviewed file (#2239)

12d599754104be
diff --git a/sdk/typescript/src/scan-history-renderer.ts b/sdk/typescript/src/scan-history-renderer.ts
index d7aa74935..d71f8af3a 100644
--- a/sdk/typescript/src/scan-history-renderer.ts
+++ b/sdk/typescript/src/scan-history-renderer.ts
@@ -219,7 +219,7 @@ export function renderScanHistory(
new Set(scans.map((scan) => scan["targetPath"])).size > 1;
const wide = width >= (multipleRepositories ? 97 : 80);
lines.push(
- ` ${strong(clean(repository))} ${accent("·")} ${scans.length} ${scans.length === 1 ? "scan" : "scans"}${latest === undefined ? "" : ` ${accent("·")} latest: ${clean(latest)} findings`}`,
+ ` ${strong(clean(repository))} ${accent("·")} ${scans.length} ${scans.length === 1 ? "scan" : "scans"}${latest === undefined ? "" : ` ${accent("·")} latest: ${clean(latest)} finding${latest === 1 ? "" : "s"}`}`,
"",
);
if (wide) {
@@ -245,7 +245,7 @@ export function renderScanHistory(
} else {
lines.push(` ${clean(scan["scanId"])}`);
const separator = ` ${accent("·")} `;
- const summary = `${findings} findings${separator}${statusLabel}`;
+ const summary = `${findings} finding${scan["findingCount"] === 1 ? "" : "s"}${separator}${statusLabel}`;
const location = multipleRepositories
? `${scanRepository}${separator}`
: "";
@@ -361,7 +361,9 @@ export function renderScanHistory(
]),
...(coverage["filesTotal"] == null
? []
- : [`${clean(coverage["filesTotal"])} files`]),
+ : [
+ `${clean(coverage["filesTotal"])} file${coverage["filesTotal"] === 1 ? "" : "s"}`,
+ ]),
];
if (parts.length > 0) {
lines.push(
diff --git a/sdk/typescript/tests-ts/scan-history-renderer.test.ts b/sdk/typescript/tests-ts/scan-history-renderer.test.ts
index 926767a5c..30548dd84 100644
--- a/sdk/typescript/tests-ts/scan-history-renderer.test.ts
+++ b/sdk/typescript/tests-ts/scan-history-renderer.test.ts
@@ -387,6 +387,26 @@ describe("scan history renderer", () => {
}
});
+ test("uses the singular for one finding or reviewed file", () => {
+ const scan = {
+ scanId: "12345678-abcd-4567-abcd-1234567890ab",
+ targetPath: "/demo/service",
+ mode: "standard",
+ progress: { status: "complete", coverage: { filesTotal: 1 } },
+ findingCount: 1,
+ startedAt: "2026-07-24T12:00:00Z",
+ };
+ const list = stripVTControlCharacters(
+ renderScanHistory({ scans: [scan] }, "list", { columns: 60 }),
+ );
+ expect(list).toMatch(/1 scan {2}· {2}latest: 1 finding$/mu);
+ expect(list).toContain("1 finding · ✓ COMPLETE");
+ const show = stripVTControlCharacters(
+ renderScanHistory({ ...scan, findings: [] }, "show"),
+ );
+ expect(show).toMatch(/REVIEW {2}1 file$/mu);
+ });
+
test("shows bounded findings, saved configuration, and failure reasons", () => {
const scan = {
scanId: "12345678-abcd-4567-abcd-1234567890ab",