fix(frontend): declare admin users runtime locally
Staging Backend Quality Gate / validate (push) Successful in 16m8s
Staging Backend Quality Gate / publish (push) Successful in 12m59s

This commit is contained in:
Jesse_Chen
2026-08-06 21:20:12 +08:00
parent de2caf6249
commit 9a3d0d440f
3 changed files with 19 additions and 2 deletions
+13
View File
@@ -2256,3 +2256,16 @@
- 相关记录:BUG-124
- 复发自:BUG-124
- 修复版本:待提交(本地可测)
## BUG-131 | Admin users route config re-export blocks Turbopack quality gate
- 状态:resolvedlocal
- 首次发现:2026-08-06
- 最近更新:2026-08-06
- 影响面:`frontend/src/app/api/admin/users/route.ts` 与 Next.js 16 Turbopack production build。
- 用户现象:Gitea quality gate 的默认 `next build` 无法解析 `/api/admin/users` route config。
- 根因:别名 route 从 `../customers/route` re-export `runtime`Next/Turbopack 要求 route config 在 route 文件内静态本地导出。
- 修复:在 users route 本地声明 `export const runtime = "nodejs"`,仅 re-export HTTP handlers;扫描全部 route 后未发现其他 `runtime``dynamic``revalidate` re-export。
- 验证:admin users contract、`tsc --noEmit`、默认 Turbopack `next build``next build --webpack``git diff --check`
- 防复发:route config 必须在各自 route 文件内静态声明,别名 route 只能 re-export handlers。
- 修复版本:本提交(本地已验证)
+3 -1
View File
@@ -1 +1,3 @@
export { DELETE, GET, PATCH, POST, PUT, runtime } from "../customers/route";
export const runtime = "nodejs";
export { DELETE, GET, PATCH, POST, PUT } from "../customers/route";
+3 -1
View File
@@ -39,5 +39,7 @@ test("admin_users migration is service-role-only and auditable", () => {
});
test("legacy admin users route aliases the guarded customer resource", () => {
assert.match(usersSource, /export \{ DELETE, GET, PATCH, POST, PUT, runtime \} from "\.\.\/customers\/route"/);
assert.match(usersSource, /export const runtime = "nodejs"/);
assert.match(usersSource, /export \{ DELETE, GET, PATCH, POST, PUT \} from "\.\.\/customers\/route"/);
assert.doesNotMatch(usersSource, /export \{[^}]*\bruntime\b[^}]*\} from/);
});