Skip to content

fix(admin): review follow-up — users.id string, ETL response schemas, retry guards#2410

Merged
andrew-bierman merged 1 commit into
mainfrom
fix/etl-review-fixes-follow-up
May 12, 2026
Merged

fix(admin): review follow-up — users.id string, ETL response schemas, retry guards#2410
andrew-bierman merged 1 commit into
mainfrom
fix/etl-review-fixes-follow-up

Conversation

@andrew-bierman
Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #2409 — this commit missed the merge window.

  • users.id type fix: AdminUserItemSchema.id was t.Number() but users.id is a text PK — changed to t.String(). Updates deleteUser/hardDeleteUser/restoreUser signatures from number to string.
  • ETL response schemas: all 4 new ETL routes now have TypeBox response: schemas — Eden Treaty consumers were getting unknown payloads without them.
  • EtlFailureSummary/EtlJobFailures derived via Static<> (dropped hand-written duplicates).
  • Parallel DB queries: failure-summary and job-failures endpoints now use Promise.all.
  • Retry guards: retry now rejects non-failed jobs (was accepting completed, risking re-ingest). Enqueue failure marks orphaned running row as failed.
  • UUID validation on jobId params in failures and retry endpoints.

Post-Deploy Monitoring & Validation

No additional operational monitoring required — type-only and query-guard changes with no new runtime paths.


🤖 Generated with Claude Code

- Fix users.id schema: t.Number() → t.String() (users.id is text PK, not serial)
- Update deleteUser/hardDeleteUser/restoreUser signatures: id: number → id: string
- Add TypeBox response schemas to all 4 new ETL routes (failure-summary, job-failures,
  reset-stuck, retry) — Eden Treaty consumers were getting unknown payloads
- Derive EtlFailureSummary/EtlJobFailures types via Static<> instead of hand-written interfaces
- Parallelize independent DB queries in failure-summary and job-failures via Promise.all
- Restrict retry to failed jobs only (was accepting completed, risking duplicate ingest)
- Clean up orphaned running row on enqueue failure (mark new job failed in catch)
- Validate jobId as UUID on failures and retry endpoints
Copilot AI review requested due to automatic review settings May 12, 2026 17:41
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

Warning

Rate limit exceeded

@andrew-bierman has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 7 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 233a5818-298a-4f89-abd2-db02432d44db

📥 Commits

Reviewing files that changed from the base of the PR and between 979201e and 868aa4c.

📒 Files selected for processing (3)
  • apps/admin/lib/api.ts
  • packages/api/src/routes/admin/analytics/catalog.ts
  • packages/api/src/schemas/admin.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/etl-review-fixes-follow-up

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 github-actions Bot added the api label May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Coverage Report for Expo Unit Tests Coverage (./apps/expo)

Status Category Percentage Covered / Total
🔵 Lines 82.61% 480 / 581
🔵 Statements 82.61% (🎯 75%) 480 / 581
🔵 Functions 92.59% 50 / 54
🔵 Branches 90.9% 170 / 187
File CoverageNo changed files found.
Generated in workflow #1156 for commit 868aa4c by the Vitest Coverage Report Action

@github-actions
Copy link
Copy Markdown
Contributor

Coverage Report for API Unit Tests Coverage (./packages/api)

Status Category Percentage Covered / Total
🔵 Lines 76.17% 502 / 659
🔵 Statements 76.17% (🎯 65%) 502 / 659
🔵 Functions 95% 38 / 40
🔵 Branches 88.67% 227 / 256
File CoverageNo changed files found.
Generated in workflow #1156 for commit 868aa4c by the Vitest Coverage Report Action

@cloudflare-workers-and-pages
Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
packrat-admin 868aa4c Commit Preview URL

Branch Preview URL
May 12 2026, 05:42 PM

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR is a follow-up to the earlier admin/ETL work, aligning admin user ID typing with the actual DB schema, tightening ETL admin retry semantics, and ensuring the new ETL admin endpoints have explicit TypeBox response schemas so Eden Treaty clients get strongly typed payloads.

Changes:

  • Fix admin user id schema/type from numberstring to match users.id (text PK) and update related admin client method signatures.
  • Add missing TypeBox response schemas for the ETL admin endpoints (failure summary, per-job failures, reset-stuck, retry).
  • Improve ETL admin endpoint behavior: parallelize independent DB queries, validate jobId as UUID, and prevent retrying non-failed jobs (plus mark the cloned job as failed if enqueue fails).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/api/src/schemas/admin.ts Updates AdminUserItemSchema.id to t.String() and introduces ETL admin response schemas (failure summary, job failures, reset-stuck, retry).
packages/api/src/routes/admin/analytics/catalog.ts Wires new ETL response schemas into route response: definitions, adds UUID param validation, parallelizes queries, and strengthens retry/enqueue guards.
apps/admin/lib/api.ts Switches user mutation helpers to accept string IDs and derives ETL response types from the shared schemas via Static<>.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andrew-bierman andrew-bierman merged commit 59e93ae into main May 12, 2026
15 checks passed
@andrew-bierman andrew-bierman deleted the fix/etl-review-fixes-follow-up branch May 12, 2026 17:50
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.

2 participants