Repository navigation
test(compress): make multi-block afterTokens scale guard non-vacuous (#378) - #379
Conversation
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-379Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr379.tgz
pi install ./packageThis comment is automatically updated on each push. |
[bot] 🏷 Reviewed #379 (fixes #378). Verified independently on top of current master (a8dfb49): Duplicate screening: no other open PR/issue touches #378 — #379 is the sole fix. Related to #377 (panel reformatting) but deliberately orthogonal: the "compression really happened" proof uses format-independent signals (ACP line present, no Triage verdict
Verification (all done by me, not taken on faith)
Minor (non-blocking): the new No fixes needed from me — nothing to patch. Ready to merge (merge itself stays human-only per repo rules). 一句话中文摘要:独立复验通过——diff 干净(仅测试文件 28+/12−)、全套 693 绿、且我亲手把 src/compress-tool.ts:418 换回 raw projection 确认新守卫确实咬合(测试如预期失败后已还原),#289 多块尺度不变量从此有有效守卫,可以合并。 |
…cuous-multiblock-scale-test test(compress): make multi-block afterTokens scale guard non-vacuous (ranxianglei#378)
…ildState carries image ledgers - kernel 0.0.83 -> 0.0.86: bundles ranxianglei#379/ranxianglei#380 (tier2Trigger 5->1000, tier3Trigger 10->2000, ranxianglei#238 usage gate deleted) — count-triggered distillation is default-off; growth/token-mass stay the need signal. Fixes the prefix-cache sawtooth class (billion-context#1249). - deriveChildState: carry imageFullRestored/imageShrinks from the parent (ref space is NOT re-issued on derive, so the ledgers stay valid for inherited content; kernel resetImageFullState applies only to ref-reissue resets). Without them image_full on an inherited shrunk ref falsely refused. - t3-rewrite-guard ranxianglei#344 test pins the hint mechanism with explicit low triggers; new tier-ready-hint.test.ts asserts default-off silence.
Fixes #378
Problem
tests/compress-tool.test.ts"compress afterTokens is measured on the same sent-view scale as beforeTokens (multi-block)" claimed to guard the #289 invariant (afterTokens must be measured on the post-processTurn sent view, which carries every active block's summary anchor + ref-tag overhead), but both compress calls in it were rejected by the kernel'sminCompressRangegate (default 5000 chars — the payloads were 52 / 193 chars). Both panels rendered as no-ops (646 → 646 tokens (~0 reclaimed, 0 block)+Errors: Total compressible content too small ...) and every assertion passed anyway: the guard was vacuous.Change (tests/compress-tool.test.ts only)
Follows the #309/#322 test pattern:
preserveRecentMessages: 1, so m00001/m00003 are actually compressible;formatK's ±50-token rounding buckets;Errors:line, and the sidecar state file holds exactly 2 blocks with non-empty stored summaries;after >= 12300(visible-only e2+e4 = 12000; true sent view ≈ 12600; raw projection reports exactly 12000) andreclaimed <= 6000(true ≈ 5700; raw over-claims ≈ 6300);|before − after − reclaimed| <= 150because at K scale each panel figure is rounded into a 100-token bucket (three roundings → <150 combined slack).Verification
src/compress-tool.ts:418back to the raw projection (estimateTokens(coreMessages, ...)instead ofestimateTokens(afterTurn.messages, ...)); the rewritten test FAILS withafterTokens 12000 missing the summary-anchor scale (raw projection reports 12000): ▣ ACP | 18.3K → 12.0K tokens (~6.3K reclaimed, 1 block). Reverted; only the test file changes.npm run typecheck+npm run buildclean.