Skip to content

fix(ledger): allocate the next anchor past every paragraph id - #188

Open
titanwings wants to merge 2 commits into
atomic/pr-0-verify-pipelinefrom
atomic/pr-1-unique-anchors
Open

titanwings wants to merge 2 commits into
atomic/pr-0-verify-pipelinefrom
atomic/pr-1-unique-anchors

Conversation

@titanwings

Copy link
Copy Markdown
Owner

Why

同一人物的后一条来源会从自己的条目 id 起编段落。旧的 nextId 只看条目 id,第二份材料从 k0002 起编,和第一份材料已经占用的段落撞号。第二次 harvest 比较的是磁盘路径和账本里的 raw 路径,同一字节被当成另一个来源,多写出一份正文。

数据形状如下。

输入 调用 字面期望
synthetic-multisource 的 slack、feishu、postmortem parse-chat、parse-chat、harvest 各一次 条目 id 是 k0001、k0036、k0054。段落锚点 60 个,连同子锚点共 120 个,两两不同
synthetic-interview 字幕后再写一条 note harvest,然后 note note 正文的首个段落锚点是 k0039,也就是字幕最后一个锚点 k0038 加一
同一目录 harvest 两次,中间做 retrospect harvest,retrospect,harvest,retrospect knowledge/text 的文件集合不变,derived 产物 sha256 不变

Scope

nextId 取账本里所有条目 id 与所有段落锚点 id 的最大值加一。新条目的段落从它自己的 id 起连续编号。

claimedByOther 两侧都收成 raw/source/file 再比。同一字节、同一来源的第二次写入在编号和写正文之前返回,不追加账本,也不另写 text 文件。

删掉 audit-tests 基线里这三行。

  • R16 three sources for one person never share an anchor id
  • R16 SKILL.md's simplest flow — one subtitle plus one note — keeps the note's anchor distinct from the subtitle's
  • R17 harvesting the same directory twice leaves ledger, text files and derived output unchanged

T30 原来把三条来源的条目 id 钉成 k0001、k0002、k0003。那是撞号时的值。修完后实测是 k0001、k0036、k0054,断言改成这个字面值。

Blast Radius

已有人物目录的锚点编号不会自动迁移。要新编号就重新 harvest。栈停在 dot-skill-test,dot-skill 保留。

us-house 的 acceptance.mjs 在 Node v22.14.0 重跑后,stdout 那一行是 FAIL · units=2744 speakers=18 attributed=85。计划 You see 里的 86 作废。acceptance-us-house 的字面谓词改成这一行。栈停在 dot-skill-test,dot-skill 保留。

Verification

T30、T31、T32 由红转绿。基线从 22 行减到 19 行。

改前,Node v22.14.0:

PASS audit-tests  (5.6s, exit 1)
     ratchet failing 22, baseline 22

改后,Node v22.14.0:

PASS audit-tests  (5.5s, exit 1)
     ratchet failing 19, baseline 19

改后,Node v20.20.2:

PASS audit-tests  (7.2s, exit 1)
     ratchet failing 19, baseline 19

node scripts/run-gates.mjs --without playwright 在 Node v20.20.2 与 Node v22.14.0 都是 8/8 gates passed。新 head 上 Node v22.14.0 再跑仍是 8/8。npm test 是 # tests 398、# fail 0。

DISTILLY_PLAYWRIGHT_ROOT=/tmp/pw-root node scripts/run-gates.mjs --requires playwright 在 Node v22.14.0 上是 3/3 gates passed。acceptance-us-house 含 FAIL · units=2744 speakers=18 attributed=85

新用例在 base 上失败,在 head 上通过。base 是 Node v22.14.0。

nextId 用例失败:

Expected values to be strictly equal:

1 !== 2

二次 harvest 用例失败:

+   'subtitle--transcript.md',
    'subtitle.md'

Rollback

回退 319e8c355dae80。已经 harvest 过的目录保持旧编号,不需要数据迁移。栈停在 dot-skill-test,dot-skill 保留。

A later entry was reusing paragraph ids the previous entry still owned,
and a second harvest of the same bytes stemmed another text file.
The single-copy harvest prints attributed=85. The old predicate still asked for 175.
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.

2 participants