fix(metanote): v2.1 有据自检豁免——锚+读数双要素放行,无据自指照拒

事故:P3 roundtrip 探针被 strong:debug_mark 拒写;历史 29 条拒收中 25 条含可回查锚
⇒ 多数是「有据自检」而非元噪声;cue×2 两头失效(真污染换词即过、有据自指因带词被拒)。

修法:anchorExempt = 可回查锚(ISO日期/时分秒/mem_|t_|ep_ id/版本串)
                    ∧ 数值读数(数字+单位)。缺一不可。
- debug_mark 单命中 + 有据 ⇒ 放行
- cue×2 + 有据 ⇒ 放行(reason=anchor_exempt)
- pool/rank/eval_metric 等系统内部读数形状 ⇒ 仍一律拒(红3 守住)

红绿:绿1 有据自检放行 | 红1 纯感慨 cue×2 拒 | 红2 只有锚无读数 拒 | 红3 内部读数形状 拒
全包回归 12/12 PASS(含原有 parity/shadow)。

退役条款:白名单启用后,若「真实自指记忆答对终验题」≥3 次,则 worklog_shadow 保底格退役。
This commit is contained in:
小怡
2026-11-28 01:09:18 +08:00
parent 7428bd771c
commit 0db3a186b6
2 changed files with 91 additions and 1 deletions
+32 -1
View File
@@ -3,10 +3,31 @@ package metanote
import (
"log"
"os"
"regexp"
"strings"
"unicode/utf8"
)
// ─── v2.1 有据自检豁免(2026-11-28)─────────────────────────
//
// 背景:P3 探针被 `strong:debug_mark` 拒写;标定集 29 条历史拒收中,
// 25 条含可回查锚(版本号/时间/id/读数)⇒ 多数是「有据自检」,不是元噪声。
// cue×2 两头失效:真污染换词即过(漏检),有据自指因带词被拒(误伤)。
//
// 判据双要素,缺一不可(防单锚乱放行):
//
// ① 可回查锚: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+)?`)
readingRx = regexp.MustCompile(`\d+(\.\d+)?\s*(ms|μs|s|秒|分|B|KB|MB|GB|%|条|次|行|个|倍)`)
)
// anchorExempt 报告文本是否为「有据自检」形态(锚 + 读数双要素)。
func anchorExempt(t string) bool {
return anchorRx.MatchString(t) && readingRx.MatchString(t)
}
// Classify 返回 (isMeta, reason)。判定逐步同序镜像 Python classify();
// reason 仅人读(命中规则拼接),与 Python 文案不逐字比。
func Classify(text string) (bool, string) {
@@ -43,7 +64,12 @@ func Classify(text string) (bool, string) {
add("eval_metric")
add("debug_mark")
if len(strong) > 0 {
return true, "strong:" + strings.Join(strong, "+")
// v2.1(2026-11-28)有据自检豁免:仅对 debug_mark 单命中生效。
// 标定集:29 条历史拒收中 25 条含可回查锚 ⇒ 多数是「有据自检」而非元噪声。
// 其余 STRONG 形状(pool/rank/eval_metric…)是系统内部读数,仍一律拒。
if !(len(strong) == 1 && strong[0] == "debug_mark" && anchorExempt(t)) {
return true, "strong:" + strings.Join(strong, "+")
}
}
// CUE 档(distinct 计数;边界过滤后的组值)
@@ -76,6 +102,11 @@ func Classify(text string) (bool, string) {
return false, "fact_decl"
}
if nCue >= 2 {
// v2.1 有据自检豁免:cue×2 两头失效已被实测证明(真污染换词即过;
// 有据自指因带词被拒 —— P3 探针即例)。含锚+读数双要素者放行。
if anchorExempt(t) {
return false, "anchor_exempt"
}
return true, "cue×2"
}
if nCue >= 1 && nDiag >= 1 {
+59
View File
@@ -0,0 +1,59 @@
package metanote
// classify_v21_test.go —— v2.1 有据自检豁免的红绿(2026-11-28)
//
// 绿:有锚 + 读数双要素的自指记录必须放行(此前被 cue×2 / debug_mark 误拒)
// 红:无据自指(纯感慨、只有日期没有读数)必须照拒
// 只验绿不验红,放进来的噪声量永远测不到。
import "testing"
func TestClassifyV21_AnchorExempt(t *testing.T) {
cases := []struct {
name string
text string
wantMeta bool
}{
{
name: "绿1_有据自检_锚加读数",
text: "2026-11-28 00:52:33 自检:探针 ZQ7X 写入 1 条,health 200,耗时 0.5ms",
wantMeta: false,
},
{
name: "红1_无据纯感慨_两个自指词",
text: "织忆的记忆系统好复杂,向量那部分完全看不懂该怎么调",
wantMeta: true,
},
{
name: "红2_只有锚没有读数",
text: "2026-11-28 织忆的向量与召回这块还是很难懂",
wantMeta: true,
},
{
name: "红3_系统内部读数形状_加了锚也照拒",
text: "2026-11-28 03:00 pool 里 rank 前 3 条 recall_count=17,候选池 200 条",
wantMeta: true,
},
}
for _, c := range cases {
got, reason := Classify(c.text)
if got != c.wantMeta {
t.Errorf("%s: Classify() = (meta=%v, %q), want meta=%v", c.name, got, reason, c.wantMeta)
} else {
t.Logf("%s → meta=%v reason=%q", c.name, got, reason)
}
}
}
// TestAnchorExempt_Unit 双要素缺一不可
func TestAnchorExempt_Unit(t *testing.T) {
if !anchorExempt("2026-11-28 00:52 读数 3 条") {
t.Error("锚+读数应通过")
}
if anchorExempt("2026-11-28 只有日期") {
t.Error("只有锚不应通过")
}
if anchorExempt("耗时 5ms 但无锚") {
t.Error("只有读数不应通过")
}
}