From 851fdedbcd5b50ede45378c2f826cebfc98e877f Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Wed, 4 Nov 2026 20:16:58 +0900 Subject: [PATCH] =?UTF-8?q?fix(apps):=20=EB=8C=80=EC=86=8C=EB=AC=B8?= =?UTF-8?q?=EC=9E=90=C2=B7=EB=81=9D=20=EC=8A=AC=EB=9E=98=EC=8B=9C=EB=A7=8C?= =?UTF-8?q?=20=EB=8B=A4=EB=A5=B8=20=EA=B8=B0=EB=8A=A5=20=EB=9D=BC=EC=9A=B0?= =?UTF-8?q?=ED=8A=B8=EB=8F=84=20=EA=B0=99=EC=9D=80=20=EA=B2=BD=EB=A1=9C?= =?UTF-8?q?=EB=A1=9C=20=EA=B1=B0=EC=A0=88=ED=95=9C=EB=8B=A4=20(1103/08-04)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제 같은 모양 검사가 파라미터 이름만 지운 문자열로 비교했다. React Router는 대소문자를 무시하고 끝 슬래시를 같은 경로로 본다. 그래서 /shop/items/:itemId와 /shop/Items/:id, /shop/items와 /shop/items/가 조립을 통과했고 라우터는 그중 하나만 그렸다. 메뉴·레지스트리에는 둘 다 나왔다. 고른 방법 모양 키를 만들 때 소문자로 바꾸고 끝 슬래시를 지운다. 라우트 경로 문법을 소문자·끝 슬래시 없음으로 제한하는 검사는 기존 라우트에 새 규칙을 거는 것이라 버렸다. 위험·한계 라우터가 caseSensitive를 켜면 이 검사가 과하게 거절한다. src에 caseSensitive 사용은 없다. 검증 - RED: context-route-roots.test.ts의 새 두 행이 수정 전 실패. - tests/architecture, router, context-layouts → 9 files / 64 tests 통과. /a/new와 /a/:id 허용 행은 그대로 통과. eslint 통과. Refs: docs/reviews/2026-11-03-maturity-review/08-presentation.md 08-04 --- src/apps/deployable-app-module.ts | 9 +++++-- .../architecture/context-route-roots.test.ts | 27 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/apps/deployable-app-module.ts b/src/apps/deployable-app-module.ts index d25f93b5..c9fa5197 100644 --- a/src/apps/deployable-app-module.ts +++ b/src/apps/deployable-app-module.ts @@ -112,8 +112,13 @@ function assertFeatureRoutesReachOwningContext( `A feature replaces a platform route only by declaring its id (${FEATURE_REPLACEABLE_PLATFORM_ROUTE_IDS.join(", ")}).`, ); } - // Parameter names do not change how the router ranks a path. - const shape = path.replace(/:[^/]+/g, ":"); + // Parameter names do not change how the router ranks a path, and + // (1103/08-04) neither do letter case or a trailing slash: the router + // matches case-insensitively and ignores the slash. + const shape = path + .replace(/:[^/]+/g, ":") + .toLowerCase() + .replace(/\/+$/, ""); const earlier = claimed.get(shape); if (earlier !== undefined) { throw new TypeError( diff --git a/tests/architecture/context-route-roots.test.ts b/tests/architecture/context-route-roots.test.ts index 50b0c8b1..fceb7a32 100644 --- a/tests/architecture/context-route-roots.test.ts +++ b/tests/architecture/context-route-roots.test.ts @@ -223,6 +223,33 @@ describe("feature routes and platform routes", () => { ).toThrow(/ITEM_DETAIL.*\/shop\/items\/:itemId.*items.*ORDER_DETAIL.*orders/); }); + it.each< + Readonly<{ + differ: string; + first: Readonly>; + second: Readonly>; + }> + >([ + { + differ: "only by letter case", + first: { ITEM_DETAIL: "/shop/items/:itemId" }, + second: { OTHER_ITEM_DETAIL: "/shop/Items/:id" }, + }, + { + differ: "only by a trailing slash", + first: { ITEM_LIST: "/shop/items" }, + second: { OTHER_ITEM_LIST: "/shop/items/" }, + }, + ])("rejects two feature routes whose paths differ $differ", ({ first, second }) => { + // 1103/08-04. The router matches paths case-insensitively and ignores a + // trailing slash, so these tie like identical paths. + expect(() => + app( + context("shop", "shop/*", [feature("items", first), feature("others", second)]), + ), + ).toThrow(/OTHER_ITEM_.*others.*has the same path as route ITEM_.*items/); + }); + it("accepts a static path next to a parameter at the same depth", () => { expect(() => app(