Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(plan): enable inline comments in release builds (#21515)
boojack4b13f354507f
diff --git a/frontend/src/routes/project/plan-detail/components/PlanDetailStatementSection.tsx b/frontend/src/routes/project/plan-detail/components/PlanDetailStatementSection.tsxindex b1961b073f..c481d61eb6 100644--- a/frontend/src/routes/project/plan-detail/components/PlanDetailStatementSection.tsx+++ b/frontend/src/routes/project/plan-detail/components/PlanDetailStatementSection.tsx@@ -40,7 +40,6 @@ 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";@@ -489,8 +488,7 @@ export function PlanDetailStatementSection({const sheetSha256 = sheetSha256OfName(sheetName);const issue = page.issue;const threadsEnabled = Boolean(- inlineThreadsEnabled() &&- issue &&+ 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.tsxindex 399ec57d4a..bf79d06dc6 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,11 +129,6 @@ 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" />,}));@@ -277,47 +272,4 @@ 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.tsxindex 50a3e45a04..d6dfe2d511 100644--- a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx+++ b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx@@ -40,7 +40,6 @@ 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";@@ -84,10 +83,7 @@ export function ReviewActivityTimeline({() => collectPlanUpdateSpecs(comments),[comments]);- const threads = useMemo(- () => (inlineThreadsEnabled() ? groupThreads(comments) : []),- [comments]- );+ const threads = useMemo(() => 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.tsindex 9b28e174ac..f90eed6655 100644--- a/frontend/src/routes/project/plan-detail/components/threads/useUnresolvedThreadCounts.ts+++ b/frontend/src/routes/project/plan-detail/components/threads/useUnresolvedThreadCounts.ts@@ -2,7 +2,6 @@ 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 {@@ -17,10 +16,7 @@ const useIssueThreads = (issueName: string | undefined) => {const comments = useAppStore((state) =>issueName ? state.getIssueComments(issueName) : NO_COMMENTS);- return useMemo(- () => (inlineThreadsEnabled() ? groupThreads(comments) : []),- [comments]- );+ return useMemo(() => 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.tsindex 053316a3e4..a8cc37937c 100644--- a/frontend/src/stores/app/issueComment.test.ts+++ b/frontend/src/stores/app/issueComment.test.ts@@ -704,54 +704,3 @@ 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.tsindex 3334ccc0dd..3600559bf8 100644--- a/frontend/src/stores/app/issueComment.ts+++ b/frontend/src/stores/app/issueComment.ts@@ -12,7 +12,6 @@ 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";@@ -175,12 +174,8 @@ 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 = inlineThreadsEnabled()- ? timeline.filter(isThreadRoot).map((c) => c.name)- : [];+ const rootNames = 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.tsdeleted file mode 100644index e954fee68b..0000000000--- a/frontend/src/utils/featureGates.test.ts+++ /dev/null@@ -1,26 +0,0 @@-// @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.tsdeleted file mode 100644index e80cbf09d7..0000000000--- a/frontend/src/utils/featureGates.ts+++ /dev/null@@ -1,11 +0,0 @@-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.tsindex 78076ed9de..3030e026f4 100644--- a/frontend/src/utils/index.ts+++ b/frontend/src/utils/index.ts@@ -3,7 +3,6 @@ export * from "./collections";export * from "./role";export * from "./slug";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.tsindex 72ebff694e..460892aed8 100644--- a/frontend/tests/e2e/plan-detail/plan-detail-review.spec.ts+++ b/frontend/tests/e2e/plan-detail/plan-detail-review.spec.ts@@ -429,10 +429,7 @@ 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.-// 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("Inline comment threads (CUJ K)", () => {test.describe.configure({ mode: "serial" });let planId: string;let issueName: string;@@ -846,10 +843,7 @@ 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.-// 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("Inline comment threads: composers, checkbox, walker, counts (CUJ L)", () => {test.describe.configure({ mode: "serial" });let planId: string;let issueName: string;@@ -1050,10 +1044,7 @@ test.describe.skip("Inline comment threads: composers, checkbox, walker, counts// 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.-// 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)", () => {+test.describe("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";@@ -1138,10 +1129,7 @@ test.describe.skip("Inline comment threads as a reply-only reader (CUJ L, restri// 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.-// 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("Inline comment threads: ranges, shared markers, walker details, narrow view (CUJ M)", () => {test.describe.configure({ mode: "serial" });let planId: string;let issueName: string;@@ -1252,10 +1240,7 @@ test.describe.skip("Inline comment threads: ranges, shared markers, walker detai// Inline comment threads, third pass: the editor scroll a walker step makes.// A thread taller than the editor's viewport used to be revealed twice, by// the walker and then by its zone, so the editor jumped and jumped back.-// 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: walker scrolls the editor once (CUJ N)", () => {+test.describe("Inline comment threads: walker scrolls the editor once (CUJ N)", () => {test.describe.configure({ mode: "serial" });let planId: string;let shortRootName = "";