Commit 48efe91
fix(spec): hook condition row declares expression, not javascript (#20475)
Fixes #20439
Clause-②: no
## What
`packages/spec/src/data/hook.form.ts`'s `condition` row declared
`language: 'javascript'` over `HookSchema.condition`, which is
`EvaluatedExpressionInputSchema` — a CEL predicate, not a script
(`hook.zod.ts`: `'Predicate (CEL); hook runs only when TRUE …'`). Every
sibling predicate row (`field.form.ts` / `object.form.ts`'s
`visibleWhen` / `readonlyWhen` / `requiredWhen`, and the formula
`expression` row) already declares `language: 'expression'`. A consumer
keyed on the row's declared language (objectui#10963's `CodeWidget` fix)
could not tell this row apart from a real script row (`body.source`,
`action.source`, both genuinely `'javascript'`).
- `condition` row now declares `language: 'expression'`, `helpText: 'CEL
predicate — the hook runs only when TRUE'` (triage's wording, matching
the sibling rows' phrasing).
- Pinned in
`packages/spec/src/system/metadata-form-declared-rows.pin.test.ts` (no
existing row-language assertion was found, so the pin was added beside
that file's existing form-row pins): asserts `hook.condition` declares
`type: 'code'` / `language: 'expression'`, with a control against
`field.visibleWhen` (a sibling predicate row already correct) so the
assertion is shown to actually discriminate.
- `en.metadata-forms.generated.ts` regenerated (`node
scripts/check-i18n-bundles.mjs --write`) to pick up the new helpText.
`zh-CN` / `ja-JP` / `es-ES` kept their existing translated values under
the tool's merge behaviour (now stale relative to the new English source
— the tool does not auto-translate).
- Changeset: `@objectstack/spec` patch.
## Why this landing site
Matches the constraint's expected surface exactly: `hook.form.ts`, the
pin, the regenerated translation bundles, and the changeset. No other
producer or consumer needed a change.
## Tests
- `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2
src/system/metadata-form-declared-rows.pin.test.ts
src/system/metadata-form-zod-reconciliation.test.ts
src/data/hook.test.ts src/data/hook-body.test.ts` — 173 passed.
- `pnpm --filter @objectstack/platform-objects exec vitest run
--maxWorkers=2 src/apps/translations` — 399 passed (21 files), including
`metadata-forms-vocabulary.test.ts` and
`hook-execution-panel-echo-decisions.test.ts`.
- `pnpm --filter @objectstack/spec build && pnpm --filter
@objectstack/spec check:generated` — all 15 generated artifacts up to
date.
- `pnpm check:i18n` — all 9 packages in sync, no undeclared authoring
keys.
- `pnpm --filter @objectstack/spec typecheck` — clean.
- Gate derivation: `node scripts/pm/dispatch-gates.mjs --repo
objectstack-ai/objectstack --commands` → 85 derived families, all run
and reconciled (`--ran`): 84 green, 1 honestly NOT-MEASURED — `pnpm
check:dual-build-cjs-loads` exits its own `PREREQUISITE NOT MET` (3)
because this worktree never ran a full `pnpm build` across every package
in the monorepo (studio, client-react, several
connectors/plugins/services have no `dist/`); that whole-workspace build
is disproportionate to this one-row change and is CI's own "Build Core"
job to run. Nothing about this diff is implicated in that gate.
## Acceptance notes
None — no out-of-scope findings surfaced while making this change.
---
_Generated by [Claude
Code](https://claude.ai/code/session_014EJ1ED8X4MMrT18BhVx4tx)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 8255a51 commit 48efe91
4 files changed
Lines changed: 47 additions & 2 deletions
File tree
- .changeset
- packages
- platform-objects/src/apps/translations
- spec/src
- data
- system
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
903 | 903 | | |
904 | 904 | | |
905 | 905 | | |
906 | | - | |
| 906 | + | |
907 | 907 | | |
908 | 908 | | |
909 | 909 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
0 commit comments