Skip to content

Conversation

@IAmUKJ
Copy link

@IAmUKJ IAmUKJ commented Jan 11, 2026

What does this PR do?

  • Adds strict validation for API route strings
  • Ensures routes follow the "METHOD PATH" format
  • Validates HTTP method and route path
  • Throws clear, descriptive errors for malformed routes

Why?

This change prevents silent failures caused by malformed route strings and improves debuggability.

Testing

  • Verified that invalid HTTP methods are caught at compile time via TypeScript
  • Confirmed malformed but type-safe routes (missing path, incorrect format, invalid path) throw descriptive runtime errors
  • Verified valid routes continue to work as expected

Related Issue

Closes #15028

Summary by CodeRabbit

  • Bug Fixes
    • Strengthened API route validation: inputs are normalized, HTTP methods are strictly validated, paths must be non-empty and begin with “/”, and error messages for invalid formats, unsupported methods, and empty/invalid paths are clearer to aid troubleshooting.

✏️ Tip: You can customize this high-level summary in your review settings.

@IAmUKJ IAmUKJ requested review from a team January 11, 2026 08:49
@netlify
Copy link

netlify bot commented Jan 11, 2026

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 99d2df9
🔍 Latest deploy log https://app.netlify.com/projects/care-ohc/deploys/69637896e0e8ca0008d7552b
😎 Deploy Preview https://deploy-preview-15097.preview.ohc.network
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link

⚠️ Merge Checklist Incomplete

Thank you for your contribution! To help us review your PR efficiently, please complete the merge checklist in your PR description.

Your PR will be reviewed once you have marked the appropriate checklist items.

To update the checklist:

  • Change - [ ] to - [x] for completed items
  • Only check items that are relevant to your PR
  • Leave items unchecked if they don't apply

The checklist helps ensure code quality, testing coverage, and documentation are properly addressed.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 11, 2026

Walkthrough

API route parsing in src/Utils/request/utils.ts now enforces strict validation: the route must trim and split into exactly two parts (METHOD and PATH), the method must be a valid HttpMethod, the path must be non-empty and begin with a single /, and descriptive errors are thrown for invalid inputs.

Changes

Cohort / File(s) Summary
API route validation enhancement
src/Utils/request/utils.ts
Trim and split route on whitespace; require exactly two parts (METHOD and PATH); validate METHOD against internal VALID_HTTP_METHODS/HttpMethod; ensure PATH is non-empty and starts with a single / (reject leading //); add specific error messages; return shape preserved.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: adding validation for API route format, which aligns with the primary objective of PR #15028.
Description check ✅ Passed The description covers the core changes and rationale, but omits most of the merge checklist items required by the repository template.
Linked Issues check ✅ Passed The code changes successfully implement all four objectives from issue #15028: validates route splits into two parts, ensures valid HttpMethod, verifies non-empty path, and throws specific error messages.
Out of Scope Changes check ✅ Passed All changes are directly related to the API route validation requirements in issue #15028 with no extraneous modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff6abd0 and 99d2df9.

📒 Files selected for processing (1)
  • src/Utils/request/utils.ts
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing

**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Use interface for defining object types in TypeScript
Avoid explicit any type in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks

**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid using any type; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management

**/*.{ts,tsx}: Use TanStack Query with the query and mutate utilities from @/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
Use useQuery hook with queryKey and queryFn parameters, where queryFn wraps the API route with the query() utility
Use useMutation hook with mutationFn parameter wrapping API routes with the mutate() utility, and implement onSuccess callbacks to invalidate related queries
Support path parameters in TanStack Query using the pathParams option in query/mutate utilities
Support query parameters in TanStack Query using the queryParams option in query/mutate utilities
Use the silent: true option to suppress global error notifications when custom error handling is needed

**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Use interface for defining object types
Avoid explicit any types and maint...

Files:

  • src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements

**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names

**/*.{ts,tsx,js,jsx}: Use path aliases @/* for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names

Files:

  • src/Utils/request/utils.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps

Files:

  • src/Utils/request/utils.ts
src/**/*.{ts,tsx,css}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Prettier for consistent code formatting across the healthcare application

Files:

  • src/Utils/request/utils.ts
src/{Utils,types,providers}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Document medical data flows, validation requirements, and healthcare workflows with clinical reasoning in API and utility code comments

Files:

  • src/Utils/request/utils.ts
src/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces

Files:

  • src/Utils/request/utils.ts
src/Utils/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/instructions/utils.instructions.md)

src/Utils/**/*.{ts,tsx}: Keep utilities organized by functionality in src/Utils/ with descriptive file names that indicate the utility's purpose
Export functions with clear, self-documenting names and group related utilities in the same file
Always provide proper TypeScript types for parameters and return values in utility functions
Use generic types where appropriate for reusability in utility functions
Avoid any type; use unknown or proper type assertions in utility code
Export interfaces and types alongside utility functions in the same file
Prefer pure functions that don't have side effects; functions should be predictable and testable
Avoid modifying input parameters; return new objects/arrays using immutable data patterns
Implement proper error handling with try-catch blocks in utility functions
Return meaningful error messages or throw specific error types in utilities
Use TypeScript's strict null checks in utility code
Validate input parameters in utility functions when necessary
Use consistent patterns for API request handling in API utility functions
Implement proper error handling for network requests with appropriate HTTP status code handling
Include retry logic for transient failures in API utilities when appropriate
Use date-fns library for date manipulations in date and time utility functions
Handle timezone considerations properly in date and time utilities
Format dates consistently across the application using utility functions
Consider internationalization (i18n) for date formatting in utility functions
Use zod for schema validation in validation utility functions
Create reusable validation schemas in validation utilities
Provide clear validation error messages in validation utilities
Handle both synchronous and asynchronous validation in validation utilities
Create helpers for common string operations in string utility functions
Implement proper text sanitization and formatting in string utilities
Handle Unicode and internationalizatio...

Files:

  • src/Utils/request/utils.ts
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Use 2-space indentation

Files:

  • src/Utils/request/utils.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)

Use camelCase for utility file names (e.g., useAuth.ts)

Files:

  • src/Utils/request/utils.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)

**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
Use navigate and useRedirect from raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys from src/Locale/ for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support

Files:

  • src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx,json,css,scss,html}

📄 CodeRabbit inference engine (AGENTS.md)

Use 2-space indentation

Files:

  • src/Utils/request/utils.ts
🧠 Learnings (17)
📓 Common learnings
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Return meaningful error messages or throw specific error types in utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Support path parameters in TanStack Query using the `pathParams` option in query/mutate utilities
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Avoid unnecessary object creation in frequently called utility functions

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2024-11-14T08:07:32.427Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9080
File: src/Utils/permissions.ts:37-50
Timestamp: 2024-11-14T08:07:32.427Z
Learning: In the `showUserPasswordReset` function within `src/Utils/permissions.ts`, both `authUser` and `targetUser` are guaranteed to be provided. Therefore, null or undefined checks for these parameters are unnecessary.

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use enums for related constant values in utility modules

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to **/*.{ts,tsx} : Avoid enums; use maps instead

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper text sanitization and formatting in string utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2024-11-20T23:25:06.602Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9145
File: src/common/validation.tsx:41-41
Timestamp: 2024-11-20T23:25:06.602Z
Learning: When updating the name validation pattern in `src/common/validation.tsx`, avoid partial internationalization by not adding specific non-Latin Unicode ranges unless we're prepared to support all non-Latin scripts.

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-01-11T06:18:13.844Z
Learnt from: rithviknishad
Repo: ohcnetwork/care_fe PR: 9895
File: src/Utils/request/types.ts:11-13
Timestamp: 2025-01-11T06:18:13.844Z
Learning: In the CARE frontend codebase, type parameters in interfaces like `ApiRoute<TData, TBody>` use uppercase `T` prefix (e.g., `TBody`, `TData`) to indicate they are type parameters for type inference, not runtime properties. These are used by data fetching utilities to infer request body and response types.

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to api.tsx : APIs are defined in the api.tsx file

Applied to files:

  • src/Utils/request/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Redirect rules - care-ohc
  • GitHub Check: Header rules - care-ohc
  • GitHub Check: Pages changed - care-ohc
  • GitHub Check: deploy-preview
🔇 Additional comments (3)
src/Utils/request/utils.ts (3)

12-34: Excellent validation implementation!

The validation logic comprehensively enforces the "METHOD PATH" format with clear, descriptive error messages. The checks correctly handle:

  • Trimming and splitting by any whitespace
  • Exactly two parts required
  • Valid HTTP method verification
  • Non-empty path requirement
  • Single "/" prefix enforcement

The error messages follow the coding guidelines for providing clear validation feedback.


35-38: Safe type assertion after validation.

The cast to HttpMethod is safe since the method was validated against VALID_HTTP_METHODS. The explicit httpMethod variable improves code clarity.


5-7: No action needed. The code is correct.

HttpMethod is defined as a TypeScript enum with explicit string values (GET = "GET", POST = "POST", etc.), so Object.values(HttpMethod) will successfully return the runtime values at runtime. The validation logic works as intended.

Likely an incorrect or invalid review comment.


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.

@IAmUKJ
Copy link
Author

IAmUKJ commented Jan 11, 2026

PR opened: #15028

@github-actions
Copy link

github-actions bot commented Jan 11, 2026

🚀 Preview Deployment Ready!

Name Details
🔗 Preview URL https://faca9427.care-preview-a7w.pages.dev
📝 Commit 99d2df9
🌐 Environment pr-15097

This preview will be automatically updated when you push new commits to this PR.

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: 1

🤖 Fix all issues with AI agents
In @src/Utils/request/utils.ts:
- Around line 24-32: The duplicate whitespace handling is unnecessary: remove
the redundant path.trim() call in the empty-path check and just test the raw
path string (e.g. if (!path || path.length === 0) throw ...), leaving the later
startsWith("/") validation unchanged; update the error message uses of
route/path as needed and ensure you reference the same variables ('path' and
'route') in the thrown Error.
📜 Review details

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a62942 and f4a52d4.

📒 Files selected for processing (1)
  • src/Utils/request/utils.ts
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing

**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Use interface for defining object types in TypeScript
Avoid explicit any type in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks

**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid using any type; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management

**/*.{ts,tsx}: Use TanStack Query with the query and mutate utilities from @/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
Use useQuery hook with queryKey and queryFn parameters, where queryFn wraps the API route with the query() utility
Use useMutation hook with mutationFn parameter wrapping API routes with the mutate() utility, and implement onSuccess callbacks to invalidate related queries
Support path parameters in TanStack Query using the pathParams option in query/mutate utilities
Support query parameters in TanStack Query using the queryParams option in query/mutate utilities
Use the silent: true option to suppress global error notifications when custom error handling is needed

**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Use interface for defining object types
Avoid explicit any types and maint...

Files:

  • src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements

**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names

**/*.{ts,tsx,js,jsx}: Use path aliases @/* for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names

Files:

  • src/Utils/request/utils.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps

Files:

  • src/Utils/request/utils.ts
src/**/*.{ts,tsx,css}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Prettier for consistent code formatting across the healthcare application

Files:

  • src/Utils/request/utils.ts
src/{Utils,types,providers}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Document medical data flows, validation requirements, and healthcare workflows with clinical reasoning in API and utility code comments

Files:

  • src/Utils/request/utils.ts
src/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces

Files:

  • src/Utils/request/utils.ts
src/Utils/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/instructions/utils.instructions.md)

src/Utils/**/*.{ts,tsx}: Keep utilities organized by functionality in src/Utils/ with descriptive file names that indicate the utility's purpose
Export functions with clear, self-documenting names and group related utilities in the same file
Always provide proper TypeScript types for parameters and return values in utility functions
Use generic types where appropriate for reusability in utility functions
Avoid any type; use unknown or proper type assertions in utility code
Export interfaces and types alongside utility functions in the same file
Prefer pure functions that don't have side effects; functions should be predictable and testable
Avoid modifying input parameters; return new objects/arrays using immutable data patterns
Implement proper error handling with try-catch blocks in utility functions
Return meaningful error messages or throw specific error types in utilities
Use TypeScript's strict null checks in utility code
Validate input parameters in utility functions when necessary
Use consistent patterns for API request handling in API utility functions
Implement proper error handling for network requests with appropriate HTTP status code handling
Include retry logic for transient failures in API utilities when appropriate
Use date-fns library for date manipulations in date and time utility functions
Handle timezone considerations properly in date and time utilities
Format dates consistently across the application using utility functions
Consider internationalization (i18n) for date formatting in utility functions
Use zod for schema validation in validation utility functions
Create reusable validation schemas in validation utilities
Provide clear validation error messages in validation utilities
Handle both synchronous and asynchronous validation in validation utilities
Create helpers for common string operations in string utility functions
Implement proper text sanitization and formatting in string utilities
Handle Unicode and internationalizatio...

Files:

  • src/Utils/request/utils.ts
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Use 2-space indentation

Files:

  • src/Utils/request/utils.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)

Use camelCase for utility file names (e.g., useAuth.ts)

Files:

  • src/Utils/request/utils.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)

**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
Use navigate and useRedirect from raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys from src/Locale/ for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support

Files:

  • src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx,json,css,scss,html}

📄 CodeRabbit inference engine (AGENTS.md)

Use 2-space indentation

Files:

  • src/Utils/request/utils.ts
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Return meaningful error messages or throw specific error types in utilities
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Create helpers for common string operations in string utility functions

Applied to files:

  • src/Utils/request/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Redirect rules - care-ohc
  • GitHub Check: Header rules - care-ohc
  • GitHub Check: Pages changed - care-ohc
  • GitHub Check: deploy-preview
🔇 Additional comments (4)
src/Utils/request/utils.ts (4)

8-14: LGTM! Route format validation is correctly implemented.

The trim and regex-based split properly handles multiple whitespace characters, and the error message clearly describes the expected format.


36-36: Type assertion is safe and maintains type correctness.

The cast to HttpMethod is valid because the validation at lines 20-22 ensures the method is one of the allowed values.


18-22: The code works correctly at runtime. HttpMethod is a TypeScript enum, which generates a runtime object, so Object.values(HttpMethod) successfully retrieves the valid HTTP methods for validation.

However, the coding guidelines state "Avoid enums; use maps instead." Consider refactoring HttpMethod from an enum to a const map object (e.g., const HttpMethod = { GET: "GET", POST: "POST", ... }) to comply with project conventions.

Likely an incorrect or invalid review comment.


5-40: All existing API route definitions comply with the new validation rules.

Verification confirms that the single implementation using the API() function (plugConfigApi.ts) adheres to the required "METHOD PATH" format with proper leading slashes and valid HTTP methods. No existing routes would fail the new validation.

@IAmUKJ
Copy link
Author

IAmUKJ commented Jan 11, 2026

PR opened: #15028

@IAmUKJ IAmUKJ removed their assignment Jan 11, 2026
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: 2

🤖 Fix all issues with AI agents
In @src/Utils/request/utils.ts:
- Around line 24-26: The check `if (!path || path.length === 0)` is redundant
because `path` is guaranteed to be non-empty by the prior split and `/\s+/`
usage; simplify it to a single, clear condition such as `if (!path)` (or remove
the guard entirely if you prefer relying on earlier validation) in the block
that throws `new Error(\`API route path cannot be empty in "${route}".\`)`,
referencing the existing `path` and `route` variables so the logic remains
readable and maintainable.
- Around line 18-22: The check recreates Object.values(HttpMethod) on each API()
call; move that array to a module-level cached constant (e.g.,
VALID_HTTP_METHODS = Object.values(HttpMethod)) and replace the inline call in
the API() function so the if-statement uses the cached
VALID_HTTP_METHODS.includes(method as HttpMethod) instead of
Object.values(HttpMethod) to avoid reallocating the array repeatedly.
📜 Review details

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f4a52d4 and 9ff3092.

📒 Files selected for processing (1)
  • src/Utils/request/utils.ts
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing

**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Use interface for defining object types in TypeScript
Avoid explicit any type in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks

**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid using any type; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management

**/*.{ts,tsx}: Use TanStack Query with the query and mutate utilities from @/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
Use useQuery hook with queryKey and queryFn parameters, where queryFn wraps the API route with the query() utility
Use useMutation hook with mutationFn parameter wrapping API routes with the mutate() utility, and implement onSuccess callbacks to invalidate related queries
Support path parameters in TanStack Query using the pathParams option in query/mutate utilities
Support query parameters in TanStack Query using the queryParams option in query/mutate utilities
Use the silent: true option to suppress global error notifications when custom error handling is needed

**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Use interface for defining object types
Avoid explicit any types and maint...

Files:

  • src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements

**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names

**/*.{ts,tsx,js,jsx}: Use path aliases @/* for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names

Files:

  • src/Utils/request/utils.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps

Files:

  • src/Utils/request/utils.ts
src/**/*.{ts,tsx,css}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Prettier for consistent code formatting across the healthcare application

Files:

  • src/Utils/request/utils.ts
src/{Utils,types,providers}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Document medical data flows, validation requirements, and healthcare workflows with clinical reasoning in API and utility code comments

Files:

  • src/Utils/request/utils.ts
src/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces

Files:

  • src/Utils/request/utils.ts
src/Utils/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/instructions/utils.instructions.md)

src/Utils/**/*.{ts,tsx}: Keep utilities organized by functionality in src/Utils/ with descriptive file names that indicate the utility's purpose
Export functions with clear, self-documenting names and group related utilities in the same file
Always provide proper TypeScript types for parameters and return values in utility functions
Use generic types where appropriate for reusability in utility functions
Avoid any type; use unknown or proper type assertions in utility code
Export interfaces and types alongside utility functions in the same file
Prefer pure functions that don't have side effects; functions should be predictable and testable
Avoid modifying input parameters; return new objects/arrays using immutable data patterns
Implement proper error handling with try-catch blocks in utility functions
Return meaningful error messages or throw specific error types in utilities
Use TypeScript's strict null checks in utility code
Validate input parameters in utility functions when necessary
Use consistent patterns for API request handling in API utility functions
Implement proper error handling for network requests with appropriate HTTP status code handling
Include retry logic for transient failures in API utilities when appropriate
Use date-fns library for date manipulations in date and time utility functions
Handle timezone considerations properly in date and time utilities
Format dates consistently across the application using utility functions
Consider internationalization (i18n) for date formatting in utility functions
Use zod for schema validation in validation utility functions
Create reusable validation schemas in validation utilities
Provide clear validation error messages in validation utilities
Handle both synchronous and asynchronous validation in validation utilities
Create helpers for common string operations in string utility functions
Implement proper text sanitization and formatting in string utilities
Handle Unicode and internationalizatio...

Files:

  • src/Utils/request/utils.ts
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Use 2-space indentation

Files:

  • src/Utils/request/utils.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)

Use camelCase for utility file names (e.g., useAuth.ts)

Files:

  • src/Utils/request/utils.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)

**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
Use navigate and useRedirect from raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys from src/Locale/ for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support

Files:

  • src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx,json,css,scss,html}

📄 CodeRabbit inference engine (AGENTS.md)

Use 2-space indentation

Files:

  • src/Utils/request/utils.ts
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Return meaningful error messages or throw specific error types in utilities
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use appropriate data transformation patterns in string and data manipulation utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper text sanitization and formatting in string utilities

Applied to files:

  • src/Utils/request/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Redirect rules - care-ohc
  • GitHub Check: Header rules - care-ohc
  • GitHub Check: Pages changed - care-ohc
  • GitHub Check: deploy-preview
🔇 Additional comments (3)
src/Utils/request/utils.ts (3)

8-14: LGTM! Robust route parsing with clear error messaging.

Using /\s+/ to split handles edge cases like multiple spaces or tabs between method and path. The error message includes the original route, aiding debuggability. Based on learnings, this aligns with providing clear validation error messages in validation utilities.


28-32: LGTM! Appropriate path format validation.

Enforcing that API paths start with / is a sensible convention for REST routes. The error message clearly indicates the issue and expected format.


34-39: LGTM! Type cast is safe after validation.

The cast method as HttpMethod is justified since the preceding validation confirms method is a valid HttpMethod value. The return shape remains consistent with the expected API.

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: 3

🤖 Fix all issues with AI agents
In @src/Utils/request/utils.ts:
- Around line 8-30: The validation currently allows network-path references like
"//evil.com" and logs the original untrimmed route; change the function to use a
trimmed route value for all checks and error messages (e.g., assign const
trimmed = route.trim() and split that), and add a guard that rejects paths that
start with "//" (e.g., if (path.startsWith("//")) throw new Error(...)). Update
all thrown errors to reference the trimmed route/value and keep existing checks
for VALID_HTTP_METHODS, parts, empty path, and leading "/" using the trimmed
inputs.
- Around line 32-37: The return currently casts method repeatedly as HttpMethod;
instead narrow it once into a local variable (e.g., const httpMethod = method as
HttpMethod) after you validate it and then use httpMethod in the returned object
(replace all occurrences of method as HttpMethod with httpMethod) so the
narrowing is centralized and safer to refactor; update the return in the
function that constructs the object (the code building { path, method: ...,
TRes: Type<TResponse>(), TBody: Type<TBody>() }) to use that local narrowed
variable.
- Line 4: VALID_HTTP_METHODS should be made resilient to enum reverse-mapping by
constructing it as a Set of only the string-valued members of HttpMethod (filter
Object.values(HttpMethod) for typeof value === 'string' and wrap in new
Set(...)), and update any callers that use Array.includes to use Set.has; adjust
the symbol VALID_HTTP_METHODS and lookups where HttpMethod is validated so only
string enum entries are considered and lookups use the Set for O(1) checks.
📜 Review details

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9ff3092 and ff6abd0.

📒 Files selected for processing (1)
  • src/Utils/request/utils.ts
🧰 Additional context used
📓 Path-based instructions (11)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use TypeScript for all code; prefer interfaces over types
Avoid enums; use maps instead
Use TanStack Query for data fetching from the API along with query and mutate utilities for the queryFn and mutationFn
Use raviger for routing

**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Use interface for defining object types in TypeScript
Avoid explicit any type in TypeScript
Use proper nullability annotations in TypeScript types
Use dedicated error handlers and TypeScript strict null checks

**/*.{ts,tsx}: Use TypeScript for all new code
Prefer interfaces over types for object definitions in TypeScript
Avoid using any type; use proper type definitions in TypeScript
Use type inference where possible in TypeScript
Use TanStack Query for API data management
Prefer React Context for global state management

**/*.{ts,tsx}: Use TanStack Query with the query and mutate utilities from @/Utils/request/
Use appropriate query keys following the resource pattern for TanStack Query
Leverage TanStack Query built-in features for pagination and debouncing
Implement proper error handling using the global error handler for TanStack Query operations
Use useQuery hook with queryKey and queryFn parameters, where queryFn wraps the API route with the query() utility
Use useMutation hook with mutationFn parameter wrapping API routes with the mutate() utility, and implement onSuccess callbacks to invalidate related queries
Support path parameters in TanStack Query using the pathParams option in query/mutate utilities
Support query parameters in TanStack Query using the queryParams option in query/mutate utilities
Use the silent: true option to suppress global error notifications when custom error handling is needed

**/*.{ts,tsx}: Use TypeScript with strict mode and ES2022 target
Use interface for defining object types
Avoid explicit any types and maint...

Files:

  • src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements

**/*.{ts,tsx,js,jsx}: Use path aliases for imports from src (@/*)
Use double quotes for strings
Semicolons are required at end of statements
Order imports as: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names

**/*.{ts,tsx,js,jsx}: Use path aliases @/* for imports from src directory
Use double quotes for strings
Require semicolons at end of statements
Order imports: 3rd-party → library → CAREUI → UI → components → hooks → utils → relative
Use PascalCase for component and class names
Use camelCase for variable and function names

Files:

  • src/Utils/request/utils.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.{ts,tsx}: Use strict TypeScript configuration for medical data safety in all TypeScript source files
All literal strings must use i18next for multi-language support in healthcare interfaces
Use comprehensive error boundaries and user-friendly error messages for medical workflow debugging without exposing PHI
Follow ESLint configured rules for React hooks, accessibility, and code quality
Use @tanstack/react-query for server state management in API client code
Localize date and time formats for medical timestamps using locale-aware formatting functions
Use date-fns for date handling and manipulation with locale awareness for medical timestamps

Files:

  • src/Utils/request/utils.ts
src/**/*.{ts,tsx,css}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Prettier for consistent code formatting across the healthcare application

Files:

  • src/Utils/request/utils.ts
src/{Utils,types,providers}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Document medical data flows, validation requirements, and healthcare workflows with clinical reasoning in API and utility code comments

Files:

  • src/Utils/request/utils.ts
src/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.{tsx,ts}: Use React 19.1.1 features and patterns following React 19 Documentation for healthcare application development
Use shadcn/ui as primary component system and CAREUI for healthcare-specific components
Use framer-motion for animations in healthcare UI interfaces

Files:

  • src/Utils/request/utils.ts
src/Utils/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/instructions/utils.instructions.md)

src/Utils/**/*.{ts,tsx}: Keep utilities organized by functionality in src/Utils/ with descriptive file names that indicate the utility's purpose
Export functions with clear, self-documenting names and group related utilities in the same file
Always provide proper TypeScript types for parameters and return values in utility functions
Use generic types where appropriate for reusability in utility functions
Avoid any type; use unknown or proper type assertions in utility code
Export interfaces and types alongside utility functions in the same file
Prefer pure functions that don't have side effects; functions should be predictable and testable
Avoid modifying input parameters; return new objects/arrays using immutable data patterns
Implement proper error handling with try-catch blocks in utility functions
Return meaningful error messages or throw specific error types in utilities
Use TypeScript's strict null checks in utility code
Validate input parameters in utility functions when necessary
Use consistent patterns for API request handling in API utility functions
Implement proper error handling for network requests with appropriate HTTP status code handling
Include retry logic for transient failures in API utilities when appropriate
Use date-fns library for date manipulations in date and time utility functions
Handle timezone considerations properly in date and time utilities
Format dates consistently across the application using utility functions
Consider internationalization (i18n) for date formatting in utility functions
Use zod for schema validation in validation utility functions
Create reusable validation schemas in validation utilities
Provide clear validation error messages in validation utilities
Handle both synchronous and asynchronous validation in validation utilities
Create helpers for common string operations in string utility functions
Implement proper text sanitization and formatting in string utilities
Handle Unicode and internationalizatio...

Files:

  • src/Utils/request/utils.ts
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Use 2-space indentation

Files:

  • src/Utils/request/utils.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/02-coding-standards.mdc)

Use camelCase for utility file names (e.g., useAuth.ts)

Files:

  • src/Utils/request/utils.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/04-ui-components.mdc)

**/*.{tsx,ts}: Use Shadcn UI components as the primary component library
Follow the component documentation for proper usage
Customize components using Tailwind CSS
Use navigate and useRedirect from raviger for navigation and redirects
Use Tailwind's responsive classes and follow mobile-first approach
Implement proper ARIA attributes for accessibility
Ensure keyboard navigation works in components
Define component props using TypeScript interfaces
Use translation keys from src/Locale/ for internationalization
Support RTL languages in components
Use proper date/time formatting for multiple language support

Files:

  • src/Utils/request/utils.ts
**/*.{ts,tsx,js,jsx,json,css,scss,html}

📄 CodeRabbit inference engine (AGENTS.md)

Use 2-space indentation

Files:

  • src/Utils/request/utils.ts
🧠 Learnings (15)
📓 Common learnings
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Return meaningful error messages or throw specific error types in utilities
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Create reusable validation schemas in validation utilities
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use consistent patterns for API request handling in API utility functions

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/types/**/*Api.ts : Define modern API routes in dedicated API files (`*Api.ts`) within the corresponding type directory using the pattern with `path`, `method`, `TRes`, and optional `TBody` properties

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to src/Utils/api.tsx : Use legacy API route definitions only in `src/Utils/api.tsx` with the `ApiRoute` type annotation for path-based route configuration

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Implement proper error handling for network requests with appropriate HTTP status code handling

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Validate input parameters in utility functions when necessary

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Handle both synchronous and asynchronous validation in validation utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Provide clear validation error messages in validation utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:52:19.758Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/pages.instructions.md:0-0
Timestamp: 2025-11-25T13:52:19.758Z
Learning: Applies to src/pages/**/*.{ts,tsx} : Implement proper route parameters and query string handling

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:54:24.075Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursor/rules/03-data-fetching.mdc:0-0
Timestamp: 2025-11-25T13:54:24.075Z
Learning: Applies to **/*.{ts,tsx} : Support path parameters in TanStack Query using the `pathParams` option in query/mutate utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Use appropriate data transformation patterns in string and data manipulation utilities

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:53:40.623Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/utils.instructions.md:0-0
Timestamp: 2025-11-25T13:53:40.623Z
Learning: Applies to src/Utils/**/*.{ts,tsx} : Avoid unnecessary object creation in frequently called utility functions

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2024-11-14T08:07:32.427Z
Learnt from: Jacobjeevan
Repo: ohcnetwork/care_fe PR: 9080
File: src/Utils/permissions.ts:37-50
Timestamp: 2024-11-14T08:07:32.427Z
Learning: In the `showUserPasswordReset` function within `src/Utils/permissions.ts`, both `authUser` and `targetUser` are guaranteed to be provided. Therefore, null or undefined checks for these parameters are unnecessary.

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:50:54.683Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .github/instructions/common.instructions.md:0-0
Timestamp: 2025-11-25T13:50:54.683Z
Learning: Applies to src/common/**/constants.tsx : Maintain LocalStorageKeys constants for secure browser storage in constants.tsx

Applied to files:

  • src/Utils/request/utils.ts
📚 Learning: 2025-11-25T13:49:43.065Z
Learnt from: CR
Repo: ohcnetwork/care_fe PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T13:49:43.065Z
Learning: Applies to api.tsx : APIs are defined in the api.tsx file

Applied to files:

  • src/Utils/request/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Redirect rules - care-ohc
  • GitHub Check: Header rules - care-ohc
  • GitHub Check: Pages changed - care-ohc
  • GitHub Check: deploy-preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add input validation to API factory function in utils.ts

1 participant