Repository navigation
fix(wiki): 验证基线只记 HEAD,脏工作区改动提交后无法判漂移(#648) #697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -373,10 +373,12 @@ window.__ModuleLoader__.load({ | |
| "wiki.drift.shifted": "上方有增删,行号挪了 {n}", | ||
| "wiki.drift.deleted": "文件已删", | ||
| "wiki.drift.unverifiable": "这条没记行号,无法定位", | ||
| "wiki.drift.uncommitted": "验证时这行还没提交,提交层面的比对看不到它", | ||
| "wiki.drift.inconsistent": "正文有语义段、库里却没有结论记录(上次 T1 没写完),这页证据无法核对。", | ||
| // 语义段 provenance(①):每页的结论是「对着哪个提交」读出来的。不说清这一点, | ||
| // 「证据复核」就只是在和某个不明时点比——页越晚富化,误报越多。 | ||
| "wiki.drift.verified": "对着 {sha} 验证", | ||
| "wiki.drift.verifiedDirty": "对着 {sha} 验证(当时工作区有未提交改动)", | ||
| "wiki.drift.verifiedUnknown": "这页没记下是哪个提交验证的(早期富化没有记录),所以判不出它有没有过时。重跑一次 T1 就会记上。", | ||
| "wiki.drift.verifiedApprox": "这页是早期富化的,没记下自己的验证点;下面按全仓基线 {sha} 比对(起点比实际更早,只会多报不会漏报)。", | ||
| "wiki.drift.anchorStalePage": "这页记下的验证提交在 git 里已经找不到了(force-push 或浅克隆截断),这页没法比对。", | ||
|
|
@@ -1557,10 +1559,12 @@ window.__ModuleLoader__.load({ | |
| "wiki.drift.shifted": "Insertions above moved it {n} lines", | ||
| "wiki.drift.deleted": "File deleted", | ||
| "wiki.drift.unverifiable": "No line number recorded — cannot locate", | ||
| "wiki.drift.uncommitted": "This file was uncommitted when the claim was recorded — commit-level diffs cannot see it", | ||
| "wiki.drift.inconsistent": "This page has prose in the file but no claims on record (the last T1 run did not finish), so its evidence cannot be checked.", | ||
| // Claim provenance: each page's claims were read from one specific commit. Without | ||
| // saying which, "evidence check" compares against an unknown point in time. | ||
| "wiki.drift.verified": "Verified at {sha}", | ||
| "wiki.drift.verifiedDirty": "Verified at {sha} (working tree had uncommitted changes)", | ||
| "wiki.drift.verifiedUnknown": "This page did not record which commit its claims were verified against (earlier enrichment did not store one), so staleness cannot be decided. Re-running T1 will record it.", | ||
| "wiki.drift.verifiedApprox": "This page was enriched before provenance was recorded; the comparison below starts from the repository baseline {sha} (earlier than the real one, so it can over-report but never miss).", | ||
| "wiki.drift.anchorStalePage": "The commit this page was verified against no longer exists in git (force-push or a shallow clone cut it off), so this page cannot be compared.", | ||
|
|
@@ -13782,13 +13786,15 @@ window.__ModuleLoader__.load({ | |
| : 0; | ||
| // 提交号显示前 7 位就够认,长 sha 会把这一行挤爆(完整值仍在 title 里)。 | ||
| const shortSha = (sha) => String(sha ?? "").slice(0, 7); | ||
| // 四种命中原因各自一句:混成「失效」会让只是行号挪了的结论也被喊去重写, | ||
| // 喊几次就没人信这个标记了。 | ||
| // 五种命中原因各自一句:混成「失效」会让只是行号挪了的结论也被喊去重写, | ||
| // 喊几次就没人信这个标记了。uncommitted 与「改动人」不是一回事:见 #648, | ||
| // 它说的是验证那天文件还没进提交,任何提交层面的 diff 都看不到这段。 | ||
| const driftReasonText = (c) => { | ||
| if (c.reason === "touched") return t("wiki.drift.touched"); | ||
| if (c.reason === "shifted") return t("wiki.drift.shifted").replace("{n}", String(c.shift ?? 0)); | ||
| if (c.reason === "deleted") return t("wiki.drift.deleted"); | ||
| if (c.reason === "unverifiable") return t("wiki.drift.unverifiable"); | ||
| if (c.reason === "uncommitted") return t("wiki.drift.uncommitted"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不要把文件级状态描述成行级状态
|
||
| return String(c.reason ?? ""); | ||
| }; | ||
| // 树的层级看 parent_id 真父子(#582),不看 slug 里的连字符数—— | ||
|
|
@@ -13858,7 +13864,11 @@ window.__ModuleLoader__.load({ | |
| const pageProvenance = driftDone && selectedDrift | ||
| ? (selectedDrift.verifiedBaseline | ||
| ? h("div", { className: "mneme-wikidriftverified", title: selectedDrift.verifiedBaseline }, | ||
| t("wiki.drift.verified").replace("{sha}", shortSha(selectedDrift.verifiedBaseline))) | ||
| // 脏工作区验证的页不能长成「对着 xxxx 验证」——那会让读者以为锚点来自一次 | ||
| // 干净提交。多一句说明,比让人事后自己发现判定不到的窗口强(#648)。 | ||
| ((Array.isArray(selectedDrift.verifiedDirtyFiles) && selectedDrift.verifiedDirtyFiles.length > 0) | ||
| ? t("wiki.drift.verifiedDirty") | ||
| : t("wiki.drift.verified")).replace("{sha}", shortSha(selectedDrift.verifiedBaseline))) | ||
|
Comment on lines
+13869
to
+13871
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 为未知工作区状态保留独立文案。 当旧页面有 请为
|
||
| // 老数据:没有逐页验证点,退到全仓基线比对。必须说清这是**保底起点**, | ||
| // 不能长成「对着 xxxx 验证」——那是把近似值冒充成真值。 | ||
| : (selectedDrift.baselineApprox && selectedDrift.diffBaseline | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正 CHANGELOG 对 diff 行为的描述。
第 20 行写道,提交后的
diffSince(HEAD, 新HEAD)看不到该改动。这与代码不符。verifiedBaseline是验证时的 HEAD,早于后续提交。因此diffSince(baseline, 新HEAD)包含该提交引入的改动。实际机理是行号坐标系不一致。claim 的行号取自验证时的磁盘内容,而
assessClaims直接用这些行号与基线 diff 的旧侧 hunk 范围比较。两者坐标系可能不同。因此,结论可能被标为shifted或touched,而不是按描述所说被判为未变。请改写该段,说明旧行为是行号坐标系不一致导致的错误判定。同时注明,本 PR 的
uncommitted判定已覆盖被 claim 引用的脏文件。LanguageTool
[uncategorized] ~20-~20: 您的意思是“"不"列”?
Context: ...(
choro_pages.verified_dirty_files,幂等迁移补列)与 evidence 旁证,页面 frontmatter 只写一个布尔 `v...(BU)
[uncategorized] ~20-~20: 您的意思是“"不"列”?
Context: ...仍不自愈;只有被引用的脏文件才牵连;老数据 NULL 与空数组语义分开;旧库幂等补列),
test/wiki-provenance.test.js10/10。...(BU)
[uncategorized] ~20-~20: 您的意思是“"不"列”?
Context: ...数据用例红;去掉
.chorography过滤 → 清单条数断言红;迁移不补列 → 迁移用例红。 - **跨类型同义双录:蒸馏提示词里「宁可拆成多条」把同...(BU)