Skip to content

feat(config): add the [workers] section to the project config schema - #6260

Merged
kanadgupta merged 8 commits into
developfrom
FUNC-753/workers-config
Aug 25, 2026
Merged

feat(config): add the [workers] section to the project config schema#6260
kanadgupta merged 8 commits into
developfrom
FUNC-753/workers-config

Conversation

@johnstonmatt

@johnstonmattjohnstonmatt commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the [workers] section to the project config schema: a Schema.Record of
worker name to { runtime, size, instances, source }, mirroring the
[functions.<slug>] convention in the same file. The same schema is used for the
project config and for [remotes.*], so a remote can carry its own worker
overrides.

Two constraints live at the schema level:

  • Worker names are DNS labels, matching what the Management API validates its
    :name path parameter against, since they end up in hostnames.
  • instances is a non-negative integer, matching 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 means a push silently deploys a different count than
    the config asked for.

There is no project-wide scalar in the table — an earlier revision had a
[workers] root for relocating the grouping directory, and it was dropped because
[workers.<name>] source already puts a worker anywhere in the repo. That keeps
workers a plain record with nothing for the index signature to collide with,
rather than a StructWithRest needing a key-pattern exclusion that vanished under
the disableChecks: trueio.ts uses 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), and
workers list/status/delete (#6263).

Linked issue

FUNC-753 (Linear). Supabase maintainer, exempt from the open-for-contribution flow.

Checklist

@johnstonmattjohnstonmatt changed the title FUNC 753/workers configfeat(config): add the [workers] section to the project config schemaAug 19, 2026
@johnstonmatt
johnstonmattforce-pushed the FUNC-753/workers-config branch 2 times, most recently from 1f30b54 to 0058885CompareAugust 20, 2026 10:19
@johnstonmatt
johnstonmatt marked this pull request as ready for review August 20, 2026 13:27
@johnstonmatt
johnstonmatt requested a review from a team as a code ownerAugust 20, 2026 13:27

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment threadpackages/config/src/workers.ts Outdated
Comment threadpackages/config/src/workers.ts Outdated
@johnstonmatt
johnstonmattforce-pushed the FUNC-753/workers-config branch from 0058885 to ce69f5bCompareAugust 20, 2026 13:33

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment threadpackages/config/src/base.ts
@github-actions

github-actionsBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@1126ed6933d406efcf92937624fa41a3428d11f4

Preview package for commit 1126ed6.

@johnstonmatt
johnstonmattforce-pushed the FUNC-753/workers-config branch from ce69f5b to 49964b7CompareAugust 21, 2026 08:05
johnstonmatt added a commit that referenced this pull request Aug 21, 2026
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.

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment threadapps/docs/public/cli/config.schema.json Outdated

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment threadpackages/config/src/workers.ts

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment threadpackages/config/src/base.ts
johnstonmatt added a commit that referenced this pull request Aug 21, 2026
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.
@johnstonmatt
johnstonmattforce-pushed the FUNC-753/workers-config branch from cf7adf6 to 0e8b578CompareAugust 21, 2026 15:45

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment threadapps/docs/public/cli/config.schema.json
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.
@johnstonmatt
johnstonmattforce-pushed the FUNC-753/workers-config branch from 0e8b578 to 17a9058CompareAugust 21, 2026 16:08

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment threadpackages/config/src/base.ts
@johnstonmatt
johnstonmattforce-pushed the FUNC-753/workers-config branch from 17a9058 to 2456e87CompareAugust 22, 2026 16:18

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment threadpackages/config/src/workers.ts
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.
@johnstonmatt
johnstonmattforce-pushed the FUNC-753/workers-config branch from 2456e87 to 69c83d2CompareAugust 24, 2026 17:58
@kanadgupta
kanadgupta self-requested a review August 24, 2026 19:26

@kanadguptakanadgupta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confined my feedback to blockers — should be quick fixes. Happy with this otherwise!

Comment threadpackages/config/src/workers.ts
Comment threadpackages/config/src/base.ts
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.
kanadgupta
kanadgupta approved these changes Aug 25, 2026
@kanadgupta
kanadgupta added this pull request to the merge queueAug 25, 2026
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Aug 25, 2026
@kanadgupta
kanadgupta added this pull request to the merge queueAug 25, 2026
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Aug 25, 2026
@kanadgupta

This comment was marked as resolved.

@kanadgupta
kanadgupta added this pull request to the merge queueAug 25, 2026
Merged via the queue into develop with commit 4b5d8beAug 25, 2026
23 checks passed
@kanadgupta
kanadgupta deleted the FUNC-753/workers-config branch August 25, 2026 20:54
pullBot pushed a commit to oogalieboogalie/cli that referenced this pull request Aug 26, 2026
## 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>
Sign up for freeto 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

@johnstonmatt@kanadgupta