Repository navigation
Commit f87239a
feat(spec): CloneFlowResponseSchema declares an optional data.noticeCode beside notice (#29779)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8JbeVEbdsiqjx3ASFPM7H2E)_
Fixes #29758
Clause-②: yes (widening)
Metadata-protocol: none
This is the contract-first half of #29727 and unblocks it: the server
half (sending the code from the flow clone door) stays on #29727.
## 维护者速读
- 改了什么:流程「新建相似」(clone) 接口的响应 schema 在 `notice` 旁新增可选字段
`noticeCode`,用一个稳定代码标识这句提示。
- 为什么改:`notice` 是服务端写死的英文句子,控制台无从得知是哪一句,中文界面只能原样显示英文;有了代码,控制台可以换成自己的译文。
- 风险与回滚:仅为可选键,旧服务端不发它时照常解析,`notice` 仍必填、仍是英文兜底;回滚即撤掉该键,无数据迁移。
-
先看:`packages/spec/src/api/automation-api.zod.ts`(`CloneFlowResponseSchema`
的 `noticeCode`
与其说明),`packages/spec/src/api/automation-api.zod.test.ts`(四条
pin),`.changeset/29758-clone-flow-notice-code.md`。
- 两分钟验证:`pnpm --filter @objectstack/spec exec vitest run
src/api/automation-api.zod.test.ts`,预期 72/72 通过。
- 需要你做的:无,席位落地(键名 `noticeCode` 在否决窗口内,有异议请在本 PR 说)。
## What changes
- `CloneFlowResponseSchema.data`
(`packages/spec/src/api/automation-api.zod.ts`) declares `noticeCode:
z.string().optional()` beside `notice`, described as a stable code
naming the `notice` sentence: a client maps a code it knows to its own
translated sentence and falls back to `notice` verbatim for an unknown
or absent code. No code values are enumerated; the vocabulary is the
server's (#29727). `notice` and its describe are unchanged. The schema's
TSDoc gains one sentence saying the same.
- Name: `noticeCode`, the seat's call under the veto window. A key named
`THING` + `Code` for the code of a sibling sentence follows
`declaredCode` in `packages/spec/src/api/contract.zod.ts`.
- Generated: `content/docs/references/api/automation-api.mdx` (via
`gen:docs`) is the only artefact the member moves.
`check:authorable-surface`, `check:api-surface`, `check:export-origins`,
`check:declaration-map` and `check:strictness-ledger` stayed green with
no regeneration: the authorable-surface shard lists
`api/CloneFlowResponse:data` and nothing below it, and no export was
added.
- Changeset: `@objectstack/spec` **patch**, not the minor the dispatch
named. `Metadata-protocol: none` (a REST answer shape is nothing a
metadata author writes, and no authorable-surface shard moved), and
`scripts/check-changeset-no-major.mjs` refuses a `minor` beside `none`;
a non-protocol widening ships `patch` and keeps `Clause-②: yes
(widening)`. `@objectstack/client` gets no entry: `automation.clone()`
returns `CloneFlowResponse['data']` imported from `@objectstack/spec` (a
dependency, external to the client's tsup build), so its emitted types
do not change.
## Why
The Console prints `data.notice` verbatim, so the flow "New similar"
notice shows English under zh-CN (#29706 row 1). Nothing in the answer
named which sentence it was. A code beside it lets the Console translate
it, contract-first, before the server sends one.
## Tests
`packages/spec/src/api/automation-api.zod.test.ts`, new
`describe('CloneFlowResponseSchema — data.noticeCode names the notice
sentence')`:
1. accepts a string `noticeCode` beside `notice` and keeps it on the
parsed value;
2. an answer without `noticeCode` still parses;
3. `notice` is still required (one issue, `invalid_type` at
`data.notice`);
4. a non-string `noticeCode` is refused (one issue, `invalid_type` at
`data.noticeCode`).
Ablation, once, on the committed head `d419dc32` through
`scripts/ablation-replace.mjs` (the test imports `./automation-api.zod`
from source, so no dist leg): renaming the key to `noticeCodeAblated`
landed on disk (anchor 1 → 0, blob `767587bb7ef0` → `c06b7927ece5`);
pins 1 and 4 went red (2 failed, 70 passed); restored to blob
`767587bb7ef0` with `git diff HEAD` empty.
## Acceptance notes
Consumers of `CloneFlowResponse`, read on `origin/main` `c9c68288`:
- `packages/client/src/index.ts` `automation.clone()` returns
`CloneFlowResponse['data']`: gains the optional key through the type, no
edit.
- `packages/runtime/src/domains/automation.ts` (the clone handler)
answers `{ flow, packageId, notice: FLOW_CLONE_NOTICE }` from
`packages/runtime/src/flow-clone.ts`: unchanged here, and still parses
(the key is optional). Serving the code is #29727.
- `packages/runtime/src/route-ledger.ts` names `CloneFlowResponseSchema`
for the clone row; its note spells `data` as `{ flow, packageId, notice
}`, which #29727 updates when it serves the code.
-
`packages/runtime/src/domains/automation-flow-clone-custom-package.test.ts`
parses each answer through the schema: still green by construction
(optional key).
-
`ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newSimilar-28567.test.tsx`
names the schema in a comment only. The Console mapping is #29706.
`packages/metadata-protocol/src/protocol.ts` is not touched (freeze).
## Verification
All readings on head `be18e3d1` (`objectstack-ai/objectstack`, merge
base `c9c68288`).
<details><summary>Local runs</summary>
- `pnpm --filter @objectstack/spec build` under the verify lock: VERDICT
command-exit 0.
- `pnpm --filter @objectstack/spec check:generated`: first run named one
stale artefact (`content/docs/references/**`), regenerated with
`gen:docs`; re-run "All 14 generated artifacts are up to date", exit 0.
- `pnpm --filter @objectstack/spec typecheck` under the lock: VERDICT
command-exit 0.
- `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2` (the
whole spec suite) under the lock: VERDICT command-exit 0, Test Files 892
passed (892), Tests 25326 passed, 1 todo.
- `pnpm lint` (`eslint . --no-inline-config`): exit 0.
- `node scripts/pm/dispatch-gates.mjs --commands`: 102 derived families.
Run with exit codes recorded before any pipe, then `--ran`: "102 derived
famil(ies) accounted for — 101 run, 1 NOT-MEASURED". Six first exited 3
on missing builds; after `turbo run build` for `@objectstack/lint...`,
`@objectstack/objectql`, `@objectstack/formula` and
`@objectstack/client-react...`, five re-ran at exit 0. NOT MEASURED:
`check:dual-build-cjs-loads` (needs every package's dist; left to CI).
- `node scripts/check-changeset-no-major.mjs --base c9c6828 --event
EVENT` with this body: exit 0, "LEVEL AXIS: clause-② yes (widening) and
metadata-protocol none … a non-protocol change at patch".
</details>
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
Card thread session `session_01JQwxbWyGo9rhjNEzeo5Ujt`, dispatched by
`domain:server#1`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01JQwxbWyGo9rhjNEzeo5Ujt
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbWyGo9rhjNEzeo5Ujt)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 69dbb3c commit f87239a
4 files changed
Lines changed: 79 additions & 2 deletions
File tree
- .changeset
- content/docs/references/api
- packages/spec/src/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
710 | 711 | | |
711 | 712 | | |
712 | 713 | | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
713 | 766 | | |
714 | 767 | | |
715 | 768 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
712 | | - | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
713 | 716 | | |
714 | 717 | | |
715 | 718 | | |
| |||
722 | 725 | | |
723 | 726 | | |
724 | 727 | | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
725 | 734 | | |
726 | 735 | | |
727 | 736 | | |
| |||
0 commit comments