Skip to content

Fix: Add missing stripe and resend error log sources#262

Merged
bd73-com merged 2 commits intomainfrom
claude/fix-github-issue-bu8gp
Mar 24, 2026
Merged

Fix: Add missing stripe and resend error log sources#262
bd73-com merged 2 commits intomainfrom
claude/fix-github-issue-bu8gp

Conversation

@bd73-com
Copy link
Owner

@bd73-com bd73-com commented Mar 23, 2026

Summary

  • Add "stripe" and "resend" to the source filter allowlist in both GET /api/admin/error-logs and POST /api/admin/error-logs/batch-delete endpoints
  • These sources were already written by ErrorLogger but could not be filtered in the admin panel

Test plan

  • npm run check passes
  • npm run test passes (1738 tests)
  • Verify filtering by source=stripe returns only stripe error logs
  • Verify filtering by source=resend returns only resend error logs
  • Verify batch-delete with source filter works for new sources

Closes #260

https://claude.ai/code/session_01FfZuTLfQMSdpJZD78q8NXM

Summary by CodeRabbit

  • New Features
    • Admin error-log filtering now accepts a broader set of sources (including scraper, email, scheduler, api, stripe, resend), giving Power-tier administrators improved visibility across more system components.
    • Source filter inputs are now validated against a centralized whitelist, reducing invalid filter results and making error-log searches more reliable.

The allowlist for the source parameter in GET /api/admin/error-logs and
POST /api/admin/error-logs/batch-delete only included ["scraper", "email",
"scheduler", "api"], but ErrorLogger writes logs with "stripe" and "resend"
sources too. This meant those logs could not be filtered by source.

Closes #260

https://claude.ai/code/session_01FfZuTLfQMSdpJZD78q8NXM
@github-actions github-actions bot added the fix label Mar 23, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 28349cb6-38ce-45b9-8b44-5db3885345f1

📥 Commits

Reviewing files that changed from the base of the PR and between 34c4c31 and 5d05dec.

📒 Files selected for processing (2)
  • server/routes.ts
  • shared/routes.ts

📝 Walkthrough

Walkthrough

Replaced inline error-log source allowlists with a shared ERROR_LOG_SOURCES constant and added a corresponding Zod enum; updated admin error-log endpoints to validate source against this shared whitelist.

Changes

Cohort / File(s) Summary
Shared routes / schemas
shared/routes.ts
Added exported ERROR_LOG_SOURCES (readonly literal array) and errorLogSourceSchema (Zod enum) to centralize allowed error-log source values.
Server admin endpoints
server/routes.ts
Replaced inline source allowlist with import of ERROR_LOG_SOURCES; updated GET /api/admin/error-logs and POST /api/admin/error-logs/batch-delete to validate source against the shared constant.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding 'stripe' and 'resend' to the error log source filter allowlist in admin endpoints.
Linked Issues check ✅ Passed The code changes directly address issue #260 by extending the source allowlist from ['scraper', 'email', 'scheduler', 'api'] to include 'stripe' and 'resend' in both affected endpoints.
Out of Scope Changes check ✅ Passed All changes are scoped to the stated objective: only the source allowlist values in error-log endpoints were modified; no unrelated alterations were introduced.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-github-issue-bu8gp

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.

coderabbitai[bot]
coderabbitai bot previously requested changes Mar 23, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@server/routes.ts`:
- Around line 1435-1436: Create a shared constant and schema (e.g., export const
ERROR_LOG_SOURCES = ["scraper","email","scheduler","api","stripe","resend"] as
const; export const errorLogSourceSchema = z.enum(ERROR_LOG_SOURCES)) in the
shared module and import them via the `@shared/` alias; then replace every
hardcoded allowlist literal (the array used in the condition that checks
errorLogs.source and any other handlers that repeat the same array) with a
reference to ERROR_LOG_SOURCES for filtering and use errorLogSourceSchema to
validate/parse incoming source values before pushing conditions (i.e., replace
the inline ["scraper",...].includes(source) and similar checks with a
centralized import and validation).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 011a92ed-2376-49ef-ac74-dcb29a993842

📥 Commits

Reviewing files that changed from the base of the PR and between baddb93 and 34c4c31.

📒 Files selected for processing (1)
  • server/routes.ts

server/routes.ts Outdated
Comment on lines 1435 to 1436
if (source && ["scraper", "email", "scheduler", "api", "stripe", "resend"].includes(source)) {
conditions.push(eq(errorLogs.source, source));
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Centralize error-log source allowlist to prevent repeat regressions

The fix works, but the same source allowlist is still hardcoded in multiple handlers. That duplication caused this exact bug and will drift again. Move allowed sources to a shared constant/schema (e.g., in shared/routes.ts) and reuse it in both filters.

Proposed refactor
-      if (source && ["scraper", "email", "scheduler", "api", "stripe", "resend"].includes(source)) {
+      if (source && ERROR_LOG_SOURCES.includes(source as any)) {
         conditions.push(eq(errorLogs.source, source));
       }
...
-        if (filters.source && ["scraper", "email", "scheduler", "api", "stripe", "resend"].includes(filters.source)) {
+        if (filters.source && ERROR_LOG_SOURCES.includes(filters.source as any)) {
           conditions.push(eq(errorLogs.source, filters.source));
         }
// shared/routes.ts (or shared/constants/errorLogs.ts)
export const ERROR_LOG_SOURCES = [
  "scraper",
  "email",
  "scheduler",
  "api",
  "stripe",
  "resend",
] as const;
export const errorLogSourceSchema = z.enum(ERROR_LOG_SOURCES);

As per coding guidelines: “All types, schemas, and constants shared between client and server must live in the shared/ directory and be imported using the @shared/ path alias. Never duplicate shared types in client or server code.”

Also applies to: 1556-1557

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/routes.ts` around lines 1435 - 1436, Create a shared constant and
schema (e.g., export const ERROR_LOG_SOURCES =
["scraper","email","scheduler","api","stripe","resend"] as const; export const
errorLogSourceSchema = z.enum(ERROR_LOG_SOURCES)) in the shared module and
import them via the `@shared/` alias; then replace every hardcoded allowlist
literal (the array used in the condition that checks errorLogs.source and any
other handlers that repeat the same array) with a reference to ERROR_LOG_SOURCES
for filtering and use errorLogSourceSchema to validate/parse incoming source
values before pushing conditions (i.e., replace the inline
["scraper",...].includes(source) and similar checks with a centralized import
and validation).

Move the hardcoded source filter array to a shared ERROR_LOG_SOURCES
constant and import it in both admin error log endpoints. This prevents
the allowlist from drifting when new sources are added.

Addresses CodeRabbit review feedback on PR #262.

https://claude.ai/code/session_01FfZuTLfQMSdpJZD78q8NXM
@bd73-com bd73-com dismissed coderabbitai[bot]’s stale review March 24, 2026 06:29

Dismissing stale bot review — fixes were pushed in subsequent commits.

@bd73-com bd73-com merged commit d705888 into main Mar 24, 2026
1 check passed
@bd73-com bd73-com deleted the claude/fix-github-issue-bu8gp branch March 24, 2026 06:29
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.

Bug: Admin error log source filter missing "stripe" and "resend" sources

2 participants