Skip to content

Commit 53d1845

Browse files
committed
chore: merge review-fix packet (demo line-0 guard)
2 parents fa20901 + 8cf6099 commit 53d1845

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

apps/webapp/app/components/dashboard-agent/demo/demo.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { join } from "node:path";
1616
import { describe, expect, it } from "vitest";
1717
import { resolveSuggestedPrompts } from "../suggested-prompts";
1818
import * as fixtures from "./fixtures";
19-
import { DEMO_ID_PREFIX, DEMO_MARKER } from "./ids";
19+
import { DEMO_ID_PREFIX, DEMO_MARKER, demoSourceUri } from "./ids";
2020

2121
const DEMO_DIR = __dirname;
2222

@@ -70,6 +70,12 @@ describe("demo ids", () => {
7070
expect(id).toContain(DEMO_MARKER);
7171
}
7272
});
73+
74+
it("rejects a zero source line instead of dropping it", () => {
75+
expect(() => demoSourceUri("abc", "src/a.ts", 0)).toThrow(/positive integer/);
76+
expect(demoSourceUri("abc", "src/a.ts", 42)).toContain("?line=42");
77+
expect(demoSourceUri("abc", "src/a.ts")).not.toContain("line=");
78+
});
7379
});
7480

7581
describe("view block fixtures", () => {

apps/webapp/app/components/dashboard-agent/demo/ids.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ export function demoReportUri(key: string): TriggerUri {
4444
}
4545

4646
export function demoSourceUri(sha: string, path: string, line?: number): TriggerUri {
47-
return formatTriggerUri({ kind: "source", ...scope, sha, path, ...(line ? { line } : {}) });
47+
return formatTriggerUri({
48+
kind: "source",
49+
...scope,
50+
sha,
51+
path,
52+
...(line !== undefined ? { line } : {}),
53+
});
4854
}
4955

5056
export function demoInvestigationUri(investigationId: string): TriggerUri {

0 commit comments

Comments
 (0)