Describe a compute provider in one place - #3946
Merged
rossnelson merged 1 commit intoSep 28, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
rossnelson
force-pushed
the
refactor/compute-provider-registry
branch
from
September 19, 2026 17:58
e358570 to
4e0629e
Compare
A provider was described in ten places, in four shapes, under two naming conventions: an icon map and two label switches in the picker, a release stage map in shared.ts, a second icon-and-label map in compute-badge keyed by the wire name rather than the short one, an if-chain normalising those wire names in lock-compute-provider, a default provider list, and five raw template imports resolved through provider ternaries in compute-fields. Adding a provider meant finding all ten, and the templates alone had grown to seven props threaded through pages, forms, and fields. COMPUTE_PROVIDERS now holds all of it, keyed by provider, and the ten readers derive from it. The Record is exhaustive over ComputeProviderValue, so adding a provider is one entry and the compiler names whatever is still missing. The seven template props collapse to one `templates` map, defaulting to the bundled templates that a self-hosted deployment wants. Because that map is exhaustive too, a consumer supplying its own — Temporal Cloud does, per environment — fails its type check when a provider is added without templates, rather than silently falling back and shipping the wrong infrastructure snippet. Two asymmetries are now modelled rather than inferred. CloudFormation is AWS-only, so it is optional on the templates type and Cloud Run simply has none, in place of the isAgentCore ternaries that decided it. The Terraform module link is likewise per provider rather than an AWS-only string built from a boolean. The provider ternary for Terraform interpolation is gone entirely: interpolateTerraformTemplate already no-ops on the ARN key absent from a given snippet, which its own comment noted, so both are passed. Behaviour is unchanged. No markup branching was touched: the per-provider field blocks render genuinely different inputs and belong where they are.
rossnelson
force-pushed
the
feat/cloud-run-public-preview
branch
from
September 19, 2026 22:38
b6aea5a to
4dedc31
Compare
rossnelson
force-pushed
the
refactor/compute-provider-registry
branch
from
September 19, 2026 22:38
4e0629e to
722376a
Compare
rossnelson
added a commit
that referenced
this pull request
Sep 30, 2026
* feat(workers): move Cloud Run to public preview Cloud Run has been behind a pre-release badge since it was added. It is going to public preview, so the shared default release stage now says so, putting it alongside Lambda. This is the badge only. It does not change which providers a caller is offered: self-hosted already offers all three, and a consumer that restricts the list decides its own before handing it to the picker. The badge also carries its stage as a data attribute now, so a test can assert the stage rather than the words rendered for it. The stage is the stable fact; the label is copy, and this change is itself an example of that copy moving. The stories assert the attribute, including the two that already read the rendered text. Adds a story for the shape a consumer renders for a GCP namespace, with the AWS providers hidden and no explicit releaseStage, so the assertion reads the shared default rather than a caller override. * refactor(workers): describe a compute provider in one place (#3946) A provider was described in ten places, in four shapes, under two naming conventions: an icon map and two label switches in the picker, a release stage map in shared.ts, a second icon-and-label map in compute-badge keyed by the wire name rather than the short one, an if-chain normalising those wire names in lock-compute-provider, a default provider list, and five raw template imports resolved through provider ternaries in compute-fields. Adding a provider meant finding all ten, and the templates alone had grown to seven props threaded through pages, forms, and fields. COMPUTE_PROVIDERS now holds all of it, keyed by provider, and the ten readers derive from it. The Record is exhaustive over ComputeProviderValue, so adding a provider is one entry and the compiler names whatever is still missing. The seven template props collapse to one `templates` map, defaulting to the bundled templates that a self-hosted deployment wants. Because that map is exhaustive too, a consumer supplying its own — Temporal Cloud does, per environment — fails its type check when a provider is added without templates, rather than silently falling back and shipping the wrong infrastructure snippet. Two asymmetries are now modelled rather than inferred. CloudFormation is AWS-only, so it is optional on the templates type and Cloud Run simply has none, in place of the isAgentCore ternaries that decided it. The Terraform module link is likewise per provider rather than an AWS-only string built from a boolean. The provider ternary for Terraform interpolation is gone entirely: interpolateTerraformTemplate already no-ops on the ARN key absent from a given snippet, which its own comment noted, so both are passed. Behaviour is unchanged. No markup branching was touched: the per-provider field blocks render genuinely different inputs and belong where they are.
This branch was successfully deployed
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.
Description & motivation 💭
A compute provider was described in ten places, in four shapes, under two naming conventions:
compute-provider-picker—providerIconRecordcompute-provider-picker—providerLabel()switchcompute-provider-picker—providerDescription()switchcompute-provider-picker—defaultProvidersshared.ts—defaultReleaseStageRecordcompute-badge.svelte—CONFIGRecord, keyed by wire namelock-compute-provider.ts—providerValuecompute-fields.svelte— templates?rawimports + provider ternariesAdding a provider meant finding all ten. The templates were the part that hurt most visibly: seven props (
cfnTemplate,cfnTemplateUrl,terraformTemplate,cloudRunTerraformTemplate,agentCoreCfnTemplate,agentCoreCfnTemplateUrl,agentCoreTerraformTemplate) threaded through pages → forms → fields, growing by three with each new provider.COMPUTE_PROVIDERSnow holds all of it and the ten readers derive from it. Adding a provider is one entry.The exhaustiveness is the point
The union derives from a tuple, not the other way round, and the maps are annotated rather than cast:
I verified this rather than assuming it. Adding a fourth provider to the tuple produces six compile errors naming it — in the registry, the release-stage map, and all three form schemas:
The same rule covers consumers.
templatesis one exhaustive map, so Temporal Cloud — which overrides them per environment — fails its own type check when a provider is added without templates, instead of silently falling back to the bundled defaults and showing a customer an infrastructure snippet pointing at the wrong account.Design Considerations 🎨
satisfies.satisfiespreserves literal types, which drops optional fields from the union —terraformModuleHrefbecame unreachable because Cloud Run has none. The annotation gives exhaustiveness and uniform access.string.labelKey: I18nKey<I18nResources>means a typo is a compile error rather than a label rendering asworkers.provider-lamda.providerarrives as a form field, so it is narrowed throughcomputeProviderFromTyperather than asserted. An unrecognised value stays unrecognised instead of reading as a provider with no entry.isAgentCoreternaries that decided it. The Terraform module link is per provider rather than an AWS-only string built from a boolean.interpolateTerraformTemplatealready no-ops on whichever ARN key is absent from a snippet — its own comment said so — so both are passed.What this does not touch
The
{#if provider === 'lambda'}blocks incompute-fields.sveltemarkup. Those render genuinely different inputs and belong where they are.Testing 🧪
How was this tested 👻
135 passedacross the worker, deployment, and utility suites.count-strict-errors.tsreports 0.Verified against a downstream consumer by building a package from this branch and type-checking it there: no new errors.
compute-fields.test.tsis the only test that changed shape — it passed two template props, and now layers an override onto the default map.Checklists
Merge Checklist
Issue(s) closed
None — groundwork so the next provider is one entry rather than ten edits.