Repository navigation
Commit 7e200b4
fix(studio): a read-only package's flow Enabled switch is drawn muted with a lock (#27376)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ836VkJMbRirYcP4FDCFmjrE)_
Part of #27356
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:Studio
自动化页里,只读(代码)包的流程「启用」开关不再画成绿色的可操作开关,改为灰色轨道加一把锁;开/关的位置与文字照旧如实显示。
- 为什么改:HotCRM 18.2.0 浏览器走查(hotcrm#2320 Studio
S10)发现只读包的开关绿着,看起来能点,其实点不动。
- 风险与回滚:只改这一个开关的样式类与一个图标;可写包外观和行为不变;回滚即 revert 本 PR。
-
先看:`ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx`(`flowSwitchEl`
里的 `track` 与 `Lock`)。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyFlowSwitch-27356.test.tsx`,预期
4 个用例全绿。
- 需要你做的:无,席位落地。
## What changes
Row 21 of #27356 (hotcrm#2320, Studio report finding S10): "A read-only
package's flow Enabled switch is drawn on and green, like a live
control."
In the Automations pillar's flow header (`flowSwitchEl` in
`StudioDesignSurface.tsx`), on a read-only package:
- The track is muted: `bg-muted-foreground/60` when the flow is on,
`bg-muted-foreground/25` when it is off, instead of `bg-emerald-500` /
`bg-muted-foreground/40`.
- A lock icon (`Lock`, `aria-hidden`) sits between the track and the
word.
- The button drops its hover fill and the `disabled:opacity-50` fade,
and reads in `text-muted-foreground`, so the lock and the word stay
legible.
- Unchanged: the thumb position, the word (Enabled / Disabled),
`aria-checked`, `disabled`, and the read-only reason on the wrapper
(objectui#12303).
A writable package's switch is unchanged: green track when on, hover
fill, operable.
## Why
The switch was already disabled on a read-only package (objectui#11124),
but a disabled switch drawn green at half opacity still reads as a live
control that is on. The muted track plus the lock says "on, and locked"
in the same place the read-only chip already says why.
## Tests
`ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyFlowSwitch-27356.test.tsx`
(4 tests, the real `AutomationsPillar` and the registered `FlowPreview`,
harness copied from the objectui#11124 file):
- Read-only, enabled flow: disabled, `aria-checked="true"`, the track
has no `bg-emerald-500` and carries the muted on-class, the thumb is at
on, a hidden lock is present, no hover fill, and a click saves nothing.
- Read-only, disabled flow: `aria-checked="false"`, the fainter track,
the thumb at off, the lock.
- CONTROL writable, enabled flow: green track, no lock, a click saves
`status: 'obsolete'`.
- CONTROL writable, disabled flow: the grey track it always had, no
lock.
<details><summary>Ablation (one, on the read-only on-track)</summary>
`node scripts/ablation-replace.mjs --anchor "? 'bg-muted-foreground/60'"
--replacement "? 'bg-emerald-500'"` on `StudioDesignSurface.tsx` (anchor
1 → 0, blob `112c2439faa1` → `30f9154353a7`): the new file goes 1 failed
/ 3 passed, `expected 'relative inline-flex h-5 w-9 shrink-0…' not to
contain 'bg-emerald-500'`. Restored: blob after restore = blob at HEAD =
`112c2439faa1`, `git diff HEAD` empty.
</details>
## Acceptance notes
- Setup's Packaged Automation toggle (row 3 of #27356) has the same look
problem; it is seat 2's row and is not touched here.
- The first commit on this branch carries no `Claude-Session` /
`Co-authored-by` trailer pair (a WIP commit pushed before the closure
build); later commits carry it. History is not rewritten.
## Verification
All on head `a24979d2` (merge base `28872e68`), under the shared
verification lock.
- New file: 4 / 4 passed. The eight existing files that drive the same
switch (`automationsReadOnly-11124`, `automationsReadOnlySelect-11546`,
`autosaveInFlight-11204`, `autosaveSwitch-11232`,
`flowRegistration-12349`, `interfacesReadOnly-11136`,
`packageLessFlows-11553`, `AutomationsPillar.narrowRow-11795`) plus the
new one: 9 files, 76 / 76 passed.
- `pnpm --filter @object-ui/app-shell run type-check` (both `tsc`
programs): exit 0.
- `pnpm --dir ui run check:new-line-citations`: 0 new citations, exit 0.
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 34 families derived, all 34 run, all exit
0; `--ran` reconciliation: 34 run, 0 NOT-MEASURED, 0 UNRUN. Tier: no
path-derived mandate; 224 changed lines.
<details><summary>Derived gate exits</summary>
Every family below exited 0: `check-adr-0087-registration` (and
`--self-test`), `check-changeset-no-major`,
`check-closing-keyword-parity` (and `--self-test`),
`check-comment-mask-corpus`, `check-empty-changeset` (and
`--self-test`), `check-sdui-manifest` (and `--self-test`),
`release-rehearsal-clone --self-test`, `release-pending-publish
--self-test`, `pnpm --dir ui exec vitest run scripts/` (174 files
passed, 2 skipped; 4987 tests passed), `spec check:duration-unit-keys`,
and `check:` changeset-gate-self-tests, closed-ceremony-text,
cross-package-test-inputs, dispatcher-error-vocabulary,
driver-memory-census, engine-double-contract, gitlink-declared,
nul-bytes, pm-changeset-deadline-census, published-files,
query-options-erasure, refd-timer-probe, skill-identifier-liveness,
test-source-alias, tier-file-adoption, type-check-coverage,
type-check-debt, undeclared-dep-imports, watch-hint-literal,
where-matcher.
</details>
Repo-wide lint, the full ui test battery and the e2e jobs are CI's.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbWuU6sVfBYiy4dY4PA)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 01516dc commit 7e200b4
3 files changed
Lines changed: 221 additions & 3 deletions
File tree
- .changeset
- ui/packages/app-shell/src/views/studio-design
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8778 | 8778 | | |
8779 | 8779 | | |
8780 | 8780 | | |
| 8781 | + | |
| 8782 | + | |
| 8783 | + | |
| 8784 | + | |
| 8785 | + | |
| 8786 | + | |
| 8787 | + | |
| 8788 | + | |
| 8789 | + | |
| 8790 | + | |
| 8791 | + | |
8781 | 8792 | | |
8782 | 8793 | | |
8783 | 8794 | | |
| |||
8794 | 8805 | | |
8795 | 8806 | | |
8796 | 8807 | | |
8797 | | - | |
8798 | | - | |
| 8808 | + | |
| 8809 | + | |
| 8810 | + | |
| 8811 | + | |
8799 | 8812 | | |
8800 | 8813 | | |
8801 | | - | |
| 8814 | + | |
8802 | 8815 | | |
8803 | 8816 | | |
| 8817 | + | |
8804 | 8818 | | |
8805 | 8819 | | |
8806 | 8820 | | |
| |||
0 commit comments