Skip to content

fix(tests): use isCompressSuccessText in export-cmd setupSession (stale /1 block/ after #376/#377) - #390

Merged
ranxianglei merged 1 commit into
masterfrom
2026-09-12_fix-export-cmd-stale-assertion
Sep 12, 2026
Merged

fix(tests): use isCompressSuccessText in export-cmd setupSession (stale /1 block/ after #376/#377)#390
ranxianglei merged 1 commit into
masterfrom
2026-09-12_fix-export-cmd-stale-assertion

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Context

Issue #389: 7 subtests in tests/export-cmd.test.ts fail on master. The shared helper setupSession() asserted /1 block/ against the compress tool result, but since #376/#377 compress returns the span-form panel (blocks: b1=m00002) instead of the legacy count form (1 block).

Fix

Replace the regex assertion with the production success predicate isCompressSuccessText() from src/compress-tool.ts — the same predicate the compress retry loop uses and that compress-retry / compress-loop-breaker / compress-tool tests already assert against. It encodes "completed run that created ≥ 1 block" and accepts BOTH panel forms (legacy count + #376 span), so the fixture no longer couples to panel wording.

Verification

  • Before (origin/master 2bdc831): 3 pass / 7 fail, error verbatim matches the issue report.
  • After: tests/export-cmd.test.ts 10/10 pass; full suite npm test722 pass / 0 fail / 3 skip; npm run typecheck clean.

Fixes #389

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown

📦 Built Extension Artifact

Branch: 2026-09-12_fix-export-cmd-stale-assertion (816969e)

Option A — Install from npm PR tag (recommended)

pi install npm:billion-context-pi@pr-390

Each push to this PR publishes a new version under the pr-390 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pi-pr390.tgz
pi install ./package

This comment is automatically updated on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 ## PR review — 已验证,可以合并(请人工合并)

Diff 整洁度:单 commit(1d49203),单文件 tests/export-cmd.test.ts,+2/-1(import + 断言替换),无无关改动。✅

谓词正确性:isCompressSuccessText(src/compress-tool.ts:174,exported)= compressPanelBlocks(text) > 0;compressPanelBlocks 同时接受旧计数形式(… N blocks))与 #376 span 形式(blocks: bN=mXXXXX),语义为「completed run that created ≥ 1 block」——正是 compress 重试循环的生产判定,compress-retry / compress-loop-breaker / compress-tool 三个测试文件也已在用。✅

无覆盖损失:helper 断言从「恰好 1 block」弱化为「≥1 block」,但各子测试独立断言精确数量(assert.equal(summaries[0]!.blocks, 1)assert.match(text, /blocks=1/)),该属性仍被覆盖。✅

实证验证(干净 worktree,非引用自述):

  • Before(origin/master 2bdc831):tests/export-cmd.test.ts3 pass / 7 fail,报错逐字一致(actual: '▣ ACP | 8.0K → 6.2K tokens (~1.8K reclaimed, blocks: b1=m00002)')
  • After(PR 分支):export-cmd 10/10;全量 npm test722 pass / 0 fail / 3 skip;npm run typecheck clean

⚠️ 重复筛查发现:存在竞争修复 PR #386

查重时发现本 PR 与以下条目修的是同一行同一缺陷:

条目 方案 状态
#385(首个报告,来源 #375 分析) open
PR #386(fixes #385):/1 block//blocks: b1=/ 正则,仍耦合面板措辞且耦合具体块标签 b1= open
PR #388(更早一次尝试,/blocks: b\d+=/) closed(未合并)
#389(再报告,来源 #380 rebase 分析) open
PR #390(本 PR):改用生产谓词 isCompressSuccessText() 语义判定,兼容新旧两种面板格式 open

#386 我也实测过:同样 10/10 通过——两个 PR 都是有效修复,但改同一行,不能同时合并。差异点:#386 的正则把 fixture 重新绑回面板措辞(下次面板再改版还会漂),#390 用生产谓词彻底解耦,方案更优;issue 层面 #389#385 也是同一问题的两次报告。

建议:合并本 PR(#390),关闭 #386#385 为重复(#389 随本 PR 合并自动关闭);或反向操作,但我不推荐保留措辞耦合版。取舍由你拍板。

一句话中文摘要:审查并实证了本 PR(master 上 7 个 export 子测试因 #376/#377 面板改版而红的修复,改用生产语义谓词而非正则,全量 722/0/3、typecheck 干净,diff 收敛可合并);另查出竞争修复 PR #386 与本 PR 修同一行,建议二选一优先保留本 PR。

@ranxianglei
ranxianglei force-pushed the 2026-09-12_fix-export-cmd-stale-assertion branch from 1d49203 to 7128bca Compare September 12, 2026 09:47
@ranxianglei
ranxianglei force-pushed the 2026-09-12_fix-export-cmd-stale-assertion branch from 7128bca to 816969e Compare September 12, 2026 09:47
@ranxianglei
ranxianglei merged commit 14225e8 into master Sep 12, 2026
9 checks passed
@ranxianglei ranxianglei mentioned this pull request Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests/export-cmd.test.ts: 7 subtests fail on master (compress-result assertion "/1 block/" stale after #376/#377 panel change)

1 participant