Repository navigation
fix(file): make write_file create-only reachable by omission - #569
tietoumiao wants to merge 1 commit into
Conversation
expectedRevision leaves the write_file required set, and the argument bridge now sends the create sentinel when a call omits it, so creating a file no longer depends on the caller knowing an undocumented literal. The field and tool descriptions name "absent" and state that omission means create-only. An explicitly supplied blank or null stays on the reject path, and the other four mutations still require an observed revision, so the CAS contract is not relaxed (T-Auto#419, T-Auto#422).
|
There is an important contract choice to reconcile with #541 before combining these changes. #541 addresses #419 by documenting the required literal At head This review leaves the contributor branch intact; #541 remains the integration branch's current contract choice until an explicit reconciliation is made. |
Nicholas023
left a comment
There was a problem hiding this comment.
审查结论:REQUEST_CHANGES — 建议关闭
1. 与 #541 是互斥的公开契约(阻断)
- 本 PR:
expectedRevision移出 required + host bridge 归一化(省略即 create) - #541:保留 required,用文档写明字面量
"absent"
二者改同一文件同一批行,语义相反,不能同时合并。#541 的测试断言了 required.includes('expectedRevision') 与 /literal string "absent"/,并入本 PR 的 schema 后必红。
2. PR body 中有三处可核实的事实错误
(a) 「12 suite(s) passed in 16s」
用同样 9 个 filter 实测只命中 8 个套件,输出 8 suite(s) passed in 8s(dsh-ops 这个 filter 匹配 0 个套件)。
(b) 「三处 pinned digest 随之更新(file-sdk-render、capabilities)」
实际 64-hex 断言只变了 2 处,且都在 test/capabilities.test.mjs;test/file-sdk-render.test.mjs 根本没有 digest。
(c) 用 digest 更新充当「字节测量」
digest 是断言值,不是测量。我实测的真实影响:write_file schema 渲染 +56 字节、工具描述 +81 字节、字段描述 +55 字节、18 个能力的 PTC 声明 113501→113557。
已核实为真的部分
- 0.5.0 基线的
PARAMETERS.write_file.required确实是["path","content","expectedRevision"](问题真实存在) - 归一化只作用于
write_file(CREATE_ONLY仅一项;edit_file走existingRevision)—— 这点做得干净 file-args10/10、file-sdk-render14/14、capabilities6/6- revert-red →
capabilities2/6、file-args2/10、file-sdk-render1/14 红
处置建议
关闭,采纳 #541 的文档方案。若维护者偏好 omission 契约,则必须同时回滚 #541 的 required / docs / tests,并修正上述 body 数字。
|
Closing — #541 landed the contract in |
Closes #419
What was wrong
ops_write_file's create-only path was only reachable if the model literally emittedexpectedRevision: "absent".src/capabilities/file.ts:61keptexpectedRevisionrequired for allfive mutation tools, the descriptions at
:14/:132did not name the literal for the create case,src/capabilities/arguments.tsdid not normalise an omitted value, and the worker has no serdedefault. A model that writes
{path, content}— the natural create call — got an argument errorinstead of a created file.
The change
src/capabilities/file.ts—write_filerequires onlypathandcontent; both descriptionsname the
"absent"sentinel.src/capabilities/arguments.ts— a create-only map: an omittedexpectedRevisionisnormalised to
"absent"before the request reaches the worker, so the wire contract still carriesan explicit CAS expectation. A supplied
""/ blank /nullstays on the reject path, andedit/copy/move/remove still require an observed revision.
test/file-args.test.mjs,test/file-sdk-render.test.mjs,test/capabilities.test.mjs,test/file-operations.test.mjs(the raw worker must keep refusing the omission), and areal-worker host-lane check in
test/permissions.test.mjs.docs/troubleshooting.md+docs/常见问题.md+docs/CHANGELOG.md.Deliberately not done: no Rust change and no worker rebuild — the baseline worker already accepts
the injected wire value, which the end-to-end probe below proves.
Validation
docs/CHANGELOG.md## [Unreleased]:已加(EN+ZH)expectedRevision从write_file的 required 集合移出,并在描述中点名"absent";schema 字节变化见file-sdk-render的 digest 更新(同 PR 内已同步)pull_request事件触发,届时回填CI required的 run URLEnvironment
065cd7fnpm ci --ignore-scripts未验证 / 风险披露
%TEMP%会被拒,permissions的该检查因此在默认口径下红;用带用户授权 + Low 标签的工作区临时根时
file-operations15/15、permissions的该检查绿。这是本机环境,不是 CI 行为。
test/*.mjs的 pinned digest 随之更新(file-sdk-render、capabilities),请重点核对。CI