Skip to content

docs: document errorlog footgun and logging util usage (#1286) - #1352

Merged
LucasSantana-Dev merged 5 commits into
mainfrom
docs/1286-errorlog-footgun
Jun 12, 2026
Merged

LucasSantana-Dev merged 5 commits into
mainfrom
docs/1286-errorlog-footgun

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Jun 12, 2026 •

Copy link
Copy Markdown
Owner

Item B6 of #1286 (logging-hardening umbrella; does not close it).

  • new docs/logging.md: shared logging utils usage; the footgun — errorLog({ message }) without error routes to captureMessage instead of captureException, silently dropping the exception object and stack; correct/incorrect examples; ADR pointer
  • ADR 2026-06-01-logging-observability-hardening.md: tracking link to docs: umbrella tracking issue for logging-hardening Tracks A/B/C status #1286

Docs-only diff (2 .md files, +95).


Summary by cubic

Add docs for shared logging utils and clarify a key footgun: calling errorLog({ message }) without error triggers Sentry captureMessage at error level (not captureException), dropping the exception and stack. Includes correct/incorrect examples, when to use warnLog, structured context tips, and updates the logging ADR with a tracking link to #1286.

Written for commit 7023bf5. Summary will update on new commits.

Review in cubic

document correct usage of shared errorLog/warnLog/infoLog utils, the footgun
where errorlog() without an error object degrades to info-level message capture
in sentry (losing stack context), and add tracking link to #1286 in adr.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@LucasSantana-Dev, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 20 minutes and 41 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4edcdbdf-f1fc-4d2d-8f7c-d5b66e84b576

📥 Commits

Reviewing files that changed from the base of the PR and between 5de7b69 and 7023bf5.

📒 Files selected for processing (2)
  • decisions/2026-06-01-logging-observability-hardening.md
  • docs/logging.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/1286-errorlog-footgun

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@LucasSantana-Dev

Copy link
Copy Markdown
Owner Author

@cubic-dev-ai review

@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) June 12, 2026 19:51
@cubic-dev-ai

cubic-dev-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@LucasSantana-Dev I have started the AI code review. It will take a few minutes to complete.

@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@vercel

vercel Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lucky Ready Ready Preview, Comment Jun 12, 2026 8:26pm

Request Review

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found and verified against the latest diff

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread docs/logging.md

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@LucasSantana-Dev

Copy link
Copy Markdown
Owner Author

@cubic-dev-ai review — findings addressed

@cubic-dev-ai

cubic-dev-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown

@cubic-dev-ai review — findings addressed

@LucasSantana-Dev I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Auto-approved: Documentation-only changes for logging best practices and a tracking link; no logic, config, or production code modified.

Re-trigger cubic

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit f0c468b into main Jun 12, 2026
42 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the docs/1286-errorlog-footgun branch June 12, 2026 20:28
LucasSantana-Dev added a commit that referenced this pull request Jun 14, 2026
)

## What

First concrete delta for **#1286 Track B3** (silent-catch sweep on
external/IO call paths): `FeatureToggleService.getDbGlobalOverride` no
longer swallows DB errors to `null` without a trace.

```ts
} catch (error) {
    warnLog({
        message: 'Failed to read global feature toggle override; falling back to config default',
        error,
        data: { name },
    })
    return null
}
```

## Why

The previous `catch { return null }` made a **DB outage
indistinguishable from "no override set"** — the caller
(`getGlobalToggleStatus`) treats `null` as "fall back to the env/config
default", so a persistent database failure silently degraded every
global feature toggle to its config value with zero observability.

The fail-open-to-config behavior is **correct and intentionally
preserved** — this only adds a `warnLog` so the failure is visible.
`warn` (not `error`) because the path is gracefully handled.

## Scope note

This PR is the *only* genuine finding from a read-only sweep of the four
external-API families called out in #1286's next-increment (Spotify,
Last.fm, Discord, Prisma). The rest of those paths already log via
`errorLog` / `warnLog` / `logAndSwallow` / `logAndWarn` before any
swallow — the codebase's existing discipline (#1296/#1302/#1352/#1358)
already covers them. The broader "promote empty-catch lint warn→error"
item (~2026-06-26) and the Track C requestId issue remain as tracked in
#1286.

## Verification

- `tsc --noEmit` clean; shared build clean.
- Extended the existing `FeatureToggleService.spec.ts` "db throws" test
to assert the warning is emitted (`warnLog` called once with the error +
`{ name }`).
- Shared suite green: **829/829** (61 suites).

Refs #1286.

@cubic-dev-ai please review.


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Log database errors when reading global feature toggle overrides so
outages are visible while still falling back to config defaults.
Addresses #1286 (Track B3) by surfacing failures on an external/IO path.

- **Bug Fixes**
- `FeatureToggleService.getDbGlobalOverride` now calls `warnLog({
message, error, data: { name } })` on DB errors, then returns `null`.
- Extended unit test to assert the warning is emitted when the DB read
throws.

<sup>Written for commit 3ffc0b4.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/LucasSantana-Dev/Lucky/pull/1411?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->

This branch was successfully deployed

1 active deployment
Preview — 7023bf52 Deployed Jun 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant