Skip to content

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

Open
johnstonmatt wants to merge 1 commit into
developfrom
FUNC-753/workers-config
Open

feat(config): add the [workers] section to the project config schema#6260
johnstonmatt wants to merge 1 commit into
developfrom
FUNC-753/workers-config

Conversation

@johnstonmatt

@johnstonmatt johnstonmatt commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the [workers] section to the project config schema: a map of worker name to
{ runtime, size, source }, wired into both the local and remote project config
structs, with the worker-name pattern enforced at the schema level (DNS labels,
root reserved because [workers] root is a scalar in the same table).

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

@johnstonmatt johnstonmatt changed the title FUNC 753/workers config feat(config): add the [workers] section to the project config schema Aug 19, 2026
@johnstonmatt
johnstonmatt force-pushed the FUNC-753/workers-config branch 2 times, most recently from 1f30b54 to 0058885 Compare August 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 owner August 20, 2026 13:27
Workers record their runtime, instance size and source directory in
`supabase/config.toml`, keyed `[workers.<name>]`, next to the
`[functions.<slug>]` entries already in the same file.

The section is unusual in carrying both a project-wide scalar (`root`, the
directory workers are grouped in, relative to `supabase/`) and one sub-table
per worker, so it is modelled with `Schema.StructWithRest`. The record's key
pattern excludes `root` deliberately: an index signature otherwise claims
that key too and rejects its string value, which would make every config
carrying a `[workers] root` fail to decode. The same collision means a
worker cannot be named `root`; the CLI reserves the name where workers are
created.

Worker names are DNS labels, matching what the Management API validates its
`:name` path parameter against, since they end up in hostnames.

The section flows into the published `schema.json`, so editors offer
completion for it in `config.toml`.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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 on lines +21 to +23
const workerName = Schema.String.check(
Schema.isPattern(/^(?!root$)[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the reserved root key when checks are disabled

When an unselected [remotes.<name>.workers] section sets root, loading the project config fails: packages/config/src/io.ts decodes every unselected remote with disableChecks: true, which disables this pattern check, so the record index signature also claims root and attempts to decode its string value as a worker struct. The exclusion needs to be represented in a way that survives check-disabled remote decoding.

Useful? React with 👍 / 👎.

Comment on lines +49 to +50
instances: Schema.optionalKey(
Schema.Number.annotate({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject fractional worker instance counts

A config such as instances = 1.5 currently decodes successfully, but the generated V2DeployAWorkerInput schema requires instances to satisfy Schema.isInt() (packages/api/src/generated/contracts.ts:10655), and the API client validates that input before sending it. Consequently a value accepted by the project-config schema will make a later worker deploy fail; refine this field to an integer so the invalid config is rejected at load time.

Useful? React with 👍 / 👎.

@johnstonmatt
johnstonmatt force-pushed the FUNC-753/workers-config branch from 0058885 to ce69f5b Compare August 20, 2026 13:33

@chatgpt-codex-connector chatgpt-codex-connector Bot 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".

realtime,
storage,
studio,
workers,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Regenerate the published config schema

Adding workers to ProjectConfigSchema without updating apps/docs/public/cli/config.schema.json leaves the schema served at PROJECT_CONFIG_SCHEMA_URL stale. That tracked asset currently has no workers property and sets top-level additionalProperties to false, so editors using the documented $schema URL will flag the newly supported [workers] section as invalid and provide no completion for it; regenerate the public asset via apps/cli/scripts/generate-docs.ts in this change.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown
Contributor

Supabase CLI preview

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

Preview package for commit ce69f5b.

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.

1 participant