fix(rest): give the bare 501 exits a machine code — NOT_IMPLEMENTED (#4067) - #4068
Merged
Merged
Conversation
…4067) Most REST error exits already carry a typed `code`, and the clone / search 501s answer `{ error, code: 'NOT_IMPLEMENTED' }`. Four 501 exits still returned a bare `{ error: '<string>' }`, so a client could only key on the prose: - the cross-object transactional batch route (POST {basePath}/batch) when the runtime has no transaction() — the last untyped exit on that route, whose siblings (BATCH_NOT_ATOMIC, VALIDATION_FAILED, enforceBatchSize's BATCH_TOO_LARGE) were already typed by the #3897 / #3933 / #3939 line; - the two saveMetaItem-unsupported exits; - the UI-view-resolution-unsupported exit. Each now carries code: 'NOT_IMPLEMENTED', matching clone / search. Additive only (message and status unchanged), so existing clients are unaffected. Extended the cross-object batch 501 test to assert the code. Closes #4067. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TzLE9cw4gZKNyPN2ZP4iTt
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 8 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
July 30, 2026 08:16
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.
Closes #4067。批量 API 契约一致性清扫线(承 #3897 / #3933 / #3939)的收官项 —— 补齐 REST 层最后几处裸串 501。
背景
REST 层的错误出口绝大多数已带类型化
code(VALIDATION_FAILED/BATCH_NOT_ATOMIC/BATCH_TOO_LARGE/PERMISSION_DENIED),clone 与 search 的 501 也已是{ error, code: 'NOT_IMPLEMENTED' }。但四处 501 出口仍返回裸{ error: '<string>' },客户端只能按文案区分:rest-server.ts跨对象批量POST {basePath}/batchtransaction()—— 该路由最后一处未类型化的出口;其余(BATCH_NOT_ATOMIC、VALIDATION_FAILED、enforceBatchSize的BATCH_TOO_LARGE)都已在 #3897 / #3933 / #3939 里类型化saveMetaItem×2'Save operation not supported by protocol implementation''UI View resolution not supported by protocol implementation'跨对象批量那处即本轮待办的 #3;另三处是同形的 501 NOT_IMPLEMENTED 裸串,顺手一起收(与 #2 折进 validateOnly PR 同理),使"每个 501 都带它兄弟早已有的机器码"这一致性真正闭合。
改动
四处 501 一律补
code: 'NOT_IMPLEMENTED',对齐 clone/search 的扁平信封{ error: '<message>', code }。纯新增字段 ——error文案与 status 均不变,现有客户端不受影响,新客户端可按 code 分支。扩展跨对象批量路由的 501 测试:从只断言
status(501)增加断言res.body.code === 'NOT_IMPLEMENTED'。测试
@objectstack/rest全绿:35 文件 / 505 测试(含扩展后的批量 501 断言)。code不影响。@objectstack/restpatch(additive)。审阅指引
改动集中在
packages/rest/src/rest-server.ts的四处res.status(501).json(...),以及rest-batch-endpoint.test.ts的一条断言。🤖 Generated with Claude Code
https://claude.ai/code/session_01TzLE9cw4gZKNyPN2ZP4iTt
Generated by Claude Code