Repository navigation
ci: cancel superseded pull request runs and let the supabase cli fall back from a throttled registry - #1857
Merged
Conversation
A new push to a pull request now cancels its CI run that is still in progress. Pushing a stack of branches started two runs per pull request, and the hundreds of parallel jobs pulling Supabase images from ghcr.io hit the registry rate limit. Pushes to main keep a group per run, so release runs are never cancelled or dropped.
Contributor
|
The following capabilities are marked
The following capabilities are marked
These may have been renamed, removed, or never registered. Please update the capability matrix. |
… throttled registry v3.0.0 pins every recent CLI to ghcr.io, which disables the CLI's own registry fallback, so image pulls failed as soon as ghcr.io throttled. v3.0.1 leaves the registry to the CLI for versions from v2.108.0 on (supabase/setup-cli#453).
spydon
force-pushed
the
ci/cancel-superseded-runs
branch
from
October 27, 2026 17:05
ef1f319 to
95f1fae
Compare
This was referenced Oct 28, 2026
spydon
added a commit
that referenced
this pull request
Nov 13, 2026
…executor (#2043) Step 3 of [SDK-2765](https://linear.app/supabase/issue/SDK-2765) ([SDK-2986](https://linear.app/supabase/issue/SDK-2986)): the table definition, the request value the typed builders of step 4 will collect, and the executors that run it. A port of the `PostgrestTableRequest` and `PostgrestTableExecutor` of supabase-flutter #1857, on the column expressions, filters and orderings of #2041 and #2042. SDK-2711, the interceptor seam, builds on it. ## What - `Table[Row, Insert, Update](name, row_type, primary_key=, computed_fields=, schema=)`: a frozen dataclass with the metadata of a table, declared once per table as the last attribute of its namespace class. `Insert` and `Update` are phantom here; the typed builder of step 4 uses them to accept only the table's write types, and `Never` makes the write methods uncallable. `relations=` waits for step 6, which adds the relation types it would hold. - `TableRequest`: a frozen `kw_only` dataclass with the fields of Dart's value: `table`, `operation`, `schema`, `columns`, `filter`, `orderings`, `limit`, `offset`, `shape`, `count`, `payload`, `read_only`, `on_conflict`, `ignore_duplicates`, `returning`, `max_affected`, `strip_nulls`, `dry_run`, `explain` and `options`. No URL and no headers, collections are tuples, and a changed copy is `dataclasses.replace`. `schema=None` means the schema the table carries and otherwise the client's; `filter=None` means every row, as in Dart, with the typed builder of step 4 requiring `where()` or `all()` before it builds such an update or delete. `embedded_scopes` waits for step 6 with the scope type. `TableResult(data, count)` carries `data` as plain decoded JSON by shape. `TableOperation`, `ResultShape`, `ExplainOptions` and `RequestOptions(headers, retry, timeout)` come with it. - `TableExecutor` and `AsyncTableExecutor` protocols with `execute(request)`. The async one returns `Awaitable[TableResult]`, so both an `async def` and a method that forwards to another executor satisfy it. - `HttpTableExecutor(client)` and `AsyncHttpTableExecutor(client)` share two Sans-IO functions. One renders a request through `pre_select`, `pre_insert`, `pre_upsert`, `pre_update`, `pre_delete`, the new `pre_rpc`, the `select` of a returning write and the `max_affected` of the string builders into the `PostgrestRequest` they would have sent; the other decodes the response by shape with their parsers. The `RetryPolicy` and the request timeout of the client apply through `communicate()`, and the headers of the client are read when a request is sent, so `apikey` and the access token of that moment go on a request built earlier. `X-Client-Info` lists `features=typed-api`, merged into whatever header the client carries (the supabase client sets its own) by the new `Headers.with_client_info_features()`; `Headers.supabase_client_headers()` takes `features=` for the same segment. - `ValueError` before anything is sent: a filter on an insert or upsert, anything but the filter, count method and options on a count, a filter of an update, delete or count that names no rows of the table, a write without a payload, a shape other than rows, none or explain on a write that is not `returning` (a `HEAD` among them), and `strip_nulls` with csv, geojson or explain. "Names no rows" is the string builder's `_filters_embedded_resource` rule, every key an embedded resource key such as `author.name`, since the relation `is_null()` filters arrive in step 6. - `RequestOptions.headers` replace the header of the same name, apart from `Accept`, which the shape decides, and `Prefer`, whose `name=value` preferences are merged into the rendered ones, each replacing the preference of the same name. - `pre_rpc` is extracted from `PostgrestClient.rpc`, `_select_returned` from `QueryRequestBuilder.select`, and `_max_affected` and `_explain` from their builder methods, so the executor renders through the same code. No behavior change for the string builder. Two defaults differ from the string builder, as in Dart: a write sends `Prefer: return=minimal` unless `returning` is set, and a list payload sends `missing=default` so that a key left out of some rows gets the database default. One thing differs from Dart: the `columns` of a function call make its `select` list whatever `returning` says, since a function call returns its rows regardless and `returning` is a write option. Three things have no string builder counterpart. Several orderings go into one `order=title.desc,id` parameter, since PostgREST keeps the first `order` parameter only; the string builder sends one parameter per `order()` call, which is worth its own look. `dry_run` sends `Prefer: tx=rollback` as the Dart and JS builders do, and since PostgREST accepts that preference whatever its `db-tx-end` setting and commits when the setting does not allow the override, the executors check `Preference-Applied` of the response and raise `APIError` when the rollback was not applied, so that a committed dry run is loud rather than silent. `handling=strict` would not help: PostgREST 13 accepts `tx=rollback` under strict handling and still ignores it. `ResultShape.GEOJSON` adds `ResponseShape.GEOJSON` to `PostgrestRequest`, rendered as `Accept: application/geo+json` and rejected with `strip_nulls` like csv. ## Tests - `test_table_executor.py`: `TestRendersWhatTheStringBuilderSends` finalizes the rendered request and the string builder's for 48 queries over every operation and shape and compares method, path, query, headers, content, timeout and retry, plus the schema of the table and of the request, the preference merge and the `Accept` of the shape. Then the pre-send `ValueError`s and the filters that do name rows, decoding by shape (rows, single, `maybe_single` with its 406, none, head, csv, geojson, explain as text and as json, value, count, a counted select, silent and returning writes, an error status, a body in another shape), the send path (`X-Client-Info` with and without a client-set header, `apikey` and a token set after the executor was created, request timeout, retries with the policy of the client and per request, schema), the async executor, and a soft-delete executor wrapped around both executors. - `test_table_request.py`: value semantics, defaults and option validation. - `tests/typecheck/tables.py` under mypy, pyright and pyrefly: a row type, primary key or computed field of another table and a nullable primary key are errors on exactly the marked lines; `HttpTableExecutor` satisfies `TableExecutor` and `AsyncHttpTableExecutor` satisfies `AsyncTableExecutor`, each is rejected as the other, an async client is rejected by the sync executor, and wrapping executors satisfy both. - `test_headers.py`: the features segment and the merge. ## Compliance The new symbols are listed under the top-level `supporting_symbols` of `sdk-compliance.yaml`, as in steps 1 and 2; the feature status changes in step 8. ## Found on the way `PostgrestClient.schema()` builds the new client from `dict(self.default_headers)`, which already holds `Accept-Profile: public`, and the constructor appends to it with `set()`, so the request carries `Accept-Profile: public, library`. Not fixed here; the parity test for a schema uses a client created with `schema="library"` instead. Linear: SDK-2986
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.
A new push to a pull request now cancels that pull request's CI run if it is still in progress.
Pushing the v3 sync stack started two CI/CD runs for each pull request, about 14 runs and 400 jobs at once. The auth, storage and realtime jobs each pull around ten Supabase images from ghcr.io, so
supabase startfailed witherror from registry: retry-after: …, allowed: 44000/minutebefore any test ran (for example run 40544530874 on #1793).mainand manual runs get a group per run id, so release and publish runs are never cancelled or dropped from the queue.A matching pull request against
v3follows, since the stack's pull requests run the workflow file fromv3.supabase/setup-cligoes from v3.0.0 to v3.0.1. v3.0.0 pins every recent CLI to ghcr.io, which disables the CLI's own fallback to another registry. v3.0.1 leaves the registry to the CLI for versions from v2.108.0 on (fix: allow registry fallback in supported CLI versions setup-cli#453), so a throttled ghcr.io no longer fails the job.