Skip to content

chore(eslint): warn on empty catch blocks (#1286 track b3) - #1358

Merged
LucasSantana-Dev merged 4 commits into
mainfrom
chore/1286-emptycatch-lint
Jun 12, 2026
Merged

LucasSantana-Dev merged 4 commits into
mainfrom
chore/1286-emptycatch-lint

Conversation

@LucasSantana-Dev

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

Copy link
Copy Markdown
Owner

Item 1 of #1286 (Track B3 soft-launch; does not close the umbrella).

Adds "no-empty": ["warn", { allowEmptyCatch: false }] to the shared rules block — one line, no config restructuring. Warnings don't fail CI.

Scope notes:

  • Active immediately for packages/backend (the one package whose lint runs the shared config against TS sources). Current inventory there: 0 empty catches.
  • packages/frontend deliberately untouched: it has its own config with no-empty: off and a --max-warnings 0 gate, so any warning would break its CI — documented exclusion.
  • packages/bot and packages/shared turn out to be entirely unlinted today (no lint scripts; root glob misses them) — filed as its own issue with evidence; the rule will cover them when that lands. Known bot inventory once linted: 1 (version.ts:20).
  • Promote warn → error after ~2 weeks per the ADR.

Summary by cubic

Warn on empty catch blocks to prevent swallowed errors, as part of Linear 1286 (Track B3 soft-launch). Adds ESLint no-empty as a warning with { allowEmptyCatch: false }; warnings don't fail CI.

  • Refactors
    • Configured in shared eslint.config.js.
    • Scope: active for packages/backend; packages/frontend excluded; packages/bot and packages/shared still unlinted.
    • Removed stray test-config.js scratch file.

Written for commit d2a53b8. Summary will update on new commits.

Review in cubic

@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 9:09pm

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.

@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 35 minutes and 3 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: 26c49ba7-32f2-466e-964c-1962c0e1bd08

📥 Commits

Reviewing files that changed from the base of the PR and between ccfd1fc and d2a53b8.

📒 Files selected for processing (1)
  • eslint.config.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/1286-emptycatch-lint

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.

@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@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

@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) June 12, 2026 20:52
@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.

@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 across 2 files

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

Re-trigger cubic

Comment thread test-config.js Outdated
@LucasSantana-Dev

Copy link
Copy Markdown
Owner Author

Fixed — test-config.js was a leftover scratch file from validating the rule, removed. The PR is now the intended one-line eslint.config.js change.

@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.

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 3f7f438 into main Jun 12, 2026
39 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the chore/1286-emptycatch-lint branch June 12, 2026 21:13

@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 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 — d2a53b84 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