Skip to content

Comments

chore: upgrade react-awesome-query-builder to v6#24232

Closed
volnei wants to merge 17 commits intomainfrom
chore/upgrade_raqb
Closed

chore: upgrade react-awesome-query-builder to v6#24232
volnei wants to merge 17 commits intomainfrom
chore/upgrade_raqb

Conversation

@volnei
Copy link
Contributor

@volnei volnei commented Oct 2, 2025

What does this PR do?

Upgrades react-awesome-query-builder from v5.1.2 to v6.6.15 and fixes a field selection error in the route builder.

Changes:

  1. Package upgrade: Migrated from react-awesome-query-builder@^5.1.2 to @react-awesome-query-builder/core@6.6.15 and @react-awesome-query-builder/ui@6.6.15
  2. Import updates: Updated all imports to use the new split packages (@react-awesome-query-builder/ui and @react-awesome-query-builder/core)
  3. Type safety improvements: Changed widget toJS and operator jsonLogic signatures from any to JsonLogicValue
  4. Operator fixes:
    • like and not_like: Converted from flags to explicit jsonLogic functions
    • multiselect_some_in and multiselect_equals: Added array unwrapping logic for RAQB v6's double-nested array structure
  5. Bug fix: Added validation in FieldSelect widget to prevent "Cannot read properties of undefined (reading 'null')" error when selecting fields

Bug Fix Details

The reported error occurred when selecting a field in the route builder at /routing/route-builder. The issue was that RAQB v6 tries to access field configurations that may not exist, causing a crash.

Fix: Added validation in widgets.tsx FieldSelect component to:

  • Check if field exists in config before calling setField()
  • Log helpful error messages showing which fields are available
  • Gracefully handle missing field configurations

Visual Demo

N/A - This is a dependency upgrade with a bug fix. The visual appearance and functionality remain the same.

Mandatory Tasks

  • I have self-reviewed the code
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change - N/A - Internal dependency upgrade
  • I confirm automated tests are in place that prove my fix is effective or that my feature works - Needs testing on live environment

How should this be tested?

Environment Setup

  • Standard Cal.com development environment
  • No special environment variables needed

Test Steps

  1. Test the bug fix:

    • Navigate to /routing/route-builder/[formId]
    • Try selecting different fields in the "Conditions" section
    • Verify no "Cannot read properties of undefined" errors occur
    • Check browser console for any error messages
  2. Test multiselect operators (CRITICAL):

    • Create routing rules with multiselect fields using "Any in" or "All in" operators
    • Verify the rules execute correctly and match expected records
    • Check that saved rules continue to work after upgrade
  3. Test text search operators:

    • Create rules using "Contains" and "Not contains" operators
    • Verify they work correctly with text fields
  4. Regression testing:

    • Test existing routing forms to ensure they still work
    • Verify saved queries execute correctly
    • Check that no existing functionality is broken

Key Areas to Review

⚠️ CRITICAL: The multiselect operator changes include unwrapping logic for double-nested arrays. This assumes RAQB v6 wraps multiselect values as [[value1, value2]] instead of [value1, value2]. This needs verification with actual data.

⚠️ IMPORTANT: The FieldSelect validation fix prevents crashes but may hide underlying issues with field configuration. Monitor console logs for "Field not found in config" errors.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas (array unwrapping logic)
  • I have checked that my changes generate no new warnings (type-check passed)

Session: Created by Volnei Munhoz (volnei@cal.com) via Devin session: https://app.devin.ai/sessions/767e68744dbf4aa5a0a0b0da65cc17c6

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 2, 2025

Walkthrough

Migrates the codebase from react-awesome-query-builder v5 to @react-awesome-query-builder/ui v6: updates imports across apps, libs, widgets, configs, and tests; replaces package dependency and Vite external mapping; extends BasicConfig with a ctx and jsonLogic settings; tightens jsonLogic and widget toJS typings to JsonLogicValue; replaces some operator jsonLogic string placeholders with functions (e.g., like, not_like, multiselect operators); adds ctx to base configs; changes several tests/types from any to unknown and normalizes strings; relaxes two factory prop typings; removes an ambient env module declaration.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "chore: upgrade react-awesome-query-builder to v6" clearly and concisely summarizes the primary change in the changeset. The title directly corresponds to the main objective of upgrading the react-awesome-query-builder dependency from v5.1.2 to v6.6.15, which is reflected in substantial changes across the codebase including import updates, type signature modifications, and bug fixes. The title is specific and avoids vague language, making it immediately understandable to developers reviewing pull request history.
Description Check ✅ Passed The PR description is comprehensive and directly related to the changeset. It explains the upgrade from v5.1.2 to v6.6.15, details specific changes including package migration, import updates, type safety improvements, operator fixes, and a field selection bug fix. The description includes testing instructions, known critical areas requiring verification (particularly the multiselect operator changes), and mandatory task checklists. The level of detail and clarity provides meaningful context for the significant dependency upgrade represented in the code changes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/upgrade_raqb

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.

@vercel
Copy link

vercel bot commented Oct 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Nov 27, 2025 10:04am
cal-eu Ignored Ignored Nov 27, 2025 10:04am

- Apply case-insensitive normalization to fixed values in resolveQueryValue
- Add explicit cardinality to multiselect operators for correct value handling
- Update test to use double-nested array format expected by RAQB v6
- Add ctx property to config objects as required by RAQB v6
- Replace any types with proper TypeScript types to satisfy ESLint rules

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
- Lowercase non-template strings in resolveQueryValue for RAQB v6 slug validation
- Unwrap [[...]] to [...] in multiselect_some_in and multiselect_equals operators
- Fix type error with @ts-expect-error comment for jsonLogic.apply
- Replace all 'any' types with 'unknown' in test files to pass ESLint
- Update test expectations to match lowercased fixed values
- RAQB v6 cardinality: 1 wraps multiselect values in extra array layer

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Oct 2, 2025
@volnei volnei marked this pull request as ready for review October 3, 2025 10:44
@volnei volnei requested a review from a team October 3, 2025 10:44
@volnei volnei requested a review from a team as a code owner October 3, 2025 10:44
@graphite-app graphite-app bot requested a review from a team October 3, 2025 10:44
@dosubot dosubot bot added the ⬆️ dependencies Pull requests that update a dependency file label Oct 3, 2025
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

🧹 Nitpick comments (3)
packages/app-store/routing-forms/components/FormInputFields.tsx (1)

49-49: Replace any with a more specific type for better type safety.

The cast to React.ComponentType<any> bypasses TypeScript's prop validation. Consider using React.ComponentType<unknown> or, preferably, importing and using the specific widget component type from @react-awesome-query-builder/ui v6 to ensure props are validated.

For example, if the library exports a WidgetProps interface:

-        const Component = widget.factory as React.ComponentType<any>;
+        const Component = widget.factory as React.ComponentType<WidgetProps>;

Or as a safer fallback:

-        const Component = widget.factory as React.ComponentType<any>;
+        const Component = widget.factory as React.ComponentType<unknown>;
packages/platform/atoms/scripts/dev-on.js (1)

18-21: Handle empty‐array edge case in regex

The pattern /external: \[([^\]]+)\]/ won’t match external: [], so an empty array would skip adding the new package. Consider switching to /external: \[([^\]]*)\]/ with a callback that inserts ["@react-awesome-query-builder/ui"] when contents is empty.

packages/app-store/routing-forms/components/react-awesome-query-builder/config/uiConfig.tsx (1)

40-41: Keep widget factory props typed

Switching these factories to any discards all compile-time guarantees around the RAQB widget props (things like listValues, setValue, etc.), making regressions harder to catch. Please derive the props from the widget components instead—e.g. type MultiSelectProps = React.ComponentProps<typeof MultiSelectWidget> (and the same for SelectWidget) and keep renderComponent working with React.ComponentType. That preserves v6 compatibility without losing type safety.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a1ac5f3 and c465332.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (21)
  • apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RouteBuilder.tsx (4 hunks)
  • packages/app-store/routing-forms/__tests__/uiConfig.test.ts (1 hunks)
  • packages/app-store/routing-forms/components/FormInputFields.tsx (1 hunks)
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts (10 hunks)
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/config.ts (2 hunks)
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/types.ts (1 hunks)
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/uiConfig.tsx (2 hunks)
  • packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx (1 hunks)
  • packages/app-store/routing-forms/lib/createFallbackRoute.ts (1 hunks)
  • packages/app-store/routing-forms/lib/processRoute.tsx (1 hunks)
  • packages/app-store/routing-forms/package.json (1 hunks)
  • packages/app-store/routing-forms/types/types.d.ts (1 hunks)
  • packages/features/Segment.tsx (1 hunks)
  • packages/lib/raqb/evaluateRaqbLogic.ts (2 hunks)
  • packages/lib/raqb/findTeamMembersMatchingAttributeLogic.test.ts (8 hunks)
  • packages/lib/raqb/findTeamMembersMatchingAttributeLogic.ts (4 hunks)
  • packages/lib/raqb/raqbUtils.test.ts (13 hunks)
  • packages/lib/raqb/raqbUtils.ts (1 hunks)
  • packages/lib/raqb/resolveQueryValue.test.ts (15 hunks)
  • packages/lib/raqb/resolveQueryValue.ts (1 hunks)
  • packages/platform/atoms/scripts/dev-on.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.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/components/react-awesome-query-builder/config/config.ts
  • packages/lib/raqb/resolveQueryValue.ts
  • packages/lib/raqb/evaluateRaqbLogic.ts
  • packages/lib/raqb/findTeamMembersMatchingAttributeLogic.ts
  • packages/lib/raqb/raqbUtils.test.ts
  • packages/app-store/routing-forms/lib/createFallbackRoute.ts
  • packages/lib/raqb/raqbUtils.ts
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts
  • packages/app-store/routing-forms/types/types.d.ts
  • packages/app-store/routing-forms/__tests__/uiConfig.test.ts
  • packages/lib/raqb/findTeamMembersMatchingAttributeLogic.test.ts
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/types.ts
  • packages/lib/raqb/resolveQueryValue.test.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/components/react-awesome-query-builder/config/config.ts
  • packages/lib/raqb/resolveQueryValue.ts
  • packages/app-store/routing-forms/lib/processRoute.tsx
  • packages/features/Segment.tsx
  • packages/lib/raqb/evaluateRaqbLogic.ts
  • packages/lib/raqb/findTeamMembersMatchingAttributeLogic.ts
  • packages/lib/raqb/raqbUtils.test.ts
  • packages/app-store/routing-forms/lib/createFallbackRoute.ts
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/uiConfig.tsx
  • packages/lib/raqb/raqbUtils.ts
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts
  • packages/app-store/routing-forms/types/types.d.ts
  • packages/app-store/routing-forms/components/FormInputFields.tsx
  • packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx
  • packages/app-store/routing-forms/__tests__/uiConfig.test.ts
  • packages/lib/raqb/findTeamMembersMatchingAttributeLogic.test.ts
  • apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RouteBuilder.tsx
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/types.ts
  • packages/lib/raqb/resolveQueryValue.test.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/config.ts
  • packages/lib/raqb/resolveQueryValue.ts
  • packages/platform/atoms/scripts/dev-on.js
  • packages/app-store/routing-forms/lib/processRoute.tsx
  • packages/features/Segment.tsx
  • packages/lib/raqb/evaluateRaqbLogic.ts
  • packages/lib/raqb/findTeamMembersMatchingAttributeLogic.ts
  • packages/lib/raqb/raqbUtils.test.ts
  • packages/app-store/routing-forms/lib/createFallbackRoute.ts
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/uiConfig.tsx
  • packages/lib/raqb/raqbUtils.ts
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts
  • packages/app-store/routing-forms/types/types.d.ts
  • packages/app-store/routing-forms/components/FormInputFields.tsx
  • packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx
  • packages/app-store/routing-forms/__tests__/uiConfig.test.ts
  • packages/lib/raqb/findTeamMembersMatchingAttributeLogic.test.ts
  • apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RouteBuilder.tsx
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/types.ts
  • packages/lib/raqb/resolveQueryValue.test.ts
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Always use t() for text localization in frontend code; direct text embedding should trigger a warning

Files:

  • packages/app-store/routing-forms/lib/processRoute.tsx
  • packages/features/Segment.tsx
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/uiConfig.tsx
  • packages/app-store/routing-forms/components/FormInputFields.tsx
  • packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx
  • apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RouteBuilder.tsx
🧠 Learnings (1)
📚 Learning: 2025-08-29T22:57:30.382Z
Learnt from: bandhan-majumder
PR: calcom/cal.com#23454
File: packages/features/form-builder/FormBuilder.tsx:11-11
Timestamp: 2025-08-29T22:57:30.382Z
Learning: FormBuilder.tsx in packages/features/form-builder/ does not have "use client" directive at the top despite using client-side React hooks and event handlers, which suggests it should be a client component.

Applied to files:

  • apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RouteBuilder.tsx
🧬 Code graph analysis (2)
packages/lib/raqb/resolveQueryValue.ts (1)
packages/lib/raqb/utils.ts (1)
  • caseInsensitive (1-9)
packages/lib/raqb/raqbUtils.test.ts (1)
packages/app-store/routing-forms/types/types.d.ts (1)
  • AttributesQueryValue (81-81)
🔇 Additional comments (31)
packages/features/Segment.tsx (1)

3-5: LGTM! Clean migration to the scoped v6 package.

The import statements have been correctly updated to use the new @react-awesome-query-builder/ui package. The symbols remain unchanged, and no logic modifications are introduced, making this a safe upgrade.

packages/lib/raqb/evaluateRaqbLogic.ts (2)

3-3: LGTM: Import path updated for v6 migration.

The import path correctly reflects the migration from react-awesome-query-builder to the scoped @react-awesome-query-builder/ui package, consistent with the broader upgrade across the codebase.


58-58: LGTM: Simplified boolean coercion.

Removing the explicit !! is a good simplification—the ternary operator already coerces to boolean context, so the double negation was redundant. Behavior remains functionally equivalent.

packages/lib/raqb/raqbUtils.ts (1)

1-3: LGTM: Import paths updated for v6 migration.

All imports correctly migrated from react-awesome-query-builder to @react-awesome-query-builder/ui. The type names remain unchanged, ensuring compatibility with the rest of the codebase.

packages/lib/raqb/findTeamMembersMatchingAttributeLogic.ts (4)

1-3: LGTM: Import paths updated for v6 migration.

The imports correctly reflect the migration to @react-awesome-query-builder/ui, with BasicConfig appropriately aliased as Config for consistency with usage throughout the file.


88-88: LGTM: Explicit type cast for filtered errors.

The explicit as string[] cast after filtering out falsy values aligns with stricter typing requirements in the v6 migration. The logic correctly handles potential null values in the valueError array.


126-132: LGTM: Stricter typing with unknown.

Updating the data parameter from any to unknown improves type safety by requiring explicit type checking before use. This aligns with the broader type refinement efforts in the v6 migration.


169-170: LGTM: Explicit type compatibility annotation.

The @ts-expect-error annotation with explanatory comment is a better approach than the previous as any cast. It explicitly documents the known structural compatibility between RAQB's JsonLogicResult and json-logic-js types, and will prompt cleanup if the types align in future updates.

packages/lib/raqb/raqbUtils.test.ts (3)

14-14: LGTM: Test builders migrated to stricter unknown typing.

The test data builders now use unknown instead of any for field values and properties, mirroring the stricter typing adopted in the production code for v6. This ensures tests validate the actual type handling required by consumers.

Also applies to: 38-38, 59-59, 90-90, 127-127


751-751: LGTM: Test expectations updated for lowercase normalization.

The test assertions correctly expect lowercased values, reflecting the normalization behavior introduced in v6 for slug validation. The inline comments ("All values lowercased for RAQB v6 slug validation") clearly document this behavioral change.

Also applies to: 918-918, 1023-1023, 1077-1077, 1084-1084, 1450-1450, 1457-1457, 1464-1464, 1589-1589


1220-1220: LGTM: Edge case tests with explicit type casts.

The explicit as unknown casts for null and empty object field values correctly test edge case handling. These scenarios verify that the code gracefully handles invalid or missing response data.

Also applies to: 1615-1615

packages/lib/raqb/findTeamMembersMatchingAttributeLogic.test.ts (5)

1-1: LGTM: Import path updated for v6 migration.

The BaseWidget import correctly reflects the migration to @react-awesome-query-builder/ui.


160-160: LGTM: Stricter type cast in test builder.

The updated cast to Record<string, unknown> provides better type safety than the previous any, consistent with the v6 migration's type refinement efforts.


694-701: LGTM: More explicit test assertions.

The test assertions have been updated to use explicit length checks and individual toContainEqual calls rather than arrayContaining. This provides clearer failure messages and aligns with stricter typing in v6. The comment update referencing RAQB v6 correctly documents the context.

Also applies to: 758-758


984-984: Verify warning handling behavior in v6.

The tests now expect an empty array for mainAttributeLogicBuildingWarnings with a comment stating "this ignores the warnings on raqb v6." This suggests a behavioral change in how v6 reports validation warnings. Confirm:

  1. Is the loss of warning information intentional?
  2. Does v6 surface validation issues through a different mechanism?
  3. Should these tests be updated to verify the new warning format instead of expecting an empty array?

If warnings are truly not available in v6, consider documenting this as a behavioral change and its impact on debugging routing form issues.

Also applies to: 991-991


209-209: No action needed: _buildDefaultCustomPageRoute is a local test helper
This function is only defined and used in this test file; the underscore prefix denotes a private helper and requires no changes.

Likely an incorrect or invalid review comment.

packages/lib/raqb/resolveQueryValue.test.ts (4)

28-28: LGTM: Test builders migrated to stricter unknown typing.

The test data builders consistently use unknown instead of any, ensuring tests validate the actual type handling required by the v6 migration. This matches the pattern applied across all test files.

Also applies to: 48-48, 79-79, 116-116


687-687: LGTM: Test expectations updated for lowercase normalization.

The test assertions correctly expect lowercased values, consistent with the slug validation normalization introduced in v6. The inline comments clearly document this behavioral change.

Also applies to: 854-854, 959-959, 1013-1013, 1020-1020, 1389-1389


1088-1088: LGTM: Edge case tests with explicit type casts.

The explicit as unknown casts for null and empty object field values test edge case handling, ensuring the code gracefully processes invalid or missing response data.

Also applies to: 1415-1415


1613-1618: LGTM: Type assertions for deep nested property access.

The explicit type assertions (as unknown as Record<string, unknown>) are necessary for accessing deeply nested properties in test assertions. These tests verify that field template resolution works correctly through arbitrarily deep object structures, which is important for complex query configurations.

Also applies to: 1648-1652, 1692-1704, 1734-1743

packages/lib/raqb/resolveQueryValue.ts (1)

185-186: Lowercasing non-field template strings is safe

Searches across raqb and routing-forms found no direct case-sensitive string comparisons on query values; downstream logic already expects lowercase slugs.

packages/app-store/routing-forms/lib/createFallbackRoute.ts (1)

1-1: LGTM: Clean import migration.

The import path has been correctly updated to use @react-awesome-query-builder/ui, aligning with the v6 upgrade.

packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx (1)

1-9: LGTM: Type imports correctly migrated.

The type imports have been properly updated to source from @react-awesome-query-builder/ui. Import reordering does not affect runtime behavior.

packages/app-store/routing-forms/components/react-awesome-query-builder/config/types.ts (1)

1-1: LGTM: Type import correctly updated.

The Widgets type import has been properly migrated to @react-awesome-query-builder/ui as RaqbWidgets, maintaining type compatibility.

apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RouteBuilder.tsx (2)

4-6: LGTM: Imports correctly migrated to v6.

The query builder imports have been properly updated to use @react-awesome-query-builder/ui, aligning with the library upgrade.


311-335: Simplified boolean check is appropriate.

Replacing !!attributeIdForWeights with direct attributeIdForWeights is functionally equivalent for string|undefined values and improves readability.

packages/app-store/routing-forms/types/types.d.ts (1)

1-1: LGTM: Type imports updated correctly.

The type imports for ImmutableTree and Config have been properly migrated to @react-awesome-query-builder/ui.

packages/app-store/routing-forms/lib/processRoute.tsx (1)

3-3: LGTM: Type import correctly updated.

The JsonTree type import has been properly migrated to @react-awesome-query-builder/ui.

packages/app-store/routing-forms/__tests__/uiConfig.test.ts (2)

1-1: LGTM: Test imports updated correctly.

The Settings type import has been properly migrated to @react-awesome-query-builder/ui.


54-135: Improved type safety in v6.

The removal of @ts-expect-error suppressions indicates that v6 provides better type definitions for widget factories, allowing direct property access without type errors. This is a positive improvement.

packages/app-store/routing-forms/package.json (1)

10-10: No vulnerabilities; 6.6.15 is the latest stable release
Registry’s dist-tags.latest points to the pre-release 6.7.0-alpha.0, and no security advisories were found for @react-awesome-query-builder/ui.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

E2E results are ready!

@emrysal
Copy link
Contributor

emrysal commented Oct 6, 2025

It's highly likely that the current e2e test fails in app-store are legit.

volnei and others added 2 commits October 7, 2025 07:51
- Import CoreConfig from @react-awesome-query-builder/core
- Spread CoreConfig.ctx to populate ctx.utils with actual RAQB v6 utilities
- Remove obsolete env.d.ts that declared old react-awesome-query-builder/lib module path
- This fixes the hanging UI issue causing E2E test timeouts

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
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

♻️ Duplicate comments (2)
packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts (2)

146-152: Same type guard concern as between operator.

The not_between operator has the same potential runtime issue with parseInt on JsonLogicValue types without validation. See the comment on the between operator above.


490-494: Critical issue remains unaddressed: Empty ctx utilities.

As noted in the previous review, setting W: {} and O: {} (in addition to the empty utils inherited from CoreConfig.ctx) will cause runtime failures when RAQB v6 attempts to call helper functions like jsonLogicFormat, loadTree, etc.

Per the past review comment, you need to import and wire the actual RAQB utilities:

+import { Utils as QbUtils } from "@react-awesome-query-builder/ui";
+
 const ctx: ConfigContext = {
-  ...CoreConfig.ctx,
-  W: {},
-  O: {},
+  ...CoreConfig.ctx,
+  utils: QbUtils,
+  // W and O may also need proper initialization depending on your widgets/operators
+  W: {},
+  O: {},
 };

Verify whether W (widgets) and O (operators) also require proper initialization:

#!/bin/bash
# Description: Check RAQB v6 documentation and examples for ctx initialization

# Search for ctx usage in the codebase
rg -n --type=ts --type=tsx 'ctx\.(utils|W|O)\.' -A2 -B2

# Look for RAQB examples or config files
fd -e ts -e tsx config | xargs rg -l 'ConfigContext'
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c465332 and b3a6d06.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts (10 hunks)
  • packages/app-store/routing-forms/env.d.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/app-store/routing-forms/env.d.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.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/components/react-awesome-query-builder/config/BasicConfig.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/components/react-awesome-query-builder/config/BasicConfig.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (9)
packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts (9)

2-11: LGTM! Import updates align with v6 migration.

The imports correctly reference the new package structure and include the necessary types (ConfigContext, JsonLogicValue) for v6 compatibility.


22-22: LGTM! Type safety improvement.

Replacing any with JsonLogicValue improves type safety and aligns with v6 expectations.


91-96: LGTM! Correct JsonLogic implementation for "contains".

The functional jsonLogic implementation correctly uses the JsonLogic in operator to check if val is contained in field.


103-112: LGTM! Correct negation implementation.

The not_like operator correctly negates the in check with the ! operator, and the _jsonLogicIsExclamationOp flag properly identifies this as a negation operator.


131-137: Consider type guards for parseInt on JsonLogicValue.

The signature correctly types vals as [JsonLogicValue, JsonLogicValue], but JsonLogicValue can be various types (string, number, object, array, boolean, null). Calling parseInt(vals[0], 10) without first checking if vals[0] is a string or number could produce NaN at runtime if the value is an object, array, or null.

Consider adding type guards or using Number() with validation:

 jsonLogic: (field: JsonLogicValue, op: JsonLogicValue, vals: [JsonLogicValue, JsonLogicValue]) => {
-  const min = parseInt(vals[0], 10);
-  const max = parseInt(vals[1], 10);
+  const min = typeof vals[0] === 'string' || typeof vals[0] === 'number' ? Number(vals[0]) : 0;
+  const max = typeof vals[1] === 'string' || typeof vals[1] === 'number' ? Number(vals[1]) : 0;
   return {
     and: [{ ">=": [field, min] }, { "<=": [field, max] }],
   };
 },

Or verify that RAQB guarantees these values are always numbers/strings for this operator.


235-249: Existing logic issue documented in comment.

The operator includes a comment acknowledging the logic is "wrongly implemented" (Line 246): it checks inclusion rather than strict equality. For example, field=["a"] matches vals=["a","b"], but a strict "equals" would require exact set equality.

This appears to be pre-existing tech debt rather than introduced by this PR. However, it's worth flagging for future correction.

The rest parameter ..._rest: JsonLogicValue[] on Line 239 is unused. Consider whether it's intentionally there for compatibility or can be removed:

-jsonLogic: (
-  field: JsonLogicValue,
-  op: JsonLogicValue,
-  vals: JsonLogicValue,
-  ..._rest: JsonLogicValue[]
-) => {
+jsonLogic: (field: JsonLogicValue, op: JsonLogicValue, vals: JsonLogicValue) => {

282-282: LGTM! Consistent type safety improvements across widgets.

All widget toJS signatures correctly use JsonLogicValue for improved type safety while maintaining the simple pass-through behavior.

Also applies to: 290-290, 298-298, 306-306, 314-314


481-488: LGTM! JsonLogic settings configured correctly.

The jsonLogic configuration group with groupVarKey, altVarKey, and lockedOp properly configures variable handling and locked operations for RAQB v6.


496-503: LGTM! Config export structure updated correctly.

The basicConfig export now includes ctx, which is required for v6. The structure is correct, though the ctx content needs to be fixed as noted in the previous comment.

Comment on lines +214 to 224
cardinality: 1, // Expects 1 value (which is an array of selected items)
jsonLogic: (field: JsonLogicValue, operator: JsonLogicValue, vals: JsonLogicValue) => {
// RAQB v6 with cardinality: 1 wraps multiselect values in an extra array layer (important-comment)
// Unwrap [[...]] to [...] for jsonLogic compatibility (important-comment)
const unwrappedVals =
Array.isArray(vals) && vals.length === 1 && Array.isArray(vals[0]) ? vals[0] : vals;
return {
// Tested in jsonLogic.test.ts
some: [field, { in: [{ var: "" }, vals] }],
some: [field, { in: [{ var: "" }, unwrappedVals] }],
};
},
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Verify the array unwrapping logic for RAQB v6.

The unwrapping logic handles [[...]][...] transformation with a clear explanation. However, since this is a significant behavioral change:

  1. Confirm that RAQB v6 with cardinality: 1 always wraps multiselect values in an extra array
  2. Verify that the unwrapping condition correctly identifies this case
  3. Ensure the fallback (vals unchanged) doesn't break when the value is already unwrapped

Run the following script to check for tests or usage patterns that validate this unwrapping behavior:


🏁 Script executed:

#!/bin/bash
# Description: Find tests or code that validates the multiselect unwrapping logic

# Search for tests related to multiselect_some_in
rg -n --type=ts --type=tsx -C5 'multiselect_some_in'

# Search for jsonLogic test files
fd -e test.ts -e test.tsx -x rg -l 'jsonLogic'

Length of output: 125


🏁 Script executed:

#!/bin/bash
sed -n '1,200p' packages/lib/raqb/jsonLogic.test.ts
echo '---'
sed -n '1,200p' packages/app-store/routing-forms/__tests__/config.test.ts

Length of output: 11873


Add nested‐array unwrap test for multiselect_some_in

  • Include a unit test where vals is wrapped ([[…]]) and assert it’s unwrapped to […]
  • Also test the fallback path (already unwrapped arrays and non‐array values) to prevent regressions
🤖 Prompt for AI Agents
In
packages/app-store/routing-forms/components/react-awesome-query-builder/config/BasicConfig.ts
around lines 214 to 224, add unit tests to verify the jsonLogic behavior for
multiselect_some_in: create a test case where vals is nested ([[...]]), call the
jsonLogic function and assert it returns the jsonLogic with the inner array
unwrapped to [...] (i.e., some: [field, { in: [{ var: "" }, unwrappedArray] }]);
also add tests for the fallback scenarios where vals is already an array ([...])
and where vals is a non-array value to assert the output is unchanged or handled
as before to prevent regressions.

…ned fields in RAQB v6

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
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

🧹 Nitpick comments (1)
packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx (1)

358-376: Use existence check instead of truthiness check for more precise validation.

Line 362 uses !config.fields[item.value] which checks truthiness rather than existence. While field configurations are objects (unlikely to be falsy), this is technically imprecise.

Apply this diff:

-        if (config && config.fields && !config.fields[item.value]) {
+        if (config && config.fields && !(item.value in config.fields)) {
           console.error(

Consider improving error handling for production readiness.

The defensive validation is justified given that item.value comes from external props. However, consider these improvements:

  1. Replace console.error with a structured logging service for production observability
  2. Evaluate whether errors should be propagated to the user or trigger a fallback behavior instead of being silently swallowed
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 988ce26 and 9bd2605.

📒 Files selected for processing (1)
  • packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Always use t() for text localization in frontend code; direct text embedding should trigger a warning

Files:

  • packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx
**/*.{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/components/react-awesome-query-builder/widgets.tsx
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (2)
packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx (2)

1-9: LGTM: Import migration to v6 completed correctly.

The import source changes from react-awesome-query-builder to @react-awesome-query-builder/ui align with the v6 upgrade objective and are consistent with the broader migration across the codebase.


340-340: LGTM: Config prop addition supports new validation.

Adding config to the destructured props enables the field validation logic below.

@github-actions
Copy link
Contributor

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

Resolved merge conflicts in:
- apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RouteBuilder.tsx
- packages/app-store/_utils/raqb/findTeamMembersMatchingAttributeLogic.ts
- packages/app-store/routing-forms/components/react-awesome-query-builder/widgets.tsx

Conflict resolutions:
- RouteBuilder.tsx: Removed ESLint disable comments (main branch changes)
- findTeamMembersMatchingAttributeLogic.ts: Kept @ts-expect-error with explanation instead of 'as any' type casting
- widgets.tsx: Added 'use client' directive from main branch

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 30 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/app-store/routing-forms/playwright/tests/basic.e2e.ts">

<violation number="1" location="packages/app-store/routing-forms/playwright/tests/basic.e2e.ts:27">
Removing the `@typescript-eslint/no-empty-function` suppression reintroduces a lint failure because the skipped test still uses an empty callback; keep the suppression or give the callback a body.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

devin-ai-integration bot and others added 2 commits November 21, 2025 11:36
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 30 files

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/web/modules/settings/my-account/profile-view.tsx">

<violation number="1" location="apps/web/modules/settings/my-account/profile-view.tsx:5">
Removing the `no-restricted-imports` suppression reintroduces an ESLint failure for the lodash import.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

import { zodResolver } from "@hookform/resolvers/zod";
import { revalidateSettingsProfile } from "app/cache/path/settings/my-account";
// eslint-disable-next-line no-restricted-imports
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 27, 2025

Choose a reason for hiding this comment

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

Removing the no-restricted-imports suppression reintroduces an ESLint failure for the lodash import.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/web/modules/settings/my-account/profile-view.tsx, line 5:

<comment>Removing the `no-restricted-imports` suppression reintroduces an ESLint failure for the lodash import.</comment>

<file context>
@@ -2,7 +2,7 @@
 import { zodResolver } from &quot;@hookform/resolvers/zod&quot;;
 import { revalidateSettingsProfile } from &quot;app/cache/path/settings/my-account&quot;;
-// eslint-disable-next-line no-restricted-imports
+ 
 import { get, pick } from &quot;lodash&quot;;
 import { signOut, useSession } from &quot;next-auth/react&quot;;
</file context>
Suggested change
// eslint-disable-next-line no-restricted-imports
Fix with Cubic

@volnei
Copy link
Contributor Author

volnei commented Dec 18, 2025

This needs to be reworked... not a priority right now

@volnei volnei closed this Dec 18, 2025
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 ⬆️ dependencies Pull requests that update a dependency file foundation ❗️ migrations contains migration files ready-for-e2e size/XL Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants