Skip to content

Conversation

hariombalhara
Copy link
Member

@hariombalhara hariombalhara commented Aug 12, 2025

feat: remove unused report.handler.ts and jsonLogicToPrisma functionality

Fixes PRI-303

Summary

This PR removes unused reporting functionality from the routing-forms package as requested in the continuation of PR #22990. The changes include:

  • Removed report.handler.ts (182 lines) - unused tRPC handler for form reporting
  • Removed jsonLogicToPrisma.ts (277 lines) - unused utility for converting JSON Logic queries to Prisma where clauses
  • Removed jsonLogicToPrisma.test.ts - comprehensive test suite for the removed utility
  • Removed buildResponsesForReporting.test.ts - test file that depended on report.handler
  • Removed report.schema.ts - Zod schema definitions for report input
  • Updated _router.ts - removed the unused report tRPC endpoint and related imports
  • Updated getQueryBuilderConfig.ts - cleaned up comment that referenced the removed function

Review & Testing Checklist for Human

  • Verify routing forms UI functionality - Test that routing forms still work correctly and no report-related UI elements are broken
  • Search for remaining references - Double-check that no other files reference the removed code (especially frontend components)
  • Test application build and startup - Ensure the app builds and runs without TypeScript or runtime errors
  • Check for database cleanup needs - Verify if any database tables/columns related to reporting should also be removed

Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    Router["packages/app-store/routing-forms<br/>trpc/_router.ts"]:::major-edit
    ReportHandler["packages/app-store/routing-forms<br/>trpc/report.handler.ts"]:::removed
    JsonLogic["packages/app-store/routing-forms<br/>jsonLogicToPrisma.ts"]:::removed
    JsonLogicTests["packages/app-store/routing-forms<br/>__tests__/jsonLogicToPrisma.test.ts"]:::removed
    ReportTests["packages/app-store/routing-forms<br/>trpc/buildResponsesForReporting.test.ts"]:::removed
    ReportSchema["packages/app-store/routing-forms<br/>trpc/report.schema.ts"]:::removed
    QueryConfig["packages/app-store/routing-forms<br/>lib/getQueryBuilderConfig.ts"]:::minor-edit
    
    Router -->|"imported report handler"| ReportHandler
    Router -->|"imported ZReportInputSchema"| ReportSchema
    ReportHandler -->|"imported jsonLogicToPrisma"| JsonLogic
    ReportTests -->|"tested buildResponsesForReporting"| ReportHandler
    JsonLogicTests -->|"tested jsonLogicToPrisma"| JsonLogic
    QueryConfig -->|"referenced in comment"| JsonLogic
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit
        L3[Removed File]:::removed
    end

classDef major-edit fill:#90EE90
classDef minor-edit fill:#87CEEB  
classDef removed fill:#FFB6C1
Loading

Notes

  • Type checking passed successfully with yarn type-check:ci --force
  • Lint errors encountered appear to be pre-existing environment issues unrelated to these changes
  • All removed code was self-contained with no external dependencies beyond the cleaned up references
  • This cleanup was requested by @hariombalhara as a continuation of PR fix: Remove Reporting page within Routing Forms #22990

Link to Devin run: https://app.devin.ai/sessions/abad8df0a97f484f9fee98ab9d87b1fa
Requested by: @hariombalhara

devin-ai-integration bot and others added 2 commits August 12, 2025 08:34
…lity

- Remove unused packages/app-store/routing-forms/trpc/report.handler.ts
- Remove packages/app-store/routing-forms/jsonLogicToPrisma.ts implementation
- Remove packages/app-store/routing-forms/__tests__/jsonLogicToPrisma.test.ts test file

These files were no longer being used in the routing-forms package.

Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
- Remove unused report.schema.ts file
- Remove buildResponsesForReporting test file
- Remove report endpoint from router
- Update comment referencing jsonLogicToPrisma

All references to the removed jsonLogicToPrisma and report handler functionality have been cleaned up.

Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

Walkthrough

This PR removes the Routing Forms reporting backend. It deletes the jsonLogicToPrisma translator and its tests, the TRPC report handler, its schema, and related tests. The TRPC router’s report endpoint is removed. A comment in getQueryBuilderConfigForFormFields is simplified without behavior changes. Public API removals include: jsonLogicToPrisma and JsonLogicQuery, reportHandler (default and named) and buildResponsesForReporting, ZReportInputSchema and TReportInputSchema, and the appRoutingForms.report route.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/remove-unused-report-handler-1754987582

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Aug 12, 2025
Copy link

vercel bot commented Aug 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal ⬜️ Ignored Aug 12, 2025 8:56am
cal-eu ⬜️ Ignored Aug 12, 2025 8:56am

@hariombalhara hariombalhara marked this pull request as ready for review August 12, 2025 08:56
@graphite-app graphite-app bot requested a review from a team August 12, 2025 08:57
@hariombalhara hariombalhara changed the title feat: remove unused report.handler.ts and jsonLogicToPrisma functionality chore: Routing Forms - remove unused report.handler.ts and jsonLogicToPrisma functionality Aug 12, 2025
@hariombalhara hariombalhara requested a review from emrysal August 12, 2025 08:57
@dosubot dosubot bot added the routing-forms area: routing forms, routing, forms label Aug 12, 2025
Copy link

graphite-app bot commented Aug 12, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (08/12/25)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link
Contributor

@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: 0

♻️ Duplicate comments (1)
packages/app-store/routing-forms/lib/getQueryBuilderConfig.ts (1)

87-90: LGTM: Comment simplification matches prior suggestion

The simplified comment aligns with the earlier suggestion and the runtime behavior remains unchanged.

🧹 Nitpick comments (1)
packages/app-store/routing-forms/lib/getQueryBuilderConfig.ts (1)

87-90: Retain brief rationale to avoid future reintroduction of unsupported operators

The new comment loses the original rationale. A short reason helps future maintainers understand why these are disabled and prevents accidental reintroduction.

Apply this diff to clarify intent:

-    // These operators can be implemented later if needed.
+    // "between" and "not_between" are disabled for reporting because our Prisma JSON query path
+    // can't translate them reliably today. Revisit if/when a safe translation layer is added.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01a0d43 and 03d756a.

📒 Files selected for processing (7)
  • packages/app-store/routing-forms/__tests__/jsonLogicToPrisma.test.ts (0 hunks)
  • packages/app-store/routing-forms/jsonLogicToPrisma.ts (0 hunks)
  • packages/app-store/routing-forms/lib/getQueryBuilderConfig.ts (1 hunks)
  • packages/app-store/routing-forms/trpc/_router.ts (0 hunks)
  • packages/app-store/routing-forms/trpc/buildResponsesForReporting.test.ts (0 hunks)
  • packages/app-store/routing-forms/trpc/report.handler.ts (0 hunks)
  • packages/app-store/routing-forms/trpc/report.schema.ts (0 hunks)
💤 Files with no reviewable changes (6)
  • packages/app-store/routing-forms/trpc/report.schema.ts
  • packages/app-store/routing-forms/trpc/buildResponsesForReporting.test.ts
  • packages/app-store/routing-forms/trpc/_router.ts
  • packages/app-store/routing-forms/jsonLogicToPrisma.ts
  • packages/app-store/routing-forms/tests/jsonLogicToPrisma.test.ts
  • packages/app-store/routing-forms/trpc/report.handler.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/app-store/routing-forms/lib/getQueryBuilderConfig.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/app-store/routing-forms/lib/getQueryBuilderConfig.ts

Copy link

linear bot commented Aug 12, 2025

PRI-303

Copy link
Contributor

github-actions bot commented Aug 12, 2025

E2E results are ready!

Copy link
Contributor

@anikdhabal anikdhabal left a comment

Choose a reason for hiding this comment

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

LGTM

@hariombalhara hariombalhara merged commit dfc5d91 into main Aug 20, 2025
133 of 140 checks passed
@hariombalhara hariombalhara deleted the devin/remove-unused-report-handler-1754987582 branch August 20, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ready-for-e2e routing-forms area: routing forms, routing, forms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants