Skip to content

chore(storage): bring provider_template to full Provider parity#695

Merged
lakhansamani merged 2 commits into
mainfrom
chore/provider-template-parity
Jul 22, 2026
Merged

chore(storage): bring provider_template to full Provider parity#695
lakhansamani merged 2 commits into
mainfrom
chore/provider-template-parity

Conversation

@lakhansamani

Copy link
Copy Markdown
Contributor

Summary

internal/storage/db/provider_template/ (generated by make generate-db-template) only stubbed 60 of the 122 methods on storage.Provider. It never got the files added after client/organization/SAML/SCIM/webauthn/audit-log/health-check landed on the real providers (#580, #686, #691, #694). Anyone scaffolding a new DB provider with make generate-db-template dbname=foo got a struct that doesn't satisfy the interface, with no compiler error pointing at what's missing.

  • add the 12 missing feature files (client.go, organization.go, org_membership.go, org_domain.go, saml_idp.go, scim_endpoint.go, scim_group.go, trusted_issuer.go, webauthn_credential.go, federated_identity.go, audit_log.go, health_check.go), matching the file-per-feature layout used by sql/mongodb
  • add the missing GetUserByExternalID stub to user.go
  • add var _ storage.Provider = (*provider)(nil) to provider.go so future interface drift fails the build immediately instead of shipping a silently incomplete template
  • expand the "Adding support for new database" section in CONTRIBUTING.md with the full feature checklist, a reference-provider guide (SQL-like vs document vs wide-column vs key-value), and the wiring/testing steps after the stubs are implemented

Test plan

  • go build ./... passes
  • go vet ./internal/storage/db/provider_template/... and gofmt -l clean
  • golangci-lint run ./internal/storage/... — 0 issues
  • Simulated make generate-db-template dbname=x, confirmed the generated package builds and satisfies storage.Provider with no code changes

Template only stubbed 60 of 122 storage.Provider methods — files for
client, organization, org_membership, org_domain, saml_idp,
scim_endpoint, scim_group, trusted_issuer, webauthn_credential,
federated_identity, audit_log, and health_check were never added
after those features landed on the real providers (#580, #686, #691,
#694). make generate-db-template handed contributors a struct that
didn't compile against the interface.

- add the 12 missing feature files as stubs, matching the existing
  file-per-feature layout of sql/mongodb
- add GetUserByExternalID stub to user.go
- add var _ storage.Provider = (*provider)(nil) to provider.go so
  future interface drift fails the build immediately instead of
  silently shipping an incomplete template

Verified: make generate-db-template dbname=x now produces a package
that builds and satisfies storage.Provider out of the box.
var _ storage.Provider = (*provider)(nil) in provider.go created an
import cycle the moment a generated provider gets wired into
storage.New() per CONTRIBUTING.md step 4: internal/storage would
import the new db package, which imported internal/storage right
back. Caught by simulating the full generate -> wire -> build flow,
not just building the template in isolation.

Move the check into interface_test.go as an external _test package
(provider_template_test), which can import internal/storage without
being part of the same build graph storage.New() pulls in. Verified:
- go build ./... clean with a provider actually wired into
  storage.New()
- go test ./internal/storage/db/provider_template/... fails to
  compile (not just fails at runtime) when a method is removed
@lakhansamani
lakhansamani merged commit f9fd529 into main Jul 22, 2026
4 checks passed
@lakhansamani
lakhansamani deleted the chore/provider-template-parity branch July 22, 2026 06:25
pull Bot pushed a commit to bhardwajRahul/authorizer that referenced this pull request Jul 22, 2026
Added to README:
- WebAuthn / passkey login
- Enterprise SSO (SAML 2.0 IdP & SP, OIDC broker, verified domains, home realm discovery)
- SCIM 2.0 provisioning
- Multi-tenant / org-scoped admin
- Migration guides (planned)

Added to CHANGELOG [Unreleased]:
- Service accounts as FGA subjects (authorizerdev#665)
- SAML ACS CSRF exemption fix (authorizerdev#666)
- Trusted-issuer token review config (authorizerdev#667)
- Session revocation on password reset (authorizerdev#669, authorizerdev#673)
- Multi-tenant SSO phases (authorizerdev#672, authorizerdev#674, authorizerdev#675)
- OIDC discovery caching + Twitter PKCE fix (authorizerdev#668)
- WebAuthn passkey support (authorizerdev#671)
- Per-user TOTP lockout + hashed recovery codes (authorizerdev#670)
- Server-side user search + org membership (authorizerdev#678, authorizerdev#680)
- Per-method MFA availability signals (authorizerdev#681)
- Consolidated MFA redesign narrative (authorizerdev#682-686)
- SAML 2.0 IdP role (authorizerdev#691)
- OAuth 2.1 / MCP hardening (authorizerdev#693)
- SCIM group provisioning + FGA + SAML assertions (authorizerdev#694)
- Provider template parity (authorizerdev#695)
- Recent fixes (async tracking, AGENTS.md rules, security fixes, storage parity, error typing, panics, frontend fixes) (authorizerdev#696-702)
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