Repository navigation
[PR] fix: panel blog detail route accepts encoded non-ASCII and dotted slugs - #4961
ranxianglei wants to merge 14 commits into
Conversation
Blog ids keep arbitrary filename characters (Chinese, dots, ...) and the index links them encodeURIComponent'd, but route() only matched [A-Za-z0-9_-]+ — every such click fell through to overview and the detail page was unreachable. Widen the capture to (.+) like the sessions route already does; loadBlog exact-matches the decoded id and degrades to a not-found card, so nothing new can be injected. Regression test pins both directions: the index emits the encoded hrefs AND those exact hashes route back to the matching article page.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7255-pr.4961.2e7eaa0This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4961.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复(open+closed issue+PR 全检索,blog 路由/详情页方向仅 #4957 + 本 PR 一组;#4915 是 #4906 博客车道的跟踪帖,与本机制无关)。标签: 不新打——bug #4957 已带 这是对已完成工作的 PR 审核(分支 方向(审原 issue):问题真实存在,根因定位正确。机制自查复现:索引行 href = 回归审查(既有行为逐项):
代码审查:一行正则放宽 + 三行注释说明为什么(引 #4957、点明 exact-match 兜底),与周边风格一致。放宽后无注入面:解码后的 id 只进 测试有效性:新测试用 vm sandbox 驱动真实 diff 整洁度:2 文件 +41/-3,单 commit,无跑题文件/空白噪音;测试 harness 仅加一个默认原值的 八问:
CI 状态:static-gates×2 / build-artifact / version-guard / test-import-graph / lane-guard / pi-subagents-guard / mysql-contract 及全部 e2e 车道已绿;7 个 判定:可合。自动合并门槛(§7.4)逐项满足:单模块纯 |
(ai: vllm-qwen/qwen3.8-27b) Review 结论:可合(独立审核,非复读 issue 结论)。 独立验证与回归清点:
八问:
CI:head |
(ai: vllm-qwen/qwen3.8-27b) CI 收尾确认: 上一条的判定维持:可合,等 owner 合并。 |
Parallel PR #4969 (same one-line fix, opened later) pinned two extra shapes this suite did not: a dot + middot + CJK mixed id, and the not-found degradation for an unknown ENCODED non-ASCII id. Absorb both so the surviving PR carries the union of coverage; #4969 is marked duplicate of this branch's PR.
PR #4961 fixes #4957 (panel blog detail route rejecting encoded/dotted slugs): the identical one-line regex widening ^#/blog/(.+)$ plus equivalent non-ASCII/dotted-slug regression tests already landed on master via ca90e44 ('fix: blog detail route rejected non-ASCII slugs ... (#4957)'), and issue #4957 is closed by that merged fix. Every conflict resolved in favor of master, so this branch converges to a no-op superset of master (net-new contribution: none) and can be closed as duplicate of ca90e44 without importing redundant tests.
…uires (#4599) The #5140 recovery test proves forkSnapshot reconstructs a non-retained parent's raw tail from the UNIFIED index — but it never pinned its own storage mode. Under the CI storage baseline (preload-storage-baseline.mjs sets BILI_STORAGE_UNIFIED=legacy for the broad corpus) no unified rows exist, so the reconstruction has no source and forkSnapshot fails closed with 409 SNAPSHOT_UNAVAILABLE. Deterministic, not a flake: reproduces 100% on master and any merged branch with BILI_STORAGE_UNIFIED=legacy, passes without it (default shadow). Pin full like the sibling persist tests and restore the ambient value afterwards.
ci-fixes at 67f8e89 still leaves four Windows shards red, and all four deltas already exist on PR #5178. This ports the missing hunks so the convergence branch actually converges. 1. `test (windows-latest, 2x, 3)` — #5103. `UnifiedShadow` builds its db path as `${dir}/index.db`, so the open-failure warning reads `C:\...\sessions/index.db`. `issue5103` asserts the warning contains `path.join(dir, "index.db")` — `...\index.db` on win32 — so a mixed separator never matches. `path` is already imported at :30 and the db is opened through the same join, so POSIX output is byte-identical. 2. `test (windows-latest, 22, 4)` + the 4788 leg — #4739/#4788 teardown. The suites arm a real `SessionStorage` under `BILI_STORAGE_UNIFIED=full`, so the sidecar is still open at teardown. `cancelAll()` clears timers and the build map but never closes the shadow; Windows refuses to unlink a directory holding an open file (`EBUSY`/`EPERM` on `index.db`). Use `closeQuietly()` — cancel, then close — in the short-lived-store teardown. 3. `test (ubuntu-latest, 24, 3)` + `(windows-latest, 22, 2)` — #5155. Both cold-rebuild cases waited for the debounced durable flush with a fixed `setTimeout(20)`. A millisecond budget is a deadline a loaded runner can miss, and the miss is an honest `409 !== 200` from a one-turn-stale table. Await the settle itself: `afterNextFlush("conv-ptrs")` resolves once the armed save lands. 4. `test (ubuntu-latest, 22, 3)` — #4788 verdict deadlock. `afterNextFlush` parks a resolver in `flushWaiters`, and the only thing that drains it is the debounce timer — which is armed `unref?.()`. Once that timer is the last pending handle the loop drains, the promise never settles, and node reports `Promise resolution is still pending but the event loop has already resolved`. Keep the timer referenced exactly while a waiter exists (`ref()` on waiter registration; the host-upkeep default stays unref'd). Both view hunks and the two test-teardown hunks are byte-identical to the ones already on PR #5178, so this converges the branches instead of inventing a third variant. Verified locally: `npx tsc --noEmit` clean; issue4788 0/4 -> 4/4; issue4739 4/4; issue5103 5/5; inc-canonical-pointers 3/3. The `cancelAll` -> `closeQuietly` hunk has no local negative control: reverting it keeps Linux green because `EBUSY`/`EPERM` only fire where an open handle blocks unlink. That control can only run on a Windows lane — stated rather than papered over. The #4788 arm's own reader is confirmed instead: `cancelAll()` leaves `index.db`, `index.db-shm`, `index.db-wal` in `/proc/self/fd` while `closeQuietly()` leaves none (probed directly).
…e settle (#4599) The turn() helper arms scheduleSave whose debounce timer is unref by design (persist.ts: a pending save must not hold the process open at shutdown) and then awaits afterNextFlush. Nothing else in that await is refd, so in a node:test child whose only surviving handles are unref sockets the event loop drains before the 50 ms debounce fires and the settle promise never resolves: all four subtests fail with "Promise resolution is still pending but the event loop has already resolved" / cancelledByParent. Reproduced deterministically on master 44067a5 AND on pre-merge ci-fixes 67f8e89 (standalone run, exact CI preload chain), while the same file has passed some CI legs by ambient-liveness luck - a born-flake per section 7.2 (no environmental luck). The pin at 67f8e89 does not touch this path. Fix: arm a refd 25 ms keep-alive interval around the afterNextFlush await (cleared in finally) so the debounce fires deterministically on every host. Test-only diff; production settle semantics untouched.
…ts ref-tracking fix (#4599) PR #5262 fixes #4788 at the source: scheduleSave now leaves the debounce timer refd while flush waiters exist (and afterNextFlush refs a pending unrefd timer when a waiter registers), so the settle is deterministic for EVERY caller on every host. The 25 ms keep-alive interval added in a3019b0 only patched this one test file and is redundant now; removing it leaves one mechanism instead of two. The comment stays: without it a future reader re-adds the interval or deletes the persist.ts tracking as dead weight.
|
Closing: the branch is fully in sync with master — the three-dot diff against origin/master is empty; the blog-detail route slug handling it carries is already on master. |
Closes #4957
What
Blog ids keep arbitrary filename characters (Chinese, dots, ...) —
src/web/blogfeed.tsderives them from filenames with no charset restriction — and the panel index links each card as#/blog/+encodeURIComponent(id). Butroute()only matched^#/blog/([A-Za-z0-9_-]+)$, so every encoded/dotted href failed the match and fell through to the defaultoverviewpage: clicking such a card landed on overview and the detail page was permanently unreachable.Fix (one line)
src/web/client.ts: widen the blog capture group to(.+), exactly like the sessions route (^#/sessions(?:/(.+))?$) already does. The existingdecodeURIComponent(blg[1])then restores the original id, andloadBlogexact-matches it against the feed (items.find(x => String(x.id) === String(sub))), degrading to a not-found card on a miss — so the widened pattern cannot surface wrong content or inject anything.Behavior change
None for currently-working links: ASCII
[A-Za-z0-9_-]slugs are a strict subset of.+. Only previously-unreachable hrefs (percent-encoded or dotted ids) now resolve. No config, wire, persistence, or kernel impact — panel client routing only.Tests
tests/web-blog-route.test.ts: new regression test pins both directions — the index emits the encoded hrefs for a Chinese-id post and a dotted-id article, AND those exact hashes route back to the matching article page (body rendered, back link present, no overview fallback). Verified red before the fix, green after. Existing 4 routing tests + fullweb-blogfeed.test.tssuite stay green; typecheck + build clean.