Repository navigation
fix(studio): a state-machine row in the validations panel can say its state may be cleared - #36719
Conversation
… edit Claude-Session: https://claude.ai/code/session_011y7As6kDA9BVrMsBR9rmrJ Co-authored-by: Claude <noreply@anthropic.com>
The row's Next states box holds the named targets; the empty-string target is a per-row May be cleared checkbox, and editing the box keeps an existing empty-string target in its place. Claude-Session: https://claude.ai/code/session_011y7As6kDA9BVrMsBR9rmrJ Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As6kDA9BVrMsBR9rmrJ Co-authored-by: Claude <noreply@anthropic.com>
…earable-state pin Claude-Session: https://claude.ai/code/session_011y7As6kDA9BVrMsBR9rmrJ Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#7 · os-alice · session_011y7As6kDA9BVrMsBR9rmrJ Final green head for L1 review: Out-of-scope findings from the dev report (class a, not fixed here; the area files them after review): the "Next states" box eats a typed trailing comma (controlled input re-rendered from the parsed list); |
|
repo:objectstack#7 · os-alice · session_011y7As88pUDUZHGdwFmizG4 维护者速读
席位核对Verdict: ACCEPT at head
|
|
repo:objectstack#7 · os-alice · session_011y7As88pUDUZHGdwFmizG4 席位核对 — delta readDelta read at head |
|
repo:objectstack#7 · os-alice · session_011y7As6kDA9BVrMsBR9rmrJ Landing at head
L1: ACCEPT 7104299620, delta read 7104917068 at this head. State change: |
… a typed comma (objectstack-ai#37837) <!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6Jao5S6gNFvmKHxrqpXWgottKg)_ Fixes objectstack-ai#36733 Clause-②: no Metadata-protocol: none ## 维护者速读 - 管理员在 Studio 的校验规则面板里给状态机规则填“下一状态”时,逐键输入逗号不再被吞,能填出两个及以上的下一状态。 - 属于 Studio 规则编辑体验的修补,替在 Studio 里定义状态流转的管理员解决输入问题。 - 出错时只影响这个输入框的显示与写入,不改存储格式,可直接撤回。 - 无 ## What changes - `TransitionsField` in `ObjectValidationsPanel.tsx`: the row's "Next states" box keeps its own typed text while it is being edited (per-row `editing` state: row index + text). Each change still writes the parsed targets, so autosave behaviour is unchanged; the box is no longer re-derived from those targets on every key, so a typed `,` and the following space survive. On blur the box shows the targets again. Deleting a row clears the held text, since the rows below move up an index. - PR objectstack-ai#36719's behaviour is kept: the `''` target stays the row's "May be cleared" checkbox, and editing the box keeps it (`rowTargets(..., to.includes(''))` unchanged). - A patch changeset for `@object-ui/app-shell`. ## Tests - New pin `ObjectValidationsPanel.typedComma-36733.test.tsx`: types `done, closed` one key at a time (`fireEvent.change` per key, value read back from the element) and asserts the box text and the written targets `['done', 'closed']` (full `ValidationRuleSchema.safeParse` green on the written rule), then blur; a second case types `, closed` into a clearable row and asserts `['open', 'closed', '']`. - Ablation (one): the `value` restored to `to.filter((s) => s !== '').join(', ')` on disk; the pin goes red (2 failed; `expected [ 'openclosed', '' ] to deeply equal [ 'open', 'closed', '' ]`); restored with `git checkout HEAD`. - Existing pins `clearableState-36567` and `newRuleComplete-26731` unchanged and green. <details><summary>Readings at acfbb9d</summary> - `pnpm exec vitest run --maxWorkers=2 packages/app-shell/src/views/studio-design/ObjectValidationsPanel` (from `ui/`, under the verify lock): `Test Files 14 passed (14)`, `Tests 122 passed (122)`, VERDICT command-exit 0. - `pnpm --filter @object-ui/app-shell type-check` (includes `tsconfig.test.json`): VERDICT command-exit 0. - `dispatch-gates.mjs --commands` derived 38 commands; all 38 exit 0; `--ran` reconciliation: 38 run, 0 NOT-MEASURED (derived zero). - eslint on the two touched files: 0 errors, 1 pre-existing warning (`react-hooks/set-state-in-effect` in `JsonField`, not in this diff). </details> ## Acceptance notes - The pin is a new file as the claim names; the panel has no shared harness file (each pin file carries its own `Harness`). - Browser not exercised; the reach is the RTL render the card measured. ## Verification Read first: `ObjectValidationsPanel.tsx` (the `TransitionsField` hunk: the `value` / `onChange` / `onBlur` of the next-states input and the delete button). Two-minute check: from `ui/`, `pnpm exec vitest run packages/app-shell/src/views/studio-design/ObjectValidationsPanel.typedComma-36733.test.tsx` shows 2 passed. --- _Generated by [Claude Code](https://claude.ai/code/session_01L9qibzpqH1nQTsbGckLspg)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
Fixes #36567
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
TransitionsFieldinObjectValidationsPanel.tsxparsed a row's next states with.split(',').map(trim).filter(Boolean), so the empty-string target (a clear of the field, allowed from that state since PR #36127) could never be authored, and any edit to a row that already listed it dropped it. The display side lost it too:['open', '']rendered asopen,and['']as an empty box.Now:
''target.''; it is written as the row's last target (targets are a set), sopaused: ['open', '']is written back unchanged.Measured against the dispatch's mechanism hypotheses: the parse in the targets box is the only parse site in the panel (
split(occurs once in the file at 9348f02); the display side (to.join(', ')) also lost the''and is fixed in the same change. Nothing changes on the server or in the spec (ADR-0020 D1/D3 shape and enforcement unchanged).New strings:
engine.studio.rules.transitionClearableandengine.studio.rules.transitionClearableHintin the studio namespace'senandzhcatalogues (the only two that namespace ships; it is not a zh-Hant generation target).Tests
New pin:
ObjectValidationsPanel.clearableState-36567.test.tsx.open, the row's checkbox is checked; an edit toopen, closedwrites['open', 'closed', ''], and an edit back toopenwrites the originaltransitionsmap exactly. Each written rule passes a fullValidationRuleSchema.safeParse.Panel suites at 26b3836: 14 files, 135 tests, all pass
pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/views/studio-design/ObjectValidationsPanel packages/app-shell/src/views/metadata-admin/previews/ValidationPreview.test.tsx(underos-verify-lock.sh):pnpm --dir ui exec vitest run --maxWorkers=2 packages/i18n/: Test Files 106 passed (106), Tests 1978 passed, 13 skipped (1991), VERDICT command-exit 0.pnpm --filter @object-ui/app-shell type-check && pnpm --filter @object-ui/i18n type-check(the app-shell script includestsconfig.test.json, which compiles the test files): VERDICT command-exit 0.Red on main: the pin fails against the base panel
Panel and both catalogues restored from 9348f02 into the worktree (unstaged), then put back with
git checkout HEAD --;git diff HEADempty afterwards.One ablation: the box edit drops the kept target
Done after the fix was committed, through
node scripts/ablation-replace.mjs, with a restore trap ongit checkout HEAD --. The anchor was the box'sfilter(Boolean), to.includes(''))and the replacement passesfalseforto.includes(''). Expected direction: red on the round-trip case only.Observed as predicted: the round-trip case went red and the checkbox case stayed green. The subject is imported from source, so no build leg was needed.
Acceptance notes
ObjectValidationsPanel.tsx) plus its two catalogue files. No edit under the fenced trees.Test UI: the full@object-ui/app-shellsuite. A local run held the shared verification lock for more than 35 minutes without finishing and was stopped. The panel's own 13 suites, the preview suite and the i18n package ran green.done, ckey by key leavesdonec. A throwaway probe confirmed this at 26b3836; the base runs the same parse expression. The cause is the same parse expression, but the fix (a text buffer) is a design change. (2) The metadata-admin validation preview renders an''target as a trailing|(open |), or as a blank where neither a target nor "dead end" shows (closed →). A throwaway probe confirmed it.Verification
Read first: the
TransitionsFieldrow inObjectValidationsPanel.tsx(the box'sonChangeand the new checkbox), thenrowTargetsabove it.Two-minute check:
pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/ObjectValidationsPanel.clearableState-36567.test.tsx. ExpectTests 2 passed (2).Local gates at 26b3836 (derived by dispatch-gates --commands, reconciled by --ran: 38 derived, 38 run)
All 38 exit 0, each with its exit code recorded before any pipe.
--ranverdict: "38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none of them is 3)".check:test-source-aliaswas red on the first sweep (the new pin reached three dynamic imports in clocked windows). The pin now imports them at module top, as its sibling suites do.check:type-check-debtfirst returned PREREQUISITE NOT MET (lock queue-timeout behind this PR's own suite run), then exit 0 under the lock. Every family CI runs is read from this PR's check-runs.node scripts/pm/overlap-check.mjs: VERDICT clean exit 0 before each push.Generated by Claude Code