fix(harness): lint-rewrite-coverage 只查单向 —— 不检测 rewrite 通配把前端页面代理走
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 969
Description
## 背景
在 #595 段 3 开发中被实测发现(coord-chat-e2e 线):`next.config.mjs` 曾短暂写成
`${prefix}/admin/:path*` 这种宽通配,会把整片 `/admin/*` 前端页面(如 `app/admin/[module]/page.tsx`,
`core-loop.spec.ts:128` 真实 `page.goto` 过)代理去 API,而不是渲染前端。
`lint-rewrite-coverage`(#539/#574)只检查「每条 API 路由前端够不到」这个方向,
**不检查反方向「这条 rewrite 会不会遮蔽一个真实存在的前端页面路由」**。
这次因为 API 路径是复数 `/admin/skills`、前端是单数 `/admin/skill`,纯属命名巧合没有炸。
## 要求
补一道反方向检查:扫 `apps/web/app/**/page.tsx` 的真实路由,与 `next.config.mjs` 的 rewrite
`source` 通配做交集,交集非空即报警。
⚠ 写这道门时要小心空转:一个天真的实现会在**现有的合法重叠**上报红(`/chat/:path*` 遮蔽
`/chat/live`、`/projects/:path*` 遮蔽 `/projects/[projectId]` 等——这些是 rewrite 故意精确到子路径、
不影响这些具体页面路由的合法写法)。需要配一份类似 #539 的棘轮豁免名单,而不是简单交集判空。
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the lint-rewrite-coverage check from #539/#574, comparing routes under apps/web/app/**/page.tsx with rewrite sources in next.config.mjs. Review core-loop.spec.ts:128 and the existing legal overlaps such as /chat/live and /projects/[projectId]. Done means broad rewrites like /admin/:path* are reported while documented legitimate overlaps remain covered by a ratchet exemption list.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, typescript
- Domain
- frontend, testing-qa, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100