Skip to content

[PERF] Optimized Stress Test Bundle#258

Open
CHOOSLA wants to merge 6 commits into
mainfrom
perf/optimized-stress
Open

[PERF] Optimized Stress Test Bundle#258
CHOOSLA wants to merge 6 commits into
mainfrom
perf/optimized-stress

Conversation

@CHOOSLA
Copy link
Copy Markdown
Member

@CHOOSLA CHOOSLA commented Apr 16, 2026

Performance stress test using optimized bundle (manualChunks, lazy loading).
Route: /perf-stress-test

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 개인 포트폴리오 및 프로필 정보가 추가되었습니다.
    • 성능 스트레스 테스트용 경로가 새로 추가되었습니다.
  • 기타

    • 개발용 모의 응답이 더 넓은 URL 패턴을 지원하도록 개선되어 테스트 안정성이 향상되었습니다.
    • 로컬 서비스 워커 버전이 최신으로 업데이트되었습니다.
    • 번들 최적화를 위한 벤더 청크 분류가 조정되었습니다.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

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

Project Deployment Actions Updated (UTC)
sampoom-management-frontend Ready Ready Preview, Comment Apr 16, 2026 6:22am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 04ccbd05-a53c-4451-99bc-a2e0af9b7fe3

📥 Commits

Reviewing files that changed from the base of the PR and between 165e525 and ea2c45a.

📒 Files selected for processing (1)
  • src/pages/wms/inventory/mocks/handlers.ts

Walkthrough

신규 portfolio.json 추가, MSW 패키지 버전 갱신, /perf-stress-test 라우트 추가(지연 로드 및 loader 연결), Vite manualChunksscheduler 포함, 여러 MSW 핸들러의 경로 매처를 와일드카드(*/api/...)로 변경 및 MSW 로더 경로 조정과 초기화 로직에 경로 기반 조건/로그 추가.

Changes

Cohort / File(s) Summary
정적 데이터 추가
portfolio.json
개인 프로필·프로젝트·오픈소스·연구 항목을 포함한 새 JSON 파일 추가 (+161 라인).
퍼블릭 서비스 워커
public/mockServiceWorker.js
MSW PACKAGE_VERSION"2.12.11""2.12.14"로 업데이트.
라우터/로더 추가
src/app/providers/router.tsx, src/pages/wms/inventory
/perf-stress-test 라우트 추가 — InventoryDashboard를 lazy 로드하고 inventoryLoader를 라우트 loader로 연결.
앱 프로바이더 / MSW 초기화
src/app/providers/index.tsx, src/app/providers/mocks/handlers.ts
MSW 활성화 조건에 경로 검사(/perf-stress-test) 추가, MSW 초기화 성공/오류 로그 추가, mock 탐색용 glob 경로를 상대경로로 변경 및 로드된 핸들러 수 로깅.
Vite 번들 분할
vite.config.ts
manualChunks 규칙에 schedulerreact-vendor 청크에 포함하도록 확장.
MSW 핸들러 매처 변경 (대규모)
src/.../mocks/handlers.ts (다수)
src/entities/*/mocks/handlers.ts, src/features/*/mocks/handlers.ts, src/pages/*/*/mocks/handlers.ts, 등
다수의 MSW 핸들러에서 경로 문자열을 "/api/..." 정확 매칭에서 "*/api/..." 와일드카드/글로브 매칭으로 변경하여 basePath/host 접두 허용. 핸들러 내부 로직·지연·응답 페이로드·검증은 변경 없음.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant Router as Router (route)
  participant Loader as inventoryLoader
  participant Network as Network (fetch)
  participant MSW as MSW (mock)

  Client->>Router: navigate /perf-stress-test
  Router->>Router: lazy load InventoryDashboard
  Router->>Loader: invoke inventoryLoader()
  Loader->>Network: fetch /api/...
  Network->>MSW: request intercepted by wildcard handlers
  MSW-->>Network: mock response (apiSuccess)
  Network-->>Loader: return response
  Loader-->>Router: resolve loader data
  Router-->>Client: render InventoryDashboard with data
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • taemin3
  • Sangyoon98
  • Lee-Jong-Jin
  • yangjiseonn
  • vivivim

Poem

🐰 새 파일 한 장 폴짝 넣고,
라우트 하나 살며시 불러와,
모의 응답 길을 넓혀주고,
청크로 묶어 가볍게 달려,
깡총깡총 배포 전 축하 춤! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 전체 변경사항의 핵심을 명확하게 설명하고 있습니다. 성능 최적화([PERF])와 스트레스 테스트 번들(Stress Test Bundle)이라는 주요 목표를 간결하게 표현하고 있으며, 실제 변경사항(perf-stress-test 라우트 추가, manualChunks 최적화, 번들 분석)과도 일치합니다.
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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/optimized-stress

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.

Copy link
Copy Markdown

@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

🧹 Nitpick comments (1)
portfolio.json (1)

29-146: metrics 필드 스키마를 한 가지 타입으로 통일하는 것을 권장합니다.

현재 metrics가 문자열/객체로 혼합되어 있어 소비 코드에서 분기 처리가 늘어납니다. 렌더러와 타입 정의 안정성을 위해 단일 스키마(예: 항상 객체)로 맞추는 편이 유지보수에 유리합니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@portfolio.json` around lines 29 - 146, Metrics fields are inconsistent
(sometimes string, sometimes object) which complicates rendering and types;
normalize all "metrics" under keyAchievements to a single object schema (e.g., {
value: string } or a structured map) across the JSON. Update every occurrence
such as in the FSD achievement ("Zero Trace of legacy patterns via global
history rewriting (git filter-branch)"), the FlipFlick achievement ("60fps
consistent UI interaction"), and Progmong/Campick/ISAK entries so they use the
chosen object shape, and adjust any consumer/type definitions accordingly (e.g.,
the renderer expects keyAchievements[].metrics as an object). Ensure no entries
leave metrics as plain strings and maintain existing metric details inside the
new object fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@public/mockServiceWorker.js`:
- Line 10: The generated mockServiceWorker.js was manually patched (only
PACKAGE_VERSION changed) which can desync MSW metadata; instead regenerate the
worker so PACKAGE_VERSION and INTEGRITY_CHECKSUM match the installed MSW. Locate
public/mockServiceWorker.js (search for PACKAGE_VERSION and INTEGRITY_CHECKSUM)
and run the MSW CLI/initializer used in your project to recreate the worker file
from the installed MSW package (so the constants in mockServiceWorker.js are
produced consistently with package.json), then commit the regenerated file.

In `@src/app/providers/router.tsx`:
- Around line 156-166: The public route with path "/perf-stress-test" currently
lazily exposes InventoryDashboard and inventoryLoader without auth; restrict it
by gating the route registration with an environment/feature flag check (e.g.,
process.env.NODE_ENV !== 'production' or a dedicated FEATURE_PERF_STRESS_TEST
flag) and/or require authentication before returning Component/loader from the
lazy import; update the route definition so InventoryDashboard and
inventoryLoader are only registered when the flag permits (or replace the route
with a placeholder/404 in production), ensuring the route string
"/perf-stress-test", InventoryDashboard, and inventoryLoader are the referenced
symbols to change.

---

Nitpick comments:
In `@portfolio.json`:
- Around line 29-146: Metrics fields are inconsistent (sometimes string,
sometimes object) which complicates rendering and types; normalize all "metrics"
under keyAchievements to a single object schema (e.g., { value: string } or a
structured map) across the JSON. Update every occurrence such as in the FSD
achievement ("Zero Trace of legacy patterns via global history rewriting (git
filter-branch)"), the FlipFlick achievement ("60fps consistent UI interaction"),
and Progmong/Campick/ISAK entries so they use the chosen object shape, and
adjust any consumer/type definitions accordingly (e.g., the renderer expects
keyAchievements[].metrics as an object). Ensure no entries leave metrics as
plain strings and maintain existing metric details inside the new object fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f8fa89a-3e29-4352-a968-4ce61f87321e

📥 Commits

Reviewing files that changed from the base of the PR and between 0ab8205 and 040df89.

📒 Files selected for processing (8)
  • op.html
  • op.json
  • portfolio.json
  • public/mockServiceWorker.js
  • src/app/providers/router.tsx
  • unop.html
  • unop.json
  • vite.config.ts

*/

const PACKAGE_VERSION = "2.12.11";
const PACKAGE_VERSION = "2.12.14";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

생성 파일은 수동 패치 대신 재생성으로 동기화해 주세요.

Line 10처럼 PACKAGE_VERSION만 변경되면, MSW 버전/워커 파일 메타데이터가 어긋날 수 있습니다. mockServiceWorker.js는 CLI 재생성 기준으로 맞추는 편이 안전합니다.

#!/bin/bash
set -euo pipefail

echo "== package.json 내 msw 버전 확인 =="
fd -i '^package\.json$' -x sh -c '
  echo "---- {} ----"
  jq -r ".dependencies.msw // .devDependencies.msw // \"(msw not found)\"" "{}"
'

echo
echo "== public/mockServiceWorker.js 메타데이터 확인 =="
rg -n "PACKAGE_VERSION|INTEGRITY_CHECKSUM" public/mockServiceWorker.js
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@public/mockServiceWorker.js` at line 10, The generated mockServiceWorker.js
was manually patched (only PACKAGE_VERSION changed) which can desync MSW
metadata; instead regenerate the worker so PACKAGE_VERSION and
INTEGRITY_CHECKSUM match the installed MSW. Locate public/mockServiceWorker.js
(search for PACKAGE_VERSION and INTEGRITY_CHECKSUM) and run the MSW
CLI/initializer used in your project to recreate the worker file from the
installed MSW package (so the constants in mockServiceWorker.js are produced
consistently with package.json), then commit the regenerated file.

Comment on lines +156 to +166
{
path: "/perf-stress-test",
lazy: async () => {
const { InventoryDashboard, inventoryLoader } =
await import("@/pages/wms/inventory");
return {
Component: InventoryDashboard,
loader: inventoryLoader,
};
},
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

/perf-stress-test 공개 라우트는 운영 환경에서 제한이 필요합니다.

Line 157~164에서 인증 없이 InventoryDashboard + inventoryLoader가 열려 내부 WMS 경로가 퍼블릭으로 노출됩니다. 성능 점검용이면 최소한 운영(Production)에서는 비활성화하거나 별도 플래그로 제한해 주세요.

🔧 제안 변경안 (운영 환경 비활성화)
       {
         path: "/signup",
         lazy: async () => {
           const { Register: Component } = await import("@/pages/register");
           return { Component };
         },
       },
-      {
-        path: "/perf-stress-test",
-        lazy: async () => {
-          const { InventoryDashboard, inventoryLoader } =
-            await import("@/pages/wms/inventory");
-          return {
-            Component: InventoryDashboard,
-            loader: inventoryLoader,
-          };
-        },
-      },
+      ...(import.meta.env.PROD
+        ? []
+        : [
+            {
+              path: "/perf-stress-test",
+              lazy: async () => {
+                const { InventoryDashboard, inventoryLoader } =
+                  await import("@/pages/wms/inventory");
+                return {
+                  Component: InventoryDashboard,
+                  loader: inventoryLoader,
+                };
+              },
+            },
+          ]),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
path: "/perf-stress-test",
lazy: async () => {
const { InventoryDashboard, inventoryLoader } =
await import("@/pages/wms/inventory");
return {
Component: InventoryDashboard,
loader: inventoryLoader,
};
},
},
{
path: "/signup",
lazy: async () => {
const { Register: Component } = await import("@/pages/register");
return { Component };
},
},
...(import.meta.env.PROD
? []
: [
{
path: "/perf-stress-test",
lazy: async () => {
const { InventoryDashboard, inventoryLoader } =
await import("@/pages/wms/inventory");
return {
Component: InventoryDashboard,
loader: inventoryLoader,
};
},
},
]),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/providers/router.tsx` around lines 156 - 166, The public route with
path "/perf-stress-test" currently lazily exposes InventoryDashboard and
inventoryLoader without auth; restrict it by gating the route registration with
an environment/feature flag check (e.g., process.env.NODE_ENV !== 'production'
or a dedicated FEATURE_PERF_STRESS_TEST flag) and/or require authentication
before returning Component/loader from the lazy import; update the route
definition so InventoryDashboard and inventoryLoader are only registered when
the flag permits (or replace the route with a placeholder/404 in production),
ensuring the route string "/perf-stress-test", InventoryDashboard, and
inventoryLoader are the referenced symbols to change.

Copy link
Copy Markdown

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pages/master/positions/mocks/handlers.ts (1)

37-39: ⚠️ Potential issue | 🟠 Major

PUT 경로도 동일하게 와일드카드로 맞춰야 합니다.

Line 38만 절대 경로("/api/...")로 남아 있어서, PUT만 인터셉트되지 않고 실제 네트워크로 빠질 수 있습니다.

수정 제안
-  http.put(
-    "/api/master/positions/:positionCode",
+  http.put(
+    "*/api/master/positions/:positionCode",
     async ({ params, request }) => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/master/positions/mocks/handlers.ts` around lines 37 - 39, The PUT
handler uses a hard-coded path string
(http.put("/api/master/positions/:positionCode", ...)) which will miss the
wildcard pattern used by other handlers and allow real network calls; update the
route string on the http.put call to use the same wildcard pattern used
elsewhere in this file (replace the absolute
"/api/master/positions/:positionCode" with the wildcard variant used by the
other handlers) so the PUT is intercepted consistently.
🧹 Nitpick comments (4)
src/pages/wms/purchase-orders/mocks/handlers.ts (1)

67-67: "*/api" 매처 문자열은 공통 헬퍼/상수로 묶는 편이 유지보수에 유리합니다.

이번 PR처럼 동일 패턴이 여러 파일에 반복되어 있어, 추후 경로 규칙 변경 시 누락 위험이 있습니다.

♻️ 제안 예시
+const withAnyOrigin = (path: string) => `*/api${path}`;

 export const handlers = [
-  http.get("*/api/warehouse/po", async ({ request }) => {
+  http.get(withAnyOrigin("/warehouse/po"), async ({ request }) => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/wms/purchase-orders/mocks/handlers.ts` at line 67, Extract the
repeated matcher string "*/api/warehouse/po" into a shared constant (e.g.,
API_WMS_PO_MATCHER) in a common mocks helper/constant module and replace the
inline usage in the http.get call (the matcher passed to http.get) with that
imported constant; update all other files using the same "*/api/..." pattern to
import and reuse the same constant to avoid duplication and future-mismatch
risks.
src/app/providers/loaders/bootstrap-auth.loader.ts (1)

44-47: 운영 환경에서는 성능 테스트 공개 라우트를 플래그로 제한하는 것을 권장합니다.

/perf-stress-test를 항상 public으로 두면 운영 노출 범위가 넓어질 수 있어, MODE/feature flag 조건으로 열어두는 편이 안전합니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/providers/loaders/bootstrap-auth.loader.ts` around lines 44 - 47, The
current public-route check always treats "/perf-stress-test" as public
(isPublicPage), which is unsafe for production; update the isPublicPage logic to
gate "/perf-stress-test" behind an environment/feature flag (e.g.,
process.env.MODE === 'staging' || isFeatureEnabled('perfStressTest')) instead of
unconditional url.pathname === "/perf-stress-test". Locate the isPublicPage
definition and modify the condition that references "/perf-stress-test" (and any
related auth check code that consumes isPublicPage) so that the perf route is
only considered public when the configured MODE or feature flag returns true.
src/app/providers/index.tsx (1)

64-65: 중복 null 체크는 제거해도 됩니다.

Line 9-11에서 이미 rootElement 부재 시 throw 하므로, Line 64의 재검사는 불필요합니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/providers/index.tsx` around lines 64 - 65, Remove the redundant
null-check "if (!rootElement) return;" — since rootElement is already validated
and throws when missing earlier in this file, delete that conditional to avoid
duplicate checks; locate the rootElement variable and the earlier throw (the
initial validation near the top of src/app/providers/index.tsx) and remove the
later guard that returns when rootElement is falsy.
src/app/providers/mocks/handlers.ts (1)

10-10: 핸들러 카운트 로그는 개발 환경에서만 출력하는 것을 권장합니다.

Line 10 로그는 운영 환경에서 불필요한 콘솔 노이즈를 만들 수 있어 import.meta.env.DEV 가드로 감싸는 편이 좋습니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/providers/mocks/handlers.ts` at line 10, The console.log line that
prints `[MSW] ${handlers.length} handlers loaded successfully.` should only run
in development; wrap the log in an import.meta.env.DEV check so it won't execute
in production. Locate the console.log that references handlers.length in
handlers.ts (the MSW handlers loader) and guard it with a conditional that
checks import.meta.env.DEV before calling console.log to silence the message in
non-dev environments.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app/providers/index.tsx`:
- Around line 45-46: Replace the overly-broad pathname check that uses
window.location.pathname.includes("/perf-stress-test") with an exact equality
check so mock mode only enables for the exact path "/perf-stress-test"; update
the expression that combines import.meta.env.VITE_USE_MOCK and the pathname
check (the use of import.meta.env.VITE_USE_MOCK and
window.location.pathname.includes) to use window.location.pathname ===
"/perf-stress-test" instead.

In `@src/app/providers/loaders/bootstrap-auth.loader.ts`:
- Around line 44-50: Normalize the incoming URL.pathname and use a set-based
membership check instead of exact string equality: trim any trailing slash from
url.pathname (so "/perf-stress-test/" -> "/perf-stress-test"), create a constant
collection like publicPaths (e.g., ['/login','/signup','/perf-stress-test']),
and replace the current isPublicPage logic with a lookup against that normalized
pathname; update the check inside the bootstrap-auth loader where isPublicPage
is defined so trailing-slash variants are treated as public pages.

In `@src/pages/sales/orders/mocks/handlers.ts`:
- Around line 26-27: The page/size query parsing allows 0, negative, or NaN
which can break pagination; after parsing `page` and `size` in the handler
(variables `page` and `size`), validate them: coerce to integers, default to
safe values (e.g., page >= 0, size >= 1) using Number.isFinite/Number.isInteger
checks and Math.max, and ensure the calculation that uses `totalPages`
(referenced as `totalPages`) never divides by zero by using the validated
`size`; update any places that read `page`/`size` (the same handler and the
block around `totalPages`) to use these sanitized values.

---

Outside diff comments:
In `@src/pages/master/positions/mocks/handlers.ts`:
- Around line 37-39: The PUT handler uses a hard-coded path string
(http.put("/api/master/positions/:positionCode", ...)) which will miss the
wildcard pattern used by other handlers and allow real network calls; update the
route string on the http.put call to use the same wildcard pattern used
elsewhere in this file (replace the absolute
"/api/master/positions/:positionCode" with the wildcard variant used by the
other handlers) so the PUT is intercepted consistently.

---

Nitpick comments:
In `@src/app/providers/index.tsx`:
- Around line 64-65: Remove the redundant null-check "if (!rootElement) return;"
— since rootElement is already validated and throws when missing earlier in this
file, delete that conditional to avoid duplicate checks; locate the rootElement
variable and the earlier throw (the initial validation near the top of
src/app/providers/index.tsx) and remove the later guard that returns when
rootElement is falsy.

In `@src/app/providers/loaders/bootstrap-auth.loader.ts`:
- Around line 44-47: The current public-route check always treats
"/perf-stress-test" as public (isPublicPage), which is unsafe for production;
update the isPublicPage logic to gate "/perf-stress-test" behind an
environment/feature flag (e.g., process.env.MODE === 'staging' ||
isFeatureEnabled('perfStressTest')) instead of unconditional url.pathname ===
"/perf-stress-test". Locate the isPublicPage definition and modify the condition
that references "/perf-stress-test" (and any related auth check code that
consumes isPublicPage) so that the perf route is only considered public when the
configured MODE or feature flag returns true.

In `@src/app/providers/mocks/handlers.ts`:
- Line 10: The console.log line that prints `[MSW] ${handlers.length} handlers
loaded successfully.` should only run in development; wrap the log in an
import.meta.env.DEV check so it won't execute in production. Locate the
console.log that references handlers.length in handlers.ts (the MSW handlers
loader) and guard it with a conditional that checks import.meta.env.DEV before
calling console.log to silence the message in non-dev environments.

In `@src/pages/wms/purchase-orders/mocks/handlers.ts`:
- Line 67: Extract the repeated matcher string "*/api/warehouse/po" into a
shared constant (e.g., API_WMS_PO_MATCHER) in a common mocks helper/constant
module and replace the inline usage in the http.get call (the matcher passed to
http.get) with that imported constant; update all other files using the same
"*/api/..." pattern to import and reuse the same constant to avoid duplication
and future-mismatch risks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ce0adf56-00c1-486e-898f-95c6241bb21f

📥 Commits

Reviewing files that changed from the base of the PR and between 040df89 and 165e525.

📒 Files selected for processing (33)
  • src/app/providers/index.tsx
  • src/app/providers/loaders/bootstrap-auth.loader.ts
  • src/app/providers/mocks/handlers.ts
  • src/entities/agency/mocks/handlers.ts
  • src/entities/factory/mocks/handlers.ts
  • src/entities/material/mocks/handlers.ts
  • src/entities/mps/mocks/handlers.ts
  • src/entities/part/mocks/handlers.ts
  • src/entities/user/mocks/handlers.ts
  • src/entities/vendor/mocks/handlers.ts
  • src/entities/wms/mocks/handlers.ts
  • src/features/bom-process/mocks/handlers.ts
  • src/features/branch-process/mocks/handlers.ts
  • src/features/item-process/mocks/handlers.ts
  • src/features/partner-process/mocks/handlers.ts
  • src/features/rop-process/mocks/handlers.ts
  • src/features/routing-process/mocks/handlers.ts
  • src/features/shipping-process/mocks/handlers.ts
  • src/features/stocking-process/mocks/handlers.ts
  • src/features/workcenter-process/mocks/handlers.ts
  • src/pages/hrm/employees/mocks/handlers.ts
  • src/pages/master/bom/mocks/handlers.ts
  • src/pages/master/branches/mocks/handlers.ts
  • src/pages/master/departments/mocks/handlers.ts
  • src/pages/master/items/mocks/handlers.ts
  • src/pages/master/partners/mocks/handlers.ts
  • src/pages/master/positions/mocks/handlers.ts
  • src/pages/master/routings/mocks/handlers.ts
  • src/pages/purchasing/requests/mocks/handlers.ts
  • src/pages/sales/orders/mocks/handlers.ts
  • src/pages/wms/purchase-orders/mocks/handlers.ts
  • src/pages/wms/rop-settings/mocks/handlers.ts
  • src/pages/wms/shipping/mocks/handlers.ts
✅ Files skipped from review due to trivial changes (3)
  • src/pages/master/items/mocks/handlers.ts
  • src/pages/wms/rop-settings/mocks/handlers.ts
  • src/features/partner-process/mocks/handlers.ts

Comment on lines +45 to +46
import.meta.env.VITE_USE_MOCK === "true" ||
window.location.pathname.includes("/perf-stress-test");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

includes 대신 경로 동등 비교로 제한하는 게 안전합니다.

Line 45-46은 /foo/perf-stress-test-anything 같은 경로에서도 mock이 켜질 수 있습니다. 이 파일의 의도와 bootstrap-auth.loader.ts의 공개 경로 판정(정확 비교)을 맞추려면 === "/perf-stress-test"가 더 안전합니다.

수정 제안
   const shouldUseMock =
     import.meta.env.VITE_USE_MOCK === "true" ||
-    window.location.pathname.includes("/perf-stress-test");
+    window.location.pathname === "/perf-stress-test";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import.meta.env.VITE_USE_MOCK === "true" ||
window.location.pathname.includes("/perf-stress-test");
import.meta.env.VITE_USE_MOCK === "true" ||
window.location.pathname === "/perf-stress-test";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/providers/index.tsx` around lines 45 - 46, Replace the overly-broad
pathname check that uses window.location.pathname.includes("/perf-stress-test")
with an exact equality check so mock mode only enables for the exact path
"/perf-stress-test"; update the expression that combines
import.meta.env.VITE_USE_MOCK and the pathname check (the use of
import.meta.env.VITE_USE_MOCK and window.location.pathname.includes) to use
window.location.pathname === "/perf-stress-test" instead.

Comment on lines +44 to 50
const isPublicPage =
url.pathname === "/login" ||
url.pathname === "/signup" ||
url.pathname === "/perf-stress-test";

if (isAuthPage) {
if (isPublicPage) {
return null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

공개 경로 판별에 경로 정규화가 없어 후행 슬래시 케이스를 놓칠 수 있습니다.

Line 44~50은 완전 일치 비교만 사용해서 /perf-stress-test/ 같은 URL에서 인증 부트스트랩이 실행될 수 있습니다.

수정 제안 (경로 정규화 + 집합 기반 판별)
 export const bootstrapAuthLoader = async ({ request }: LoaderFunctionArgs) => {
   const url = new URL(request.url);
-  const isPublicPage =
-    url.pathname === "/login" ||
-    url.pathname === "/signup" ||
-    url.pathname === "/perf-stress-test";
+  const normalizedPath = url.pathname.replace(/\/+$/, "") || "/";
+  const publicPaths = new Set(["/login", "/signup", "/perf-stress-test"]);
+  const isPublicPage = publicPaths.has(normalizedPath);

   if (isPublicPage) {
     return null;
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/providers/loaders/bootstrap-auth.loader.ts` around lines 44 - 50,
Normalize the incoming URL.pathname and use a set-based membership check instead
of exact string equality: trim any trailing slash from url.pathname (so
"/perf-stress-test/" -> "/perf-stress-test"), create a constant collection like
publicPaths (e.g., ['/login','/signup','/perf-stress-test']), and replace the
current isPublicPage logic with a lookup against that normalized pathname;
update the check inside the bootstrap-auth loader where isPublicPage is defined
so trailing-slash variants are treated as public pages.

Comment on lines +26 to +27
const page = Number(url.searchParams.get("page") ?? "0");
const size = Number(url.searchParams.get("size") ?? "20");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

page/size 검증이 없어 페이징 메타가 깨질 수 있습니다.

Line 26-27에서 size=0, 음수, NaN을 막지 않아 Line 51의 totalPages가 비정상 값(예: Infinity)이 될 수 있습니다. 최소 1 이상의 정수 검증이 필요합니다.

수정 제안
-      const page = Number(url.searchParams.get("page") ?? "0");
-      const size = Number(url.searchParams.get("size") ?? "20");
+      const page = Number(url.searchParams.get("page") ?? "0");
+      const size = Number(url.searchParams.get("size") ?? "20");
+      if (!Number.isInteger(page) || page < 0) {
+        return apiFail(400, "page는 0 이상의 정수여야 합니다.");
+      }
+      if (!Number.isInteger(size) || size <= 0) {
+        return apiFail(400, "size는 1 이상의 정수여야 합니다.");
+      }
@@
-        totalPages: Math.max(1, Math.ceil(filtered.length / size || 1)),
+        totalPages: Math.max(1, Math.ceil(filtered.length / size)),

Also applies to: 43-52

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/sales/orders/mocks/handlers.ts` around lines 26 - 27, The page/size
query parsing allows 0, negative, or NaN which can break pagination; after
parsing `page` and `size` in the handler (variables `page` and `size`), validate
them: coerce to integers, default to safe values (e.g., page >= 0, size >= 1)
using Number.isFinite/Number.isInteger checks and Math.max, and ensure the
calculation that uses `totalPages` (referenced as `totalPages`) never divides by
zero by using the validated `size`; update any places that read `page`/`size`
(the same handler and the block around `totalPages`) to use these sanitized
values.

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

Labels

None yet

Projects

Status: 리뷰 필요

Development

Successfully merging this pull request may close these issues.

1 participant