fix(view): reject anchors absent from knowledge/index.json - #192
Open
titanwings wants to merge 1 commit into
Open
titanwings wants to merge 1 commit into
titanwings wants to merge 1 commit into
Conversation
view check and view render fail with view/orphan-anchor when a cited id is missing from the ledger. doctor JSON-parses view.json anchors[].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
画像页可以引用账本里不存在的锚点。
view check只核对evidence[],doctor用方括号正则扫view.json,JSON 里的"anchors": ["k9999"]扫不到。SKILL.md Step 5.1 要求先view check再渲染,这条回指当时是空的。数据形状如下。
anchors改成k9999,并补进evidence[]view check --jsondiagnostics[0].code为view/orphan-anchorview render --jsonviews/下没有 html,也没有 receiptdoctor --jsonanchors.dangling为 1--file,旁边没有knowledge/index.jsonview check --file --jsonVIEW_LEDGER_ABSENTScope
view check与view render在有--person或--base-dir时读knowledge/index.json。每个anchors[]元素在账本锚点集合里查成员,缺失则发view/orphan-anchorerror 并退出 1。--file模式没有账本时打一条 warningVIEW_LEDGER_ABSENT,不静默。view render复用同一校验,有 error 时不写 html 也不写 receipt。renderView内部的checkView也会从 view 文件旁的账本再读一次。doctor的deliveredAnchors对.view.json走JSON.parse,收集每个anchors[],覆盖headline.anchors、sections[].claims[].anchors、sections[].items[].anchors、points[].anchors。其余文件仍走方括号正则。不改corpusShape。删掉 audit-tests 基线里这两行。
view checkrejects an anchor that does not exist in knowledge/index.json这两行对应
tests/audit里的 T47 与 T60。基线数据行从 19 减到 17。Blast Radius
已有合法画像不受影响。R36 在 harvest 后的真实账本上
view check仍退出 0,diagnostics 为空。只变严悬空引用。栈停在 dot-skill-test,dot-skill 保留。
Verification
T47、T60 由红转绿。基线从 19 行减到 17 行。
改前,Node v22.14.0,HEAD 319e8c3:
改后,Node v22.14.0,HEAD 8784cac:
改后,Node v20.20.2:
node scripts/run-gates.mjs --without playwright在 Node v20.20.2 与 Node v22.14.0 都是 8/8 gates passed。npm test是 # tests 403、# fail 0。DISTILLY_PLAYWRIGHT_ROOT=/tmp/pw-root node scripts/run-gates.mjs --requires playwright在 Node v22.14.0 上是 3/3 gates passed。三份语料都是验收结果:18/18 通过。us-house 含FAIL · units=2744 speakers=18 attributed=85。You see,Node v22.14.0。工作区 harvest synthetic-interview 后写入引用
k9999的 view.json。view check --json退出 1,diagnostics[0].code为view/orphan-anchorview render --json退出 1,views/下没有 htmldoctor --json退出 1,anchors.dangling为 1新用例在 base 上失败,在 head 上通过。base 是 Node v22.14.0。
a cited id missing from the ledger is view/orphan-anchor失败:cli: view check --json exits 1 with view/orphan-anchor when the ledger lacks the cited id失败:cli: view render exits 1 and writes no html when a cited anchor is absent from the ledger失败:cli: view check --file without a ledger warns VIEW_LEDGER_ABSENT and still exits 0失败:doctor fails when views/<slug>.view.json cites an anchor the ledger does not declare失败:head 上
node --test tests/views.test.mjs tests/doctor-coverage.test.mjs是 # tests 43、# fail 0。Rollback
回退 8784cac。已渲染的 html 不用迁移。栈停在 dot-skill-test,dot-skill 保留。