Repository navigation
fix(auth): make the sync test generator reproduce the committed sync tests - #1971
Conversation
|
Warning Review limit reachedYou'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. View limit details
No actionable comments were generated in the recent review. Summary
Change: Other Merge Risk:
|
57d4d4c to
0097ec5
Compare
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.
Fixes SDK-2795.
Problem
Running
make auth.build-sync && make ruffrewrote six committed files undersrc/auth/tests/_sync/, and pyrefly then reported 7 import errors. Two causes:scripts/run-unasync.pylet unasync's defaultAsync*toSync*rule turnAsyncHttpxSessionintoSyncHttpxSession, which does not exist. The sync class isHttpxSession.conftest.pydefined anAsyncAiohttpSessionfactory, and there is no sync aiohttp session. unasync cannot drop code, so the generated sync conftest imported a non-existent class.Changes
run-unasync.pymapsAsyncHttpxSessiontoHttpxSession,AsyncHttpSessiontoHttpSession, andasync_http_sessionstosync_http_sessions.tests/http_sessions.py, outside_async/so the generator never copies it, holds the session factories:async_http_sessions(httpx and aiohttp) andsync_http_sessions(httpx). The async conftest importsasync_http_sessions as http_sessions, which the generator turns into the sync import.print(payload)from the asynctest_gotrue.py._sync/. Besides imports, this brings back drift from earlier hand edits: fixture order,Generatorinstead ofIteratorreturn types, thesign_out()teardown inauth_client_with_sessionthat the async version already had, wrapped signatures that follow the async files, and removal of the unusedcreate_new_user_with_emailhelper.Verification
make auth.build-sync && make rufffollowed bygit diff --exit-code src/auth/tests/_syncis 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.