Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(review): open each reviewer's latest run in Activity (#21694)
rebelicec33c1a3d6825
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex fd583de59a..c5e69a42f5 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -553,6 +553,7 @@"sensitive-placeholder": "Sensitive - write only","settings": "Settings","share": "Share",+ "show": "Show","show-less": "Show less","show-more": "Show more","sign-in": "Sign in",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 14b58c40cf..a06ec89077 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -553,6 +553,7 @@"sensitive-placeholder": "Sensible - solo escritura","settings": "Configuraciones","share": "Compartir",+ "show": "Mostrar","show-less": "Mostrar menos","show-more": "Mostrar más","sign-in": "Iniciar sesión",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 0ed229acd8..933b864304 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -553,6 +553,7 @@"sensitive-placeholder": "機密データ - 書き込みのみ","settings": "設定","share": "共有",+ "show": "表示","show-less": "折りたたむ","show-more": "もっと見る","sign-in": "ログイン",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 84e9a272c6..7894b13a75 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -553,6 +553,7 @@"sensitive-placeholder": "Nhạy cảm - Chỉ ghi","settings": "Cài đặt","share": "Chia sẻ",+ "show": "Hiện","show-less": "Thu gọn","show-more": "Hiển thị thêm","sign-in": "Đăng nhập",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 52e59f6275..7d27342b4a 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -553,6 +553,7 @@"sensitive-placeholder": "敏感数据 - 仅写入","settings": "设置","share": "分享",+ "show": "显示","show-less": "收起","show-more": "显示更多","sign-in": "登录",diff --git a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.test.tsx b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.test.tsxindex ae0a75219f..b79676e165 100644--- a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.test.tsx+++ b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.test.tsx@@ -24,7 +24,6 @@ const mocks = vi.hoisted(() => ({activityFocus: undefined as { commentName: string; nonce: number } | undefined,clearActivityFocus: vi.fn(),requestThreadFocus: vi.fn(),- setWalkerFilter: vi.fn(),expandPhase: vi.fn(),placements: new Map<string, unknown>(),placementTargets: new Map<string, string>(),@@ -140,7 +139,6 @@ vi.mock("../../shared/stores/usePlanDetailStore", () => ({usePlanDetailStoreApi: () => ({getState: () => ({requestThreadFocus: mocks.requestThreadFocus,- setWalkerFilter: mocks.setWalkerFilter,}),}),}));@@ -302,27 +300,39 @@ describe("ReviewActivityTimeline", () => {act(() => root.unmount());});- test("a run's line steps through its open findings in the editor", () => {+ test("a run's line shows and hides its finding cards in place", () => {+ const sha = "c".repeat(64);const plan = create(PlanSchema, {name: "projects/p1/plans/1",- specs: [create(Plan_SpecSchema, { id: "spec-1" })],+ specs: [+ create(Plan_SpecSchema, {+ id: "spec-1",+ config: {+ case: "changeDatabaseConfig",+ value: create(Plan_ChangeDatabaseConfigSchema, {+ sheet: `projects/p1/sheets/${sha}`,+ }),+ },+ }),+ ],});- const finding = (- id: string,- line: number,- threadState: IssueComment_ThreadState- ) =>+ const finding = (id: string, ms: number, superseded: boolean) =>create(IssueCommentSchema, {name: `projects/p1/issues/1/issueComments/${id}`,comment: "No WHERE clause",- threadState,- createTime: timestampFromMs(0),+ threadState: superseded+ ? IssueComment_ThreadState.RESOLVED+ : IssueComment_ThreadState.OPEN,+ createTime: timestampFromMs(ms),statementAnchor: create(StatementAnchorSchema, {spec: "spec-1",- startPosition: create(PositionSchema, { line, column: 0 }),+ sheetSha256: sha,+ startPosition: create(PositionSchema, { line: 1, column: 0 }),+ endPosition: create(PositionSchema, { line: 1, column: 0 }),}),reviewMetadata: create(IssueComment_ReviewMetadataSchema, {runType: ReviewRun_Type.RULE,+ superseded,}),});const container = document.createElement("div");@@ -330,29 +340,30 @@ describe("ReviewActivityTimeline", () => {act(() => {root.render(<ReviewActivityTimeline- comments={[- finding("resolved", 1, IssueComment_ThreadState.RESOLVED),- finding("open-5", 5, IssueComment_ThreadState.OPEN),- finding("open-3", 3, IssueComment_ThreadState.OPEN),- ]}+ comments={[finding("old", 0, true), finding("new", 60_000, false)]}issue={create(IssueSchema, { name: "projects/p1/issues/1" })}plan={plan}/>);});- const show = [...container.querySelectorAll("button")].find(- (button) => button.textContent === "plan.deploy-waiting.show"- );- act(() => show?.click());- expect(mocks.setWalkerFilter).toHaveBeenCalledWith({- runType: ReviewRun_Type.RULE,- group: "open",- });- expect(mocks.requestThreadFocus).toHaveBeenCalledWith(- expect.objectContaining({- commentName: "projects/p1/issues/1/issueComments/open-3",- })- );+ const cards = () =>+ [...container.querySelectorAll("[data-testid='thread-card']")].map(+ (card) => card.getAttribute("data-root")?.split("/").pop()+ );+ const runButtons = () =>+ [...container.querySelectorAll("button[aria-expanded]")];+ expect(cards()).toEqual(["new"]);+ expect(runButtons().map((button) => button.textContent)).toEqual([+ "common.show",+ "common.hide",+ ]);++ act(() => (runButtons()[0] as HTMLButtonElement).click());+ expect(cards()).toEqual(["old", "new"]);++ act(() => (runButtons()[1] as HTMLButtonElement).click());+ expect(cards()).toEqual(["old"]);+ expect(mocks.requestThreadFocus).not.toHaveBeenCalled();act(() => root.unmount());});diff --git a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsxindex 01d10a82c6..ff8bc847a9 100644--- a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx+++ b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx@@ -44,12 +44,8 @@ import { hasProjectPermissionV2 } from "@/utils/iam/permission";import { useFocusThread } from "../../hooks/useFocusThread";import { usePlanChangeReferenceData } from "../../hooks/usePlanChangeReferenceData";import { placementOf } from "../../shared/stores/placementSlice";-import {- usePlanDetailStore,- usePlanDetailStoreApi,-} from "../../shared/stores/usePlanDetailStore";+import { usePlanDetailStore } from "../../shared/stores/usePlanDetailStore";import { usePlanDetailContext } from "../../shell/PlanDetailContext";-import { findingsInOrder } from "../../utils/findingIndex";import { PlanSpecChangeReference } from "../PlanChangeReference";import { CommentThreadCard } from "../threads/CommentThreadCard";import { ReviewerIcon, reviewerName } from "../threads/ReviewResult";@@ -84,6 +80,12 @@ export function ReviewActivityTimeline({const page = usePlanDetailContext();const project = useProjectByName(`${projectNamePrefix}${page.projectId}`);const [expanded, setExpanded] = useState(false);+ const [runToggles, setRunToggles] = useState<ReadonlyMap<string, boolean>>(+ new Map()+ );+ const toggleRun = useCallback((runId: string, open: boolean) => {+ setRunToggles((prev) => new Map(prev).set(runId, open));+ }, []);const planUpdateSpecs = useMemo(() => collectPlanUpdateSpecs(comments),[comments]@@ -110,6 +112,7 @@ export function ReviewActivityTimeline({useEffect(() => {setExpanded(false);+ setRunToggles(new Map());}, [page.pageKey]);// A card asked for from elsewhere may sit in the folded middle, so the@@ -160,6 +163,7 @@ export function ReviewActivityTimeline({issueDraft: issue.draft,comments,keepFindingCard,+ runToggles,}),[comments,@@ -169,6 +173,7 @@ export function ReviewActivityTimeline({keepFindingCard,plan.createTime,plan.creator,+ runToggles,]);const items = useMemo(() => {@@ -214,6 +219,7 @@ export function ReviewActivityTimeline({issue={issue}isLast={isLast}key={item.entry.id}+ onToggleRun={toggleRun}plan={plan}renderPlanChangeReference={renderPlanChangeReference}threads={threads}@@ -283,6 +289,7 @@ function ActivityRow({entry,issue,isLast,+ onToggleRun,plan,renderPlanChangeReference,threads,@@ -290,13 +297,20 @@ function ActivityRow({entry: TimelineEntry;issue: Issue;isLast: boolean;+ onToggleRun: (runId: string, open: boolean) => void;plan: Plan;renderPlanChangeReference: PlanChangeReferenceRenderer;threads: CommentThread[];}) {const source = entry.source;if (source.type === "review-run") {- return <ReviewRunActivityRow isLast={isLast} plan={plan} source={source} />;+ return (+ <ReviewRunActivityRow+ isLast={isLast}+ onToggle={() => onToggleRun(entry.id, !source.open)}+ source={source}+ />+ );}if (source.type === "comment" && isThreadRoot(source.comment)) {const thread = threads.find(@@ -337,37 +351,21 @@ function ActivityRow({);}-// One line per run in place of a card per finding, which the editor shows:-// how many findings it posted and how many are still open. "Show" steps-// through the open ones in the editor.+// One line per run: how many findings it posted and how many are still open.+// "Show" opens the run's finding cards below it.function ReviewRunActivityRow({isLast,- plan,+ onToggle,source,}: {isLast: boolean;- plan: Plan;+ onToggle: () => void;source: Extract<TimelineSource, { type: "review-run" }>;}) {const { t } = useTranslation();- const storeApi = usePlanDetailStoreApi();- const { focusInStatement } = useFocusThread();const open = source.findings.filter((finding) => finding.threadState === IssueComment_ThreadState.OPEN).length;- const showOpen = () => {- const first = findingsInOrder(- source.findings,- source.runType,- plan.specs,- "open"- )[0];- if (!first) return;- storeApi- .getState()- .setWalkerFilter({ runType: source.runType, group: "open" });- focusInStatement(first);- };return (<ActivityRowShellheader={@@ -390,16 +388,15 @@ function ReviewRunActivityRow({className="text-xs text-control-light"tsMs={getTimeForPbTimestampProtoEs(source.time)}/>- {open > 0 && (- <Button- appearance="link"- className="text-control-light"- onClick={showOpen}- size="xs"- >- {t("plan.deploy-waiting.show")}- </Button>- )}+ <Button+ aria-expanded={source.open}+ appearance="link"+ className="text-control-light"+ onClick={onToggle}+ size="xs"+ >+ {source.open ? t("common.hide") : t("common.show")}+ </Button></>}icon={diff --git a/frontend/src/routes/project/plan-detail/components/review/foldTimeline.test.ts b/frontend/src/routes/project/plan-detail/components/review/foldTimeline.test.tsindex 4292bbbe4d..ecd8cc7a26 100644--- a/frontend/src/routes/project/plan-detail/components/review/foldTimeline.test.ts+++ b/frontend/src/routes/project/plan-detail/components/review/foldTimeline.test.ts@@ -1,11 +1,19 @@// @vitest-environment nodeimport { describe, expect, test } from "vitest";-import { FOLD_HEAD, FOLD_TAIL, foldTimeline } from "./foldTimeline";+import {+ FOLD_HEAD,+ FOLD_TAIL,+ type FoldedItem,+ foldTimeline,+} from "./foldTimeline";interface E {id: string;+ pinned?: boolean;}-const e = (id: string): E => ({ id });+const e = (id: string, pinned?: boolean): E => ({ id, pinned });+const idsOf = (items: FoldedItem<E>[]) =>+ items.map((i) => (i.type === "entry" ? i.entry.id : `FOLD:${i.count}`));describe("foldTimeline", () => {test("timelines of 10 or fewer never fold", () => {@@ -36,6 +44,32 @@ describe("foldTimeline", () => {expect(items.find((i) => i.type === "fold")).toMatchObject({ count: 24 });});+ test("pinned entries stay in place and split the fold", () => {+ const entries = Array.from({ length: 30 }, (_, i) =>+ e(`e${i}`, i >= 15 && i < 18)+ );+ expect(idsOf(foldTimeline(entries, false))).toEqual([+ "e0",+ "e1",+ "e2",+ "FOLD:12",+ "e15",+ "e16",+ "e17",+ "FOLD:9",+ "e27",+ "e28",+ "e29",+ ]);+ });++ test("a stretch too short to fold renders as is", () => {+ const entries = Array.from({ length: 20 }, (_, i) => e(`e${i}`, i >= 7));+ expect(idsOf(foldTimeline(entries, false))).toEqual(+ entries.map((entry) => entry.id)+ );+ });+test("expanded shows everything", () => {const entries = Array.from({ length: 30 }, (_, i) => e(`e${i}`));expect(foldTimeline(entries, true)).toHaveLength(30);diff --git a/frontend/src/routes/project/plan-detail/components/review/foldTimeline.ts b/frontend/src/routes/project/plan-detail/components/review/foldTimeline.tsindex 90a31d9438..748c05baf2 100644--- a/frontend/src/routes/project/plan-detail/components/review/foldTimeline.ts+++ b/frontend/src/routes/project/plan-detail/components/review/foldTimeline.ts@@ -1,9 +1,11 @@-// Long-history fold: once the timeline has more than FOLD_THRESHOLD entries,-// only the first FOLD_HEAD and last FOLD_TAIL render; everything in between-// collapses into a single fold marker carrying the exact hidden count. One-// click ("Show all") expands the whole list.+// Long-history fold: past the first FOLD_HEAD and before the last FOLD_TAIL+// entries, each stretch of FOLD_MIN_HIDDEN or more unpinned entries collapses+// into a single fold marker carrying the exact hidden count. Pinned entries+// stay in place and split the stretch around them. One click ("Show all")+// expands the whole list.export interface FoldableEntry {id: string;+ pinned?: boolean;}export type FoldedItem<T extends FoldableEntry> =@@ -12,25 +14,36 @@ export type FoldedItem<T extends FoldableEntry> =export const FOLD_HEAD = 3;export const FOLD_TAIL = 3;-// Fold only when collapsing would actually hide something, i.e. there are more-// than head + tail entries. ">10" in the design (3 + 3 visible + >=5 hidden).-export const FOLD_THRESHOLD = 10;+// Fold only when collapsing would actually hide something. ">10" in the+// design: 3 + 3 visible + >=5 hidden.+export const FOLD_MIN_HIDDEN = 5;export function foldTimeline<T extends FoldableEntry>(entries: T[],expanded: boolean): FoldedItem<T>[] {- const all = entries.map((entry) => ({ type: "entry" as const, entry }));- if (expanded || entries.length <= FOLD_THRESHOLD) {- return all;+ if (expanded) {+ return entries.map((entry) => ({ type: "entry", entry }));}- const hiddenCount = entries.length - FOLD_HEAD - FOLD_TAIL;- const items: FoldedItem<T>[] = entries- .slice(0, FOLD_HEAD)- .map((entry) => ({ type: "entry" as const, entry }));- items.push({ type: "fold", count: hiddenCount });- for (const entry of entries.slice(entries.length - FOLD_TAIL)) {+ const items: FoldedItem<T>[] = [];+ let stretch: T[] = [];+ const flush = () => {+ if (stretch.length >= FOLD_MIN_HIDDEN) {+ items.push({ type: "fold", count: stretch.length });+ } else {+ for (const entry of stretch) items.push({ type: "entry", entry });+ }+ stretch = [];+ };+ entries.forEach((entry, i) => {+ const inMiddle = i >= FOLD_HEAD && i < entries.length - FOLD_TAIL;+ if (inMiddle && !entry.pinned) {+ stretch.push(entry);+ return;+ }+ flush();items.push({ type: "entry", entry });- }+ });+ flush();return items;}diff --git a/frontend/src/routes/project/plan-detail/components/review/timelineEvents.test.ts b/frontend/src/routes/project/plan-detail/components/review/timelineEvents.test.tsindex 628dae0fd6..c1cfe60896 100644--- a/frontend/src/routes/project/plan-detail/components/review/timelineEvents.test.ts+++ b/frontend/src/routes/project/plan-detail/components/review/timelineEvents.test.ts@@ -10,7 +10,7 @@ import {IssueCommentSchema,ReviewRun_Type,} from "@/types/proto-es/v1/issue_service_pb";-import { buildTimelineEntries } from "./timelineEvents";+import { buildTimelineEntries, type TimelineEntry } from "./timelineEvents";const userComment = (name: string, comment: string) =>create(IssueCommentSchema, { name, comment, creator: "users/[email protected]" });@@ -103,36 +103,84 @@ describe("buildTimelineEntries", () => {expect(entries.map((entry) => entry.id)).toEqual(["c-submit"]);});- test("folds each run's findings into one line and keeps only the cards asked for", () => {- const finding = (- name: string,- runType: ReviewRun_Type,- seconds: bigint,- nanos = 0- ) =>- create(IssueCommentSchema, {- name,- threadState: IssueComment_ThreadState.OPEN,- createTime: create(TimestampSchema, { seconds, nanos }),- reviewMetadata: create(IssueComment_ReviewMetadataSchema, { runType }),- });+ const finding = (+ name: string,+ runType: ReviewRun_Type,+ superseded: boolean,+ seconds: bigint,+ nanos = 0+ ) =>+ create(IssueCommentSchema, {+ name,+ threadState: superseded+ ? IssueComment_ThreadState.RESOLVED+ : IssueComment_ThreadState.OPEN,+ createTime: create(TimestampSchema, { seconds, nanos }),+ reviewMetadata: create(IssueComment_ReviewMetadataSchema, {+ runType,+ superseded,+ }),+ });+ const rowsOf = (entries: TimelineEntry[]) =>+ entries.map((entry) =>+ entry.source.type === "review-run"+ ? `run:${entry.source.findings.map((f) => f.name).join("+")}`+ : entry.id+ );++ test("opens each reviewer's latest run and folds a superseded one to the cards asked for", () => {const entries = buildTimelineEntries({comments: [- finding("r1", ReviewRun_Type.RULE, 10n, 0),- finding("r2", ReviewRun_Type.RULE, 10n, 1000),+ finding("r1", ReviewRun_Type.RULE, true, 10n, 0),+ finding("r2", ReviewRun_Type.RULE, true, 10n, 1000),userComment("u", "hello"),- finding("r3", ReviewRun_Type.RULE, 60n),- finding("a1", ReviewRun_Type.AI, 61n),+ finding("r3", ReviewRun_Type.RULE, false, 60n),+ finding("a1", ReviewRun_Type.AI, false, 61n),],keepFindingCard: (root) => root.name === "r2",});- expect(- entries.map((entry) =>- entry.source.type === "review-run"- ? `run:${entry.source.findings.map((f) => f.name).join("+")}`- : entry.id- )- ).toEqual(["run:r1+r2", "r2", "u", "run:r3", "run:a1"]);+ expect(rowsOf(entries)).toEqual([+ "run:r1+r2",+ "r2",+ "u",+ "run:r3",+ "r3",+ "run:a1",+ "a1",+ ]);+ });++ test("a toggle opens a superseded run and folds the latest one", () => {+ const entries = buildTimelineEntries({+ comments: [+ finding("r1", ReviewRun_Type.RULE, true, 10n),+ finding("r2", ReviewRun_Type.RULE, false, 60n),+ ],+ keepFindingCard: () => false,+ runToggles: new Map([+ ["review-run:r1", true],+ ["review-run:r2", false],+ ]),+ });+ expect(rowsOf(entries)).toEqual(["run:r1", "r1", "run:r2"]);+ });++ test("pins an open run's line and cards, apart from a superseded run a second before", () => {+ const entries = buildTimelineEntries({+ comments: [+ finding("old-1", ReviewRun_Type.RULE, true, 10n),+ finding("old-2", ReviewRun_Type.RULE, true, 10n),+ finding("new-1", ReviewRun_Type.RULE, false, 11n),+ finding("new-2", ReviewRun_Type.RULE, false, 11n),+ ],+ keepFindingCard: () => false,+ });+ expect(entries.map((entry) => [entry.id, Boolean(entry.pinned)])).toEqual([+ ["review-run:old-1", false],+ ["review-run:new-1", true],+ ["new-1", true],+ ["new-2", true],+ ]);});test("without the log, every finding stays its own entry", () => {diff --git a/frontend/src/routes/project/plan-detail/components/review/timelineEvents.ts b/frontend/src/routes/project/plan-detail/components/review/timelineEvents.tsindex 6e89a44637..eaf483b92d 100644--- a/frontend/src/routes/project/plan-detail/components/review/timelineEvents.ts+++ b/frontend/src/routes/project/plan-detail/components/review/timelineEvents.ts@@ -14,12 +14,13 @@ export type TimelineSource =| { type: "plan-created"; creator: string; time?: Timestamp }| { type: "ready-for-review"; creator: string; time?: Timestamp }| { type: "comment"; comment: IssueComment }- // One line for a reviewer's run, standing in for the findings it posted.+ // One line for a reviewer's run, which opens to the findings it posted.| {type: "review-run";runType: ReviewRun_Type;time?: Timestamp;findings: IssueComment[];+ open: boolean;};// A run posts its findings in one batch, a microsecond apart.@@ -32,6 +33,9 @@ export interface TimelineEntry {// consecutive similar activities (e.g. repeated label edits). Drives the// "(N similar activities)" badge. Absent means a standalone row.similarCount?: number;+ // The line and cards of an open run, which the long-history fold leaves in+ // place.+ pinned?: boolean;}export function buildTimelineEntries(input: {@@ -41,9 +45,12 @@ export function buildTimelineEntries(input: {issueCreateTime?: Timestamp;issueDraft?: boolean;comments: IssueComment[];- // Under SQL Review V2, findings become one line per run; a finding keeps- // its own card only where this says so.+ // Under SQL Review V2, findings become one line per run. An open run shows+ // every finding's card; a folded one only those this keeps.keepFindingCard?: (root: IssueComment) => boolean;+ // Runs someone opened or folded, by entry id. The rest follow the default:+ // only each reviewer's latest run is open.+ runToggles?: ReadonlyMap<string, boolean>;}): TimelineEntry[] {const reviewSubmission = input.comments.find((comment) => comment.event.case === "reviewSubmission"@@ -73,6 +80,7 @@ export function buildTimelineEntries(input: {ReviewRun_Type,{at: number;+ latest: boolean;source: Extract<TimelineSource, { type: "review-run" }>;}>();@@ -94,22 +102,38 @@ export function buildTimelineEntries(input: {}const review = comment.reviewMetadata;if (input.keepFindingCard && review && isThreadRoot(comment)) {+ // A completed run supersedes every earlier result of its reviewer, so+ // the results still current are the latest run's, and a run's results+ // are never split between the two.+ const latest = !review.superseded;const time = getTimeForPbTimestampProtoEs(comment.createTime, 0);- const last = runs.get(review.runType);- if (last && time - last.at <= RUN_BATCH_GAP_MS) {- last.source.findings.push(comment);- last.at = time;+ let run = runs.get(review.runType);+ if (run && run.latest === latest && time - run.at <= RUN_BATCH_GAP_MS) {+ run.source.findings.push(comment);+ run.at = time;} else {- const source = {- type: "review-run" as const,- runType: review.runType,- time: comment.createTime,- findings: [comment],+ const id = `review-run:${comment.name}`;+ run = {+ at: time,+ latest,+ source: {+ type: "review-run",+ runType: review.runType,+ time: comment.createTime,+ findings: [comment],+ open: input.runToggles?.get(id) ?? latest,+ },};- runs.set(review.runType, { at: time, source });- entries.push({ id: `review-run:${comment.name}`, source });+ runs.set(review.runType, run);+ entries.push({ id, source: run.source, pinned: run.source.open });}- if (!input.keepFindingCard(comment)) continue;+ if (!run.source.open && !input.keepFindingCard(comment)) continue;+ entries.push({+ id: comment.name,+ source: { type: "comment", comment },+ pinned: run.source.open,+ });+ continue;}entries.push({ id: comment.name, source: { type: "comment", comment } });}diff --git a/frontend/src/routes/project/plan-detail/components/threads/threadModel.ts b/frontend/src/routes/project/plan-detail/components/threads/threadModel.tsindex 13bc7ccd62..6d97d99394 100644--- a/frontend/src/routes/project/plan-detail/components/threads/threadModel.ts+++ b/frontend/src/routes/project/plan-detail/components/threads/threadModel.ts@@ -255,10 +255,11 @@ export function isShownInEditor();}-// Under SQL Review V2, Activity records each run as one line, so a finding-// keeps its own card only where nothing else shows it: people replied to it,-// or the editor cannot show it. A result a later run superseded is history-// unless someone reopened it, since an open thread holds the rollout.+// Under SQL Review V2, a folded run shows in Activity as one line, so a+// finding of it keeps its own card only where nothing else shows it: people+// replied to it, or the editor cannot show it. A result a later run superseded+// is history unless someone reopened it, since an open thread holds the+// rollout.export function needsActivityCard(thread: CommentThread,shownInEditor: boolean