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.
53 lines
2.9 KiB
Markdown
53 lines
2.9 KiB
Markdown
# Changelog
|
|
|
|
All notable changes to this module will be documented in this file.
|
|
|
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
and this module adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
|
## [1.0.0] - 2026-05-12
|
|
|
|
### Added
|
|
|
|
- `authClient *auth.Client` cached in `OnInit` — the Auth client is now initialised once
|
|
during startup and reused in `HealthCheck`, eliminating a per-probe `app.Auth(ctx)` call.
|
|
|
|
### Changed
|
|
|
|
- Go directive bumped from 1.25 to 1.26
|
|
- `health`, `launcher`, and `logz` dependencies bumped to v1.0.1
|
|
- `xerrors v1.0.1` added — all error returns now use structured `xerrors.Err` instead of
|
|
`fmt.Errorf`; `OnInit` returns `ErrInvalidInput` for missing `ProjectID` and
|
|
`ErrInternal` for SDK initialisation failures; `HealthCheck` returns `ErrInternal` when
|
|
called before `OnInit`
|
|
|
|
### Stabilization
|
|
|
|
- API committed as stable. `Config`, `Provider`, `Component`, and `New` are unchanged
|
|
from v0.9.0.
|
|
|
|
[1.0.0]: https://code.nochebuena.dev/go/firebase/compare/v0.9.0...v1.0.0
|
|
|
|
## [0.9.0] - 2026-03-18
|
|
|
|
### Added
|
|
|
|
- `Config` struct — Firebase connection settings loaded from environment variables: `FIREBASE_PROJECT_ID` (required, Google Cloud project ID); credentials are resolved via Application Default Credentials (ADC)
|
|
- `Provider` interface — `App() *firebase.App`; for consumers that only need the Firebase Admin SDK entry point
|
|
- `Component` interface — embeds `launcher.Component`, `health.Checkable`, and `Provider`; the full lifecycle-managed surface registered with the launcher
|
|
- `New(logger logz.Logger, cfg Config) Component` — constructor; returns a `Component` ready for `lc.Append`
|
|
- `OnInit` — validates `ProjectID`, then calls `fb.NewApp` to construct the Admin SDK `*firebase.App`
|
|
- `OnStart` — no-op beyond logging; connectivity is verified by `HealthCheck`
|
|
- `OnStop` — no-op log statement; the Firebase Admin SDK exposes no `Close` method
|
|
- `HealthCheck(ctx context.Context) error` — calls `GetUser("health-probe-non-existent")` on the Auth client; treats `auth.IsUserNotFound` as healthy (confirms the service is reachable); any other error is a health failure
|
|
- `Name() string` — returns `"firebase"`
|
|
- `Priority() health.Level` — returns `health.LevelCritical`; a Firebase Auth outage is treated as a critical failure
|
|
|
|
### Design Notes
|
|
|
|
- The native `*firebase.App` is exposed directly via `App()`; 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` / `Component` split follows the framework pattern: inject `Provider` into services that only need `App()`, inject `Component` only at the lifecycle registration site.
|
|
|
|
[0.9.0]: https://code.nochebuena.dev/go/firebase/releases/tag/v0.9.0
|