Repository navigation
test: cover chain-detection disk branches — loadSync restart ownership, BILI_CHAIN_CONTENT parsing, warn-set FIFO - #1174
ranxianglei wants to merge 1 commit into
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1174Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1174.tgz
npm install -g packageInstall instructions are refreshed on each push. |
|
[bot] 🏷 Closing as duplicate. The three branches this PR covers are already covered on master since #1090 merged (2026-09-22, merge commit Line-by-line comparison against this PR's diff: same three scenarios, same assertions, no unique branch or edge coverage. This PR's base (master Only difference: the restart test here resets memory on the SAME store instance, while master's T7 swaps in a fresh If you believe there is a scenario T7-T9 miss that this file catches, point at the specific assertion and I will fold it into the canonical file. 中文摘要:这三个分支的覆盖已随 #1090 合入 master(T7/T8/T9),本 PR 与之逐行重复且无独有断言,按查重规则关闭。 |
Fixes #1101
What
#1090's four integration tests all injected
_setStoreForTest(new SessionStore({ enabled: false })), leaving three disk-adjacent branches of the chain-detection content fallback with zero coverage. This addstests/issue1101-chain-disk-coverage.test.tswith exactly the three tests the issue asks for:store.loadSyncrestart path — persisted-then-restart integration: realSessionStore({enabled:true})over a temp dir → plain request creates state →flushAllSessions()→_resetSessionsForTest()(simulated restart, memory empty, disk intact) → the same conversation re-sends the [Bug] 链检测把 bili 自己注入的 ACP 产物判成 bili→bili 链 —— 压缩内核永久跳过,长会话撞 1,048,576 上限 400(v0.1.133 回归) #1086 artifact body → asserted processed, not byte-identical passthrough, zero[chain]warns, session resurrected via loadSync. This is the auto-update-restart ownership path from [Bug] BILI_PERSIST=0 重启后自己的会话被永久判为 bili→bili 链(#1086 残留,#1090 随附) #1100.BILI_CHAIN_CONTENTenv parsing —loadOptions({})default-on;=0disables; filechainContentDetection:falsehonored when env unset; env=1wins over file. Deterministic viaBILI_CONFIG_FILEpointed at a temp dir.warnedChainSessionsset to exactlyWARNED_CHAIN_SESSION_CAP(4096), fires one real foreign-artifact request through the server, asserts: oldest entry evicted, size stays capped, the triggering session still gets its exactly-one warn.Finding worth noting
While writing test 3 I confirmed a design detail the tests now document:
server.tsseedsartifactSeedonly whengetStore().enabled— with persistence disabled the content fallback is OFF entirely ("no local state" cannot distinguish a foreign chain from this instance's own session after a restart, so processing is the safe default). The FIFO test therefore runs an enabled store over an empty dir, same as T3 in issue1086-chain-self-exemption.Verification
npm run typecheckclean.