Skip to content

refactor: move WebWrapper files from packages/platform to apps/web/modules#9

Open
tomerqodo wants to merge 2 commits into
qodo_full_base_refactor_move_webwrapper_files_from_packages_platform_to_apps_web_modules_pr9from
qodo_full_head_refactor_move_webwrapper_files_from_packages_platform_to_apps_web_modules_pr9
Open

refactor: move WebWrapper files from packages/platform to apps/web/modules#9
tomerqodo wants to merge 2 commits into
qodo_full_base_refactor_move_webwrapper_files_from_packages_platform_to_apps_web_modules_pr9from
qodo_full_head_refactor_move_webwrapper_files_from_packages_platform_to_apps_web_modules_pr9

Conversation

@tomerqodo

Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#9

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

1. EventRecurringWebWrapper default export 📘 Rule violation ➹ Performance
Description
apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx uses a
  default export even though it is not a Next.js page.tsx or layout.tsx file.
• This violates the requirement to prefer named exports across the codebase (except where Next.js
  requires defaults).
• Consumers importing this file via next/dynamic should be adjusted to import a named export
  instead of relying on default.
Code

apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx[8]

+export default EventRecurringWebWrapper;
Evidence
PR Compliance ID 10 restricts default exports to Next.js page/layout files only. The cited line
shows a default export in a non-page/layout module file.

AGENTS.md
apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx[1-8]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx` uses `export default`, but default exports are only allowed in Next.js `page.tsx` / `layout.tsx` (and legacy `apps/web/app/pages/**/*.tsx`) per the compliance checklist.

## Issue Context
`apps/web/modules/event-types/components/EventTypeWebWrapper.tsx` dynamically imports this wrapper using a pattern that currently relies on the module’s default export.

## Fix Focus Areas
- apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx[1-8]
- apps/web/modules/event-types/components/EventTypeWebWrapper.tsx[73-77]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Router removed, still used 🐞 Bug ✓ Correctness
Description
useRouter import and const router = useRouter() were removed from BookerWebWrapper, but
  router.push(...) is still called in multiple handlers.
• This should fail TypeScript compilation (“Cannot find name 'router'”) and breaks booking
  navigation flows at runtime.
• The useCallback dependency array also references router, compounding the compile error.
Code

apps/web/modules/bookings/components/BookerWebWrapper.tsx[R41-43]

const BookerWebWrapperComponent = (props: BookerWebWrapperAtomProps) => {
-  const router = useRouter();
  const pathname = usePathname();
  const searchParams = useSearchParams();
Evidence
The module no longer imports/initializes router, but still calls router.push and references
router in hook deps, which will not compile and would break navigation if it did.

apps/web/modules/bookings/components/BookerWebWrapper.tsx[3-5]
apps/web/modules/bookings/components/BookerWebWrapper.tsx[41-44]
apps/web/modules/bookings/components/BookerWebWrapper.tsx[182-196]
apps/web/modules/bookings/components/BookerWebWrapper.tsx[221-239]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`BookerWebWrapper` still uses `router.push(...)` but no longer imports/initializes `router`. This causes a compile-time failure and breaks booking navigation.

### Issue Context
This component is a client component and uses Next.js App Router hooks.

### Fix Focus Areas
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[3-5]
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[41-44]
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[182-196]
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[221-239]

### Suggested fix
1. Add `useRouter` back to the `next/navigation` import.
2. Re-add `const router = useRouter();` near the top of `BookerWebWrapperComponent`.
3. Ensure `onOverlaySwitchStateChange` deps remain correct (`[router]` is fine once defined).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Host sorting order flipped 🐞 Bug ✓ Correctness
Description
sortHosts was moved into packages/lib/bookings/hostGroupUtils.ts, but the tie-break logic
  changed: when RR weights are enabled and weights are equal, it now sorts priority ascending.
• Priority values are defined as 0=lowest … 4=highest; elsewhere (non-weighted sorting) priority is
  sorted descending.
• This inconsistency can reorder hosts incorrectly when enabling RR weights, especially since
  default weights are equal (100), making the tie-break path common.
Code

packages/lib/bookings/hostGroupUtils.ts[R41-59]

+export function sortHosts(
+  hostA: { priority: number | null; weight: number | null },
+  hostB: { priority: number | null; weight: number | null },
+  isRRWeightsEnabled: boolean
+) {
+  const weightA = hostA.weight ?? 100;
+  const priorityA = hostA.priority ?? 2;
+  const weightB = hostB.weight ?? 100;
+  const priorityB = hostB.priority ?? 2;
+
+  if (isRRWeightsEnabled) {
+    if (weightA === weightB) {
+      return priorityA - priorityB;
+    } else {
+      return weightB - weightA;
+    }
+  } else {
+    return priorityB - priorityA;
+  }
Evidence
The comparator now returns priorityA - priorityB (ascending) for equal weights, while the UI
defines higher numeric values as higher priority and the non-weighted branch sorts descending via
priorityB - priorityA. Multiple call sites pass true/eventType.isRRWeightsEnabled, so the
affected code path is exercised.

packages/lib/bookings/hostGroupUtils.ts[41-59]
apps/web/modules/event-types/components/HostEditDialogs.tsx[47-53]
apps/web/modules/event-types/components/tabs/assignment/EventTeamAssignmentTab.tsx[319-334]
packages/platform/atoms/event-types/hooks/useEventTypeForm.ts[101-105]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`sortHosts` now sorts priorities in ascending order when RR weights are enabled and weights are equal, but priority values indicate higher numbers are higher priority and other branches sort priority descending. This can reorder hosts incorrectly.

### Issue Context
The sort function is used in both web UI and atoms form initialization, and is called with `isRRWeightsEnabled=true`.

### Fix Focus Areas
- packages/lib/bookings/hostGroupUtils.ts[41-59]

### Suggested fix
1. Change the equal-weight branch to return `priorityB - priorityA` (descending) to match the non-weighted branch and priority semantics.
2. (Optional but recommended) Add a small test ensuring:
  - when weights are equal and RR weights enabled, higher `priority` sorts first
  - when weights differ, higher `weight` sorts first
  - when RR weights disabled, higher `priority` sorts first

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

4. Missing final newline 🐞 Bug ⛯ Reliability
Description
• Two files are flagged in the PR diff as missing a trailing newline.
• Repo .editorconfig requires insert_final_newline = true, so CI formatting/lint checks may
  fail.
• Fix is trivial: add a newline at EOF for both files.
Code

apps/web/modules/event-types/components/tabs/limits/EventLimitsTabWebWrapper.tsx[8]

+export default EventLimitsTabWebWrapper;
Evidence
The repository enforces final newlines via .editorconfig, while the PR diff explicitly indicates
these two files have no newline at EOF.

.editorconfig[6-10]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Two files are missing a final newline, which violates `.editorconfig` and can fail formatting/lint checks.

### Issue Context
Git diff indicates `\ No newline at end of file` for both wrappers.

### Fix Focus Areas
- apps/web/modules/event-types/components/tabs/limits/EventLimitsTabWebWrapper.tsx[1-8]
- apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx[1-8]

### Suggested fix
Ensure each file ends with a newline after the final `export default ...;` line.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



ⓘ The new review experience is currently in Beta. Learn more

Qodo Logo

};

export default EventRecurringWebWrapper;
export default EventRecurringWebWrapper; No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. eventrecurringwebwrapper default export 📘 Rule violation ➹ Performance

apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx uses a
  default export even though it is not a Next.js page.tsx or layout.tsx file.
• This violates the requirement to prefer named exports across the codebase (except where Next.js
  requires defaults).
• Consumers importing this file via next/dynamic should be adjusted to import a named export
  instead of relying on default.
Agent prompt
## Issue description
`apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx` uses `export default`, but default exports are only allowed in Next.js `page.tsx` / `layout.tsx` (and legacy `apps/web/app/pages/**/*.tsx`) per the compliance checklist.

## Issue Context
`apps/web/modules/event-types/components/EventTypeWebWrapper.tsx` dynamically imports this wrapper using a pattern that currently relies on the module’s default export.

## Fix Focus Areas
- apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx[1-8]
- apps/web/modules/event-types/components/EventTypeWebWrapper.tsx[73-77]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 41 to 43
const BookerWebWrapperComponent = (props: BookerWebWrapperAtomProps) => {
const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Router removed, still used 🐞 Bug ✓ Correctness

useRouter import and const router = useRouter() were removed from BookerWebWrapper, but
  router.push(...) is still called in multiple handlers.
• This should fail TypeScript compilation (“Cannot find name 'router'”) and breaks booking
  navigation flows at runtime.
• The useCallback dependency array also references router, compounding the compile error.
Agent prompt
### Issue description
`BookerWebWrapper` still uses `router.push(...)` but no longer imports/initializes `router`. This causes a compile-time failure and breaks booking navigation.

### Issue Context
This component is a client component and uses Next.js App Router hooks.

### Fix Focus Areas
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[3-5]
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[41-44]
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[182-196]
- apps/web/modules/bookings/components/BookerWebWrapper.tsx[221-239]

### Suggested fix
1. Add `useRouter` back to the `next/navigation` import.
2. Re-add `const router = useRouter();` near the top of `BookerWebWrapperComponent`.
3. Ensure `onOverlaySwitchStateChange` deps remain correct (`[router]` is fine once defined).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +41 to +59
export function sortHosts(
hostA: { priority: number | null; weight: number | null },
hostB: { priority: number | null; weight: number | null },
isRRWeightsEnabled: boolean
) {
const weightA = hostA.weight ?? 100;
const priorityA = hostA.priority ?? 2;
const weightB = hostB.weight ?? 100;
const priorityB = hostB.priority ?? 2;

if (isRRWeightsEnabled) {
if (weightA === weightB) {
return priorityA - priorityB;
} else {
return weightB - weightA;
}
} else {
return priorityB - priorityA;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. Host sorting order flipped 🐞 Bug ✓ Correctness

sortHosts was moved into packages/lib/bookings/hostGroupUtils.ts, but the tie-break logic
  changed: when RR weights are enabled and weights are equal, it now sorts priority ascending.
• Priority values are defined as 0=lowest … 4=highest; elsewhere (non-weighted sorting) priority is
  sorted descending.
• This inconsistency can reorder hosts incorrectly when enabling RR weights, especially since
  default weights are equal (100), making the tie-break path common.
Agent prompt
### Issue description
`sortHosts` now sorts priorities in ascending order when RR weights are enabled and weights are equal, but priority values indicate higher numbers are higher priority and other branches sort priority descending. This can reorder hosts incorrectly.

### Issue Context
The sort function is used in both web UI and atoms form initialization, and is called with `isRRWeightsEnabled=true`.

### Fix Focus Areas
- packages/lib/bookings/hostGroupUtils.ts[41-59]

### Suggested fix
1. Change the equal-weight branch to return `priorityB - priorityA` (descending) to match the non-weighted branch and priority semantics.
2. (Optional but recommended) Add a small test ensuring:
   - when weights are equal and RR weights enabled, higher `priority` sorts first
   - when weights differ, higher `weight` sorts first
   - when RR weights disabled, higher `priority` sorts first

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

};

export default EventLimitsTabWebWrapper;
export default EventLimitsTabWebWrapper; No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

4. Missing final newline 🐞 Bug ⛯ Reliability

• Two files are flagged in the PR diff as missing a trailing newline.
• Repo .editorconfig requires insert_final_newline = true, so CI formatting/lint checks may
  fail.
• Fix is trivial: add a newline at EOF for both files.
Agent prompt
### Issue description
Two files are missing a final newline, which violates `.editorconfig` and can fail formatting/lint checks.

### Issue Context
Git diff indicates `\ No newline at end of file` for both wrappers.

### Fix Focus Areas
- apps/web/modules/event-types/components/tabs/limits/EventLimitsTabWebWrapper.tsx[1-8]
- apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx[1-8]

### Suggested fix
Ensure each file ends with a newline after the final `export default ...;` line.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant