Cache auth.Client in OnInit (eliminates per-probe app.Auth call in HealthCheck). Replace all fmt.Errorf with xerrors structured errors (ErrInvalidInput / ErrInternal). Bump health/launcher/logz to v1.0.1, add xerrors v1.0.1, Go directive to 1.26. API committed as stable.
2.9 KiB
2.9 KiB
Changelog
All notable changes to this module will be documented in this file.
The format is based on Keep a Changelog, and this module adheres to Semantic Versioning.
1.0.0 - 2026-05-12
Added
authClient *auth.Clientcached inOnInit— the Auth client is now initialised once during startup and reused inHealthCheck, eliminating a per-probeapp.Auth(ctx)call.
Changed
- Go directive bumped from 1.25 to 1.26
health,launcher, andlogzdependencies bumped to v1.0.1xerrors v1.0.1added — all error returns now use structuredxerrors.Errinstead offmt.Errorf;OnInitreturnsErrInvalidInputfor missingProjectIDandErrInternalfor SDK initialisation failures;HealthCheckreturnsErrInternalwhen called beforeOnInit
Stabilization
- API committed as stable.
Config,Provider,Component, andNeware unchanged from v0.9.0.
0.9.0 - 2026-03-18
Added
Configstruct — Firebase connection settings loaded from environment variables:FIREBASE_PROJECT_ID(required, Google Cloud project ID); credentials are resolved via Application Default Credentials (ADC)Providerinterface —App() *firebase.App; for consumers that only need the Firebase Admin SDK entry pointComponentinterface — embedslauncher.Component,health.Checkable, andProvider; the full lifecycle-managed surface registered with the launcherNew(logger logz.Logger, cfg Config) Component— constructor; returns aComponentready forlc.AppendOnInit— validatesProjectID, then callsfb.NewAppto construct the Admin SDK*firebase.AppOnStart— no-op beyond logging; connectivity is verified byHealthCheckOnStop— no-op log statement; the Firebase Admin SDK exposes noClosemethodHealthCheck(ctx context.Context) error— callsGetUser("health-probe-non-existent")on the Auth client; treatsauth.IsUserNotFoundas healthy (confirms the service is reachable); any other error is a health failureName() string— returns"firebase"Priority() health.Level— returnshealth.LevelCritical; a Firebase Auth outage is treated as a critical failure
Design Notes
- The native
*firebase.Appis exposed directly viaApp(); callers obtain service-specific clients themselves (e.g.app.Auth(ctx),app.Firestore(ctx)), keeping this module free of service proliferation. - The health check uses a sentinel UID (
"health-probe-non-existent") rather than string-matching error messages, making it robust against Firebase error message changes. Provider/Componentsplit follows the framework pattern: injectProviderinto services that only needApp(), injectComponentonly at the lifecycle registration site.