From 240af37b7cf255d3be505d0d9fda6b4855bbbd50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=80=A1?= Date: Sat, 28 Nov 2026 01:29:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(metanote):=20v2.1.1=20=E8=A1=A5=20cue+diag?= =?UTF-8?q?=20=E8=B7=AF=E5=BE=84=E9=94=9A=E8=B1=81=E5=85=8D=20+=20?= =?UTF-8?q?=E5=9B=9E=E6=94=BE=E6=A0=87=E5=AE=9A=E9=9B=86=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 回放(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:零成本验收集回放工具(不设断言,只出读数)。 --- go/internal/metanote/classify.go | 13 +++- go/internal/metanote/classify_replay_test.go | 74 ++++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 go/internal/metanote/classify_replay_test.go diff --git a/go/internal/metanote/classify.go b/go/internal/metanote/classify.go index 63843eb..403e379 100644 --- a/go/internal/metanote/classify.go +++ b/go/internal/metanote/classify.go @@ -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, "" diff --git a/go/internal/metanote/classify_replay_test.go b/go/internal/metanote/classify_replay_test.go new file mode 100644 index 0000000..ed98931 --- /dev/null +++ b/go/internal/metanote/classify_replay_test.go @@ -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) +}