Skip to content

[PR] feat: panel blog live-refreshes posts from GitHub master (#4906) - #4915

Closed
ranxianglei wants to merge 5 commits into
masterfrom
2026-10-27_blog-live-github-master
Closed

ranxianglei wants to merge 5 commits into
masterfrom
2026-10-27_blog-live-github-master

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

The panel's Blog view served posts frozen at npm-release time — master's new posts waited for the next release + self-update. This makes /__bili/blog pull the latest website/blog/posts/*.md from GitHub master behind a 1-hour access-driven throttle, failing soft onto the bundled copy otherwise. Style mirrors the changelog module (#3719): in-memory cache only, no config keys, no env vars, no disk cache files, no resident timer.

Behavior change (old → new):

Config surface: none — deliberate. No new key/env/flag; the refresh window and caps are module constants (changelog precedent, #3719).

Mechanics: ONE api.github.com contents call per window (unauthenticated, inside the 60 req/h anonymous budget) plus raw.githubusercontent.com fetches for the markdown bodies (no API quota), concurrency 4, 15 s whole-refresh budget via a shared AbortController — an overrun aborts the whole refresh so a partial set can never become authoritative. An empty listing is treated as content anomaly (fail soft), not truth. Relative image refs in live posts rewrite onto raw.githubusercontent.com absolute URLs (web/markdown.ts passes absolute http(s) image targets through untouched, so the guarded /__bili/blog-assets/ route stays bundled-only); traversal refs drop.

Tests: new tests/web-blog-live.test.ts (10 cases, both gate directions: merge replace/append/delete-on-master/articles-stay-bundled, throttle + force bypass, network/HTTP-500/non-array/empty-listing fail-soft, per-file fallback, remote image rewrite incl. traversal drop, malformed listing rows, budget abort, always-200 handler). blogfeed.ts gains exported shared helpers (renderPostText / shapePost / sortBlogItems / postIdFromBase) used by both disk and live paths so the two views cannot drift. In passing: dropped renderBody() from blogfeed.ts — dead since #4587 shipped (definition only, zero callers repo-wide).

Verified locally: typecheck + build clean (dist external-dep check OK — no new dependencies); targeted suites 30/30 (web-blog-live, web-blogfeed, web-changelog, web-blog-route); real-bundle smoke test (boot dist, GET /__bili/blog twice) — 200 JSON with the live refresh succeeding against real GitHub, second call instant (throttled). Full-suite verdict: CI on this head.

Closes #4906

ci-check added 2 commits October 27, 2026 11:54
…e overlay (#4906)

Extracts frontmatter+H1+markdown rendering into renderPostText, bilingual item assembly into shapePost, and feed ordering into sortBlogItems (+ postIdFromBase) — exported so web/blog-live.ts reuses the exact same definitions instead of drifting copies. collectPosts/collect now go through them with zero behavior change (web-blogfeed suite unchanged and green).

In passing: drops renderBody(), dead since #4587 shipped (definition only, zero callers repo-wide).
The panel blog (/__bili/blog) served posts frozen at package-release time; newly written posts waited for a release + self-update. /__bili/blog now overlays the bundled feed with the latest website/blog/posts/*.md from GitHub master, access-driven like web/changelog.ts (#3719): one network round per hour of panel use (contents listing + raw bodies, concurrency 4, 15s wall-clock budget), in-memory cache only — no config keys, no env vars, no disk cache, no resident timer.

A successful listing is authoritative for posts: changed posts replace their bundled twin, new slugs append, posts deleted on master leave the panel, and a listed post whose body fails to fetch keeps its bundled twin. Every failure mode (offline, HTTP error, non-array or empty listing, budget overrun) fails soft to the bundled feed with error:"offline" — the handler still answers 200 and the panel never errors. Articles stay bundled. Relative image refs in live posts rewrite onto raw.githubusercontent.com (markdown.ts passes absolute http(s) image targets through); traversal refs drop.

Closes #4906
@ranxianglei ranxianglei changed the title feat: panel blog live-refreshes posts from GitHub master (#4906) [PR] feat: panel blog live-refreshes posts from GitHub master (#4906) Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-27_blog-live-github-master (133f2d4)

Latest build — install this exact version

npm install -g billion-context@0.0.6381-pr.4915.d241337

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
133f2d4 billion-context@0.0.6381-pr.4915.d241337 build
556f0a6 billion-context@0.0.6379-pr.4915.6929a19 build
0862dad billion-context@0.0.6374-pr.4915.f9304b8 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr4915.tgz
npm install -g package

Install instructions are refreshed on each push.

ci-check added 2 commits October 27, 2026 12:16
admin.ts now serves /__bili/blog through handleBlogLiveGet, so the bundled-only
handler had zero production callers repo-wide. Removing it (the always-200
handler behavior stays covered by tests/web-blog-live.test.ts); the disk-feed
test keeps its broken-manifest degradation half.
…nto phantom deletions

MAX_FILES used to slice the parsed listing: posts beyond the cap were excluded
from listedIds, which mergeLive reads as deleted-on-master — silently stripping
real master posts from the panel, the opposite of fail-soft. Over-cap now throws
so the refresh degrades onto the bundled feed, pinned by a 51-row regression.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策

This conflict is not textual drift — it is a design clash between two incompatible implementations of the same feature (#4906), and no mechanical rebase can resolve it without picking one of the two designs. The merge-guard run of 2026-10-29 already identified this and filed decision request #5170 (p1); that issue was closed by @ranxianglei on 2026-10-31T17:45Z as completed with zero comments — no explicit choice was ever recorded in-thread, and the PR has stayed dirty since. I am re-surfacing the decision rather than guessing.

Live state verified this run (2026-11-12):

Options (unchanged from #5170):

Default if undecided: hold — no push, branch unchanged at 133f2d4fd; do not attempt another mechanical rebase. Under that default the only remaining work is option A's owner action (close the PR).

Option-A residual verification (the one open item from #5170): does master have the over-cap "phantom deletion" protection this PR's last commit 133f2d4fd added? Yes, structurally — src/web/blog-refresh.ts line 234 throws round file count exceeds ${MAX_TOTAL_FILES} (cap 200) before any registration when files.size + imageTargets > MAX_TOTAL_FILES, and the catch path registers only the error:"offline" marker while keeping the last good overlay / bundled floor (atomic replacement design). An over-cap listing can therefore never become authoritative — there is no truncate→treat-as-deleted→phantom-delete path on master. No regression pin needs adding.

请拍板:确认 A(并请你自行关闭本 PR),或选 B/C。标签已打 needs-decision。

八问

  1. 是什么问题:PR [PR] feat: panel blog live-refreshes posts from GitHub master (#4906) #4915 与 master 冲突无法自动合并——根因是同一个功能 Web Panel Blog: Automatically pulls new posts from GitHub master — no need to wait for a release. | Web 面板博客:自动从 GitHub master 拉取新文章,不用等发版 #4906(面板 Blog 从 GitHub master 实时拉文章)存在两套互不兼容的实现,必须二选一。
  2. 什么原因导致的:Web Panel Blog: Automatically pulls new posts from GitHub master — no need to wait for a release. | Web 面板博客:自动从 GitHub master 拉取新文章,不用等发版 #4906 先在 master 侧用 blog-refresh.ts(每小时自调度定时器链)落地并随多个后续 PR 演进;本 PR 并行开发、用了另一套方案(blog-live.ts,访问驱动节流、无常驻定时器),两边都接 /__bili/blog,且本 PR 删掉了 master 仍在用的主 handler handleBlogGet——设计层面互斥,不是文本漂移。
  3. 影响范围与严重程度:只阻塞本 PR 合并;线上面板 Blog 功能由 master 实现正常提供,无用户可见故障。按「需 owner 拍板的方向/契约选择」定级 p1(沿用 decision request: panel blog GitHub-master refresh has two conflicting implementations (#4906) — choose which ships #5170)。
  4. 怎么修复的:本轮不改代码——这是方向裁决而非机械冲突。完成 decision request: panel blog GitHub-master refresh has two conflicting implementations (#4906) — choose which ships #5170 遗留的唯一技术核对项:master 已具备超上限幻影删帖防护(MAX_TOTAL_FILES=200 注册前 throw + 原子替换,超限整轮回退保留最后好快照/捆绑版),无需补回归钉。选项 A/B/C 与推荐见上。
  5. 是否有回归问题:本轮零推送、零分支改动,无回归面;所有结论均为对 live master(c26c31ace4)代码的只读核对。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:本轮未改。若拍板 A = 维持 master 既有方向(常驻自调度刷新链)为本功能的最终形态。
  8. 是否引入了新的配置:无。

判定:待 owner 拍板(推荐 A:确认后请你关闭本 PR);本轮未修改分支,已打 needs-decision 标签,不再触碰该 PR。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

1 similar comment
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Status after forced restart (no output for 34 min, floor 27) — re-verified everything live this run; nothing has changed, still blocked on the same owner decision from floor 22.

Live state this run (2026-11-12):

Why I still won't rebase: the conflict is the two incompatible #4906 implementations (master's blog-refresh.ts timer-chain vs this PR's blog-live.ts access-driven handler, which also deletes master's primary handleBlogGet). Options unchanged: A (recommended) keep master's impl, close this PR as superseded (closing is owner-only — agents cannot close PRs); B revert master's impl; C reconcile (≈ rewrite one side). Default if undecided: hold, no push. The one open technical item from decision request #5170 is already verified done (master's MAX_TOTAL_FILES=200 pre-registration throw + atomic replacement covers the over-cap phantom-delete hole; no regression pin needed).

八问(本轮)

  1. 是什么问题:PR 与 master 的冲突是同一功能 Web Panel Blog: Automatically pulls new posts from GitHub master — no need to wait for a release. | Web 面板博客:自动从 GitHub master 拉取新文章,不用等发版 #4906 的两套互不兼容实现,需 owner 二选一,非机械冲突。
  2. 什么原因导致的:master 侧 blog-refresh.ts 已落地并演进(含 owner follow-up);本 PR 的 blog-live.ts 并行开发、接同一路由且删掉了 master 仍在用的 handleBlogGet。
  3. 影响范围与严重程度:只阻塞本 PR 合并;线上面板 Blog 由 master 实现正常提供,无用户可见故障(p1 = 方向裁决类)。
  4. 怎么修复的:本轮零代码改动——重新 live 核验了 PR/master/CI/线程状态,确认与 floor 22 时一致;继续等待拍板(推荐 A)。
  5. 是否有回归问题:无——本轮未推送、未动分支。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:未改;master 侧方向(自调度刷新链)保持现状。
  8. 是否引入了新的配置:无。

判定:继续 hold,待 owner 拍板(A = 确认后请你关闭本 PR;B/C = 指明方向我再来对齐)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Re-trigger status ping (no change since floor 28 — full decision request remains at floor 22, not re-pasted here).

Live-verified this run (2026-11-13):

Position unchanged: the conflict is the two incompatible #4906 implementations (master's blog-refresh.ts timer-chain vs this PR's blog-live.ts, which also deletes master's primary handleBlogGet) — not mechanically resolvable. A (recommended): keep master's impl, close this PR as superseded (owner-only action); B: revert master's impl; C: reconcile (≈ rewrite one side). Default if undecided: hold — no push, branch untouched.

八问(本轮)

  1. 是什么问题:PR 与 master 的冲突是同一功能 Web Panel Blog: Automatically pulls new posts from GitHub master — no need to wait for a release. | Web 面板博客:自动从 GitHub master 拉取新文章,不用等发版 #4906 的两套互不兼容实现,需 owner 二选一,非机械冲突。
  2. 什么原因导致的:master 侧 blog-refresh.ts 已落地并持续演进;本 PR 的 blog-live.ts 并行开发、接同一路由且删掉了 master 仍在用的 handleBlogGet。
  3. 影响范围与严重程度:只阻塞本 PR 合并;线上面板 Blog 由 master 实现正常提供,无用户可见故障(p1 = 方向裁决类)。
  4. 怎么修复的:本轮零代码改动——live 重新核验 PR/master/CI/线程状态,确认与 floor 22/28 一致;继续等待拍板(推荐 A)。
  5. 是否有回归问题:无——未推送、未动分支。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:未改;master 侧方向保持现状。
  8. 是否引入了新的配置:无。

判定:继续 hold,待 owner 拍板(A = 确认后请你关闭本 PR;B/C = 指明方向我再来对齐)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

1 similar comment
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

Closing: the feature is already on master — src/web/blog-refresh.ts, 5d140d7 (hourly self-scheduling blog refresh chain) and b1f2bd2 (blog tab). Issue #4906 is closed; this branch is the superseded implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant