Skip to content

fix(console): regional Projects API for service toggles + full ApiSer…#2976

Open
HarshMN2345 wants to merge 12 commits intomainfrom
fix-project-services-region-and-sdk-list
Open

fix(console): regional Projects API for service toggles + full ApiSer…#2976
HarshMN2345 wants to merge 12 commits intomainfrom
fix-project-services-region-and-sdk-list

Conversation

@HarshMN2345
Copy link
Copy Markdown
Member

@HarshMN2345 HarshMN2345 commented Apr 13, 2026

…vice list

What does this PR do?

image image image image

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 13, 2026

Greptile Summary

This PR fixes service and protocol toggles to use the regional sdk.forProject API instead of the global sdk.forConsole, adds new services to the list (Health, Migrations, Project, Sites, TablesDB), introduces a new Protocols UI card, and overhauls the webhook secret flow to a reveal-once UX. Webhook field names are updated throughout to match the new SDK model (tls, authUsername, authPassword).

  • The "Enable/Disable all" bulk action in both updateServices.svelte and updateProtocols.svelte iterates through items sequentially; if any call fails, invalidate(Dependencies.PROJECT) is never reached, leaving the toggle switches displaying stale state that doesn't match the server until the user refreshes.

Confidence Score: 4/5

Safe to merge after fixing the missing invalidate on bulk-toggle error paths in both services and protocols.

Two P1 findings in the bulk-toggle loops: if any sequential API call fails, invalidate(Dependencies.PROJECT) is skipped and the UI displays stale toggle state. All other changes look correct.

updateServices.svelte and updateProtocols.svelte — both need invalidate moved to the finally block.

Important Files Changed

Filename Overview
src/lib/stores/project-services.ts Refactored to use ServiceId (regional SDK) instead of ApiService, expands service list, and extracts a projectServiceRows helper; alphabetically sorted.
src/lib/stores/project-protocols.ts New store for protocol (REST/GraphQL/WebSocket) enable/disable state, mirroring the services store pattern using ProtocolId from the regional SDK.
src/routes/(console)/project-[region]-[project]/settings/updateServices.svelte Migrated service toggles to regional sdk.forProject API; replaced single updateServiceStatusAll with a sequential loop — but invalidate is only called on success, leaving the UI stale if a mid-loop call fails.
src/routes/(console)/project-[region]-[project]/settings/updateProtocols.svelte New component for protocol enable/disable UI with Enable/Disable all bulk action; same partial-failure / missing-invalidate issue as updateServices.svelte.
src/routes/(console)/project-[region]-[project]/settings/webhooks/[webhook]/regenerate.svelte Reworked to support custom secrets and reveal-once UX; casts webhooks to a locally-defined interface to access updateSecret.
src/routes/(console)/project-[region]-[project]/settings/webhooks/create/+page.svelte Webhook creation now shows the generated secret in a one-time modal before navigating away; field names updated to match new SDK model.

Comments Outside Diff (1)

  1. src/routes/(console)/project-[region]-[project]/settings/updateServices.svelte, line 73-108 (link)

    P1 Stale UI state on partial failure

    If any individual updateServiceStatus call throws mid-loop, invalidate(Dependencies.PROJECT) is never reached. Services that were already toggled on the server will not be reflected in the local store, so the toggle switches display the wrong state until the user manually refreshes. Moving invalidate to the finally block ensures the UI always syncs with the server.

    The same pattern applies to toggleAllProtocols in updateProtocols.svelte.

Reviews (9): Last reviewed commit: "update terminoligy" | Re-trigger Greptile

Comment thread src/routes/(console)/project-[region]-[project]/+layout.ts Outdated
Comment thread src/lib/stores/project-services.ts Outdated
Comment thread src/routes/(console)/project-[region]-[project]/+layout.ts Outdated
@HarshMN2345 HarshMN2345 requested a review from Meldiron April 13, 2026 15:16
Comment thread src/lib/stores/project-services.ts Outdated
HarshMN2345 and others added 2 commits April 13, 2026 20:50
Co-authored-by: Matej Bačo <matejbaco2000@gmail.com>
Comment thread src/lib/stores/project-services.ts Outdated
{ label: 'Functions', method: ApiService.Functions, value: null },
{ label: 'GraphQL', method: ApiService.Graphql, value: null },
{ label: 'Messaging', method: ApiService.Messaging, value: null }
] satisfies Service[]
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.

We are missing Migrations

Let's also ask AI to sort the list alphabetically

Comment thread src/lib/stores/project-services.ts Outdated
{
label: 'Messaging',
method: ApiService.Messaging,
value: project.serviceStatusForMessaging
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.

Missing migrations I think


try {
await sdk.forConsole.projects.updateServiceStatusAll({
await sdk.forConsoleIn($project.region).projects.updateServiceStatusAll({
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.

We no longer have updateServiceStatusAll. We need to loop them, and do "updateServiceStatus".


try {
await sdk.forConsole.projects.updateServiceStatus({
await sdk.forConsoleIn($project.region).projects.updateServiceStatus({
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.

We need new SDK and use project SDK, not projects.

@HarshMN2345 HarshMN2345 requested a review from Meldiron April 14, 2026 08:57
Comment thread src/lib/stores/project-services.ts Outdated
<svelte:fragment slot="aside">
<div>
<Secret label="Key" copyEvent="signature" bind:value={$webhook.signatureKey} />
<Secret label="Key" copyEvent="signature" bind:value={$webhook.secret} />
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.

You can no longer read secret - you only see it once after creating it, or after updating it

Comment thread src/lib/stores/project-services.ts Outdated
@HarshMN2345 HarshMN2345 self-assigned this Apr 15, 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