ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/platform/config/config_test.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/platform/config/config_test.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision39df94f92b2a33f852481fe1954dabed841524bb
Branchw0-aedt-compliance
Path or archive memberinternal/platform/config/config_test.go
Original SHA-256d4d1a7c8afdce022fd7d9ac24eaff9aaa009cddfdabb56646aed0855f4c21d9c
Git blob SHA98e0bd5c10a639265bf4781364c151a3a204dd52
Reading-copy SHA-256d4d1a7c8afdce022fd7d9ac24eaff9aaa009cddfdabb56646aed0855f4c21d9c

Original source ↗

Recovered source transcript

package config import ( "strings" "testing" ) func TestValidateDevDefaultsOK(t *testing.T) { c := Config{ Env: EnvDevelopment, HTTPAddr: ":8080", Cloud: CloudLocal, Embeddings: Embeddings{Provider: ProviderFake, Dimension: 384}, DecisionRetentionDays: 90, Auth: Auth{PepperVersion: 1, SessionIdleSeconds: 900, SessionAbsoluteSeconds: 43200, PendingAbsoluteSeconds: 300}, } if err := c.Validate(); err != nil { t.Fatalf("dev defaults should validate, got %v", err) } } func TestProductionRejectsFakeProviderAndLocalCloud(t *testing.T) { c := Config{ Env: EnvProduction, HTTPAddr: ":8080", Cloud: CloudLocal, AppDatabaseURL: "", // also missing Embeddings: Embeddings{Provider: ProviderFake, Dimension: 384}, } err := c.Validate() if err == nil { t.Fatal("production with fake provider + local cloud + no DB must fail") } msg := err.Error() for _, want := range []string{"MM_DATABASE_URL", "fake embedding provider", "government cloud"} { if !strings.Contains(msg, want) { t.Errorf("expected error to mention %q; got: %s", want, msg) } } } func TestOpenAIProviderRequiresEndpointAndModel(t *testing.T) { c := Config{ Env: EnvDevelopment, HTTPAddr: ":8080", Cloud: CloudLocal, Embeddings: Embeddings{Provider: ProviderOpenAI, Dimension: 384}, } err := c.Validate() if err == nil { t.Fatal("openai provider without endpoint/model must fail") } if !strings.Contains(err.Error(), "MM_EMBED_ENDPOINT") || !strings.Contains(err.Error(), "MM_EMBED_MODEL") { t.Fatalf("want endpoint+model errors, got: %v", err) } } func TestInvalidEnumsRejected(t *testing.T) { c := Config{Env: "staging", Cloud: "gcp", Embeddings: Embeddings{Provider: "magic", Dimension: 0}} err := c.Validate() if err == nil { t.Fatal("invalid enums + zero dimension must fail") } for _, want := range []string{"MM_ENV", "MM_CLOUD", "MM_EMBED_PROVIDER", "MM_EMBED_DIMENSION"} { if !strings.Contains(err.Error(), want) { t.Errorf("expected %q in error; got: %s", want, err.Error()) } } } func TestProductionRejectsDevHeaderAuthAndMissingAuthSecrets(t *testing.T) { c := Config{ Env: EnvProduction, HTTPAddr: ":8080", Cloud: CloudAWSGovCloud, AppDatabaseURL: "postgres://app@db/missionmatch", Embeddings: Embeddings{Provider: ProviderOpenAI, Endpoint: "https://e", Model: "m", Dimension: 384}, RequireFIPS: false, // also rejected AllowDevHeaderAuth: true, // the backdoor must never be on in production Auth: Auth{PepperVersion: 1, SessionIdleSeconds: 900, SessionAbsoluteSeconds: 43200, PendingAbsoluteSeconds: 300}, } err := c.Validate() if err == nil { t.Fatal("production with the dev header resolver, no FIPS, and no auth secrets must fail") } for _, want := range []string{ "MM_ALLOW_DEV_HEADER_AUTH", "MM_REQUIRE_FIPS", "MM_CREDENTIAL_PEPPER", "MM_TOTP_KEK", "MM_CSRF_KEY", "MM_RECOVERY_LOOKUP_KEY", "MM_ALLOWED_ORIGINS", "MM_COOKIE_SECURE", } { if !strings.Contains(err.Error(), want) { t.Errorf("expected error to mention %q; got: %s", want, err.Error()) } } } func TestLoadAppliesDefaults(t *testing.T) { // No MM_* env set in this test process → all defaults; dev config must load clean. for _, k := range []string{ "MM_ENV", "MM_HTTP_ADDR", "MM_DATABASE_URL", "MM_MIGRATOR_DATABASE_URL", "MM_CLOUD", "MM_COMPLIANCE_DATABASE_URL", "MM_DECISION_RETENTION_DAYS", "MM_EMBED_PROVIDER", "MM_EMBED_ENDPOINT", "MM_EMBED_MODEL", "MM_EMBED_DIMENSION", "MM_EMBED_API_KEY", "MM_REQUIRE_FIPS", "MM_ALLOW_DEV_HEADER_AUTH", "MM_ALLOWED_ORIGINS", "MM_TRUSTED_PROXY_HEADER", "MM_CREDENTIAL_PEPPER_VERSION", "MM_CREDENTIAL_PEPPER", "MM_CREDENTIAL_PEPPER_PREVIOUS", "MM_TOTP_KEK_VERSION", "MM_TOTP_KEK", "MM_CSRF_KEY", "MM_RECOVERY_LOOKUP_KEY", "MM_TOTP_ISSUER", "MM_SESSION_IDLE_SECONDS", "MM_SESSION_ABSOLUTE_SECONDS", "MM_SESSION_PENDING_SECONDS", "MM_INVITE_EXPIRY_SECONDS", "MM_COOKIE_SECURE", } { t.Setenv(k, "") } c, err := Load() if err != nil { t.Fatalf("Load with defaults failed: %v", err) } if c.Env != EnvDevelopment || c.Cloud != CloudLocal || c.Embeddings.Provider != ProviderFake { t.Fatalf("unexpected defaults: %+v", c) } if c.Embeddings.Dimension != 384 || c.HTTPAddr != ":8080" { t.Fatalf("unexpected scalar defaults: %+v", c) } }

Search equations, builds, manuscript text, and recovered sources.