Repository navigation
[PR] Blog pipeline: every post gets its own bilingual GitHub Discussion automatically - #5414
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7780-pr.5414.372dc18This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5414.tgz
npm install -g packageInstall instructions are refreshed on each push. |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: opencode/vllm-qwen/qwen3.8-27b)
Verdict: REQUEST_CHANGES (posted as a COMMENT review because GitHub refuses a change-request event on a PR from its own authoring identity — treat as blocking; do NOT merge until Finding 1 is resolved).
One load-bearing step cannot work against this repo's actual branch protection; every other facet reviewed clean.
Finding 1 (blocker): the manifest write-back commit will be rejected by master's branch protection
scripts/blog-discussions.mjs:218 (writeBackManifest) commits website/articles.json back to master via the Contents API using GITHUB_TOKEN, and .github/workflows/blog-discussions.yml grants it contents: write. Master currently enforces required status checks (strict, all CI test lanes as contexts). A brand-new commit has no passing check runs at push time, and GITHUB_TOKEN direct pushes are not exempt from required status checks (it is not an admin identity, and enforce_admins is off) — so the recording PUT will be rejected on every run.
Evidence, not speculation:
- Across master's entire history, zero commits authored by
github-actions[bot]sit on the first-parent chain — all 72 bot release-bump commits entered via PR merges. Direct pushes by the Actions token have never landed here. - This repo's own release infrastructure codes the same expectation:
.github/workflows/release-manual.yml:215attemptsgit push origin HEAD:masterand carries an explicit fallback —::warning::direct push to master was blocked (branch protection). Fallback: release prepared on a branch; a PR is needed to publish.
Impact if merged as-is: thread creation succeeds (the GraphQL mutation is unaffected), but the recording step fails → a red workflow on every qualifying blog push. The three-layer idempotency keeps duplicate threads out (good), but articles.json never gains numbers, so the dependent #5394/#5396 discussion-button feature is dead on arrival until someone edits the manifest by hand.
Suggested fix (pick one; owner decides posture):
- (a) Mirror the release-manual pattern: attempt the direct write-back, and on rejection fall back to pushing a
[bili-blog-pipeline]branch + opening a PR for the manifest update. One human merge closes the loop today; if protection is later relaxed for the Actions app, the direct path starts working automatically without code changes. - (b) A repo-scoped fine-grained PAT stored as a secret, used only for the write-back commit (an admin identity bypasses checks while
enforce_adminsis off). - (c) Owner relaxes master protection for the Actions app (ruleset bypass) — largest blast radius, your call.
Related body note: the "one-time prerequisite" (Settings → Actions → Workflow permissions = Read and write) is likely unnecessary — the workflow-level permissions: block (contents: write, discussions: write) already overrides the repository default token setting per GitHub's docs. Please verify on first live run and correct the body either way.
Verified clean
- GraphQL shapes, verified live read-only (no mutation executed): repository id ✓; discussion categories include lowercase
general(the script's"General" ?? "general"lookup lands correctly) ✓; discussions connection returns newest-first withbodyText(marker-scan ordering holds) ✓;CreateDiscussionInputaccepts exactlyrepositoryId/categoryId/title/bodyas sent ✓. - Idempotency: walked every crash point — created-before-recorded (marker scan recovers), lost response after create (same), concurrent runs (concurrency group serializes), recorded thread deleted (recreated + self-healing record), unverifiable state (aborts rather than duplicates). No duplicate-thread path found.
- Re-trigger loop guard (
thisPushIsOnlyOurOwnWriteBack): correct for plain pushes, squash merges (commit message = PR title), and merge commits (payload.commits = the PR's own commits, none prefixed). src/web/blogfeed.tsdedupe: module read in full; the manifest-wins filter is directionally right and the shipped manifest slugs align with the date-stripped flat-dir ids, so the two bundled posts collapse to one row each in the real tree. The new test builds a genuine overlap fixture (same file in flat dir + manifest entry) and asserts both the single-row outcome and the winnerkind— both directions pinned, real regression teeth.- Behavior-drift inventory (intended, disclosed here): the two bundled posts' feed rows flip
kindfrompost→article, so the panel shows the article-type label (src/web/client.ts:985) — cosmetic, content bytes unchanged. Both posts carry explicit frontmatter dates, so no sort/date drift despite the article path lacking the filename-date fallback. Remote-overlay merge (#4906) stays consistent (per-id Map, article wins on both paths).package.jsonfilesalready shipswebsite/articles.json. - Conventions & security: branch naming, single clean
feat:commit, no version bump, @v4 action pins matching existing workflows, no new config/env surface (standardGITHUB_*vars only), least-privilege token permissions, script talks only to api.github.com with UA + 30 s timeouts, token header-only (nothing secret in logs or errors).
Minor (non-blocking — fix in passing or leave)
repoId()is re-queried per post inside the creation loop — hoist it out.- Write-back re-reads the sha immediately before the PUT but the content snapshot dates from run start (lost-update window ≈ run duration; serialized by the concurrency group, acceptable).
- Two manifest entries sharing one slug would alias to a single thread (authoring error; degenerate, not dangerous).
Bottom line: the mechanism design is genuinely good and the web-side facet ships clean — but the write-back leg is provably dead on arrival against the current master protection, so REQUEST_CHANGES on Finding 1. Happy to re-review as soon as a fallback/PAT/ruleset decision lands.
(ai: opencode/vllm-qwen/qwen3.8-27b) Review 完成 → 已在 PR #5414 提交评审(判定 REQUEST_CHANGES):#5414 (review) —— 一个阻断项:「把讨论编号写回 articles.json」这步在 master 现行分支保护下必然被拒。查重:不重复(无其他 open PR/issue 做同一 blog-discussions 自动化;#5394/#5396 是下游依赖 PR,不同关注点)。GitHub 不允许对本人账号的 PR 发 change-request 事件,故以 COMMENT 评审形式发布、正文已显著标注阻断判定,合并权仍在人。 八问:
判定:REQUEST_CHANGES——Finding 1(写回通道)解决前不应合并;无 kernel 涉及,无需授权申请。修法落地后我复审。 |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 全仓 issue(open+closed)检索无同主题条目——这是落实你 2026-11-01 决策(讨论区自动建、镜像文章、双语)的新功能 PR,不是对已有条目的重做。 一句话判定:可合,但合前先收掉 F1(一处「代码 / 文档 / 日志三者自相矛盾」的小缺陷;happy path 和「绝不重复建线程」的安全性质都不受影响,属该修而非硬拦)。CI 全绿,diff 干净、每行都在目的之内。 我核了什么(既有行为清单 + 回归判定)
发现F1(建议合前处理)—
|
…ord thread numbers back into articles.json - scripts/blog-discussions.mjs: zero-dependency runner. For each manifest entry without a recorded number it creates one Discussion (English section first, then Chinese; creation-time mirror plus canonical-source reference; invisible body marker), then commits all new numbers back into website/articles.json with a [bili-blog-pipeline] prefix that also guards against re-trigger loops. Three-layer idempotency (number re-verification, marker scan over recent discussions, serialized concurrency) makes crash-window duplicates impossible to hide. api.github.com only — the raw host is blocked by the GFW, this host is not.- .github/workflows/blog-discussions.yml: push-triggered on blog surface changes, contents+discussions write, never cancel-in-progress.- website/articles.json: first real manifest (meet-bili + frequent-compression, explicit slugs matching the flat files so ids stay stable).- bundled feed dedupe: a manifest entry pointing at a flat posts-dir file previously rendered twice under one id; the manifest entry now wins (pinned test).
… be verified against a real repo without any writes
23ea4e9 to
1dd6a13
Compare
…n — try direct push, fall back to a fixed branch + one PR; honest log for vanished threads; newest-first marker scan; resolve repo id once; pin the safety properties with mocked-fetch tests (cherry picked from commit aebfd85c2d45c96d3d22ade2a40db47622abc2ab)
…rectly; numbers always land on the fixed branch as exactly one PR for a human merge
…-back no-op facet
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.995-master.ee0dcc7 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…iscussion, not node) The new blog pipeline (#5414) selected "{ node { number url } }" from the createDiscussion mutation, but GitHub's CreateDiscussionPayload exposes "discussion", not "node" — so the first master run of sync-discussions failed with "Field 'node' doesn't exist on type 'CreateDiscussionPayload'". Align the query and its result reads, and pin the selection in the unit test (positive + negative) so the wrong field cannot silently ship again.
… gate + ranxianglei#5414 blog pipeline No overlap with this lane's 16 files. The three generated docs conflicted because master regenerated them from a newer seed; resolved by taking master's bytes and regenerating from the lane's seed (chat pack +212 lines), which is the documented revert-then-keep flow for tools/gen-config-docs.mjs. ranxianglei#5506 matters to this workspace historically: it fixes the issue2129 restart-measurement flake I reported as ranxianglei#5379.
What this closes the loop
Owner decision (2026-11-01): the discussion area must be created automatically (never manually), mirror the article + reference it, and carry both languages. This PR is the machinery that does exactly that, end to end:
Pieces
<!-- bili-blog:<slug> -->marker before creating, and the concurrency group serializes runs. A push consisting only of our own[bili-blog-pipeline]write-backs exits early (no trigger loop). Talks to api.github.com only — raw.githubusercontent.com is unreachable behind the GFW while this host is not, which matters because Actions itself must run from here.website/blog/posts/**orwebsite/articles.json;cancel-in-progress: false(cancelling mid-write would orphan a thread).package.jsonalready listed this file in the npmfilesarray, so the slot was reserved for months).Honest limits
Tests
scripts/blog-discussions.mjs passes
node --check; workflow YAML parses; full local blog suite green (web-blogfeed 12/12 incl. new dedupe facet, web-blog-route + i18n + refresh 25/25); tsc clean.