Spotted via the Datadog error-polling cron: thermos-logs had 200 level:error entries in the last 6 hours, all generated by the same wrapper around the LaunchDarkly SDK:
| Count | Flag key | Caller |
|---|---|---|
| 100 | timerShardCooldownSeconds | utils/launchdarkly.go:573 |
| 100 | timerShardControllerPollIntervalSeconds | utils/launchdarkly.go:640 |
Both message + error: failed to get LaunchDarkly flag value / unknown feature key: <X>. Verify that this feature key exists. Returning default value.
These flags aren't configured in the staging LD project (and may be intentionally unset in some envs). The SDK already returns the documented default — our code branches on err != nil, logs at Error, and then returns the default anyway. The behavior is correct; only the log severity is wrong, and it's noisy enough to drown out real errors.
This PR adds a small logFlagError helper that downgrades the specific "unknown feature key" SDK error to Warn (since the fallback path is the documented behavior) and keeps everything else at Error. All 32 existing call sites in utils/launchdarkly.go are routed through it — no behavioral change to flag evaluation or defaults.
cd apps/thermos && go build ./... — cleancd apps/thermos && go vet ./utils/... — cleancd apps/thermos && go test ./utils/... — ok (0.256s)go test -v -run 'TestLogFlagError' ./utils/ — 3 new tests pass:
TestLogFlagError_UnknownFeatureKeyLogsWarn — unknown-flag-key error logs at WarnTestLogFlagError_OtherErrorLogsError — other errors stay at ErrorTestLogFlagError_PassesExtraFields — caller-provided fields and error are present in log contextpnpm lint skipped: golangci-lint binary pinned to Go 1.23, repo is Go 1.26.2 (pre-existing sandbox limitation, not introduced here).No runtime path change to test against a live thermos server — only log severity for an SDK-error fallback that already worked.
Origin: cron-dd-errors / zen-cron-8b2004608d62
Triggered by: cron | Source: cron-dd-errors Session: https://zen-api-production-4c98.up.railway.app/dashboard/#/chat/zen-cron-8b2004608d62
Based on git blame analysis of 2 file(s):
| Contributor | Contribution | Files |
|---|---|---|
| lingalarahul7 | 35% | 1 |
| Sarthak Agrawal |
| 34% |
| 1 |
| Zen | 20% | 2 |
| anshugarg15 | 6% | 1 |
| abir-taheer | 2% | 1 |
Based on git history, lingalarahul7 or Sarthak Agrawal would be good reviewer(s) for this PR.
🤖 Based on git blame with recency weighting (recent edits count more).
:x: Patch coverage is 15.78947% with 32 lines in your changes missing coverage. Please review.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| apps/thermos/utils/launchdarkly.go | 15.78% | 32 Missing :warning: |
| Flag | Coverage Δ | |
|---|---|---|
| e2e-tests | ? | |
| self-hosted-tests | 5.63% <ø> (ø) | |
| thermos-service-isolation-tests | 65.62% <ø> (?) | |
| thermos-unit-tests | 7.26% <15.78%> (?) | |
| unit-tests | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| apps/thermos/utils/launchdarkly.go | 3.90% <15.78%> (ø) |
... and 1088 files with indirect coverage changes