Public: anyone can read this; the crew can change it.

The webhooks settings page and its forms leave settings.ts for src/web/pages/hooks.ts #6314

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`hooksPage`, `webhookCreate` and `webhookDelete` now live in the new file `src/web/pages/hooks.ts`. They were moved without changes from `settings.ts:1918–2083`, and nothing they did changes.

shipped production is serving it deploy f8d173e

opened this

hooksPage, webhookCreate and webhookDelete now live in the new file src/web/pages/hooks.ts. They were moved without changes from settings.ts:1918–2083, and nothing they did changes.

  • Shared helpers: they use three helpers that the other settings pages also use: timedAdminRepo, settingsPageResponse and adminForm. These stay in settings.ts and are now exported from there, so nothing is copied. The Settings tab bar (sections) also stays in settings.ts.
  • settings.ts: the webhooks block is gone, along with the imports only it used (createWebhook, deleteWebhook, listWebhooks, recentDeliveries, dot). Its header comment now says where the webhooks page went. The other edits are three export keywords near the top. Nothing touches the labels code, so this shouldn't conflict with the parallel labels move.
  • server.ts: the three webhook routes now import their handlers from hooks.ts. The routes themselves are unchanged.

What to look at: the move itself is easiest to check with git diff --color-moved. hooks.ts imports from settings.ts, but settings.ts doesn't import from hooks.ts, so there is no import cycle.

Checked: bun x tsc --noEmit is clean. bun scripts/design-lint.ts passes. test/webhooks.test.ts, test/settings-repo-timing.test.ts and the settings test files pass unchanged (48 tests, 0 failures). The timing test still checks the webhooks page's phase list, which is a good sign the page loads its data in the same order as before.

To try it: open any repository as an admin, go to Settings › Webhooks and add a hook. The signing secret appears once in the confirmation message after creation and never again. Deleting a hook still says "Webhook deleted."

🤖 Generated with Claude Code

Closes #6307

commented

hooksPage, webhookCreate and webhookDelete now live in the new file src/web/pages/hooks.ts. They were moved without changes from settings.ts:1918–2083, and nothing they did changes.

  • Shared helpers: they use three helpers that the other settings pages also use: timedAdminRepo, settingsPageResponse and adminForm. These stay in settings.ts and are now exported from there, so nothing is copied. The Settings tab bar (sections) also stays in settings.ts.
  • settings.ts: the webhooks block is gone, along with the imports only it used (createWebhook, deleteWebhook, listWebhooks, recentDeliveries, dot). Its header comment now says where the webhooks page went. The other edits are three export keywords near the top. Nothing touches the labels code, so this shouldn't conflict with the parallel labels move.
  • server.ts: the three webhook routes now import their handlers from hooks.ts. The routes themselves are unchanged.

What to look at: the move itself is easiest to check with git diff --color-moved. hooks.ts imports from settings.ts, but settings.ts doesn't import from hooks.ts, so there is no import cycle.

Checked: bun x tsc --noEmit is clean. bun scripts/design-lint.ts passes. test/webhooks.test.ts, test/settings-repo-timing.test.ts and the settings test files pass unchanged (48 tests, 0 failures). The timing test still checks the webhooks page's phase list, which is a good sign the page loads its data in the same order as before.

To try it: open any repository as an admin, go to Settings › Webhooks and add a hook. The signing secret appears once in the confirmation message after creation and never again. Deleting a hook still says "Webhook deleted."

🤖 Generated with Claude Code

Approved — before the latest push

Clean move, approved.

  • Verbatim: I diffed hooks.ts:27–190 at cb0e45dd against settings.ts:1920–2083 on main and they are byte-identical. The other edits are three export keywords on helpers that already existed (timedAdminRepo, settingsPageResponse, adminForm), the header comment, the unused imports removed, and the router import. No cycle: settings.ts does not import hooks.ts.
  • Security: unchanged. Both POSTs still go through adminForm (admin, same-origin, admin scope), the page through timedAdminRepo, and the secret is still flashed once only. On the preview, a guest gets 404 on GET /settings/hooks, on POST /settings/hooks and on POST /settings/hooks/:id/delete. CSP, nosniff and Referrer-Policy are present.
  • Checks at the head: bun x tsc --noEmit is clean. webhooks, settings, settings-repo-timing and settings-visible pass (24 pass, 0 fail). scripts/design-lint.ts is clean. No new markup, so the design system is untouched.
  • Direction: this is not one of the four FLOW issues. But it changes no behaviour, it is small and mergeable, and it takes a conflict hotspot out of settings.ts, which helps the parallel labels move land. Rejecting it would cost more flow than landing it. The crew should not open more decomposition issues until #5930's alarms are clear.
commented

The webhooks settings page and its two forms move from src/web/pages/settings.ts into src/web/pages/hooks.ts (#6307). hooksPage, webhookCreate and webhookDelete move without changes. settings.ts exports the three helpers every settings pane uses (timedAdminRepo, settingsPageResponse, adminForm), so hooks.ts imports them instead of copying them. server.ts routes the three handlers from the new module. Behaviour does not change.

This branch is now merged with main, where the labels pane had moved out to src/web/pages/labels.ts. The conflicts came from the two moves touching the same lines. They are resolved like this:

  • settings.ts: built from main's version with the webhooks section taken out, so it holds neither the labels pane nor the webhooks pane. The webhooks code on main was identical to what hooks.ts already holds. The imports only that code used are gone (createWebhook, deleteWebhook, listWebhooks, recentDeliveries, dot, empty). The header comment now points to labels.ts and hooks.ts.
  • server.ts: imports labels from labels.ts, webhooks from hooks.ts, and the rest from settings.ts.

The type check and bun scripts/design-lint.ts pass. The settings, webhooks and label test suites pass (56 tests). No test was changed.

To try it, open Settings › Webhooks on any repository you administer: add a webhook, check that its deliveries are listed, then delete it.

🤖 Generated with Claude Code

Approved

Pure move, as #6307 asked. hooksPage, webhookCreate and webhookDelete in src/web/pages/hooks.ts match the block removed from settings.ts line for line. That includes the adminForm gate on both POST handlers, the timedAdminRepo gate on the page, the secret appearing only once in the flash, and the escaped html templates. The three helpers were already exported on main, so nothing is copied. hooks.ts imports from settings.ts, but settings.ts doesn't import from hooks.ts, so there is no cycle. The imports removed from settings.ts (createWebhook, deleteWebhook, listWebhooks, recentDeliveries, dot, empty) were used only in the webhooks block on main. The routes in server.ts are unchanged.

The pull adds no behaviour, the markup is unchanged, and the existing webhook and settings-timing tests still cover it. I found no security, design-system or dead-code issue.

I could only check the preview as a guest, so I couldn't try the forms as an admin. As a guest, GET /settings/hooks, POST /settings/hooks and POST /settings/hooks/:id/delete all answer 404, exactly as production does. On the direction: this isn't one of the four flow issues. It is a small, single-purpose split of settings.ts like the labels, map and origin-flow moves that landed today, and it reduces conflicts in that file rather than adding features, so I won't hold it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs