feat(frontend): allow creating serverfull instances during onboarding#5035
Conversation
PR Review: feat(frontend): allow creating serverfull instances during onboardingOverviewThis PR adds a serverless/runner toggle to the onboarding flow so users can configure a self-hosted runner (serverfull) instance instead of only serverless backends. It also ports the engine-mode namespace route to show the onboarding screen inline, and adds a "Skip onboarding" link for non-platform deployments. Bugs1. Leftover console.log(ls.get("__I_SOLELY_SWORE_TO_ONLY_ENABLE_DEV_TOOLBAR_FOR_DEBUGGING_PURPOSES..."));This fires on every render, including in production. Remove it before merging. 2. 3. const isSkipped =
ls.onboarding.getSkipWelcomeEngine(params.namespace) ||
d.skipOnboarding; // always undefined
4. Unguarded datacenter cast [v.datacenter as string]: {
normal: {},
metadata: { ... }
}
Code Quality5. Pervasive const v = values as unknown as { runnerName: string; provider: string; mode?: ...; datacenter?: string; ... };This signals the form values aren't properly typed end-to-end. Consider defining a discriminated union for the two form shapes so the compiler can verify correctness rather than casting. 6. Mode-based schema selection is fragile if ((values.mode as string) === "serverfull") {
return z.object({ mode: z.literal("serverfull"), ... });
}
return z.object({
mode: z.union([...]).optional(),
...ConnectServerlessForm.configurationSchema.shape,
...ConnectServerlessForm.deploymentSchema.shape,
});The fallback (serverless) schema makes 7. Actors count fetched sequentially after runner queries const [runnerNames, runnerConfigs] = await Promise.all([...]);
// ...
const actors = await context.queryClient.fetchQuery(
context.dataProvider.actorsCountQueryOptions(),
);All three are independent queries. Fetching the actors count in the same 8. Only first page checked for runner configs const hasRunnerConfigs =
Object.entries(runnerConfigs.pages[0].runnerConfigs).length > 0;If the API paginates runner configs, a user with runners on page 2+ would be incorrectly shown the onboarding screen. Either flatten all pages (as 9. Duplicate const isCustom = provider === "custom" || provider === "custom-platform";Extract to a shared helper. 10. Unnecessary type cast on default form value mode: "serverless" as "serverless" | "serverfull",TypeScript narrows string literals in object literals automatically. The cast is noise. Architecture / Design11. Duck-typing data provider capabilities "upsertCurrentNamespaceManagedPoolMutationOptions" in dataProvider
"publishableTokenQueryOptions" in dataProviderThis works but accumulates fragile 12. Untyped search params const s = search as unknown as { skipOnboarding?: boolean; onboardingSuccess?: boolean };TanStack Router supports typed, runtime-validated search params via Minor
|
97c2f75 to
577a189
Compare
e600754 to
81994b8
Compare
577a189 to
a23259e
Compare
81994b8 to
4b2680f
Compare
4b2680f to
865a907
Compare

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: