feat(firebase): initial stable release v0.9.0

Firebase App component with launcher lifecycle and health check integration.

What's included:
- Config with ProjectID (FIREBASE_PROJECT_ID env var); credentials via ADC
- Provider interface exposing native *firebase.App directly
- Component interface: launcher.Component + health.Checkable + Provider
- New(logger, cfg) constructor for lifecycle registration via lc.Append
- Health check via GetUser("health-probe-non-existent") + auth.IsUserNotFound at LevelCritical
- No-op OnStop (Firebase Admin SDK has no Close method)

Tested-via: todo-api POC integration
Reviewed-against: docs/adr/
This commit is contained in:
2026-03-19 13:35:40 +00:00
commit 3ef30c2354
13 changed files with 741 additions and 0 deletions

51
firebase_test.go Normal file
View File

@@ -0,0 +1,51 @@
package firebase
import (
"testing"
"code.nochebuena.dev/go/health"
"code.nochebuena.dev/go/logz"
)
func newLogger() logz.Logger { return logz.New(logz.Options{}) }
func TestNew(t *testing.T) {
if New(newLogger(), Config{ProjectID: "test"}) == nil {
t.Fatal("New returned nil")
}
}
func TestComponent_Name(t *testing.T) {
c := New(newLogger(), Config{ProjectID: "test"}).(health.Checkable)
if c.Name() != "firebase" {
t.Errorf("want firebase, got %s", c.Name())
}
}
func TestComponent_Priority(t *testing.T) {
c := New(newLogger(), Config{ProjectID: "test"}).(health.Checkable)
if c.Priority() != health.LevelCritical {
t.Error("Priority() != LevelCritical")
}
}
func TestComponent_OnInit_MissingProjectID(t *testing.T) {
c := New(newLogger(), Config{ProjectID: ""})
if err := c.OnInit(); err == nil {
t.Error("expected error for empty ProjectID")
}
}
func TestComponent_OnStop_NilApp(t *testing.T) {
c := &firebaseComponent{logger: newLogger()}
if err := c.OnStop(); err != nil {
t.Errorf("OnStop with nil app: %v", err)
}
}
func TestComponent_App_ReturnsNilBeforeInit(t *testing.T) {
c := New(newLogger(), Config{ProjectID: "test"})
if c.App() != nil {
t.Error("App() should be nil before OnInit")
}
}