Repository navigation
fix(app-shell): Studio API tab example body leaves out owner_id and optional references - #27613
Merged
Merged
Conversation
…ptional references The example body put the id "related_record_id" into every reference field and added the platform-filled owner_id when there was room, so the copied Create and Update cURL were refused reference_not_found. Optional references and system fields now never join the body; a required reference shows a placeholder naming its target. Claude-Session: https://claude.ai/code/session_01Utp6CbUYNdYFJJSovGy2qL Co-authored-by: Claude <noreply@anthropic.com>
An object whose writable fields are all optional references or platform fields now shows an empty body, and the note still names them. Claude-Session: https://claude.ai/code/session_01Utp6CbUYNdYFJJSovGy2qL Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#3 · os-bill · session_01Utp6CaJoinvGQSbHeDaWBe 席位核对ACCEPT · head
Generated by Claude Code |
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.
Requested by Bill · project thread
维护者速读
owner_id和可选的引用字段;必填引用字段改成一眼就能认出的占位符(尖括号包住的id of a showcase_project record)。"related_record_id",这个 id 不对应任何记录,复制出来的新建/更新 cURL 在几乎所有对象上都被 400reference_not_found拒掉。ObjectApiPanel.tsx一个文件。ObjectApiPanel.tsx的buildExampleBody(哪些字段进体)→ 同文件referencePlaceholderFor(必填引用的占位符)→ 钉住测试新增的 objectstack#27490 一节。pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/ObjectApiPanel.exampleBody-11803.test.tsx,预期 13 个测试全绿。Fixes #27490
Clause-②: no
Metadata-protocol: none
What changes
ui/packages/app-shell/src/views/studio-design/ObjectApiPanel.tsx,buildExampleBodyand the reference branch ofexampleElementFor:system: true, such asowner_id, which the platform fills in when it is left out), and a reference field (REFERENCE_VALUE_TYPES:lookup,master_detail,user,tree). Both come from the field metadata the draft already carries; there is no list of field names. They are still named in the panel's "Optional fields not shown" note, so every writable field is either in the body or named.id of a TARGET recordwrapped in angle brackets, the target read through the spec'sreferenceTargetOf(so auserfield namessys_user), the same angle-bracket form as the cURL's token placeholder. Before, it was"related_record_id", which reads like a working value.The previous "own fields before platform fields" ordering is now a stronger rule: platform fields are never shown when optional.
Tests
ObjectApiPanel.exampleBody-11803.test.tsx(the existing pin) is extended with aobjectstack#27490describe block of 5 tests. Its oracle is the write path's own reference check:assertReferencesResolvein@objectstack/objectqlresolves a supplied value only on a field thatreferenceTargetOfanswers a target for. So for every key of the shown body the test assertsreferenceTargetOf(def)is undefined (nothing for that check to refuse) and the value still parses undervalueSchemaFor(def, 'stored').showcase_project;sys_userfor auserfield).owner_id.Two existing tests are adjusted, not weakened: the per-type zoo test reads a reference type's value shape with the field marked required (an optional one is no longer in the body), and the multi-value test marks
f_lookupsrequired for the same reason.Test and ablation readings (head 8e49824)
pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/ObjectApiPanel.exampleBody-11803.test.tsx: Test Files 1 passed (1), Tests 13 passed (13).scripts/ablation-replace.mjs: the never-shown predicate replaced byfalse(anchor 1 to 0, blob f6f17e67 to bdfdf47c). Tests 4 failed, 8 passed: the three new body tests and the existing ordering test. Restored: blob equals HEAD,git diff HEADempty.'related_record_id'(blob f6f17e67 to a11e246e). Tests 1 failed (the placeholder test), 11 passed. Restored the same way.|| omitted.length > 0replaced by a constant-false marker (blob e4365cdd to b4195746). Tests 1 failed (the empty-body note test), 12 passed. Restored the same way. A first attempt whose replacement was a substring of the anchor was refused by the tool (replacement count did not rise) and ran nothing.pnpm --filter @object-ui/app-shell type-check(bothtsc --noEmitandtsc -p tsconfig.test.json): exit 0.Acceptance notes
owner_idissystem: trueand never required, so it is never in the body.FILE_REFERENCE_TYPES) keep thefile_idsample. The write path's reference check does not resolve them (referenceTargetOfanswers no target), so they are outside this card.Verification
Local gates on head 8e49824: the
dispatch-gates --commandslist for this diff, 34 families, each recorded ascommand :: exit codebefore any pipe. All 34 exit 0;--ranreconciliation: 34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN.node scripts/check-sdui-manifest.mjsexit 0 (in that list).pnpm --dir ui check:new-line-citations: 0 new citations.check-nul-bytesexit 0.On the first head (c2a2ffc)
pnpm --dir ui exec vitest run scripts/was red on two tests outside this diff (check-hand-rolled-comment-mask.test.tsandjs-comment-mask-returns-interpolation-9424.test.ts), bothTest timed out in 15000mswhile a build held the box; on 8e49824 the same command exits 0.Not run locally, left to CI: the full
app-shellsuite (thestudio-designfolder alone holds 247 test files, past the container's foreground limit) and the repo-wide lint. CI runs the full set.🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CbUYNdYFJJSovGy2qL
Generated by Claude Code