Gate wasp-auth-only codegen behind the provider and expose the active provider identity - #4720
Closed
FranjoMindek wants to merge 1 commit into
Closed
Conversation
15 tasks
Deploying wasp-docs-on-main with
|
| Latest commit: |
a28c9c9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a6d15b1d.wasp-docs-on-main.pages.dev |
| Branch Preview URL: | https://franjo-auth-capability-codeg.wasp-docs-on-main.pages.dev |
FranjoMindek
had a problem deploying
to
railway-deploy-test
August 13, 2026 23:46 — with
GitHub Actions
Failure
FranjoMindek
temporarily deployed
to
fly-deploy-test
August 13, 2026 23:46 — with
GitHub Actions
Inactive
@wasp.sh/spec
@wasp.sh/wasp-cli
@wasp.sh/wasp-cli-darwin-arm64-unknown
@wasp.sh/wasp-cli-darwin-x64-unknown
@wasp.sh/wasp-cli-linux-arm64-glibc
@wasp.sh/wasp-cli-linux-x64-glibc
@wasp.sh/wasp-cli-linux-x64-musl
commit: |
FranjoMindek
force-pushed
the
franjo/auth-capability-codegen
branch
2 times, most recently
from
August 14, 2026 06:24
c9acb3a to
cacb5c3
Compare
FranjoMindek
temporarily deployed
to
fly-deploy-test
August 14, 2026 06:37 — with
GitHub Actions
Inactive
FranjoMindek
had a problem deploying
to
railway-deploy-test
August 14, 2026 06:37 — with
GitHub Actions
Failure
FranjoMindek
force-pushed
the
franjo/auth-capability-codegen
branch
from
August 14, 2026 07:11
cacb5c3 to
3e243c6
Compare
FranjoMindek
temporarily deployed
to
fly-deploy-test
August 14, 2026 07:27 — with
GitHub Actions
Inactive
FranjoMindek
had a problem deploying
to
railway-deploy-test
August 14, 2026 07:27 — with
GitHub Actions
Failure
… provider identity
FranjoMindek
force-pushed
the
franjo/auth-capability-codegen
branch
from
August 14, 2026 07:52
3e243c6 to
a28c9c9
Compare
FranjoMindek
temporarily deployed
to
fly-deploy-test
August 14, 2026 08:42 — with
GitHub Actions
Inactive
FranjoMindek
had a problem deploying
to
railway-deploy-test
August 14, 2026 08:42 — with
GitHub Actions
Failure
Contributor
Author
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.
Description
Stack: PR 6, on top of #4719. Capability-gated code generation: the generated app is different code per provider, not different runtime behavior. This is the mechanism RedwoodJS lacked — a library must typecheck every configuration at once; a compiler can simply not emit what cannot work.
Under an external auth provider:
LoginForm/SignupFormand all ofwasp/client/auth/ui, per-method client modules, Wasp's server auth flows (password.ts,jwt.ts,lucia.ts,provider/wasp.ts,hooks.ts, email/username/oauth modules), and their SDKexportsentries.luciaand@lucia-auth/adapter-prisma.JWT_SECRET— gone from the generated env schema andconfig.auth.useAuth,logout(),context.user,authRequired,/auth/me,/auth/logout, andwasp/server/auth'sdefineUserSignupFields.And in both directions:
wasp/auth/provider(new, every auth app):authProviderIdandauthCapabilitiesasas constliterals — "which provider am I on" answered by the type system.CLERK_SECRET_KEYfails at boot with the manifest's own doc string, not at the first authenticated request.userSignupFields: the manifest's ref reaches the SDK as a virtual user module and is fed the provider-verifiedclaims, closing the "non-nullableUser.emailcan never be provisioned" trap flagged in verification. Claims are also persisted asAuthIdentity.providerData.Golden proof, not assertion: a new e2e snapshot (
auth-provider-external, the Clerk example) pins all of the above verbatim — noauth/forms, no lucia inpackage.json, noJWT_SECRET,authProviderId = "clerk", Clerk env vars in the env schema. Meanwhile every existing snapshot is byte-identical under.wasp/out/except the intended additions (the provider-identity module and its export). 1100 e2e tests green.Consciously not here (each deferred with a reason recorded in the design doc): mounting manifest routes and adapter-package imports (next PR — a src-adapter manifest cannot even declare routes), generated client-adapter glue, provisioning hooks (blocked on the veto-loop tombstone problem), and curated diagnostics beyond TS2307 at the import site.
Type of change
Checklist
I tested my change in a Wasp app to verify that it works as intended.
Verified live at the top of the stack (better-auth example): JIT provisioning with claims → local
Userrow,providerDatacarrying{email, name}, andcontext.user.ididentical across providers.🧪 Tests and apps:
I added unit tests for my change.
The new e2e snapshot is the test: generated output compared verbatim is strictly stronger than unit-testing generator functions.
(if you fixed a bug) I added a regression test for the bug I fixed.
(if you added/updated a feature) I added/updated e2e tests in
examples/kitchen-sink/e2e-tests.Not in kitchen-sink (it must stay a wasp-auth app); the coverage is the new
auth-provider-externalsnapshot suite.(if you added/updated a feature) I updated the starter templates in
waspc/data/Cli/templates, as needed.(if you added/updated a feature) I updated the example apps in
examples/, as needed.examples/tutorials) I updated the tutorial in the docs (and vice versa).📜 Documentation:
(if you added/updated a feature) I added/updated the documentation in
web/docs/.Held with the stack until the API stops moving.
🆕 Changelog: (if change is more than just code/docs improvement)
waspc/ChangeLog.mdwith a user-friendly description of the change.web/docs/migration-guides/.versioninwaspc/waspc.cabalto reflect the changes I introduced.