Zongzi.Anchor.NoteTriplet (zongzi v0.3.0)

Copy Markdown

基于 NoteTriplet 的结构锚点策略。默认策略。

三元组 {prev_seq, current_seq, next_seq} 锚定 intervention 在 Timeline 中的位置。 rebase 是纯函数——只判结构死活,不碰 snapshot(语义有效性留给 render 时 resolve)。

决策表

current statusmatch输出
active3/3{:ok, :preserve}
active≥ threshold{:ok, {:rebase, updated}}
active< threshold{:conflict, :adjacency_lost}
merge_tombstone{:conflict, :merged_away}(或 :follow_merge relocate)
delete_tombstonerelocate 到最近活跃邻居(双腿扫描)
missing依据注入 interv 时的 option 等判断是 conflict 还是 relocated

match_threshold

Context 或 Strategy opts 可设 match_threshold(默认 2):

  • 2 = 默认:≥2/3 匹配即存活
  • 1 = lenient:仅 current 匹配即可(适合 pitch 等 parameter channel)

Options

本策略专属配置,挂在 Intervention.strategy{NoteTriplet, %Options{…}} 元组中。 rebase 的第四参数即为 %Options{}(或兼容 map)。

  • :match_threshold — 存活阈值(默认 2)。1 = lenient(仅 current 匹配即可,适合 pitch channel)
  • :allow_follow_merge — 是否允许跟踪 merge 目标重定位(默认 false)
  • :orphan_direction:prev | :next | :never(默认 :never)。 :never 时 delete tombstone 直接报 conflict,不尝试 relocate。