Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor(frontend): the last guards that only restated absence

zchpetercfd07425c5c6
diff --git a/frontend/src/components/release/ReleaseInfoCard.tsx b/frontend/src/components/release/ReleaseInfoCard.tsx
index da64943a02..070b4bf9be 100644
--- a/frontend/src/components/release/ReleaseInfoCard.tsx
+++ b/frontend/src/components/release/ReleaseInfoCard.tsx
@@ -167,12 +167,10 @@ function ReleaseBlock({ release }: Readonly<{ release: Release }>) {
</div>
)}
- {createdTimeMs !== undefined && (
- <HumanizeTs
- className="text-xs text-control-light"
- tsMs={createdTimeMs}
- />
- )}
+ <HumanizeTs
+ className="text-xs text-control-light"
+ tsMs={createdTimeMs}
+ />
</div>
</div>
);
diff --git a/frontend/src/routes/project/ProjectReleaseDetailPage.tsx b/frontend/src/routes/project/ProjectReleaseDetailPage.tsx
index 642712939d..f02d5d6337 100644
--- a/frontend/src/routes/project/ProjectReleaseDetailPage.tsx
+++ b/frontend/src/routes/project/ProjectReleaseDetailPage.tsx
@@ -259,9 +259,7 @@ function ReleaseBasicInfo({
<div className="flex flex-row items-center pl-1 gap-4">
<div className="flex items-center gap-1">
<Clock4 className="size-4 text-control-light" />
- {createTimeMs !== undefined && (
- <HumanizeTs tsMs={createTimeMs} className="text-sm text-control" />
- )}
+ <HumanizeTs tsMs={createTimeMs} className="text-sm text-control" />
</div>
{showVcs && (
<div className="flex flex-row items-center gap-1">
diff --git a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx
index 8c05367f63..0f41191beb 100644
--- a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx
+++ b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx
@@ -142,9 +142,7 @@ function TaskRunHistoryItem({
)}
</span>
<span className="flex shrink-0 items-center gap-x-3 text-xs text-control-light">
- {startMs !== undefined && (
- <HumanizeTs mode="compact" tsMs={startMs} />
- )}
+ <HumanizeTs mode="compact" tsMs={startMs} />
{duration && (
<span className="flex items-center gap-x-1">
<Clock3 className="size-3" />
diff --git a/frontend/src/routes/project/plan-detail/components/threads/CommentThreadCard.test.tsx b/frontend/src/routes/project/plan-detail/components/threads/CommentThreadCard.test.tsx
index 5661367c06..e09b675fce 100644
--- a/frontend/src/routes/project/plan-detail/components/threads/CommentThreadCard.test.tsx
+++ b/frontend/src/routes/project/plan-detail/components/threads/CommentThreadCard.test.tsx
@@ -1,5 +1,5 @@
import { create } from "@bufbuild/protobuf";
-import { TimestampSchema } from "@bufbuild/protobuf/wkt";
+import { timestampFromMs } from "@bufbuild/protobuf/wkt";
import { act, useState } from "react";
import { createRoot, type Root } from "react-dom/client";
import { MonacoViewZoneRevealContext } from "@/components/monaco/MonacoViewZone";
@@ -118,14 +118,20 @@ const project = { name: "projects/p" } as Project;
const comment = (
id: string,
text: string,
- extra: { root?: string; resolved?: boolean; creator?: string } = {}
+ extra: {
+ root?: string;
+ resolved?: boolean;
+ creator?: string;
+ writtenMs?: number;
+ editedMs?: number;
+ } = {}
) =>
create(IssueCommentSchema, {
name: `${ISSUE}/issueComments/${id}`,
comment: text,
creator: extra.creator ?? "users/[email protected]",
- createTime: create(TimestampSchema, { seconds: BigInt(1) }),
- updateTime: create(TimestampSchema, { seconds: BigInt(1) }),
+ createTime: timestampFromMs(extra.writtenMs ?? 1_000),
+ updateTime: timestampFromMs(extra.editedMs ?? extra.writtenMs ?? 1_000),
root: extra.root,
threadState:
extra.root !== undefined
@@ -228,13 +234,11 @@ describe("CommentThreadCard", () => {
test("times a reply by when it was written, not when it was edited", () => {
// The two instants sit beside each other in ThreadComment and feed the
// same "edited" marker, so the row has to say which one it shows.
- const reply = create(IssueCommentSchema, {
- name: `${ISSUE}/issueComments/edited`,
- comment: "Reply",
- creator: "users/[email protected]",
+ const writtenMs = Date.UTC(2026, 2, 2, 12);
+ const reply = comment("edited", "Reply", {
root: `${ISSUE}/issueComments/root`,
- createTime: create(TimestampSchema, { seconds: BigInt(1_000) }),
- updateTime: create(TimestampSchema, { seconds: BigInt(2_000) }),
+ writtenMs,
+ editedMs: writtenMs + 60_000,
});
const [thread] = groupThreads([comment("root", "Root question"), reply]);
render(
@@ -244,8 +248,8 @@ describe("CommentThreadCard", () => {
const shown = Array.from(
container.querySelectorAll("[data-testid='humanize-ts']")
).map((node) => node.textContent);
- expect(shown).toContain("1000000");
- expect(shown).not.toContain("2000000");
+ expect(shown).toContain(String(writtenMs));
+ expect(shown).not.toContain(String(writtenMs + 60_000));
});
test("renders the root and replies oldest first with the thread footer", () => {
diff --git a/frontend/src/utils/v1/issue/rollout.test.ts b/frontend/src/utils/v1/issue/rollout.test.ts
index a066a1c00f..e40d4fa56d 100644
--- a/frontend/src/utils/v1/issue/rollout.test.ts
+++ b/frontend/src/utils/v1/issue/rollout.test.ts
@@ -123,35 +123,42 @@ describe("getStageStatusFromCounts", () => {
});
});
-describe("isTaskActivelyTransitioning", () => {
- const NOW = 1_700_000_000_000; // fixed "now" in ms
- const at = (offsetSec: number) => ({
- seconds: BigInt(NOW / 1000 + offsetSec),
+const NOW_MS = 1_700_000_000_000;
+const RUN_AT_MS = 1_772_452_800_000;
+
+const taskAt = (status: Task_Status, runTimeMs?: number) =>
+ create(TaskSchema, {
+ status,
+ runTime: runTimeMs === undefined ? undefined : timestampFromMs(runTimeMs),
});
- const task = (status: Task_Status, runTime?: { seconds: bigint }) =>
- create(TaskSchema, runTime ? { status, runTime } : { status });
+
+describe("isTaskActivelyTransitioning", () => {
+ const at = (offsetSec: number) => NOW_MS + offsetSec * 1_000;
test("RUNNING is always active, regardless of run_time", () => {
- expect(isTaskActivelyTransitioning(task(Task_Status.RUNNING), NOW)).toBe(
- true
- );
expect(
- isTaskActivelyTransitioning(task(Task_Status.RUNNING, at(3600)), NOW)
+ isTaskActivelyTransitioning(taskAt(Task_Status.RUNNING), NOW_MS)
+ ).toBe(true);
+ expect(
+ isTaskActivelyTransitioning(taskAt(Task_Status.RUNNING, at(3600)), NOW_MS)
).toBe(true);
});
test("PENDING is active when unscheduled or already due", () => {
- expect(isTaskActivelyTransitioning(task(Task_Status.PENDING), NOW)).toBe(
- true
- );
expect(
- isTaskActivelyTransitioning(task(Task_Status.PENDING, at(-3600)), NOW)
+ isTaskActivelyTransitioning(taskAt(Task_Status.PENDING), NOW_MS)
+ ).toBe(true);
+ expect(
+ isTaskActivelyTransitioning(
+ taskAt(Task_Status.PENDING, at(-3600)),
+ NOW_MS
+ )
).toBe(true);
});
test("PENDING scheduled for a future run_time is not active", () => {
expect(
- isTaskActivelyTransitioning(task(Task_Status.PENDING, at(3600)), NOW)
+ isTaskActivelyTransitioning(taskAt(Task_Status.PENDING, at(3600)), NOW_MS)
).toBe(false);
});
@@ -163,32 +170,22 @@ describe("isTaskActivelyTransitioning", () => {
Task_Status.CANCELED,
Task_Status.SKIPPED,
]) {
- expect(isTaskActivelyTransitioning(task(status), NOW)).toBe(false);
+ expect(isTaskActivelyTransitioning(taskAt(status), NOW_MS)).toBe(false);
}
});
});
-const RUN_AT_MS = 1_772_452_800_000;
-
-const scheduledTask = (status: Task_Status, runTimeMs?: number) =>
- create(TaskSchema, {
- status,
- runTime: runTimeMs === undefined ? undefined : timestampFromMs(runTimeMs),
- });
-
describe("scheduledRunTimeMs", () => {
test("gives the instant a waiting task is due to run", () => {
- expect(
- scheduledRunTimeMs(scheduledTask(Task_Status.PENDING, RUN_AT_MS))
- ).toBe(RUN_AT_MS);
+ expect(scheduledRunTimeMs(taskAt(Task_Status.PENDING, RUN_AT_MS))).toBe(
+ RUN_AT_MS
+ );
});
test("gives nothing for a waiting task with no time set", () => {
// Such a task is due now, not scheduled -- the reading rollout.ts already
// takes of an absent runTime.
- expect(
- scheduledRunTimeMs(scheduledTask(Task_Status.PENDING))
- ).toBeUndefined();
+ expect(scheduledRunTimeMs(taskAt(Task_Status.PENDING))).toBeUndefined();
});
test.each([
@@ -198,8 +195,6 @@ describe("scheduledRunTimeMs", () => {
["skipped", Task_Status.SKIPPED],
["canceled", Task_Status.CANCELED],
])("gives nothing for a %s task that carries one", (_name, status) => {
- expect(
- scheduledRunTimeMs(scheduledTask(status, RUN_AT_MS))
- ).toBeUndefined();
+ expect(scheduledRunTimeMs(taskAt(status, RUN_AT_MS))).toBeUndefined();
});
});