Repository navigation
feat(developers): API keys and webhooks move to each organization's Developers tab (#1440) - #1444
Merged
Merged
Conversation
…evelopers tab (#1440) API keys and webhooks belong to an organization, but they sat in Office, which admits only the platform `office` role, so an employer admin could not manage their own. They now live on the organization, the way #1312 moved Applications to /hiring. App - /employers/org/[slug]/developers with API keys and Webhooks views, and a Developers tab beside Teams and Logs (ROUTES.EMPLOYERS.ORG.DETAIL.DEVELOPERS). The organization comes from the slug and is sent with every call. - DeveloperPortal takes organizationId and canManage. Create, re-scope and revoke are offered only to the organization's admins (owner, org `admin` role, or team_admin on any of its teams); everyone else gets a read-only list. - The webhook list, create and a new detail screen (status, stats, events, recent deliveries, delete) moved to features/developers. The old list row pushed /office/webhooks/:id, which had no route file and was a 404. - /office/api-keys and /office/webhooks/* redirect for every signed-in user: the Office layout skips its role gate for them (isLegacyDevelopersPath), as it does for the hiring paths. One organization goes straight to the same screen on it; several or none go to My Organizations. Office's own links to them are gone. Api - lib/org-developer-roles.ts: one rule for membership and admin, read from teams, ownership and org-scoped roles. api-keys read teams only, so the owner on no team (the seeded orgAdmin) was refused every call; webhooks read org-scoped roles only, so a team_admin without one could not create a webhook. - GET /v1/api-keys takes ?organization_id= and returns organization_id. - Creating a key or a webhook, and deleting a webhook, now need admin, like revoking a key already did. - GET /v1/webhooks/{id} and /{id}/deliveries, which the SDK called and the api never served. List and detail no longer carry the signing secret. SDK pointer: Scaffald/sdk#44 (organization_id on list and create). Tests: tests/routers/org-developers-rest.test.ts (gated) covers the orgAdmin persona, a team_admin of two organizations without the office role, a plain member and an outsider. api-keys-org-authz-rest.test.ts uses a fresh plain member: the seeds give nikola the org-scoped admin role. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
📊 Performance Benchmark Results |
…rged Scaffald/sdk#44 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
📊 Performance Benchmark Results |
…type-check (#1440) The openapi routes declared only their success response, so every c.json(..., 401/403/404/500) was a type error: three on main, two more from the detail and deliveries routes this PR added. Each route now declares the errors it returns, and the success returns name their 200. webhooks.ts goes from 5 type errors to 0, so its TYPECHECK_BASELINE entry (3) is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
📊 Performance Benchmark Results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1440. Part of epic #1442.
API keys and webhooks belong to an organization, but they lived in Office, which admits only the platform
officerole, so an employer admin couldn't manage their own. They now sit on a Developers tab on each organization (/employers/org/[slug]/developers), with API keys and Webhooks views. This is the same move #1312 made for Applications.What changed
App
ROUTES.EMPLOYERS.ORG.DETAIL.DEVELOPERS(+API_KEYS,WEBHOOKS,WEBHOOKS.CREATE,WEBHOOKS.DETAIL) and route files under(protected)/employers/org/[slug]/developers/.buildOrgSubItemsaddsorg-<slug>-developersbeside Teams and Logs. It lights on every page under the prefix (tested insection-tabs.test.ts).DeveloperPortalnow takesorganizationIdandcanManage. The webhook list and create screens moved tofeatures/developers/, plus a new webhook detail screen: status, delivery stats, events, recent deliveries, and delete. The old list row pushed/office/webhooks/:id, which had no route file, so every tap was a 404.organization_idfrom the slug, so a member of two organizations manages each one separately and never sees "pass organization_id".adminrole, or ateam_adminon any of its teams (features/developers/access.ts). Everyone else gets a read-only list./office/api-keysand/office/webhooks/*renderLegacyDevelopersRedirect, and the Office layout skips its role gate for them (isLegacyDevelopersPath), as it does forisLegacyHiringPath. A user in one organization goes to the same screen on it (/office/webhooks/<id>goes to that webhook's detail). Users in several organizations, or none, go to My Organizations. Office's own links to the two pages are removed.Api (
packages/supabase/functions/api)lib/org-developer-roles.tsis one membership/admin rule, read from teams, ownership and org-scoped roles. Before, api-keys read teams only, so the owner on no team (the seededorgAdmin, reviewer-employer) was refused every key call. Webhooks read org-scoped roles only, so a team_admin without one couldn't create a webhook.GET /v1/api-keys?organization_id=filters to one org (403 if you aren't in it), and rows carryorganization_id.GET /v1/webhooks/{id}andGET /v1/webhooks/{id}/deliveries. The SDK'sretrieveandlistDeliveriesalready called them, but the api never served them. The list and detail responses no longer include the signing secret.SDK (Scaffald/sdk#44): optional
organization_idonapiKeys.list,webhooks.list,CreateApiKeyParamsandCreateWebhookParams.Tests (real local DB, real HTTP to the
apifunction)tests/routers/org-developers-rest.test.tsorgAdminpersona (owner + org admin, no team, no office role) lists, creates and revokes its keys, and creates, lists, opens (detail + deliveries) and deletes a webhook.api-keys-org-authz-rest.test.ts: the "plain member" is now a fresh persona on a team. The seeds give nikola the org-scopedadminrole, which counts as admin under the shared rule.org-developer-roles.test.ts(api),features/developers/__tests__/{access,legacy-paths}.test.ts,section-tabs.test.ts.Checks
pnpm check✅nx run scf-core:test✅ 1828/1828 on Node 22.20.0 (.nvmrc). On Node 26, 13 unrelated storage tests fail on its experimentallocalStorageglobal.pnpm prepush✅, gated api suite 281 passed. The shared edge runtime on this machine is mounted from a stalesweep5worktree, so the gated run used this branch'sapion :8014 (*_TEST_API_BASE). Against the stale runtime, 9 unrelated suites (invites, stage history, office jobs, stripe settings) fail; all of them pass against this branch.pnpm radium:check❌ with 3 violations, none in files this PR touches:packages/uimissing the[theme]dimension (LegendIndicator, useTheme, colors docs) and the@hookform/resolvers5.x pin..radium/app-expo.mdgains the org-owned-data rule.pnpm test787 passed,pnpm typecheckclean.Browser verification
Local web (
expo start --web, api from this branch), signed in as [email protected]: owner and org admin of Apex Mechanical, no office role, on no team./office/api-keysredirected to/employers/org/apex-mechanical/developers/api-keys./developersopens on API keys./office/webhooks/createredirected to the org's create page. Created a webhook (secret shown once), saw it in the list, opened its detail (status Active, 0 deliveries, eventsjob.created, "Nothing has been delivered…"), and deleted it (confirm prompt, "Webhook deleted", empty list).Overlap with #1443 (#1439, Admin section)
Both PRs touch
OfficeDeveloperLinks.tsx(#1443 re-points OAuth apps, this PR removes the API keys and Webhooks entries),routes.ts,drawer/config.ts,section-tabs.test.tsand the localeroutes.jsonfiles, in different blocks. Whichever merges second keeps both sides. #1443's moved-paths test already leaves/office/api-keysand/office/webhooksalone.Not in this PR
useOrgBySlug(used by the other org pages) has the bug fixed here inuseOrgDevelopers: before the user resolves, the disabled query reportsisLoading: false, so the page can flash "not found".DeveloperPortalstill uses a hard-coded#ffffffbackground, which is wrong in dark mode.🤖 Generated with Claude Code