fix(metadata-protocol): updateMany classifies an id-less row as a caller error, matching batchData (#5100) - #5200
Merged
Conversation
…ler error, matching batchData (#5100) runUpdateManyLoop lacked the !record.id guard #4793 gave batchData's update branch: the same malformed row answered VALIDATION_FAILED/400 on one by-id face and RECORD_NOT_FOUND/404 ('Record undefined not found') on the other, with the unguarded path handing { id: undefined } to the probe and the write — a reading each driver decides for itself. The guard fires before any engine round-trip, both faces now give one classification (#4620), pinned by a cross-face parity test. record.data handling aligned to the batch branch's || {} in passing. Dormant over REST (UpdateManyRecordSchema requires id, #3939); the change is observable only to in-process protocol callers. Proven red-first: both new cases fail unguarded (RECORD_NOT_FOUND where VALIDATION_FAILED is asserted). After: metadata-protocol 348 tests, typecheck across 82 dependent tasks all green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BotUP49pqhvqGY393n2HfU
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 3 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
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.
Fixes #5100
维护者已拍板补齐守卫,裁定记录在 #5100 的裁定评论。protocol.ts 已知的最后一处 by-id 写面口径漂移(#4435→#5088、#5099 同族),关掉它即关掉整类。
问题
runUpdateManyLoop缺runBatchDataLoopupdate 分支那道!record.id守卫(#4793)。同一个没有 id 的行,两个 by-id update 写面给两种分类:batchDataupdate 分支VALIDATION_FAILED/ 400(Record id is required for update)updateMany(修前)RECORD_NOT_FOUND/ 404,消息是插值出来的Record undefined not found in …请求形状错误被报成数据状态错误,且未设防路径把
{ id: undefined }递进探针和写两层——这个 where 形状怎么读取决于各 driver 对 undefined 键的处理,最好情况是那个 404,其余情况不受任何约束。当前 REST 打不到(
UpdateManyRecordSchema强制 id 必填,#3939)——但这个 dormancy 依赖的不变量写在两个包之外,protocol.ts本地无痕迹;任何新入口(进程内调用、新传输层)都会无声地把它变 live。守卫把分布式不变量收为本地不变量。修法
if (!record.id) throw rowRequiredIdError('update')——与 batch 分支共用同一个 helper、同一分类,守卫先于任何引擎往返(探针也不再跑)。record.data裸递对齐为 batch 分支的record.data || {}(同族微漂移)。undefined)变为 400。changeset 如实记录。先证红再信绿
在 #5088 的跨面一致性测试文件里新增
[#5100]describe(2 例:单面分类断言 + 双面同答案的 #4620 对称 pin,含"引擎从未被问到"断言)。守卫缺席时:修复后:
@objectstack/metadata-protocol40 文件 / 348 用例全绿,turbo typecheck --filter=...@objectstack/metadata-protocol82 任务全过。备注
packages/objectql+service-automation,predicate 批量写按行语义)无共享文件;本 PR 是 fix(metadata-protocol): batchData upsert fork asks existence, not caller visibility (#5099) #5187(upsert 存在性分岔)落地后同分支的串行后续。BatchOperationResultSchema形状 —— 方案 B 已拍板,硬切 + 诚实迁移说明(Blocked-by #4620) #4793 已定的分类补齐到最后一个写面。🤖 Generated with Claude Code
https://claude.ai/code/session_01BotUP49pqhvqGY393n2HfU
Generated by Claude Code