Skip to content

fix(studio): a state-machine row in the validations panel can say its state may be cleared - #36719

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-36567-validations-clearable-state
Nov 23, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-36567-validations-clearable-state

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #36567
Clause-②: no
Metadata-protocol: none

维护者速读

  • 管理员在 Studio 的校验规则面板里编辑状态机时,每一行流转多了一个「可清空」勾选框;改动前后其它界面不变。
  • 为什么做:状态机规则把清空状态字段算作一次流转,只有勾了「可清空」的状态才允许;以前面板写不出这个设置,编辑已有规则时还会把它悄悄删掉,用户随后清空字段就被拒绝。
  • 出错会怎样:最坏是某个状态的「可清空」设置被写错,用户清空字段时被误拒或误放行;不涉及数据丢失,可直接撤回本次合并。
  • 无。

What changes

TransitionsField in ObjectValidationsPanel.tsx parsed 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 as open, and [''] as an empty box.

Now:

  • The "Next states" box shows and edits the named targets only.
  • Each row has a "May be cleared" checkbox (zh: 可清空, with a hover hint) that adds or removes the '' target.
  • Editing the box keeps an existing ''; it is written as the row's last target (targets are a set), so paused: ['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.transitionClearable and engine.studio.rules.transitionClearableHint in the studio namespace's en and zh catalogues (the only two that namespace ships; it is not a zh-Hant generation target).

Tests

New pin: ObjectValidationsPanel.clearableState-36567.test.tsx.

  • "a rule with paused: ['open', ''] round-trips through a row edit unchanged": the box shows open, the row's checkbox is checked; an edit to open, closed writes ['open', 'closed', ''], and an edit back to open writes the original transitions map exactly. Each written rule passes a full ValidationRuleSchema.safeParse.
  • "the checkbox adds and removes the empty-string target".
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 (under os-verify-lock.sh):

 Test Files  14 passed (14)
      Tests  135 passed (135)
os-verify-lock: VERDICT command-exit 0

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 includes tsconfig.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 HEAD empty afterwards.

     × a rule with paused: ['open', ''] round-trips through a row edit unchanged
     × the checkbox adds and removes the empty-string target
 Test Files  1 failed (1)
      Tests  2 failed (2)
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 on git checkout HEAD --. The anchor was the box's filter(Boolean), to.includes('')) and the replacement passes false for to.includes(''). Expected direction: red on the round-trip case only.

ablation-replace: ok mutation landed: anchor 1 -> 0, blob 259e85f4d6e5 -> 9d93a6bd26bb
     × a rule with paused: ['open', ''] round-trips through a row edit unchanged
AssertionError: expected [ 'open', 'closed' ] to deeply equal [ 'open', 'closed', '' ]
 Test Files  1 failed (1)
      Tests  1 failed | 1 passed (2)
ablation-replace: ok restored: blob == HEAD (259e85f4d6e5) and `git diff HEAD` is empty

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

  • Landing point is the expected one (ObjectValidationsPanel.tsx) plus its two catalogue files. No edit under the fenced trees.
  • Not run locally, and declared to CI's Test UI: the full @object-ui/app-shell suite. 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.
  • Out of scope, reported to the seat and not fixed here: (1) a comma typed at the end of the "Next states" box is eaten. The controlled box re-renders from the parsed list, so typing done, c key by key leaves donec. 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 TransitionsField row in ObjectValidationsPanel.tsx (the box's onChange and the new checkbox), then rowTargets above it.

Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/ObjectValidationsPanel.clearableState-36567.test.tsx. Expect Tests 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. --ran verdict: "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-alias was 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-debt first 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

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>
…earable-state pin

Claude-Session: https://claude.ai/code/session_011y7As6kDA9BVrMsBR9rmrJ
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 23, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As6kDA9BVrMsBR9rmrJ

Final green head for L1 review: 26b38360d0c6bd08c2ccc5a30c4281d6907344c2 (read 2026-11-23T14:36Z: 45 check-runs success, 13 skipped, 0 failing or in progress; mergeable_state: clean). Area o7-studio sends this head to L1 thread L1-b. Size 150+/2- across 5 files (code), so the area does not self-review. After ACCEPT the area syncs main (the merge base is 9348f02) before landing and asks L1-b for the delta read.

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); ValidationPreview renders a '' target as a trailing separator or a blank.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As88pUDUZHGdwFmizG4

维护者速读

  • Studio 校验规则面板里,状态机的每一行流转多了「可清空」勾选框;管理员能在 Studio 里允许某状态下清空该字段,编辑这一行也不会再悄悄丢掉已有的「可清空」。
  • 属于「Studio 编辑元数据不破坏原有规则」这条线,修掉一个编辑后用户清空字段被拒的问题。
  • 出错的话只影响这个面板的显示与写回;服务端校验不变,可直接撤回。
  • 无需你操作。

席位核对

Verdict: ACCEPT at head 26b38360d0c6bd08c2ccc5a30c4281d6907344c2 (read 2026-11-23T14:37Z).

  1. Shape. Open, draft, base main, first line Fixes #36567; both "done when" items are delivered (an explicit "May be cleared" control, an edit keeps an existing '', and the paused: ['open', ''] round-trip pin with one ablation), so Fixes is right. No closing keyword binds another card. mergeable_state: clean.
  2. Premise measured. origin/main: ObjectValidationsPanel.tsx:597 parses the targets with .split(',').map((s) => s.trim()).filter(Boolean), the only such parse in the file, and the box displayed to.join(', '). On the head the box shows and parses named targets only and carries to.includes('') through rowTargets; the checkbox adds or removes ''; both write through the same setRow, so the blank-row hold (Studio Data › Validations: new state_machine / format / json_schema rules save immediately with field: created_at and an empty message (an empty transition row persists and publishes); the conditional rule's when is captioned as a fail condition #26731) applies to the checkbox too.
  3. Gates at this head (check-runs). 45 success · 13 expected skip · 0 unexpected skip · 0 failed · 0 pending; Lint & Repo Gates and TypeScript Type Check both success (l1-face.mjs --pr 36719, clean on all 13 items).
  4. Accepted deviations. Tests: red on base (both cases fail with the panel and catalogues restored to 9348f02) and an ablation of the carried to.includes('') turning the round-trip case red, restored to the head blob; every written rule is checked with a full ValidationRuleSchema.safeParse. Nit, accepted as is: '' is always written last, so a hand-written ['', 'open'] comes back as ['open', ''] after a row edit — the same set, and the targets are read as a set. Strings: the studio namespace has exactly two catalogues (en.ts, zh.ts), both given the two new keys. Changeset read sentence by sentence against the diff: every sentence true; @object-ui/i18n (published) carries its patch entry beside the private @object-ui/app-shell.
  5. Out of scope. None found. Skills-docs: not owed (Metadata-protocol: none, no narrowing arm).
  6. Landing. No contract face: no packages/spec/src/**, no governed path, no Clause-②: yes, no narrowing, so no L2 is owed; this record is the review of record at TIER_DEFAULT. No content/docs/releases/ path. SQL push-down: not applicable. Land on this head, or on a main-sync head after a delta read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As88pUDUZHGdwFmizG4

席位核对 — delta read

Delta read at head f33ba3da011bbd66a3b99420f68d81a9af6bea22 (read 2026-11-23T15:01Z): the move from 26b38360d0c6bd08c2ccc5a30c4281d6907344c2 is one merge of origin/main (parents 26b38360 and e343ab7c). Seat reading: git diff MERGE_BASE HEAD | git patch-id --stable is 47da18c165b14ab6a23e7868d4f9636dfd446af4 at both heads, and no commit main brought in touches ObjectValidationsPanel.tsx or the studio i18n catalogues. The PR's own change is the one reviewed; the ACCEPT in comment 7104299620 stands at this head. Checks at f33ba3da: 45 success · 13 expected skip · 0 failed · 0 pending; Lint & Repo Gates and TypeScript Type Check success. No contract record is owed on this PR. Clear to land on this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As6kDA9BVrMsBR9rmrJ

Landing at head f33ba3da011bbd66a3b99420f68d81a9af6bea22 (2026-11-23T15:02Z), area o7-studio:

Reading Result
check-governed-merges.mjs --pr 36719 NOT governed (0 of 5 paths); 152 changed lines ≤ 3000
check-runs at this head 45 success · 13 skipped · 0 failed · 0 pending

L1: ACCEPT 7104299620, delta read 7104917068 at this head. State change: pr_ready + auto-merge; #36567 closes on merge (Fixes).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 23, 2026 15:02
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 0e83fe0 Nov 23, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-36567-validations-clearable-state branch November 23, 2026 15:28
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
… 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Studio validations panel cannot author a clearable state: it drops the '' target of a state_machine row

2 participants