Skip to content

refactor(webhooks): make admin webhooks view-only, remove write actions#1754

Open
Shreyag02 wants to merge 2 commits into
mainfrom
feature/webhooks-view-only
Open

refactor(webhooks): make admin webhooks view-only, remove write actions#1754
Shreyag02 wants to merge 2 commits into
mainfrom
feature/webhooks-view-only

Conversation

@Shreyag02

@Shreyag02 Shreyag02 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes the admin console Webhooks page permanently view-only. All write actions (create, update, delete) are removed from the admin UI entirely — no config flag, no gating. The page now shows a read-only list of webhooks.

Changes

  • Removed the row Action menu (Update + Delete), the New Webhook button, and the create/update drawers.
  • Deleted the now-unused create/, update/, and delete/ components and the delete mutation from the query hook.
  • Simplified WebhooksView to a read-only table; its only prop is now icon.
  • Removed the dead webhooks/create and webhooks/:webhookId routes.
  • Dropped the webhooks UI config (enable_actions / enable_delete) from the admin app config types, dev config, and the Go server (WebhooksConfig + /configs response).

Technical Details

  • SDK (web/sdk/admin/views/webhooks/webhooks/): WebhooksView renders only the Description / State / URL / Created-at columns. getColumns() takes no arguments; useWebhookQueries exposes only the list query.
  • App (WebhooksPage.tsx, routes.tsx): renders <WebhooksView /> with just an icon; create/detail routes removed.
  • Config (constants.ts, configs.dev.json): WebhooksConfig and the webhooks block removed.
  • Go server (pkg/server/config.go, server.go): WebhooksConfig and its /configs field removed. The /configs response no longer emits a webhooks object.
  • Backend webhook RPCs (createWebhook / updateWebhook / deleteWebhook) are unchanged — only the admin UI surface was removed.

Test Plan

  • Manual testing — webhooks page loads as a read-only list; no write actions present.
  • Build and type checking — admin tsc + Vite production build, SDK tsup build, ESLint, and go build / go vet / go test ./pkg/server/... all clean.

SQL Safety (if your PR touches *_repository.go or goqu.*)

N/A

@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Jul 14, 2026 10:14am

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ec1aaa60-c0fb-4530-b5b5-fb877cac3d15

📥 Commits

Reviewing files that changed from the base of the PR and between 68b0e3d and ec9649d.

📒 Files selected for processing (13)
  • pkg/server/config.go
  • pkg/server/server.go
  • web/apps/admin/configs.dev.json
  • web/apps/admin/src/pages/webhooks/WebhooksPage.tsx
  • web/apps/admin/src/routes.tsx
  • web/apps/admin/src/utils/constants.ts
  • web/sdk/admin/views/webhooks/webhooks/columns.tsx
  • web/sdk/admin/views/webhooks/webhooks/create/index.tsx
  • web/sdk/admin/views/webhooks/webhooks/delete/index.tsx
  • web/sdk/admin/views/webhooks/webhooks/hooks/useWebhookQueries.ts
  • web/sdk/admin/views/webhooks/webhooks/index.tsx
  • web/sdk/admin/views/webhooks/webhooks/update/index.tsx
  • web/sdk/admin/views/webhooks/webhooks/webhooks.module.css
💤 Files with no reviewable changes (7)
  • web/sdk/admin/views/webhooks/webhooks/delete/index.tsx
  • web/sdk/admin/views/webhooks/webhooks/create/index.tsx
  • web/apps/admin/configs.dev.json
  • web/sdk/admin/views/webhooks/webhooks/update/index.tsx
  • web/apps/admin/src/utils/constants.ts
  • web/sdk/admin/views/webhooks/webhooks/webhooks.module.css
  • pkg/server/config.go

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added an enable_actions configuration flag for webhooks (default: disabled).
  • UI Changes
    • Simplified the Webhooks admin page to display the webhooks list only, removing the “New Webhook” button and row action controls (edit/delete).
  • API Changes
    • Updated the /configs response to no longer include the nested webhook enablement configuration previously shown to the UI.

Walkthrough

Changes

Webhook management simplification

Layer / File(s) Summary
Configuration and response contract
pkg/server/config.go, pkg/server/server.go, web/apps/admin/configs.dev.json, web/apps/admin/src/utils/constants.ts
Adds the server-side EnableActions field and local admin default, while removing webhook configuration from the UI configuration response.
Webhook page routing and entry point
web/apps/admin/src/routes.tsx, web/apps/admin/src/pages/webhooks/WebhooksPage.tsx
Mounts the webhook page only at /webhooks and reduces it to rendering WebhooksView.
List-only webhook view
web/sdk/admin/views/webhooks/webhooks/*
Removes create, update, and delete flows, action columns, mutations, nested panels, and related styles while retaining webhook listing and error handling.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested reviewers: rohilsurana, paansinghcoder, rohanchkrabrty

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch feature/webhooks-view-only

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0445ed10-2956-4c1c-b75a-211d48b2d3bf

📥 Commits

Reviewing files that changed from the base of the PR and between cd6b070 and 68b0e3d.

📒 Files selected for processing (7)
  • pkg/server/config.go
  • pkg/server/server.go
  • web/apps/admin/configs.dev.json
  • web/apps/admin/src/pages/webhooks/WebhooksPage.tsx
  • web/apps/admin/src/utils/constants.ts
  • web/sdk/admin/views/webhooks/webhooks/columns.tsx
  • web/sdk/admin/views/webhooks/webhooks/index.tsx

Comment on lines +30 to +88
const actionColumn: DataTableColumnDef<Webhook, unknown> = {
header: "Action",
accessorKey: "id",
classNames: { cell: styles.actionColumn, header: styles.actionColumn },
cell: ({ getValue, row }) => {
const ActionCell = () => {
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
const webhookId = getValue() as string;
const webhook = row.original;

return (
<>
{/* @ts-ignore */}
<Menu style={{ padding: "0 !important" }}>
<Menu.Trigger
render={<DotsVerticalIcon style={{ cursor: "pointer" }} />}
/>
<Menu.Content>
<Menu.Group style={{ padding: 0 }}>
<Menu.Item style={{ padding: 0 }}>
<Flex
style={{ padding: "12px" }}
gap={3}
data-test-id="admin-webhook-update-btn"
onClick={() => openEditPage(webhookId)}
>
<UpdateIcon />
Update
</Flex>
</Menu.Item>
<Menu.Item style={{ padding: 0 }}>
<Flex
className={styles.deleteMenuItem}
gap={3}
data-test-id="admin-webhook-delete-btn"
onClick={() => setIsDeleteDialogOpen(true)}
>
<TrashIcon />
Delete
</Flex>
</Menu.Item>
</Menu.Group>
</Menu.Content>
</Menu>

<DeleteWebhookDialog
isOpen={isDeleteDialogOpen}
onOpenChange={setIsDeleteDialogOpen}
webhookId={webhookId}
webhookDescription={webhook.description}
deleteWebhookMutation={deleteWebhookMutation}
/>
</>
);
};

return <ActionCell />;
},
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

ActionCell defined inside cell causes state loss on re-renders.

ActionCell is declared as a function component inside the cell callback. Every table re-render (data refetch, sort, filter) creates a new function reference, so React unmounts and remounts the component — discarding isDeleteDialogOpen and the Menu's open state. The delete dialog and action menu will close unexpectedly mid-interaction.

Extract ActionCell outside getColumns so its identity is stable:

♻️ Proposed fix
+interface ActionCellProps {
+  getValue: () => unknown;
+  row: { original: Webhook };
+  openEditPage: (id: string) => void;
+  deleteWebhookMutation: ReturnType<typeof useMutation>;
+}
+
+function ActionCell({
+  getValue,
+  row,
+  openEditPage,
+  deleteWebhookMutation,
+}: ActionCellProps) {
+  const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
+  const webhookId = getValue() as string;
+  const webhook = row.original;
+
+  return (
+    <>
+      {/* `@ts-ignore` */}
+      <Menu style={{ padding: "0 !important" }}>
+        <Menu.Trigger
+          render={<DotsVerticalIcon style={{ cursor: "pointer" }} />}
+        />
+        <Menu.Content>
+          <Menu.Group style={{ padding: 0 }}>
+            <Menu.Item style={{ padding: 0 }}>
+              <Flex
+                style={{ padding: "12px" }}
+                gap={3}
+                data-test-id="admin-webhook-update-btn"
+                onClick={() => openEditPage(webhookId)}
+              >
+                <UpdateIcon />
+                Update
+              </Flex>
+            </Menu.Item>
+            <Menu.Item style={{ padding: 0 }}>
+              <Flex
+                className={styles.deleteMenuItem}
+                gap={3}
+                data-test-id="admin-webhook-delete-btn"
+                onClick={() => setIsDeleteDialogOpen(true)}
+              >
+                <TrashIcon />
+                Delete
+              </Flex>
+            </Menu.Item>
+          </Menu.Group>
+        </Menu.Content>
+      </Menu>
+
+      <DeleteWebhookDialog
+        isOpen={isDeleteDialogOpen}
+        onOpenChange={setIsDeleteDialogOpen}
+        webhookId={webhookId}
+        webhookDescription={webhook.description}
+        deleteWebhookMutation={deleteWebhookMutation}
+      />
+    </>
+  );
+}
+
 export const getColumns: (
   opt: getColumnsOptions,
 ) => DataTableColumnDef<Webhook, unknown>[] = ({ openEditPage, deleteWebhookMutation, enableActions }) => {
   const actionColumn: DataTableColumnDef<Webhook, unknown> = {
     header: "Action",
     accessorKey: "id",
     classNames: { cell: styles.actionColumn, header: styles.actionColumn },
-    cell: ({ getValue, row }) => {
-      const ActionCell = () => {
-        const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
-        const webhookId = getValue() as string;
-        const webhook = row.original;
-
-        return (
-          <>
-            {/* `@ts-ignore` */}
-            <Menu style={{ padding: "0 !important" }}>
-              <Menu.Trigger
-                render={<DotsVerticalIcon style={{ cursor: "pointer" }} />}
-              />
-              <Menu.Content>
-                <Menu.Group style={{ padding: 0 }}>
-                  <Menu.Item style={{ padding: 0 }}>
-                    <Flex
-                      style={{ padding: "12px" }}
-                      gap={3}
-                      data-test-id="admin-webhook-update-btn"
-                      onClick={() => openEditPage(webhookId)}
-                    >
-                      <UpdateIcon />
-                      Update
-                    </Flex>
-                  </Menu.Item>
-                  <Menu.Item style={{ padding: 0 }}>
-                    <Flex
-                      className={styles.deleteMenuItem}
-                      gap={3}
-                      data-test-id="admin-webhook-delete-btn"
-                      onClick={() => setIsDeleteDialogOpen(true)}
-                    >
-                      <TrashIcon />
-                      Delete
-                    </Flex>
-                  </Menu.Item>
-                </Menu.Group>
-              </Menu.Content>
-            </Menu>
-
-            <DeleteWebhookDialog
-              isOpen={isDeleteDialogOpen}
-              onOpenChange={setIsDeleteDialogOpen}
-              webhookId={webhookId}
-              webhookDescription={webhook.description}
-              deleteWebhookMutation={deleteWebhookMutation}
-            />
-          </>
-        );
-      };
-
-      return <ActionCell />;
-    },
+    cell: ({ getValue, row }) => (
+      <ActionCell
+        getValue={getValue}
+        row={row}
+        openEditPage={openEditPage}
+        deleteWebhookMutation={deleteWebhookMutation}
+      />
+    ),
   };

   return [
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const actionColumn: DataTableColumnDef<Webhook, unknown> = {
header: "Action",
accessorKey: "id",
classNames: { cell: styles.actionColumn, header: styles.actionColumn },
cell: ({ getValue, row }) => {
const ActionCell = () => {
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
const webhookId = getValue() as string;
const webhook = row.original;
return (
<>
{/* @ts-ignore */}
<Menu style={{ padding: "0 !important" }}>
<Menu.Trigger
render={<DotsVerticalIcon style={{ cursor: "pointer" }} />}
/>
<Menu.Content>
<Menu.Group style={{ padding: 0 }}>
<Menu.Item style={{ padding: 0 }}>
<Flex
style={{ padding: "12px" }}
gap={3}
data-test-id="admin-webhook-update-btn"
onClick={() => openEditPage(webhookId)}
>
<UpdateIcon />
Update
</Flex>
</Menu.Item>
<Menu.Item style={{ padding: 0 }}>
<Flex
className={styles.deleteMenuItem}
gap={3}
data-test-id="admin-webhook-delete-btn"
onClick={() => setIsDeleteDialogOpen(true)}
>
<TrashIcon />
Delete
</Flex>
</Menu.Item>
</Menu.Group>
</Menu.Content>
</Menu>
<DeleteWebhookDialog
isOpen={isDeleteDialogOpen}
onOpenChange={setIsDeleteDialogOpen}
webhookId={webhookId}
webhookDescription={webhook.description}
deleteWebhookMutation={deleteWebhookMutation}
/>
</>
);
};
return <ActionCell />;
},
};
interface ActionCellProps {
getValue: () => unknown;
row: { original: Webhook };
openEditPage: (id: string) => void;
deleteWebhookMutation: ReturnType<typeof useMutation>;
}
function ActionCell({
getValue,
row,
openEditPage,
deleteWebhookMutation,
}: ActionCellProps) {
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
const webhookId = getValue() as string;
const webhook = row.original;
return (
<>
{/* `@ts-ignore` */}
<Menu style={{ padding: "0 !important" }}>
<Menu.Trigger
render={<DotsVerticalIcon style={{ cursor: "pointer" }} />}
/>
<Menu.Content>
<Menu.Group style={{ padding: 0 }}>
<Menu.Item style={{ padding: 0 }}>
<Flex
style={{ padding: "12px" }}
gap={3}
data-test-id="admin-webhook-update-btn"
onClick={() => openEditPage(webhookId)}
>
<UpdateIcon />
Update
</Flex>
</Menu.Item>
<Menu.Item style={{ padding: 0 }}>
<Flex
className={styles.deleteMenuItem}
gap={3}
data-test-id="admin-webhook-delete-btn"
onClick={() => setIsDeleteDialogOpen(true)}
>
<TrashIcon />
Delete
</Flex>
</Menu.Item>
</Menu.Group>
</Menu.Content>
</Menu>
<DeleteWebhookDialog
isOpen={isDeleteDialogOpen}
onOpenChange={setIsDeleteDialogOpen}
webhookId={webhookId}
webhookDescription={webhook.description}
deleteWebhookMutation={deleteWebhookMutation}
/>
</>
);
}
export const getColumns: (
opt: getColumnsOptions,
) => DataTableColumnDef<Webhook, unknown>[] = ({
openEditPage,
deleteWebhookMutation,
enableActions,
}) => {
const actionColumn: DataTableColumnDef<Webhook, unknown> = {
header: "Action",
accessorKey: "id",
classNames: { cell: styles.actionColumn, header: styles.actionColumn },
cell: ({ getValue, row }) => (
<ActionCell
getValue={getValue}
row={row}
openEditPage={openEditPage}
deleteWebhookMutation={deleteWebhookMutation}
/>
),
};

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 29269745070

Coverage decreased (-0.002%) to 44.874%

Details

  • Coverage decreased (-0.002%) from the base build.
  • Patch coverage: 2 uncovered changes across 1 file (0 of 2 lines covered, 0.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
pkg/server/server.go 2 0 0.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 37645
Covered Lines: 16893
Line Coverage: 44.87%
Coverage Strength: 12.54 hits per line

💛 - Coveralls

@Shreyag02 Shreyag02 changed the title feat(webhooks): make admin webhooks view-only via enable_actions flag refactor(webhooks): make admin webhooks view-only, remove write actions Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants