Skip to content

[PR] verif: tag-echo-filter Replay Judge — found real bugs #4106 (cleanup not idempotent) and #4107 (streaming output depends | verif: tag-echo-filter 回放判官 — 发现真 bug #4106(清理不幂等)与 #4107(流式输出依赖分块) - #4108

Merged
ranxianglei merged 1 commit into
masterfrom
verif/tag-echo-judge
Oct 21, 2026

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

方向 2(tag-echo-filter,1655 行全渠道标签过滤器)收服。接 #4103。

为什么是回放判官而不是求解器

strip 链的 regex 家族用了 lookaround(ORPHAN_RUN_BEFORE/DEAD_REF_CLOSE/LONE_CLOSE)+ \p{So}(MARKER_*),流式过滤器是带状态的 re.exec 循环——都在翻译子语言之外,求解器会降级到 any。判官改为真实代码 + 对抗性标签文法生成(确定性种子 0x7ea4c0de,失败可精确复现),这正是这个文件历史上出事的形态(流式边界)。

判官(tests/verif-tag-echo-filter.test.ts,17 用例)

立刻发现两个真 bug(性质随机生成命中,均已在真代码上确认)

  1. Tag cleanup is not idempotent: a second call to stripAcpTags on the same text will additionally remove the dead refere | 标签清理不幂等:同一文本第二次 stripAcpTags 会额外删掉死引用闭合(m3117</cPa) #4106 strip 不幂等:marker 行删除在最后,但 DEAD_REF_CLOSE 的 out !== text 门控在它之前求值——同一文本第二次清理会额外删内容(重清理路径已发送字节缩水)。钉 C#4106,P2 域排除该形状至修复。
  2. Streaming tag filter output depends on chunk position: when the same text arrives in two chunks, internal residual m1255 | 流式标签过滤器输出依赖分块位置:同一文本分两块到达时内部残留 m1255</acPA 泄漏给客户端 #4107 流式输出依赖分块(两形状):死引用残留 m1255</acPA 整块被清、分块放行给客户端;裸闭合片段 </apc 跨界泄漏。钉 C#4107/C#4107-2,P1 域排除带标签文本至修复。

两处判官越界(误设性质)已修并在测试里注明依据:containsMarkerLineText 是 raw includes() 预检(#717)而删除是行锚定;containsEchoResidue 是审计信号不是删除保证(#1760);dropped 与 dropCount 是不同概念。

验证

  • 本文件 17/17 绿;全套 verif 47/47 绿;tsc 干净(存量除外)
  • 不需要求解器(CI 也能跑)

@ranxianglei 人工合并;#4106/#4107 修复后翻转两个钉即可

tests/verif-tag-echo-filter.test.ts: property judge over the REAL filter
family (src/loop/tag-echo-filter.ts). No solver — the interesting entry
points are outside the symbolic sublanguage today (lookaround +
\\p{So} regexes in stripAcpTags' family, stateful re.exec loops in the
stream filters), so this judge runs real code over adversarial
grammar-generated shapes (deterministic seed 0x7ea4c0de):

- P1 chunk-split equivalence (streaming ≡ whole-text) across 5 filter
  factories, all split points for short texts + sampled + 3-way
- P1b absorb-instructed emission hold split-stability
- P2 stripAcpTags/normalizeEchoArtifacts idempotence
- P3 monotone length, P4 clean-prose passthrough, P5 residue duality
  (strip-acted ⇒ strict detectors silent), P6 stats accounting,
  P7 identity/compose sanity
- per-issue controls pinning the file's own history: #644 #1720 #1760
  #1881 #2023 #2862 #717 #2405

TWO real bugs found immediately by the properties:

- #4106 stripAcpTags is NOT idempotent: the gated DEAD_REF_CLOSE pass
  evaluates `out !== text` BEFORE the marker-line pass (which runs
  LAST), so a marker line + trailing dead-ref-close text strips once
  (keeps the dead ref) then strips MORE on the second call (marker
  removal enabled an end-anchored TRUNC_REF_CLOSE match). Re-normalized
  messages shrink per pass = unstable sent bytes. Pinned C#4106;
  P2 domain excludes the shape until fixed.
- #4107 stream output depends on chunk boundaries (two shapes): (a)
  dead-ref residue `m1255</acPA` is cleaned on whole-text push but
  RELEASED to the client when the transport splits at the payload/close
  boundary; (b) a bare close fragment `</apc ` at the chunk boundary
  leaks in the split path. Both pinned (C#4107/C#4107-2); P1 domain
  excludes tag-bearing texts until fixed.

Property overreach fixed during calibration (documented in-test):
containsMarkerLineText is the raw includes() pre-check (#717) while
removal is line-anchored (detect-but-keep for mid-line markers);
containsEchoResidue is an audit signal, not a strip guarantee
(#1760 close-only preservation); dropped vs dropCount are different
documented concepts.

README: judge table rows for the conflict-watch/snapshot/wire quartet,
responses-ingress, tag-echo-filter; found-bugs list += #4052 #4106
#4107.

Suite: 47/47 green (17/17 here). tsc clean.
@ranxianglei ranxianglei changed the title verif: tag-echo-filter 回放判官 — 发现真 bug #4106(清理不幂等)与 #4107(流式输出依赖分块) [PR] verif: tag-echo-filter Replay Judge — found real bugs #4106 (cleanup not idempotent) and #4107 (streaming output depends | verif: tag-echo-filter 回放判官 — 发现真 bug #4106(清理不幂等)与 #4107(流式输出依赖分块) Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: verif/tag-echo-judge (9f85c2a)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4900-pr.4108.c01c5b6

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

Option B — Download artifact

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

Install instructions are refreshed on each push.

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.

1 participant