fix(metanote): v2.1.1 补 cue+diag 路径锚豁免 + 回放标定集工具

回放(30 条历史拒收)发现两处:
1) cue+diag 路径**漏接**锚豁免(8/30 落在此处被误拒)⇒ 补上,放行 5→12。
2) 试放宽读数臂(id/版本串也算读数)⇒ 两臂完全重叠、退化成单臂锚,
   被 parity 契约锁当场抓住(case 47  Go≠Python)⇒ 已退回。

结论:门宽已到安全边界 12/30;剩余 18 条(cue×2 8 / debug_mark 4 / mem_id 3 /
write_bug 2 / cue+diag 1)需 category 正门而非继续放宽正则。

新增 classify_replay_test.go:零成本验收集回放工具(不设断言,只出读数)。
This commit is contained in:
小怡
2026-11-28 01:29:58 +08:00
parent 0db3a186b6
commit 240af37b7c
2 changed files with 86 additions and 1 deletions
+12 -1
View File
@@ -19,7 +19,13 @@ import (
// ① 可回查锚:ISO 日期 / 时分秒 / mem_|t_|ep_ id / 版本串
// ② 数值读数:数字 + 单位(ms/s/秒/分/B/KB/MB/%/条/次/行)
var (
anchorRx = regexp.MustCompile(`20\d{2}-\d{2}-\d{2}|\d{2}:\d{2}:\d{2}|mem_\d{10,}|t_[0-9a-f]{8}|ep_\d+|v\d+\.\d+(\.\d+)?`)
anchorRx = regexp.MustCompile(`20\d{2}-\d{2}-\d{2}|\d{2}:\d{2}:\d{2}|mem_\d{10,}|t_[0-9a-f]{8}|ep_\d+|v\d+\.\d+(\.\d+)?`)
// 读数臂:必须是「数字+单位」的实测读数。
//
// v2.2 曾试放宽为「数值化标识也算读数」(id / 版本串),结果两臂完全重叠、
// 退化成单臂锚 —— 被 parity 契约锁当场抓住(TestDifferential_PythonReference
// case 47:`历史数据表明t_38a79286因缺乏验证导致召不回` Go=false ≠ Python=true)。
// 故退回严格双要素:标识只能当锚,不能既当锚又当读数。
readingRx = regexp.MustCompile(`\d+(\.\d+)?\s*(ms|μs|s|秒|分|B|KB|MB|GB|%|条|次|行|个|倍)`)
)
@@ -110,6 +116,11 @@ func Classify(text string) (bool, string) {
return true, "cue×2"
}
if nCue >= 1 && nDiag >= 1 {
// v2.1 补漏(2026-11-28 回放标定集发现):本路径原先没接锚豁免,
// 导致「cue+diag」形态的有据自检全数被拒(标定集 8/30 落在此处)。
if anchorExempt(t) {
return false, "anchor_exempt"
}
return true, "cue+diag"
}
return false, ""
@@ -0,0 +1,74 @@
package metanote
// classify_replay_test.go —— 历史拒收标定集回放(2026-11-28)
//
// 用途:v2.1 上线后,用 29 条历史拒收原文回放新门,
// 检验「86% 有据」这个读数证的是旧拒收的性质、还是新门的宽度。
//
// 本测试不设断言(它是对照读数工具),跑 -v 看三数:
// 有据通过数 / 无据拒绝数 / 内部读数形状拒绝数。
import (
"bufio"
"encoding/json"
"os"
"regexp"
"testing"
)
type rejectedRec struct {
TS string `json:"ts"`
Category string `json:"category"`
Reason string `json:"reason"`
Content string `json:"content"`
}
// 旧口径「有据」:宽锚(含日期/时间/id/版本串),不含数值臂要求。
var looseAnchor = regexp.MustCompile(`20\d{2}-\d{2}-\d{2}|\d{2}:\d{2}:\d{2}|mem_\d{10,}|t_[0-9a-f]{8}|ep_\d+|v\d+\.\d+`)
func TestReplayRejectedSet(t *testing.T) {
path := os.Getenv("HOME") + "/.hermes/logs/zhiyi-rejected-writes.jsonl"
f, err := os.Open(path)
if err != nil {
t.Skipf("标定集不可读: %v", err)
}
defer f.Close()
var total, passed, rejected int
var looseAnchored, looseAnchoredPassed int
var internallyShaped int
reasons := map[string]int{}
sc := bufio.NewScanner(f)
sc.Buffer(make([]byte, 1<<20), 1<<20)
for sc.Scan() {
var r rejectedRec
if json.Unmarshal(sc.Bytes(), &r) != nil || r.Content == "" {
continue
}
total++
meta, reason := Classify(r.Content)
if meta {
rejected++
reasons[reason]++
if reason == "strong:pool" || reason == "strong:rank" || reason == "strong:rank_num" ||
reason == "strong:eval_metric" || reason == "strong:recall_count" {
internallyShaped++
}
} else {
passed++
reasons["PASS:"+reason]++
}
if looseAnchor.MatchString(r.Content) {
looseAnchored++
if !meta {
looseAnchoredPassed++
}
}
}
for k, v := range reasons {
t.Logf(" reason=%s → %d", k, v)
}
t.Logf("回放总数=%d|新门放行=%d|新门仍拒=%d(其中内部读数形状=%d)", total, passed, rejected, internallyShaped)
t.Logf("旧口径有据=%d|其中新门放行=%d|其中新门仍拒=%d", looseAnchored, looseAnchoredPassed, looseAnchored-looseAnchoredPassed)
}