Skip to content

Conversation

@jog1t
Copy link
Contributor

@jog1t jog1t commented Jan 7, 2026

TL;DR

Refactored runner configuration UI to support both shared and per-datacenter settings, improving the management of serverless providers across multiple regions.

What changed?

  • Created a new RunnerConfigToggleGroup component for switching between serverless and dedicated modes
  • Split the runner config form into shared settings and per-datacenter settings
  • Added ability to copy settings between datacenters
  • Improved the runner config table to group configurations by provider and endpoint
  • Added status indicators showing runner pool errors with detailed error messages
  • Enhanced region selection with multi-select capability
  • Reorganized the edit dialog to use an accordion for datacenter-specific settings
  • Fixed namespace handling in the Vercel connection flow

How to test?

  1. Navigate to the runner configuration page
  2. Create a new provider or edit an existing one
  3. Test switching between "Shared Settings" and "Per Datacenter Settings" modes
  4. Verify that settings can be applied globally or per region
  5. Check that error states are properly displayed in the runner config table
  6. Confirm that settings can be copied between datacenters in the per-datacenter view

Why make this change?

This change provides more flexibility in managing runner configurations across multiple regions. Users can now choose between applying the same configuration to all datacenters or customizing settings for specific regions. The improved UI makes it easier to identify and troubleshoot configuration issues with better error reporting and visualization of provider status across regions.

@vercel
Copy link

vercel bot commented Jan 7, 2026

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

Project Deployment Review Updated (UTC)
rivet-cloud Ready Ready Preview, Comment Jan 7, 2026 1:26am
rivet-inspector Ready Ready Preview, Comment Jan 7, 2026 1:26am
2 Skipped Deployments
Project Deployment Review Updated (UTC)
rivet-site Ignored Ignored Preview Jan 7, 2026 1:26am
rivetkit-serverless Skipped Skipped Jan 7, 2026 1:26am

@vercel vercel bot temporarily deployed to Preview – rivetkit-serverless January 7, 2026 01:23 Inactive
Copy link
Contributor Author

jog1t commented Jan 7, 2026


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

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

@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 7, 2026

Graphite Automations

"Test" took an action on this PR • (01/07/26)

1 assignee was added to this PR based on Kacper Wojciechowski's automation.

@claude
Copy link

claude bot commented Jan 7, 2026

PR Review: Editable Serverless Configs

I've reviewed PR #3765 and have several observations and recommendations:

Code Quality Issues

1. Broken Logic in SharedSettingsForm (edit-runner-config.tsx:54-56)

const isSharedSettings = Object.values(data?.datacenters || {}).every(
    (dcConfig) => JSON.stringify(dcConfig) === JSON.stringify(dcConfig),
);

This comparison always returns true since it compares the same object to itself. This should likely compare all datacenter configs to the first one:

const dcConfigs = Object.values(data?.datacenters || {});
const isSharedSettings = dcConfigs.length > 0 && dcConfigs.every(
    (dcConfig) => JSON.stringify(dcConfig) === JSON.stringify(dcConfigs[0]),
);

2. Strict Equality vs Loose Equality (edit-runner-config.tsx:86)

Inconsistent comparison operators:

  • Line 77: settingsMode === "shared" (strict)
  • Line 86: settingsMode == "datacenter" (loose)

Should use strict equality consistently.

3. Unused Import (edit-runner-config.tsx:25)

RegionSelect is imported but never used. Should be removed.

4. Type Safety Issue (edit-single-runner-config-form.tsx:27-28)

export const Enable = <TValues extends Record<string, any> = FormValues>({name}: {name: FieldPath<TValues>;}) => {
    const { control } = useFormContext<FormValues>();

The generic parameter TValues is declared but then FormValues is used directly, defeating the purpose of the generic. Should be:

const { control } = useFormContext<TValues>();

5. Weak Type Assertion (edit-single-runner-config-form.tsx:37)

checked={field.value as unknown as boolean ?? false}

Double casting suggests a type mismatch. Consider fixing the underlying type issue rather than forcing it.

6. Formatting Issue (edit-runner-config.tsx:311)

Extra whitespace before closing tag:

<EditSingleRunnerConfigForm.Datacenters/>

Potential Bugs

7. Data Mutation Risk (edit-runner-config.tsx:259)

{
    ...data.datacenters[dc.id]?.serverless || defaultServerlessConfig,
    enable: !!data.datacenters[dc.id]?.serverless,
    // ...
}

The spread operator precedence means if data.datacenters[dc.id]?.serverless is undefined, the entire object becomes defaultServerlessConfig (a boolean). Should use:

...(data.datacenters[dc.id]?.serverless || defaultServerlessConfig)

8. Unhandled Edge Case (edit-runner-config.tsx:147-152)

If all datacenters have serverless: null, the fallback uses defaultServerlessConfig, but this might not match the actual API state. Consider whether this is the intended behavior.

Performance Considerations

9. Multiple Query Calls

SelectDatacenterSettingsSource makes duplicate queries that are already fetched in the parent component. Consider passing data down as props to avoid redundant API calls.

10. Inefficient Object Iteration (edit-runner-config.tsx:274)

for (const [dcId, dcConfig] of Object.entries(values.datacenters || {})) {

Consider filtering disabled datacenters before iteration for better performance with many regions.

Security Concerns

✅ No major security issues detected. Headers are properly handled and user input is validated through Zod schemas.

Best Practices

11. Inconsistent Error Handling

No error boundaries or loading states for mutation failures. Consider adding error handling to mutateAsync calls.

12. Magic Numbers (edit-runner-config.tsx:28-35)

Default values like maxRunners: 10, requestLifespan: 300 should be defined as named constants for better maintainability.

13. Code Duplication

Query invalidation is repeated in multiple places:

await queryClient.invalidateQueries(provider.runnerConfigsQueryOptions());
await queryClient.invalidateQueries(provider.runnerConfigQueryOptions({ name }));

Consider extracting to a helper function.

Test Coverage

⚠️ No test files were included in this PR. For a feature this complex with multiple forms and data transformations, unit and integration tests are highly recommended.

Positive Aspects

  • Good separation of concerns with dedicated form components
  • Proper use of TypeScript generics for reusable form fields
  • Good UX with the copy-from-datacenter feature
  • Appropriate use of Zod for validation

Recommendations

Critical:

  1. Fix the broken isSharedSettings logic (issue [SVC-2555] Set up issue templates #1)
  2. Fix the operator precedence bug (issue [SVC-2404] Improve internal documentation #7)

High Priority:
3. Fix type safety in Enable component (issue #4)
4. Add error handling for mutations
5. Add tests for the new forms

Medium Priority:
6. Remove unused imports
7. Use consistent comparison operators
8. Extract magic numbers to constants
9. Optimize redundant queries

Low Priority:
10. Fix formatting issues
11. Reduce code duplication

Let me know if you'd like me to help fix any of these issues!

@jog1t jog1t force-pushed the 01-07-feat_dashboard_editable_serverless_configs branch from 851656c to f23273a Compare January 7, 2026 22:17
@jog1t jog1t force-pushed the 01-06-feat_dashboard_prefetch_daa_for_context_switcher branch from 06d1b43 to 69729dc Compare January 7, 2026 22:17
Base automatically changed from 01-06-feat_dashboard_prefetch_daa_for_context_switcher to main January 7, 2026 22:19
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