Skip to content

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

chore(plan): gate inline comment threads to dev builds

zchpeterd12e8cfca368
diff --git a/frontend/src/routes/project/plan-detail/components/PlanDetailStatementSection.tsx b/frontend/src/routes/project/plan-detail/components/PlanDetailStatementSection.tsx
index d2f5641f79..5acd7b1695 100644
--- a/frontend/src/routes/project/plan-detail/components/PlanDetailStatementSection.tsx
+++ b/frontend/src/routes/project/plan-detail/components/PlanDetailStatementSection.tsx
@@ -39,6 +39,7 @@ import {
import { GetSheetRequestSchema } from "@/types/proto-es/v1/sheet_service_pb";
import { unknownDatabase } from "@/types/v1/database";
import { extractDatabaseResourceName, hasProjectPermissionV2 } from "@/utils";
+import { inlineThreadsEnabled } from "@/utils/featureGates";
import { engineSupportsSchemaEditor } from "@/utils/schemaEditor";
import { getStatementSize, MAX_UPLOAD_FILE_SIZE_MB } from "@/utils/sheet";
import { getInstanceResource } from "@/utils/v1/database";
@@ -487,7 +488,8 @@ export function PlanDetailStatementSection({
const sheetSha256 = sheetSha256OfName(sheetName);
const issue = page.issue;
const threadsEnabled = Boolean(
- issue &&
+ inlineThreadsEnabled() &&
+ issue &&
!page.isCreating &&
!isPendingDraft &&
sheetSha256 &&
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.tsx
index bf79d06dc6..399ec57d4a 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
@@ -129,6 +129,11 @@ vi.mock("../threads/CommentThreadCard", () => ({
),
}));
+const gateMocks = vi.hoisted(() => ({
+ inlineThreadsEnabled: vi.fn(() => true),
+}));
+vi.mock("@/utils/featureGates", () => gateMocks);
+
vi.mock("../threads/StatementAnchorContext", () => ({
StatementAnchorContext: () => <div data-testid="anchor-context" />,
}));
@@ -272,4 +277,47 @@ describe("ReviewActivityTimeline", () => {
act(() => root.unmount());
});
+
+ test("a release build renders a thread root as an ordinary comment", () => {
+ gateMocks.inlineThreadsEnabled.mockReturnValue(false);
+ const issue = create(IssueSchema, {
+ name: "projects/p1/issues/1",
+ creator: "users/[email protected]",
+ draft: false,
+ });
+ const plan = create(PlanSchema, { name: "projects/p1/plans/1" });
+ const rootName = "projects/p1/issues/1/issueComments/root";
+ const comments = [
+ create(IssueCommentSchema, {
+ name: rootName,
+ comment: "Root",
+ creator: "users/[email protected]",
+ threadState: IssueComment_ThreadState.OPEN,
+ statementAnchor: create(StatementAnchorSchema, { spec: "spec-1" }),
+ }),
+ create(IssueCommentSchema, {
+ name: "projects/p1/issues/1/issueComments/general",
+ comment: "General",
+ creator: "users/[email protected]",
+ }),
+ ];
+ const container = document.createElement("div");
+ const root = createRoot(container);
+
+ act(() => {
+ root.render(
+ <ReviewActivityTimeline comments={comments} issue={issue} plan={plan} />
+ );
+ });
+
+ // The root keeps its stored thread state; with the gate off it must still
+ // reach the reader, as a plain comment rather than a card.
+ expect(container.querySelector("[data-testid='thread-card']")).toBeNull();
+ expect(
+ container.querySelectorAll("[data-testid='comment-row']")
+ ).toHaveLength(2);
+
+ act(() => root.unmount());
+ gateMocks.inlineThreadsEnabled.mockReturnValue(true);
+ });
});
diff --git a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx
index 4dd44096fa..4cdec2a5b3 100644
--- a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx
+++ b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx
@@ -40,6 +40,7 @@ import { projectNamePrefix } from "@/stores/modules/v1/common";
import { getTimeForPbTimestampProtoEs, unknownUser } from "@/types";
import type { Issue, IssueComment } from "@/types/proto-es/v1/issue_service_pb";
import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
+import { inlineThreadsEnabled } from "@/utils/featureGates";
import { hasProjectPermissionV2 } from "@/utils/iam/permission";
import { usePlanChangeReferenceData } from "../../hooks/usePlanChangeReferenceData";
import { placementOf } from "../../shared/stores/placementSlice";
@@ -83,7 +84,10 @@ export function ReviewActivityTimeline({
() => collectPlanUpdateSpecs(comments),
[comments]
);
- const threads = useMemo(() => groupThreads(comments), [comments]);
+ const threads = useMemo(
+ () => (inlineThreadsEnabled() ? groupThreads(comments) : []),
+ [comments]
+ );
// Anchored threads reference the plan's current specs; hydrate them once
// here rather than once per card.
const referenceSpecs = useMemo(
diff --git a/frontend/src/routes/project/plan-detail/components/threads/useUnresolvedThreadCounts.ts b/frontend/src/routes/project/plan-detail/components/threads/useUnresolvedThreadCounts.ts
index f90eed6655..9b28e174ac 100644
--- a/frontend/src/routes/project/plan-detail/components/threads/useUnresolvedThreadCounts.ts
+++ b/frontend/src/routes/project/plan-detail/components/threads/useUnresolvedThreadCounts.ts
@@ -2,6 +2,7 @@ import { useMemo } from "react";
import { useAppStore } from "@/stores/app";
import type { IssueComment } from "@/types/proto-es/v1/issue_service_pb";
import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
+import { inlineThreadsEnabled } from "@/utils/featureGates";
import { placementsForSheet } from "../../shared/stores/placementSlice";
import { usePlanDetailStore } from "../../shared/stores/usePlanDetailStore";
import {
@@ -16,7 +17,10 @@ const useIssueThreads = (issueName: string | undefined) => {
const comments = useAppStore((state) =>
issueName ? state.getIssueComments(issueName) : NO_COMMENTS
);
- return useMemo(() => groupThreads(comments), [comments]);
+ return useMemo(
+ () => (inlineThreadsEnabled() ? groupThreads(comments) : []),
+ [comments]
+ );
};
// Every unresolved thread on the issue; zero before an issue exists.
diff --git a/frontend/src/stores/app/issueComment.test.ts b/frontend/src/stores/app/issueComment.test.ts
index a8cc37937c..053316a3e4 100644
--- a/frontend/src/stores/app/issueComment.test.ts
+++ b/frontend/src/stores/app/issueComment.test.ts
@@ -704,3 +704,54 @@ test.each(["timeline", "threads"])(
expect(store.getIssueComments(parent)).toEqual([old, remote]);
}
);
+
+test("a release build loads the timeline but never the reply pass", async () => {
+ vi.resetModules();
+ vi.doMock("@/utils/featureGates", () => ({
+ inlineThreadsEnabled: () => false,
+ }));
+ const { createIssueCommentSlice: createGatedSlice } = await import(
+ "./issueComment"
+ );
+ const state: Record<string, unknown> = {};
+ const set = (updater: unknown) => {
+ Object.assign(
+ state,
+ typeof updater === "function" ? updater(state) : updater
+ );
+ };
+ Object.assign(
+ state,
+ createGatedSlice(set as never, (() => state) as never, {} as never)
+ );
+ const store = state as ReturnType<typeof createIssueCommentSlice>;
+
+ const parent = "projects/p/issues/1";
+ const root = create(IssueCommentSchema, {
+ name: parent + "/issueComments/root",
+ threadState: IssueComment_ThreadState.OPEN,
+ });
+ const general = create(IssueCommentSchema, {
+ name: parent + "/issueComments/general",
+ });
+ mocks.listIssueComments.mockResolvedValueOnce({
+ issueComments: [root, general],
+ nextPageToken: "",
+ });
+
+ const loaded = await store.fetchIssueCommentThreads({ parent });
+
+ // One call: the timeline. No `root in [...]` follow-up.
+ expect(mocks.listIssueComments).toHaveBeenCalledTimes(1);
+ expect(mocks.listIssueComments.mock.calls[0][0]).toMatchObject({
+ parent,
+ filter: "",
+ });
+ // The plain timeline still reaches every comment surface, thread roots
+ // included — they simply render as ordinary comments.
+ expect(loaded).toEqual([root, general]);
+ expect(store.getIssueComments(parent)).toEqual(loaded);
+
+ vi.doUnmock("@/utils/featureGates");
+ vi.resetModules();
+});
diff --git a/frontend/src/stores/app/issueComment.ts b/frontend/src/stores/app/issueComment.ts
index 3600559bf8..3334ccc0dd 100644
--- a/frontend/src/stores/app/issueComment.ts
+++ b/frontend/src/stores/app/issueComment.ts
@@ -12,6 +12,7 @@ import {
ListIssueCommentsRequestSchema,
UpdateIssueCommentRequestSchema,
} from "@/types/proto-es/v1/issue_service_pb";
+import { inlineThreadsEnabled } from "@/utils/featureGates";
import { celStringList } from "@/utils/v1/celLiteral";
import type { AppSliceCreator, IssueCommentSlice } from "./types";
@@ -174,8 +175,12 @@ export const createIssueCommentSlice: AppSliceCreator<IssueCommentSlice> = (
return all;
};
+ // The timeline load is what every comment surface reads, threads or
+ // not, so it runs unconditionally; only the reply pass is gated.
const timeline = await listAll("");
- const rootNames = timeline.filter(isThreadRoot).map((c) => c.name);
+ const rootNames = inlineThreadsEnabled()
+ ? timeline.filter(isThreadRoot).map((c) => c.name)
+ : [];
const replies: IssueComment[] = [];
for (let i = 0; i < rootNames.length; i += REPLY_QUERY_ROOTS) {
const chunk = rootNames.slice(i, i + REPLY_QUERY_ROOTS);
diff --git a/frontend/src/utils/featureGates.test.ts b/frontend/src/utils/featureGates.test.ts
new file mode 100644
index 0000000000..e954fee68b
--- /dev/null
+++ b/frontend/src/utils/featureGates.test.ts
@@ -0,0 +1,26 @@
+// @vitest-environment node
+import { expect, test, vi } from "vitest";
+
+test("inline threads follow the dev build flag", async () => {
+ vi.resetModules();
+ vi.doMock("./util", () => ({ isDev: () => false }));
+ const disabled = await import("./featureGates");
+ expect(disabled.inlineThreadsEnabled()).toBe(false);
+
+ vi.resetModules();
+ vi.doMock("./util", () => ({ isDev: () => true }));
+ const enabled = await import("./featureGates");
+ expect(enabled.inlineThreadsEnabled()).toBe(true);
+
+ vi.doUnmock("./util");
+ vi.resetModules();
+});
+
+// Vitest reports DEV, so every other suite exercises the feature as an engineer
+// on the dev server sees it. A release bundle is the opposite case, and only the
+// suites that stub the gate cover it.
+test("the suite runs with the gate on, matching the dev server", async () => {
+ const { inlineThreadsEnabled } = await import("./featureGates");
+ expect(import.meta.env.DEV).toBe(true);
+ expect(inlineThreadsEnabled()).toBe(true);
+});
diff --git a/frontend/src/utils/featureGates.ts b/frontend/src/utils/featureGates.ts
new file mode 100644
index 0000000000..e80cbf09d7
--- /dev/null
+++ b/frontend/src/utils/featureGates.ts
@@ -0,0 +1,11 @@
+import { isDev } from "./util";
+
+// Inline comment threads on plan detail are still stabilizing: the browser
+// journeys in plan-detail-review.spec.ts do not run in CI, and re-anchoring a
+// comment onto a newer revision is unverified against a saved sheet. Until
+// that closes the feature stays on the Vite dev server only.
+//
+// `isDev()` is a build-time constant, so a release bundle folds every call to
+// `false` and drops the thread UI rather than hiding it. Flipping this to
+// `true` is the whole un-gate.
+export const inlineThreadsEnabled = (): boolean => isDev();
diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts
index 435f5393ae..4359b78595 100644
--- a/frontend/src/utils/index.ts
+++ b/frontend/src/utils/index.ts
@@ -4,6 +4,7 @@ export * from "./role";
export * from "./slug";
export * from "./types";
export * from "./util";
+export * from "./featureGates";
export * from "./datetime";
export * from "./label";
export * from "./string";
diff --git a/frontend/tests/e2e/plan-detail/plan-detail-review.spec.ts b/frontend/tests/e2e/plan-detail/plan-detail-review.spec.ts
index f990d0feee..256a587399 100644
--- a/frontend/tests/e2e/plan-detail/plan-detail-review.spec.ts
+++ b/frontend/tests/e2e/plan-detail/plan-detail-review.spec.ts
@@ -429,7 +429,10 @@ test.describe("Permission boundary: non-candidate cannot review but can comment"
// A thread anchors to whole lines of the spec's saved sheet; it renders as a
// gutter marker + expanded card in the statement editor and as a card with
// its recorded context in the Review Activity timeline.
-test.describe("Inline comment threads (CUJ K)", () => {
+// Gated off with the feature: inlineThreadsEnabled() is false in the embedded
+// binary this suite runs against, so the thread UI is absent by design.
+// Re-enable together with the gate in src/utils/featureGates.ts.
+test.describe.skip("Inline comment threads (CUJ K)", () => {
test.describe.configure({ mode: "serial" });
let planId: string;
let issueName: string;
@@ -843,7 +846,10 @@ test.describe("Long approval flow adaptive rendering (CUJ I)", () => {
// Inline comment threads, second pass: several composers at once, the
// reply composer's thread-state checkbox, the editor walker, and the
// unresolved counts on the change tab and the Review summary.
-test.describe("Inline comment threads: composers, checkbox, walker, counts (CUJ L)", () => {
+// Gated off with the feature: inlineThreadsEnabled() is false in the embedded
+// binary this suite runs against, so the thread UI is absent by design.
+// Re-enable together with the gate in src/utils/featureGates.ts.
+test.describe.skip("Inline comment threads: composers, checkbox, walker, counts (CUJ L)", () => {
test.describe.configure({ mode: "serial" });
let planId: string;
let issueName: string;
@@ -1044,7 +1050,10 @@ test.describe("Inline comment threads: composers, checkbox, walker, counts (CUJ
// A reader who may reply but not resolve sees neither the standalone
// Resolve action nor the reply composer's state checkbox. No predefined role
// separates the two comment permissions, so the test provisions its own.
-test.describe("Inline comment threads as a reply-only reader (CUJ L, restricted)", () => {
+// Gated off with the feature: inlineThreadsEnabled() is false in the embedded
+// binary this suite runs against, so the thread UI is absent by design.
+// Re-enable together with the gate in src/utils/featureGates.ts.
+test.describe.skip("Inline comment threads as a reply-only reader (CUJ L, restricted)", () => {
const stamp = Date.now();
const readerEmail = `e2e-reply-only-${stamp}@example.com`;
const readerPassword = "12345678";
@@ -1129,7 +1138,10 @@ test.describe("Inline comment threads as a reply-only reader (CUJ L, restricted)
// Inline comment threads, third pass: a range selected from the gutter, two
// threads sharing one marker, the walker's announcement and its retreat
// behind the find widget, and a narrow viewport.
-test.describe("Inline comment threads: ranges, shared markers, walker details, narrow view (CUJ M)", () => {
+// Gated off with the feature: inlineThreadsEnabled() is false in the embedded
+// binary this suite runs against, so the thread UI is absent by design.
+// Re-enable together with the gate in src/utils/featureGates.ts.
+test.describe.skip("Inline comment threads: ranges, shared markers, walker details, narrow view (CUJ M)", () => {
test.describe.configure({ mode: "serial" });
let planId: string;
let issueName: string;