Uh oh!
There was an error while loading. Please reload this page.
feat(config): add the [workers] section to the project config schema - #6260
Conversation
1f30b54 to
0058885CompareThere was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:005888549e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
0058885 to
ce69f5bCompareThere was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:ce69f5b12b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@1126ed6933d406efcf92937624fa41a3428d11f4Preview package for commit |
ce69f5b to
49964b7CompareTwo schema defects found in review of #6260. `StructWithRest` applies its rest record to declared struct fields too, so excluding `root` from the worker-name pattern was the only thing keeping the record from claiming it — and `io.ts` decodes every unselected `[remotes.*]` block with `disableChecks: true`, which drops that pattern. A remote that merely names a workers root therefore failed the entire config load. The rest value now admits either a worker table or the `root` string, and a business-rule check rejects a bare value where a table belongs. That check relaxes under `disableChecks` along with every other business rule, which is what the flag is for: an unselected remote is never the config being acted on. `instances` was an unconstrained `Schema.Number`, so `1.5` and `-1` loaded happily. Neither ever reached the API — `readWorkersSection` drops a non-integer, so `push` silently deployed 1 instead, rescaling a worker against the recorded config. Bounded here as a non-negative integer, matching `spec.instances` in the Management API's own input schema, so the mistake is named at load time instead.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:5a0dfa965b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:b7759542fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:76a45a82f7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Two schema defects found in review of #6260. `StructWithRest` applies its rest record to declared struct fields too, so excluding `root` from the worker-name pattern was the only thing keeping the record from claiming it — and `io.ts` decodes every unselected `[remotes.*]` block with `disableChecks: true`, which drops that pattern. A remote that merely names a workers root therefore failed the entire config load. The rest value now admits either a worker table or the `root` string, and a business-rule check rejects a bare value where a table belongs. That check relaxes under `disableChecks` along with every other business rule, which is what the flag is for: an unselected remote is never the config being acted on. `instances` was an unconstrained `Schema.Number`, so `1.5` and `-1` loaded happily. Neither ever reached the API — `readWorkersSection` drops a non-integer, so `push` silently deployed 1 instead, rescaling a worker against the recorded config. Bounded here as a non-negative integer, matching `spec.instances` in the Management API's own input schema, so the mistake is named at load time instead.
cf7adf6 to
0e8b578CompareThere was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:0e8b5783e5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Workers record their runtime, instance size, instance count and source directory in `supabase/config.toml`, keyed `[workers.<name>]`, next to the `[functions.<slug>]` entries already in the same file. The section is a plain `Schema.Record`: one sub-table per worker and no project-wide scalar sitting beside them, so there is nothing for the index signature to collide with. Worker names are DNS labels, matching what the Management API validates its `:name` path parameter against, since they end up in hostnames. `instances` is bounded as a non-negative integer to match `spec.instances` in the API's own input schema — a value that gets past the schema is dropped rather than sent, so leaving it unbounded silently deploys a different count than the config asked for. The section flows into the published `schema.json`, so editors offer completion for it in `config.toml`. That asset is served at PROJECT_CONFIG_SCHEMA_URL and stamped into every `config.toml` that `saveProjectConfig` writes, so a stale copy makes editors flag valid config as invalid. Most of that asset's diff is not workers. `toJsonSchemaDocument` changed how it emits unions between effect beta.107 and rc.108, and the bump landed on develop without the asset being regenerated, so inline `Infinity`/`NaN` unions collapse into `$defs` refs throughout — regenerating on the parent commit alone produces ~549 of those deletions. Nothing wires the generator into a script or CI job, so the drift is silent. Worth fixing separately.
0e8b578 to
17a9058CompareThere was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:17a9058f3e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
17a9058 to
2456e87CompareThere was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:2456e87b37
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Workers record their runtime, instance size, instance count and source directory in `supabase/config.toml`, keyed `[workers.<name>]`, next to the `[functions.<slug>]` entries already in the same file. The section is a plain `Schema.Record`: one sub-table per worker and no project-wide scalar sitting beside them, so there is nothing for the index signature to collide with. Worker names are DNS labels, matching what the Management API validates its `:name` path parameter against, since they end up in hostnames. `instances` is bounded as a non-negative integer to match `spec.instances` in the API's own input schema — a value that gets past the schema is dropped rather than sent, so leaving it unbounded silently deploys a different count than the config asked for. The section flows into the published `schema.json`, so editors offer completion for it in `config.toml`. That asset is served at PROJECT_CONFIG_SCHEMA_URL and stamped into every `config.toml` that `saveProjectConfig` writes, so a stale copy makes editors flag valid config as invalid. Most of that asset's diff is not workers. `toJsonSchemaDocument` changed how it emits unions between effect beta.107 and rc.108, and the bump landed on develop without the asset being regenerated, so inline `Infinity`/`NaN` unions collapse into `$defs` refs throughout — regenerating on the parent commit alone produces ~549 of those deletions. Nothing wires the generator into a script or CI job, so the drift is silent. Worth fixing separately.
2456e87 to
69c83d2Compare
kanadgupta
left a comment
There was a problem hiding this comment.
Confined my feedback to blockers — should be quick fixes. Happy with this otherwise!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…/cli into FUNC-753/workers-config
The Go baseConfig is decoded with UnmarshalExact, so any top-level key it does not model is a hard parse error. Once the published JSON schema advertises [workers], a hand-written section breaks every Go-delegated path that calls flags.LoadConfig. Add an ignored Workers field so the delegated child accepts what the TS schema accepts.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as resolved.
This comment was marked as resolved.
Uh oh!
There was an error while loading. Please reload this page.
## Summary Adds `supabase workers new`, plus the project layout and `config.toml` editing the whole command family builds on: - `shared/workers/` — worker path resolution, `config.toml` section reading and patching (`toml-section.ts` preserves surrounding formatting), the runtime/size envelope, and the starter files. - Starter files live as ordinary files under `shared/workers/stacks/<runtime>/` rather than string literals, and are embedded into the compiled binary through a Bun macro — the directory is expanded at transpile time and inlined. A completeness check inside the macro fails the build if `WORKER_RUNTIMES` and the directory drift apart. **Stack 2 of 4**, on top of the config schema (supabase#6260). Reviewer note: the third commit is where the embedding mechanism is explained; the starters are deliberately kept out of the type program (a `deno` starter is not valid under this workspace's Bun types), which is why `tsconfig.json` excludes the directory and nothing imports the files. ## Linked issue FUNC-753 (Linear). Supabase maintainer, exempt from the `open-for-contribution` flow. ## Checklist - [x] The PR title follows [Conventional Commits](https://www.conventionalcommits.org/) --------- Co-authored-by: Kanad Gupta <git@kanad.dev>
Summary
Adds the
[workers]section to the project config schema: aSchema.Recordofworker name to
{ runtime, size, instances, source }, mirroring the[functions.<slug>]convention in the same file. The same schema is used for theproject config and for
[remotes.*], so a remote can carry its own workeroverrides.
Two constraints live at the schema level:
:namepath parameter against, since they end up in hostnames.instancesis a non-negative integer, matchingspec.instancesin the API'sown input schema. A value that gets past the schema is dropped rather than sent,
so leaving it unbounded means a
pushsilently deploys a different count thanthe config asked for.
There is no project-wide scalar in the table — an earlier revision had a
[workers] rootfor relocating the grouping directory, and it was dropped because[workers.<name>] sourcealready puts a worker anywhere in the repo. That keepsworkersa plain record with nothing for the index signature to collide with,rather than a
StructWithRestneeding a key-pattern exclusion that vanished underthe
disableChecks: trueio.tsuses for unselected remotes.No CLI surface consumes this yet — it lands first so the schema and its generated
types are reviewable on their own.
Stack 1 of 4. Followed by
workers new(#6261),workers push(#6262), andworkers list/status/delete(#6263).Linked issue
FUNC-753 (Linear). Supabase maintainer, exempt from the
open-for-contributionflow.Checklist