boardx / boardx/boardx-dev-template

F03 e2e:切换器点击导航测试 dev-server 竞态导致偶发跳转 oauth 登录(非鉴权缺陷)

Open
#797 0 comments 0 reactions 0 assignees View on GitHub
area:devportal
Dominant language
TypeScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

`apps/devportal/e2e/p30/workspace-authz.spec.ts` 的最后一条用例(「从切换器真实点击路径进入 /p/:slug」)目前 `test.skip`。

**现象**:登录 owner-user,从 /me 的项目切换器点击进入 /p/fixture-proj——点击触发 Next.js Link 的 RSC 导航,抓包发现连续发出两个 `_rsc=` 请求,携带**逐字节相同**的 Cookie header:第一个 200,紧随其后的第二个 302 跳转到 oauth 登录(视为未登录)。`page.waitForLoadState("networkidle")` 等 prefetch 稳定后再点击也无法消除。

**已排除**:
- 不是 cookie 名称/`__Host-` 前缀问题(`context.setExtraHTTPHeaders` 注入的 cookie 两次请求都在,且值相同)。
- 不是 F03 服务端裁剪逻辑问题——其余 9 条用例(含单次 `page.goto("/p/fixture-proj/settings")` 请求路径)稳定通过,充分覆盖了 `resolveWorkspaceAccess` 本身。

**怀疑方向**:next dev 边缘运行时(`middleware.ts` 跑在 edge runtime)在背靠背两个请求上表现不一致——可能是 dev 模式下 edge 函数的重复实例化/HMR 相关竞态,需要专门起 `next dev` 手动复现抓包,或改用 `next build && next start`(生产构建模式)跑同一条用例验证是否只在 dev 模式下出现。

**优先级**:低——不影响任何真实用户路径的正确性判断,只影响这一条端到端点击流程测试的稳定性。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the skipped test in apps/devportal/e2e/p30/workspace-authz.spec.ts and reproduce the switcher click under next dev while capturing the two _rsc= requests. Run the same test with next build && next start to compare dev and production behavior; done means the cause is identified and the end-to-end test no longer intermittently redirects to OAuth.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
devtools, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.