Repository navigation
fix(harvest): validate identity maps before writing identity.json - #191
Open
titanwings wants to merge 1 commit into
Open
titanwings wants to merge 1 commit into
titanwings wants to merge 1 commit into
Conversation
Load and reject duplicate handles before mkdir/copy so a bad map writes nothing. Declare warnings before pushing empty-handle notices. Emit harvest receipts through createReceipt with entries after the contract fields.
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
harvest --identity先把映射拷进 Skill 再校验。重复句柄已经 exit 2,但identity.json已经落盘。某人没写 handles 时,warnings.push发生在const warnings = []之前,命令以Cannot access 'warnings' before initialization崩溃。IDENT 纪律是响亮失败且不写任何文件。合法映射本来就是绿的。
数据形状如下。
{"people":[{"name":"A","handles":["x"]},{"name":"B","handles":["x"]}]}harvest --identity dup.json --jsonerror.message是identity.json: handle "x" is claimed by both "A" and "B"。工作区没有比 dup.json 新的文件{"people":[{"name":"林工"}]}harvest --identity no-handles.json --json"林工" lists no handles; only its own name is canonicalisedhandles:["ou_lin"]harvest --identity ok.json --jsonidentity.handles是["ou_lin"],identity.turns是 12Scope
loadIdentity在mkdir与copyFileSync之前跑。重复句柄直接返回,不建人物目录。const warnings = []提前到identity.warnings的 push 之前。没写 handles 的人只进回执,命令继续。harvest 回执改走
createReceipt。前八个键是command、person、ok、inputs、outputs、anchors、warnings、unavailable。entries接在契约字段之后。tests/identity.test.mjs加两条用例。基线只删下面两行。本树从 PR-1 起步,删完这两行后基线数据行是 17。不删 R08、R28、R38、R49。
parse-* 回执仍在
src/commands/parse-shared.mjs手拼。那个文件不在本 PR 的 Files 里。Blast Radius
已经装进 Skill 的合法
identity.json不改。非法映射不会再留下半份目录。栈停在 dot-skill-test,dot-skill 保留。Verification
T35、T37 由红转绿。T36 保持绿。基线从 19 行减到 17 行。
改前,Node v22.14.0:
T35 失败原文:
T37 失败原文:
T36 同一次跑是
ok 2。改后,Node v22.14.0:
改后,Node v20.20.2 与 Node v22.14.0 的
node scripts/run-gates.mjs --without playwright都是 8/8 gates passed。unit-tests 是# tests 400、# fail 0。DISTILLY_PLAYWRIGHT_ROOT=/tmp/pw-root node scripts/run-gates.mjs --requires playwright在 Node v22.14.0 上是 3/3 gates passed。三份 acceptance 都是18/18。us-house 含FAIL · units=2744 speakers=18 attributed=85。新用例在 base SHA
319e8c36633313450ba0b6c2695c55e39b835085上失败,在 head 上通过。Node v22.14.0。重复句柄用例失败:
无 handles 用例失败:
You see。
harvest --identity dup.json --json退出 2,stdout 的error.message是identity.json: handle "x" is claimed by both "A" and "B",find $W -newer dup.json为空。没写 handles 的映射退出 0,warnings 含林工。Rollback
回退本 PR head。已经写入的合法映射不用迁移。栈停在 dot-skill-test,dot-skill 保留。