Repository navigation
Commit 5c2e34c
fix(lint): demand flows.FLOW.label for every named flow, the docs flow embed titles any flow by it (#36826)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwB9Gqqp1VYZwEqbXEm1YsTjU)_
Fixes #36400
Clause-②: no
Metadata-protocol: none
repo:objectstack#3 · os-support-ai · session_01WGufziH9MVhWYLVCiw5eXB
## 维护者速读
-
用户能看到什么变化:应用作者运行翻译检查时,没有界面步骤、也没有审批步骤的流程(定时、记录触发、接口流程)现在也会被提示缺少流程名称的译文;终端用户无感,直到作者补上译文后,手册里的流程卡片标题在中文下不再是英文。
- 为什么做:上一轮让流程图里每个步骤名都能翻译,但卡片标题(流程名)只对含界面或审批步骤的流程要求翻译,中文读者会看到英文标题压在中文步骤上。
- 出错会怎样:只多报缺译提示、不改任何运行行为或数据;示例应用的缺译基线随之上调,可直接撤回。
- 要你做什么:无。
## What changes
**Landing point: `packages/lint/src/i18n-walk.ts`, `walkScreenFlows`, as
the dispatch expected.** `flows.FLOW_NAME.label` is now demanded for
every flow with a `name`, instead of only a flow holding a `screen` or
`approval` node. The comment over the demand now names the key's three
readers and says why the third draws any flow.
**Why every declared flow is "drawn" (the card's rule: "a string nobody
reads is not demanded").** The docs viewer's `type: flow` embed titles
its card by `translated?.flowLabel` for whichever flow a page names,
whatever its nodes (`metadata-viewer.tsx:572`). The walk already treats
that embed as drawing every declared flow: since #36383 it asks every
flow's drawn steps for `flows.FLOW_NAME.nodes.NODE_ID.label`, with no
screen/approval predicate (ruling 7076440876, item 1: "A flow node gets
a translatable label key under the flow's translation bundle (spec,
validation and the business-view reader), so every drawn step (start,
end, decision, notify, approval) can carry a label per language."). A
card whose steps are demanded and whose title is not is the exact
symptom the card describes. So this does not turn on a new product
reading: the population is the one the `nodes` demand already uses.
Independently, the Studio flow designer's rail names every flow of the
package by the same key (`StudioDesignSurface.tsx:8508`,
objectstack#35319), though the walk does not use the Studio as a demand
basis (its own comment: "the walk asks only for what the docs embed
draws").
**The card's "embedded flow" premise, measured.** The card reads
"embedded" as an object's or an app's bundled flows. No such declaration
site exists: the spec refuses both (tables below). PR #36383's
acceptance note 1 used "embedded flow" for a flow drawn by the docs
`type: flow` embed, and that is what this PR covers. The acceptance arm
"a flow nobody draws is not" therefore has one real member: a flow with
no `name`, which no bundle entry can address (pinned).
**Unchanged on purpose.** `successMessage` stays demanded only for a
flow with a screen (its one reader is the screen runner); the `nodes`,
`screens`, `approvals`, `refusals`, `notices` and `records` families are
untouched. `packages/cli/src/utils/i18n-coverage.ts` changes one comment
word ("Screen-flow copy" to "Flow copy, every flow's label").
### Census 1: readers that draw a flow's label
| Reader | Where (origin/main 65ee4b7) | Which flows it draws |
|:--|:--|:--|
| Screen-flow runner header and completion toast |
`ui/packages/app-shell/src/views/FlowRunner.tsx:434-445`
(`translateFlow(...).label`); hosts pass the served label in at
`FlowRunsPage.tsx:408`, `RecordDetailView.tsx:2300`,
`useConsoleActionRuntime.tsx:814` | a run paused at a screen |
| Approvals door (inbox, record panel, request page) |
`packages/plugins/plugin-approvals/src/reader-locale-labels.ts:129`
(`flowLabelKey`), `:356-358` | a flow whose `approval` node opened a
request |
| Docs viewer `type: flow` embed, card title |
`ui/packages/components/src/renderers/basic/metadata-viewer.tsx:556`
(`useFlowLabelTranslations`), `:572` (title) | any flow a docs page
names, any node types |
| Studio flow designer: rail row and open-flow header |
`ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx:8508`
(rail), `:8632` / `:9965` (header), via
`metadata-admin/previews/flow-label-translations.tsx:43-45` and
`ui/packages/i18n/src/flowLabels.ts:67-77` | every flow of the package
(not a demand basis for the walk) |
### Census 2: where a flow can be declared
| Site | Evidence | Walked? |
|:--|:--|:--|
| Top-level `flows` | `packages/spec/src/stack.zod.ts:965` (`flows:
z.array(FlowSchema)`) | yes, `config.flows` |
| Composed / plugin-contributed | `composeStacks` concatenates `flows`
(`stack.zod.ts:1677`), last wins by name (`:3396`); each contributed
flow is a top-level flow of its own stack, and the ten bundle packages
run the walk on their own extract configs | yes, as top-level flows of
the composed or contributing config |
| Object-embedded | does not exist:
`packages/spec/src/data/object.zod.ts:1887-1895` refuses `workflows` /
`workflow` and points at a top-level flow | n/a |
| App-bundled | does not exist:
`packages/spec/src/ui/app.zod.ts:1895-1897`, "`flows` is not an App
field — flows are top-level stack metadata" | n/a |
| Install manifest / deploy bundle | `system/app-install.zod.ts:52`,
`system/deploy-bundle.zod.ts:201,229`: names or serialized copies of the
same top-level flows, not authoring sites | n/a |
## Read first (by risk)
1. `packages/lint/src/i18n-walk.ts`, the `flows.FLOW_NAME.label` block
at the top of `walkScreenFlows`: the predicate is gone, `hasScreen`
survives only for `successMessage`.
2. `scripts/i18n-coverage-baseline.json`: two rows rise, nothing else
moves.
3. `packages/cli/test/i18n-flow-screen-coverage.test.ts`, the renamed
describe "the flow label is demanded for every named flow".
Two-minute check: `pnpm --filter @objectstack/cli exec vitest run
--project unit test/i18n-flow-screen-coverage.test.ts
test/i18n-flow-approval-coverage.test.ts` (after building the cli
dependency closure); expect 39 passed, including the scheduled
`nightly_digest` asked for its label and a nameless flow asked for
nothing.
## Tests
<details><summary>Pins changed (the five that pinned the narrow
predicate, rewritten to the new rule)</summary>
- `packages/cli/test/i18n-flow-screen-coverage.test.ts`: the describe is
now "the flow label is demanded for every named flow": a scheduled flow
with no screen emits `flows.nightly_digest.label` seeded with its label;
a flow with `name` absent or empty emits nothing; the coverage gate
lists both flows' labels in one tree and goes quiet for the one
translated. The region-table pin's `http` payload flow now expects its
label and still no screen key.
- `packages/cli/test/i18n-flow-approval-coverage.test.ts`: the scheduled
flow emits only its label (no approval or screen key), and the gate asks
the scheduled flow for its label alone.
</details>
<details><summary>Runs (head 385ed2b)</summary>
- Before the pin edits, the 60 cli unit files matching i18n /
translation / lint: `Test Files 2 failed | 58 passed (60)`, `Tests 5
failed | 652 passed (657)`; the five failures were exactly the
narrow-predicate pins above.
- After: the four flow family files, `Test Files 4 passed (4)`, `Tests
55 passed (55)`.
- `@objectstack/lint` whole suite: `Test Files 229 passed (229)`, `Tests
9513 passed (9513)`. `pnpm --filter @objectstack/lint typecheck` and
`pnpm --filter @objectstack/cli typecheck`: exit 0.
- Ablation (lint resolves through `dist/` in the cli suite, so each leg
rebuilt `@objectstack/lint`): the old predicate put back under a marker
that survives the build, `ablation-dist-preflight` "marker present in 2
built files", the two pin files `Tests 5 failed | 34 passed (39)`;
restored (blob == HEAD, `git diff HEAD` empty), rebuilt, preflight
`--absent` green, `Tests 39 passed (39)`. A first attempt used a comment
marker the build strips, so its preflight failed and its reading was
discarded.
- `node scripts/check-i18n-coverage.mjs` before `--update`:
`app-showcase 425 -> 449`, `app-todo 130 -> 136`; the new `os lint`
findings are exactly 24 showcase flow labels (one locale each) and 3
todo flow labels (two locales each). After `--update`: OK. `pnpm
check:i18n`: all ten bundle packages in sync.
- `dispatch-gates --commands` at 385ed2b: 75 commands, 73 exit 0, 2
NOT MEASURED (exit 3, prerequisite refusals unrelated to this diff:
`check-plugin-teardown-shape.mjs --self-test` needs an unshallow clone
for its pinned fixture, `check:dual-build-cjs-loads` needs a full `pnpm
build`; both left to CI). `dispatch-gates --ran` with recorded exit
codes: "75 derived famil(ies) accounted for — 73 run, 2 NOT-MEASURED (2
DERIVED from a recorded exit 3)". Inside the sweep:
`check:i18n-coverage` "OK (14 config(s), 585 baselined untranslated
string(s), none new)", `check:i18n-walk-parity` "17 declared group(s),
15 walked, 2 exempted", `check:nul-bytes` exit 0.
- `overlap-check.mjs`: merges cleanly with `origin/main`, no open PR
shares a file.
</details>
## Acceptance notes
- The card's "embedded flow" (an object's or app's bundled flows) is not
a declaration site the spec accepts; see census 2. The widened demand
covers every declared flow because the docs flow embed draws any of
them.
- The 24 showcase and 3 todo flow labels are ratcheted, not translated,
as #36383 did for its population.
- Ruling governing the population: 7076440876 (quoted above). No
`ruling`, `maintainer` or ⛔ line in the two edited files sits inside the
edited block; the nearest cited record is #24916 (the approvals door),
kept as the second reader.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufziH9MVhWYLVCiw5eXB)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufziH9MVhWYLVCiw5eXB
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufziH9MVhWYLVCiw5eXB -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 1d28405 commit 5c2e34c
6 files changed
Lines changed: 84 additions & 55 deletions
File tree
- .changeset
- packages
- cli
- src/utils
- test
- lint/src
- scripts
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | | - | |
| 361 | + | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
99 | | - | |
100 | | - | |
| 101 | + | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| |||
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
142 | | - | |
| 144 | + | |
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
149 | | - | |
| 151 | + | |
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
565 | 565 | | |
566 | 566 | | |
567 | 567 | | |
568 | | - | |
569 | | - | |
570 | | - | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
571 | 572 | | |
572 | 573 | | |
573 | 574 | | |
| |||
614 | 615 | | |
615 | 616 | | |
616 | 617 | | |
617 | | - | |
| 618 | + | |
618 | 619 | | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
| |||
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
714 | | - | |
715 | | - | |
716 | | - | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
717 | 724 | | |
718 | 725 | | |
719 | 726 | | |
| |||
723 | 730 | | |
724 | 731 | | |
725 | 732 | | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
737 | 748 | | |
738 | 749 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2443 | 2443 | | |
2444 | 2444 | | |
2445 | 2445 | | |
2446 | | - | |
2447 | | - | |
2448 | | - | |
| 2446 | + | |
| 2447 | + | |
2449 | 2448 | | |
2450 | 2449 | | |
2451 | | - | |
| 2450 | + | |
2452 | 2451 | | |
2453 | 2452 | | |
2454 | | - | |
2455 | | - | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
2456 | 2461 | | |
2457 | | - | |
2458 | | - | |
2459 | | - | |
2460 | | - | |
2461 | | - | |
2462 | | - | |
2463 | | - | |
2464 | | - | |
2465 | | - | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
2466 | 2468 | | |
2467 | | - | |
2468 | | - | |
2469 | | - | |
| 2469 | + | |
| 2470 | + | |
2470 | 2471 | | |
2471 | 2472 | | |
2472 | 2473 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments