Skip to content

fix(auth): make the sync test generator reproduce the committed sync tests - #1971

Merged
spydon merged 1 commit into
mainfrom
lukasklingsbo/sdk-2795-auth-sync-test-generator
Nov 4, 2026
Merged

spydon merged 1 commit into
mainfrom
lukasklingsbo/sdk-2795-auth-sync-test-generator

Conversation

@spydon

@spydon spydon commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Fixes SDK-2795.

Problem

Running make auth.build-sync && make ruff rewrote six committed files under src/auth/tests/_sync/, and pyrefly then reported 7 import errors. Two causes:

  1. scripts/run-unasync.py let unasync's default Async* to Sync* rule turn AsyncHttpxSession into SyncHttpxSession, which does not exist. The sync class is HttpxSession.
  2. The async conftest.py defined an AsyncAiohttpSession factory, and there is no sync aiohttp session. unasync cannot drop code, so the generated sync conftest imported a non-existent class.

Changes

  • run-unasync.py maps AsyncHttpxSession to HttpxSession, AsyncHttpSession to HttpSession, and async_http_sessions to sync_http_sessions.
  • New tests/http_sessions.py, outside _async/ so the generator never copies it, holds the session factories: async_http_sessions (httpx and aiohttp) and sync_http_sessions (httpx). The async conftest imports async_http_sessions as http_sessions, which the generator turns into the sync import.
  • Removed a leftover print(payload) from the async test_gotrue.py.
  • Regenerated _sync/. Besides imports, this brings back drift from earlier hand edits: fixture order, Generator instead of Iterator return types, the sign_out() teardown in auth_client_with_session that the async version already had, wrapped signatures that follow the async files, and removal of the unused create_new_user_with_email helper.

Verification

  • make auth.build-sync && make ruff followed by git diff --exit-code src/auth/tests/_sync is clean.
  • make auth.pyrefly: 0 errors.
  • make auth.tests: 213 passed. The async tests still run against both httpx and aiohttp.

The CI drift check from SDK-1688 is left for a separate PR.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bcca957f-dc26-4182-8fd8-1fa151439433
Commits

Reviewing files that changed from the base of the PR and between 57d4d4c and 0097ec5.

Files selected for processing: 6
  • src/auth/scripts/run-unasync.py
  • src/auth/tests/_async/conftest.py
  • src/auth/tests/_async/test_gotrue.py
  • src/auth/tests/_sync/conftest.py
  • src/auth/tests/_sync/test_gotrue.py
  • src/auth/tests/http_sessions.py

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Compatibility

    • Python package support is now listed for versions 3.11–3.14. Python 3.10 and earlier are no longer within the documented minimum-version range.
    • Realtime connections support a broader range of WebSocket versions.
  • Documentation

    • Updated installation guidance to require Python 3.11 or later and refreshed package links.
  • Developer Experience

    • Updated development-container setup and editor configuration for the project.

The pull request updates development-container setup and package metadata, including Python version classifiers, build-system requirements, and Ruff rules. It replaces legacy collection annotations with built-in generics and moves applicable typing imports to collections.abc across the packages. Auth test fixtures now share HTTP session factories, add user cleanup, and sign out after session tests.

Change: Other

Merge Risk: Minimal · previous review 57d4d

The changes align generated auth tests and modernize tooling and annotations. No concrete merge-blocking issue was identified; merge after normal checks pass.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a2ae8d88-1c0e-4fcb-847c-3fdf10821479
Commits

Reviewing files that changed from the base of the PR and between f68baf0 and 57d4d4c.

Files ignored due to path filters: 1
  • uv.lock is excluded by !**/*.lock
Files selected for processing: 73
  • .devcontainer/Dockerfile
  • .devcontainer/devcontainer.json
  • pyproject.toml
  • src/auth/.devcontainer/Dockerfile
  • src/auth/.devcontainer/devcontainer.json
  • src/auth/pyproject.toml
  • src/auth/scripts/run-unasync.py
  • src/auth/src/supabase_auth/admin_api.py
  • src/auth/src/supabase_auth/client.py
  • src/auth/src/supabase_auth/errors.py
  • src/auth/src/supabase_auth/helpers.py
  • src/auth/src/supabase_auth/session.py
  • src/auth/src/supabase_auth/timer.py
  • src/auth/src/supabase_auth/types.py
  • src/auth/tests/_async/conftest.py
  • src/auth/tests/_async/test_gotrue.py
  • src/auth/tests/_async/test_pkce_code_challenge.py
  • src/auth/tests/_sync/conftest.py
  • src/auth/tests/_sync/test_gotrue.py
  • src/auth/tests/_sync/test_pkce_code_challenge.py
  • src/auth/tests/conftest.py
  • src/auth/tests/http_sessions.py
  • src/functions/conftest.py
  • src/functions/pyproject.toml
  • src/functions/src/supabase_functions/client.py
  • src/functions/tests/test_client.py
  • src/functions/tests/test_errors.py
  • src/postgrest/.devcontainer/Dockerfile
  • src/postgrest/.devcontainer/devcontainer.json
  • src/postgrest/README.md
  • src/postgrest/docs/index.rst
  • src/postgrest/pyproject.toml
  • src/postgrest/src/postgrest/client.py
  • src/postgrest/src/postgrest/exceptions.py
  • src/postgrest/src/postgrest/request_builder.py
  • src/postgrest/src/postgrest/utils.py
  • src/postgrest/tests/_async/conftest.py
  • src/postgrest/tests/_async/test_request_builder.py
  • src/postgrest/tests/_sync/conftest.py
  • src/postgrest/tests/_sync/test_request_builder.py
  • src/postgrest/tests/test_filter_builder.py
  • src/realtime/pyproject.toml
  • src/realtime/src/realtime/channel.py
  • src/realtime/src/realtime/client.py
  • src/realtime/src/realtime/message.py
  • src/realtime/src/realtime/presence.py
  • src/realtime/src/realtime/types.py
  • src/realtime/tests/test_connection.py
  • src/realtime/tests/test_join_ref.py
  • src/realtime/tests/test_presence.py
  • src/realtime/tests/test_reconnection.py
  • src/realtime/tests/test_unknown_refs.py
  • src/storage/pyproject.toml
  • src/storage/src/storage3/analytics.py
  • src/storage/src/storage3/file_api.py
  • src/storage/src/storage3/types.py
  • src/storage/src/storage3/vectors.py
  • src/storage/tests/_async/test_client.py
  • src/storage/tests/_sync/test_client.py
  • src/storage/tests/utils.py
  • src/supabase/README.md
  • src/supabase/pyproject.toml
  • src/supabase/src/supabase/_async/client.py
  • src/supabase/src/supabase/_sync/client.py
  • src/supabase/src/supabase/lib/client_options.py
  • src/supabase/tests/_async/conftest.py
  • src/supabase/tests/_sync/conftest.py
  • src/utils/pyproject.toml
  • src/utils/src/supabase_utils/http/headers.py
  • src/utils/src/supabase_utils/http/io.py
  • src/utils/src/supabase_utils/http/query.py
  • src/utils/src/supabase_utils/http/request.py
  • src/utils/src/supabase_utils/types.py
Files with no reviewable changes: 5
  • src/postgrest/.devcontainer/devcontainer.json
  • src/auth/.devcontainer/Dockerfile
  • src/auth/.devcontainer/devcontainer.json
  • .devcontainer/Dockerfile
  • src/postgrest/.devcontainer/Dockerfile

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

Base automatically changed from chore/align-outdated-tooling to main November 4, 2026 13:50
@spydon
spydon force-pushed the lukasklingsbo/sdk-2795-auth-sync-test-generator branch from 57d4d4c to 0097ec5 Compare November 4, 2026 14:11
@spydon
spydon merged commit 5523e0b into main Nov 4, 2026
23 checks passed
@spydon
spydon deleted the lukasklingsbo/sdk-2795-auth-sync-test-generator branch November 4, 2026 14:14
spydon added a commit that referenced this pull request Nov 4, 2026
Resolves SDK-1688.

Adds `.github/workflows/codegen.yml`, which runs on pull requests and
pushes to `main`. It regenerates the sync code with `make
auth.build-sync`, formats it with `make ruff`, and fails with an error
naming the command to run if `git diff --exit-code` reports changes.

The Linear issue lists `build-sync` for functions, storage, postgrest
and supabase, but only `auth` still has a `build-sync` target (it
generates `src/auth/tests/_sync/`), so the check covers exactly that.

Notes:

- It lives in its own workflow file to avoid conflicts with #1967, which
rewrites `ci.yml`.
- `UV_FROZEN=1` keeps the Makefile's `uv run` calls from rewriting
`uv.lock`, which would otherwise show up as a false diff.
- No Docker or Supabase infra is needed.

The SDK-2795 fix (#1971) is on `main`, so the generator now reproduces
the committed sync tests and this check passes.
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