Skip to content

feat(frontend): add serverless check when editing the runner config#4961

Open
jog1t wants to merge 1 commit intomainfrom
04-29-feat_frontend_add_serverless_check_when_editing_the_runner_config
Open

feat(frontend): add serverless check when editing the runner config#4961
jog1t wants to merge 1 commit intomainfrom
04-29-feat_frontend_add_serverless_check_when_editing_the_runner_config

Conversation

@jog1t
Copy link
Copy Markdown
Contributor

@jog1t jog1t commented May 4, 2026

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@railway-app
Copy link
Copy Markdown

railway-app Bot commented May 4, 2026

🚅 Deployed to the rivet-pr-4961 environment in rivet-frontend

Service Status Web Updated (UTC)
frontend-inspector ❌ Build Failed (View Logs) Web May 5, 2026 at 6:20 pm
ladle ❌ Build Failed (View Logs) Web May 5, 2026 at 6:20 pm
frontend-cloud ❌ Build Failed (View Logs) Web May 5, 2026 at 6:19 pm
kitchen-sink ❌ Build Failed (View Logs) Web May 5, 2026 at 6:18 pm
website 😴 Sleeping (View Logs) Web May 4, 2026 at 5:02 pm
mcp-hub ✅ Success (View Logs) Web May 4, 2026 at 4:48 pm

Copy link
Copy Markdown
Contributor Author

jog1t commented May 4, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 4, 2026


PR Review: feat(frontend): add serverless check when editing the runner config

Overview

This PR adds runtime mode switching (serverless vs serverfull/Runners) to the runner config edit dialogs, along with real-time endpoint health checks for serverless configurations. Key additions:

  • A mode toggle (serverless vs. serverfull) in both shared and per-datacenter settings forms
  • A health indicator widget that polls the configured runner endpoint and blocks save when the endpoint is unreachable
  • A mode-switch confirmation flow that warns when saving would change an existing datacenter runtime mode
  • Splits formSchema into baseFormSchema + a superRefine so URL validation only triggers in serverless mode

Positive aspects

  • EndpointHealthCheckProvider / context approach is clean: a single provider scoped to the dialog coordinates all per-field indicators without prop drilling.
  • ResetOnModeChange is a focused, reusable side-effect component rather than an ad-hoc useEffect scattered through parent forms.
  • ConfirmableSaveButton inline confirmation is a good pattern for preventing accidental mode switches.
  • dcSignatureWithoutMetadata fixes a latent bug where metadata diffs were falsely breaking the shared-settings check.
  • Debouncing endpoint + headers before firing the health query avoids flooding the API on every keystroke.

Issues and suggestions

Code style: import order

The SERVERLESS_FIELDS constant is declared between two import blocks, which violates the convention of keeping all imports at the top of the file. Per CLAUDE.md: always add imports at the top of the file. Module-level constants should follow all imports, not be interleaved with them.

validateRuntimeModeFields / submit handler inconsistency

The submit handler in DatacenterSettingsForm uses if (mode === 'serverless' || !mode) treating undefined as serverless and building a serverless config object that requires a URL. But validateRuntimeModeFields checks if (data.mode === 'serverless') skipping validation when mode is undefined. An entry with no mode set passes validation but then hits the serverless submit path with a potentially empty URL. Fix: treat undefined as serverless in the validator too: if (!data.mode || data.mode === 'serverless').

Type cast fragility: (dc as { normal?: unknown }).normal

This cast appears in at least four places. Rivet.RunnerConfigResponse does not include a normal field. Centralise with a type guard to avoid repeated unsafe casts and make future API type updates easier to catch.

useEndpointHealthChecksValid empty-map contract

When no indicators are mounted (serverfull mode), statuses is {} and [].every(...) returns true, unblocking save correctly. But this relies on the indicator unmount cleanup setting status to 'idle' (which deletes the key). A short comment near setStatus explaining the deletion-on-idle contract would help future readers.

WhenMode silently defaults to "serverless"

A wrong name path silently renders the serverless subtree in serverfull mode. A dev-only warning when mode is undefined would help catch typos early.

Minor: blank line inside JSX props in serverless-endpoint-health.tsx near line 1292: extra blank line between the opening <WithTooltip tag and delayDuration={0}.

Missing test coverage: The pure helpers (extractErrorMessage, dcMode, dcSignatureWithoutMetadata, describeSwitches) are straightforward to unit-test and would be good starting points.


Summary

Solid overall approach and meaningful UX improvements. Main things to address before merging:

  1. Import ordering - move SERVERLESS_FIELDS after all imports.
  2. validateRuntimeModeFields - treat undefined mode as serverless to match the submit handler.
  3. Type cast centralisation - introduce a type guard for the repeated (dc as { normal?: unknown }).normal pattern.
  4. Blank line in JSX - cosmetic cleanup in serverless-endpoint-health.tsx.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Preview packages published to npm

Install with:

npm install rivetkit@pr-4961

All packages published as 0.0.0-pr.4961.d447d31 with tag pr-4961.

Engine binary is shipped via @rivetkit/engine-cli on linux-x64-musl, linux-arm64-musl, darwin-x64, and darwin-arm64. Windows users should use the release installer or set RIVET_ENGINE_BINARY.

Docker images:

docker pull rivetdev/engine:slim-d447d31
docker pull rivetdev/engine:full-d447d31
Individual packages
npm install rivetkit@pr-4961
npm install @rivetkit/react@pr-4961
npm install @rivetkit/rivetkit-napi@pr-4961
npm install @rivetkit/workflow-engine@pr-4961

@jog1t jog1t force-pushed the 04-29-feat_frontend_add_serverless_check_when_editing_the_runner_config branch from f54e255 to 4c5456e Compare May 4, 2026 21:14
@jog1t jog1t mentioned this pull request May 4, 2026
11 tasks
@jog1t jog1t marked this pull request as ready for review May 4, 2026 21:14
@jog1t jog1t force-pushed the 04-29-feat_frontend_add_serverless_check_when_editing_the_runner_config branch from 4c5456e to c92292f Compare May 5, 2026 18:18
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.

1 participant