Skip to content

deps: express 5.3.0 + path-to-regexp v8 wildcard fix - #75

Merged
alloevil merged 3 commits into
masterfrom
deps/express-5
Oct 18, 2026
Merged

alloevil merged 3 commits into
masterfrom
deps/express-5

Conversation

@alloevil

@alloevil alloevil commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Supersedes #73

根因

#73(express 4.22.2 → 5.3.0)的 CI:claims run 39091258609 显示 ERR test-count [error] timed out after 120s (exit 124),test run 39091258611 一直卡在 npm test(已手动取消)。原因有两层:

  1. 服务一启动就崩。 server.js 的 SPA 兜底路由 app.get('*', …) 在 Express 5(path-to-regexp v8)下不合法,node server.js 直接抛出:PathError [TypeError]: Missing parameter name at index 1: *。所有要起服务的测试都报 server exited before ready。
  2. 崩溃变成挂起。 test/llm.test.js 有两个用例先起 mock OpenAI 服务、再 startServer。startServer 抛错时走不到 try/finally,mock 不会关,开着的监听让 node --test 永远不退出。

修复

  • server.js:app.get('*', …) 改成 app.get('/{*splat}', …)。这种具名通配写法和 Express 4 的 * 一样,也能匹配 /。
  • test/llm.test.js:startServer(NO_CLI).catch(async (e) => { await mock.close(); throw e; })。以后服务再起不来,这个文件约 2 秒就失败,不会把 CI 挂住(用改坏的 server.js 验证过:6 fail、exit 1、2s)。
  • package.json / package-lock.json:express ^5.3.0(同 chore: bump express from 4.22.2 to 5.3.0 #73)。
  • 其他 Express 5 变化都查过,不需要改代码:其余路由都是普通 :param;req.query 只读平铺的键;req.body 都有 || {} 兜底;没有用 res.send(status)、app.del、req.param()。

本地验证(Node 22.23.3)

  • npm ci(完整构建 UI):✓ built in 601ms;pure.js 和 diagnostics.cjs 没有漂移;biome check exit 0
  • npm test:# tests 348 · # pass 348 · # fail 0 · # cancelled 0,耗时 8 秒(合并 master 的 security: rate-limit every route (express-rate-limit) — fixes CodeQL js/missing-rate-limiting #76 之后是 349/349)
  • verify-claims:16 machine-checked · 16 ok · 0 failed · 0 error · 3 manual
  • 同一组路径在 Express 4(master)和 5 上返回完全一致:/、/some/deep/path、/legacy、/legacy/x/y、/api/version、/api/agents?dir=…、/assets/nope.js → 200/200/301/200/200/500/200

验收标准

更新(合并 master 之后)

已把 master(含 #76 限流)合并进本分支(a286e55,普通 push)。app.use(limiter) 在 /{*splat} 之前挂载,新增的限流测试也覆盖了 SPA 兜底(/no/such/page)。CodeQL:No new alerts in code changed by this pull request,#78 已是 fixed。

dependabot Bot and others added 2 commits October 17, 2026 20:40
Bumps [express](https://github.com/expressjs/express) from 4.22.2 to 5.3.0.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@v4.22.2...v5.3.0)

---
updated-dependencies:
- dependency-name: express
  dependency-version: 5.3.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
# Conflicts:
#	package-lock.json
#	package.json
@alloevil
alloevil merged commit 5e48017 into master Oct 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant