Skip to content

feat: migrate to TanStack Query v5, add rate-limit cleanup cron, and overhaul DOX docs - #17

Merged
VaibhavDaveDev merged 1 commit into
mainfrom
feat/tanstack-query-and-rate-limiting
Sep 21, 2026
Merged

VaibhavDaveDev merged 1 commit into
mainfrom
feat/tanstack-query-and-rate-limiting

Conversation

@VaibhavDaveDev

Copy link
Copy Markdown
Owner
  • Migrate client-side server-data fetching to TanStack Query v5:
    • Add query-client factory, QueryProvider, and centralized queryKeys
    • Replace manual useEffect + useState and custom caches across dashboard, property, billing, and notification islands
    • Wrap island roots in QueryProvider via withErrorBoundary
    • Remove obsolete dashboard-cache.ts and use-async-resource.ts
  • Enhance rate limiting and storage hygiene:
    • Add on-write expired key pruning to in-memory email rate limiter
    • Add GET /api/cron/cleanup-stale-rate-limits route to purge stale D1 rate-limit rows (OTP, password changes, daily counters)
    • Add comprehensive test suites for cron cleanup and email rate-limit pruning
  • Harden Cloudflare Turnstile bot protection:
    • Switch verify endpoint payload to URL-encoded form data
    • Add request timeout, token length guard, and hostname allowlist validation
    • Implement proper widget ID tracking and lifecycle reset in useTurnstile
  • Upgrade DOX documentation hierarchy:
    • Replace stubs with operational contracts across AGENTS.md, src/AGENTS.md, src/api/AGENTS.md, and routes/lib child docs
  • Add Prettier formatting tooling:
    • Add .prettierignore and npm scripts (pnpm format, pnpm format:check)
    • Format codebase to project Prettier standard

…overhaul DOX docs

- Migrate client-side server-data fetching to TanStack Query v5:
  - Add query-client factory, QueryProvider, and centralized queryKeys
  - Replace manual useEffect + useState and custom caches across dashboard, property, billing, and notification islands
  - Wrap island roots in QueryProvider via withErrorBoundary
  - Remove obsolete dashboard-cache.ts and use-async-resource.ts
- Enhance rate limiting and storage hygiene:
  - Add on-write expired key pruning to in-memory email rate limiter
  - Add GET /api/cron/cleanup-stale-rate-limits route to purge stale D1 rate-limit rows (OTP, password changes, daily counters)
  - Add comprehensive test suites for cron cleanup and email rate-limit pruning
- Harden Cloudflare Turnstile bot protection:
  - Switch verify endpoint payload to URL-encoded form data
  - Add request timeout, token length guard, and hostname allowlist validation
  - Implement proper widget ID tracking and lifecycle reset in useTurnstile
- Upgrade DOX documentation hierarchy:
  - Replace stubs with operational contracts across AGENTS.md, src/AGENTS.md, src/api/AGENTS.md, and routes/lib child docs
- Add Prettier formatting tooling:
  - Add .prettierignore and npm scripts (pnpm format, pnpm format:check)
  - Format codebase to project Prettier standard
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 140 files, which is 40 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 902e7c9c-02d9-4722-abb5-b67f2ecca26a

📥 Commits

Reviewing files that changed from the base of the PR and between 1e53502 and 67b8e15.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (140)
  • .prettierignore
  • AGENTS.md
  • DEPLOY.md
  • DESIGN.md
  • PRODUCT.md
  • docker-compose.observability.yml
  • drizzle.config.ts
  • observability/grafana-datasources.yaml
  • observability/prometheus.yml
  • package.json
  • public/site.webmanifest
  • scripts/fix-wrangler.mjs
  • src/AGENTS.md
  • src/api/AGENTS.md
  • src/api/app.ts
  • src/api/lib/AGENTS.md
  • src/api/lib/MAILER.md
  • src/api/lib/bill-generation.ts
  • src/api/lib/billing-engine.test.ts
  • src/api/lib/email-templates.test.ts
  • src/api/lib/email.test.ts
  • src/api/lib/email.ts
  • src/api/lib/logger.ts
  • src/api/lib/notifications.ts
  • src/api/lib/openapi-schemas.test.ts
  • src/api/lib/otel-config.ts
  • src/api/lib/otp-limiter.test.ts
  • src/api/lib/otp-limiter.ts
  • src/api/lib/password-change-limiter.ts
  • src/api/lib/property-auth.ts
  • src/api/lib/session-limit.test.ts
  • src/api/lib/solo-mode.ts
  • src/api/middleware/AGENTS.md
  • src/api/middleware/turnstile.ts
  • src/api/routes/AGENTS.md
  • src/api/routes/billing-periods.ts
  • src/api/routes/change-password.test.ts
  • src/api/routes/cron.test.ts
  • src/api/routes/cron.ts
  • src/api/routes/custom-charges.ts
  • src/api/routes/dashboard.ts
  • src/api/routes/export.test.ts
  • src/api/routes/invites.ts
  • src/api/routes/new-features-cycle.test.ts
  • src/api/routes/otp-integration.test.ts
  • src/api/routes/properties.test.ts
  • src/api/routes/rates.ts
  • src/api/routes/tenancies.test.ts
  • src/components/AGENTS.md
  • src/components/auth/AGENTS.md
  • src/components/auth/AuthInputs.tsx
  • src/components/auth/ForgotPasswordForm.tsx
  • src/components/auth/InviteAcceptForm.tsx
  • src/components/auth/LoginForm.tsx
  • src/components/auth/SignupForm.tsx
  • src/components/auth/VerifyEmailForm.tsx
  • src/components/common/AGENTS.md
  • src/components/common/ConfirmDialog.tsx
  • src/components/common/LoadingStates.tsx
  • src/components/common/NotificationBell.tsx
  • src/components/common/NotificationHelpers.test.tsx
  • src/components/common/QueryProvider.tsx
  • src/components/common/TableActionDialog.tsx
  • src/components/common/withErrorBoundary.tsx
  • src/components/dashboard/AGENTS.md
  • src/components/dashboard/NotificationsPage.tsx
  • src/components/dashboard/Overview.tsx
  • src/components/dashboard/OwnerDashboard.tsx
  • src/components/dashboard/TenantDashboard.tsx
  • src/components/export/ExportPage.tsx
  • src/components/meter/AGENTS.md
  • src/components/meter/CreatePeriodForm.tsx
  • src/components/meter/LiveCalculationPreview.tsx
  • src/components/meter/OcrConflictDialog.tsx
  • src/components/meter/SubmitConfirmDialog.tsx
  • src/components/onboarding/OnboardingWizard.tsx
  • src/components/properties/AGENTS.md
  • src/components/properties/EditRequestsPage.tsx
  • src/components/properties/PropertyChargesTable.tsx
  • src/components/properties/PropertyList.tsx
  • src/components/properties/RequestsManager.tsx
  • src/components/settings/AGENTS.md
  • src/components/settings/DiceBearPicker.tsx
  • src/components/tenancies/TenancyGraphsSection.tsx
  • src/components/ui/AGENTS.md
  • src/components/ui/badge.tsx
  • src/components/ui/button.test.tsx
  • src/components/ui/button.tsx
  • src/components/ui/checkbox.test.tsx
  • src/components/ui/data-table.tsx
  • src/components/ui/dialog.tsx
  • src/components/ui/input.tsx
  • src/components/ui/label.tsx
  • src/components/ui/switch.tsx
  • src/components/ui/timeline.tsx
  • src/components/ui/toast.tsx
  • src/components/ui/toaster.tsx
  • src/components/ui/tooltip.tsx
  • src/db/index.ts
  • src/db/migrations/meta/0000_snapshot.json
  • src/db/queries/AGENTS.md
  • src/db/schema/auth.ts
  • src/db/schema/bill-photos.ts
  • src/db/schema/meter-readings.ts
  • src/db/schema/notifications.ts
  • src/hooks/AGENTS.md
  • src/hooks/use-async-resource.ts
  • src/hooks/use-bill-detail.ts
  • src/hooks/use-dashboard-data.ts
  • src/hooks/use-forgot-password.ts
  • src/hooks/use-ocr-data.ts
  • src/hooks/use-property-data.test.ts
  • src/hooks/use-property-data.ts
  • src/hooks/use-property-settings.ts
  • src/hooks/use-reading-submit.ts
  • src/hooks/use-reading-validation.ts
  • src/hooks/use-toast.ts
  • src/hooks/use-turnstile.ts
  • src/layouts/AGENTS.md
  • src/lib/AGENTS.md
  • src/lib/cache.ts
  • src/lib/dashboard-cache.ts
  • src/lib/image-cache.ts
  • src/lib/image-compress.ts
  • src/lib/ocr-extraction.test.ts
  • src/lib/ocr-extraction.ts
  • src/lib/ocr-worker.ts
  • src/lib/pdf-extract.test.ts
  • src/lib/progress-state.ts
  • src/lib/query-client.ts
  • src/lib/query-keys.ts
  • src/lib/utils.test.ts
  • src/lib/utils.ts
  • src/lib/validate-reading.test.ts
  • src/lib/validate-reading.ts
  • src/pages/forgot-password.astro
  • src/types/AGENTS.md
  • src/types/db.ts
  • src/utils/AGENTS.md
  • wrangler.jsonc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

@VaibhavDaveDev
VaibhavDaveDev merged commit 0888c03 into main Sep 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant