Repository navigation
feat(app-shell): the Studio option editor authors an option's lifecycle kind - #26931
Merged
Merged
Conversation
…le kind The picklist option editor owned value/label/color and carried `kind` only through its rest bag, so a Studio-built select could never become the object's stageField: ObjectSchema refuses a stage field whose option declares no kind, and nothing in Studio could write one. `kind` is now an owned key with a picker (no kind / open / won / lost) on single-value select and radio fields only; a multi-value field draws no picker and writes no kind, a retype to one drops the kinds, an out-of-vocabulary kind is reported as a malformed row, and the inspector says what the lifecycle field needs. Claude-Session: https://claude.ai/code/session_01JQwxbX9Xgog3zJyBcPdC2R Co-authored-by: Claude <noreply@anthropic.com>
…raft, and the i18n patch changeset Claude-Session: https://claude.ai/code/session_01JQwxbX9Xgog3zJyBcPdC2R Co-authored-by: Claude <noreply@anthropic.com>
…ocale Claude-Session: https://claude.ai/code/session_01JQwxbX9Xgog3zJyBcPdC2R Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
席位核对ACCEPT · seat 席位意见:选项编辑器现在把
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 Warren · project thread
Fixes #26729
Clause-②: no
Metadata-protocol: none
维护者速读
kind。kind,而 Studio 原来没有任何地方能写它,保存一律 422,只能走 API。kind,改成多值类型时会去掉kind;回滚即 revert 本 PR。ObjectFieldInspector.tsx的patchOptions与changeType(写入与去除kind的两处),其次classifyOption(非法kind走异常行)。pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.optionKind-26729.test.tsx,预期 16 个测试全过。What changes
kindbecomes an owned key of the picklist option editor.Optiongainskind?: SelectOptionKind;classifyOptionmoves it out of therestbag into its own slot (the docblock's "the three parts move together":Option,readOptions,patchOptions). The vocabulary is read from the installed contract (SelectOptionSchema.shape.kind.unwrap().options), not re-listed.data-testid="option-kind", the shared RadixSelect): "No kind" / Open / Won / Lost. "No kind" removes the key outright — absent stays absent, which is what letsObjectSchematell "declared open" from "forgot the key" understageField.patchOptionswriteskind, only on a single-valueselect/radio(takesOptionKind:SINGLE_OPTION_TYPESandmultiple !== true, the same testFieldSchemaapplies). On a multi-value field no picker is drawn and nokindis written; a kind authored there by other means (whichFieldSchemaalready refuses) is not written back. A retype to a type that cannot carry one drops the kinds, as a retype already drops apicklistthe new type cannot name; a retype toradiokeeps them.kind(kind: 'closed') is a malformed row (kind-not-valid), carried verbatim like the other malformed shapes, rather than silently dropped.stageFieldand an option still has no kind, the inspector shows one held-hint line saying so; it clears once every option has one.designer.field.*rows in thestudionamespace,enandzh:optKind,optKind.unset/.open/.won/.lost,optMalformed.kindNotValid,hint.stageKinds. Noengine.studio.settings.*row. Patch changeset for@object-ui/i18n(app-shell is private).ObjectSettingsPanel.tsx(the Lifecycle picker itself), the spec, the engine.Why
The Lifecycle field picker refused a Studio-authored select (
Option 'new' of field status declares no kind), and the option editor had nokindcontrol: the triage grade asks for the control for the published optionkind(#23809).Tests
New
ObjectFieldInspector.optionKind-26729.test.tsx(16 tests), every case ending atObjectSchema/FieldSchemaor the written document's keys:fields.status.options.{0,1,2}.kind.ObjectSchemathen accepts the object withstageField: 'status'; with one option left unset, the refusal names only that option.selectwithmultiple: true: no picker, nokindwritten,FieldSchemaaccepts.FieldSchemaaccepts both.await loadStudioCatalogue('zh')at import).Ablation (one-shot, through
scripts/ablation-replace.mjs, mutation committed-then-restored): deletingif (o.kind && kindAllowed) out.kind = o.kind;frompatchOptionsturned 5 of the 16 tests red (the three authoring cases, the round trip, the hint); restore verified blob == HEAD andgit diff HEADempty.Acceptance notes
ObjectSettingsPanel's Lifecycle picker is unchanged; the order marked that line optional and the inspector's hint covers what the picker would have said.ui/scripts/__tests__(check-i18n-dead-keys.test.ts"on the real tree",check-vi-mock-inherit.test.ts"the sweep") each hit their 15 s test budget once on this shared box during the fullvitest run scripts/(a different test each run); each file passes alone. Load-sensitive, not this diff; CI's run is the verdict.Verification
Local runs (worktree head 7a53b40, after merging origin/main 96e7a43)
pnpm --filter '@object-ui/app-shell^...' buildunder the verify lock: VERDICT command-exit 0.pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/inspectors/ packages/app-shell/src/views/studio-design/ packages/i18n/ packages/app-shell/src/__tests__/: Test Files 527 passed (527), Tests 6021 passed, 14 skipped.pnpm --filter @object-ui/app-shell run type-checkandpnpm --filter @object-ui/i18n run type-check: exit 0.node scripts/pm/dispatch-gates.mjs --commands: 34 families, all run; 33 exit 0;pnpm --dir ui exec vitest run scripts/exit 1 on the timeout noted above (177 of 178 files green, both affected files green alone).--ranreconciliation: 34 derived, 34 run, 0 NOT-MEASURED.pnpm check:changeset-fixed,pnpm --dir ui run check:i18n-keys,check:i18n-dead-keys,check:i18n-designer-parity,check:i18n-drift,check:new-line-citations.Human Minimum
packages/specholds no runtime logic. (spec untouched)pnpm lintpasses. (CI ownspnpm lint)main, one pull request.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code