Skip to content

Commit 9b99640

Browse files
feat(spec,plugin-audit): an activity milestone's timeline row reads in the reader's language (#37582)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuPE7uyDAJyqjwwMzomWv5ff)_ Fixes #37524 Clause-②: yes (widening) Metadata-protocol: added Skills-docs: follow-up #37585 ## 维护者速读 - 用户能看到什么变化:应用声明的「活动里程碑」(例如工单关闭、商机赢单)写在记录时间线上的那一行,现在按读者的语言显示:应用在翻译包里给这条里程碑写了中文模板,中文用户看到的就是中文句子,句子里的下拉值也显示成中文选项名;没写译文的语言照旧显示作者原文。 - 为什么做:以前这一行永远是作者写的语言,翻译包里没有放它的位置,应用自己没法改(HotCRM 的工单、商机时间线就是这样)。 - 出错会怎样:存下来的行文字不变,只在读的时候换成译文;译文缺失、读请求不带语言、或者是这次改动之前写的旧行,都显示原文。字段权限的遮蔽规则照旧:读者看不到的字段参与拼出的句子,任何语言下都不给。 - 要你做什么:无。技能文档 `skills/objectstack-i18n` 补一句的后续卡是 #37585。 ## What changes **The reading** (at `4116465625`): the timeline already serves most rows in the reader's language — the CRUD mirror stores a summary CODE beside the sentence and the `sys_activity` read middleware re-composes it per reader (`packages/plugins/plugin-audit/src/activity-summary-message.ts`). A fired milestone was the one row left out, by an implementation note in that file ("its template is the author's sentence and is never translated"), and `ObjectTranslationDataSchema` had no key the template could be translated under. ADR-0052 §5b.2 defines the milestone and says nothing about its language. - **Spec, translation slot** (`packages/spec/src/system/translation.zod.ts`). An object translation accepts `_milestones: { <field>: { <value>: { summary } } }`. A milestone declares no name; the watched `field` and the `value` it fires on are what fire it (the writer fires the first declared match), so the pair is its address and no new authorable key is added to `activityMilestones`. `milestones` and `activityMilestones` are refused, and the refusal names `_milestones` as the key to write (as `validations` names `_validations`). - **Spec, resolver** (`packages/spec/src/system/i18n-resolver.ts`). `resolveObjectMilestoneSummary(bundle, object, field, value, opts)` reads the template along the locale chain; a dotted value is one key. It is deliberately NOT overlaid by `translateObject`: an object served by `/meta` with the translated template on it would round-trip into the authored declaration on the next Studio save. A pin holds that `translateObject` leaves `activityMilestones[].summary` as authored. - **Writer** (`packages/plugins/plugin-audit/src/audit-writers.ts`). A fired milestone's row now carries `metadata.summary_message` = `{ key: 'activityMilestone', object, field, value, tokens }`, each token stored as the field-change code stores a value: the text the writer rendered, plus the select option it matched. The stored `summary` is unchanged (the authored sentence, rendered as before), and so are `type`, `metadata.kind` and the text sources the redaction reads. - **Reader** (`activity-summary-message.ts`). `readerSummaryLocale` gains `milestoneSummary`, which reads the template from the same bundle and `ResolveOptions` the labels are translated with. `composeActivitySummary` interpolates it: a select token is named by the option label on the reader-language object definition, any other token by its stored text, and a token with no stored value (a token the translation adds, or an empty value) renders empty, as an empty value does in the authored sentence. No template for the reader's language ⇒ nothing is composed and the stored sentence stands. A tenant that reworded a packaged milestone's `summary` keeps its words (ADR-0029 D9.2a, judged as a reworded validation message is: the served milestone against the packaged one of the same pair, through the resolver's one predicate `scalarOverridesPackagedBase`, whose key union gains `'summary'`; an empty served summary is no rewording, so the catalog still applies). The code is stripped from `metadata` for every non-system reader, as the other non-field-change codes are. - **Redaction, unchanged.** The milestone's token fields were already the summary's declared text sources, so a reader not served one has the `summary` dropped before this middleware runs; the middleware only overlays a `summary` still present, so it never re-adds a dropped one. Pinned below. - **Lint.** The extractor (`i18n-walk.ts`) scaffolds `objects.<o>._milestones.<field>.<value>.summary` for each pair, the first entry of a repeated pair only. The translation-reference rule (`validate-translation-references.ts`) flags a `_milestones` key over a pair no milestone of the object declares, suggesting the near value. - **Example.** `examples/app-showcase` translates its one milestone (`showcase_task`, `status` → `done`) in zh-CN, so the extractor's new key is translated where the coverage gate measures it. - **Docs.** `content/docs/ui/translations.mdx` (the key table) and `content/docs/protocol/kernel/i18n-standard.mdx` (the reference rule's table) name the key. `content/docs/references/system/translation.mdx`, `api-surface/system.json`, `export-origins/system.json` and the strictness-ledger count (`system/` 409 → 410, the new strict object) regenerated by `check:generated --fix`. Small calls made here (no card): the `field` + `value` address rather than a new `name` on a milestone; a boolean token keeps rendering its stored value (as the authored sentence does today) rather than a per-locale yes/no word; token texts are not length-bounded in the code (the authored sentence they come from is not bounded either). Left as they are after contract review (optional, noted here): N3, the `{token}` pattern is spelled twice (writer and reader); N4, the reader asks `getPackagedObjectBase` twice per row with no cache. Neither changes an answer. ## Why An app that is otherwise fully translated still wrote authoring-language rows ("Case escalated — …") on the record timeline, with no key it could fill in. ## Verification - `packages/plugins/plugin-audit/src/activity-milestone-summary-locale.integration.test.ts` (new; real kernel, real audit writer, SQLite, the engine middleware chain): a zh-CN reader reads `商机赢单:Acme(赢单)` from the zh-CN template with the `{stage}` token named by its zh-CN option label; the system, an en reader, a read with no locale and a ja-JP reader (no entry) read the stored `Deal won: Acme (Won)`; the code is stored for the system and served to no other caller; a reader not served a token's field (`note`) gets the row with no `summary`. Red first: with the composer's template lookup stubbed out, the zh-CN pin and the redaction pin's served half fail (2 of 4). - `activity-summary-message.test.ts`, new describe: composes the translated template, an unstored token empty; nothing composed for a locale with no entry or on a locale with no `milestoneSummary`; a tenant's rewording of the packaged milestone keeps its words while the untouched one translates, and an emptied one still translates (fails with the earlier local copy of the comparison); the stored code reads back and a malformed one is refused. - `packages/spec/src/system/i18n-milestone-summary.test.ts` (new): the key is read by pair, a dotted value as one key, along the fallback chain, `undefined` on misses; the schema accepts the group and refuses a key it does not declare; `translateObject` leaves the authored summary. - `packages/lint/src/i18n-milestones-37524.test.ts` (new): the extractor emits one key per fired pair seeded with the authored template; the reference rule resolves declared pairs and flags an undeclared value (with the suggestion) and an unwatched field. - `validate-translation-references.test.ts`: the #13835 object-branch coverage ledger classifies `_milestones` as reference-checked, backed by a ghost that reports, and the all-groups control bundle names the real pair. - Local runs at `92e8e1bcf`: `@objectstack/plugin-audit` vitest 110 files / 1,840 tests pass; `@objectstack/lint` vitest 237 files / 9,683 tests pass (the one red, the coverage ledger, fixed in the tip commit and re-run: 268/268); `@objectstack/spec` vitest `src/system` pass; `node scripts/check-i18n-bundles.mjs` exit 0; eslint on the touched files exit 0; `tsc --noEmit` for plugin-audit exit 0; `pnpm --filter @objectstack/spec check:generated` exit 0; `node scripts/pm/overlap-check.mjs` exit 0. `check:i18n-coverage` needs the built examples and is left to CI. Contract review (L2) is owed before landing: the diff changes `packages/spec/src/**` and declares `Clause-②: yes (widening)`. ## 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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgUpnvPnJ1hR74pUrVj --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgUpnvPnJ1hR74pUrVj)_ <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgUpnvPnJ1hR74pUrVj --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent f4978d9 commit 9b99640

20 files changed

Lines changed: 640 additions & 19 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/plugin-audit': patch
4+
'@objectstack/lint': patch
5+
---
6+
7+
feat(spec,plugin-audit): an activity milestone's timeline row reads in the reader's language — `objects.<object>._milestones.<field>.<value>.summary`
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: added
11+
Skills-docs: follow-up #37585
12+
13+
- **Translation slot.** An object translation accepts `_milestones`, keyed by an `activityMilestones` entry's watched `field` and then the `value` it fires on, each carrying `summary`: the milestone's template in that language, with the same `{field}` tokens. `milestones` and `activityMilestones` are refused, and the refusal names `_milestones` as the key to write. `resolveObjectMilestoneSummary` (`@objectstack/spec/system`) reads it along the locale chain.
14+
- **Timeline rows.** A fired milestone's `sys_activity` row now stores a summary code (`metadata.summary_message`, `key: 'activityMilestone'`): the pair, and each interpolated token's value with the select option it matched. On a read whose caller has a locale, a language that translates the milestone serves the row's `summary` composed from its template, a select token named by the option label in that language. The stored `summary` is unchanged — the authored sentence — and a language with no entry, a read with no locale, and every row written before this change read it as stored. A tenant that reworded a packaged milestone's `summary` keeps its words. The field redaction still judges the composed text by the fields the row was composed from.
15+
- **Extraction and references.** `os i18n extract` scaffolds the key for each milestone pair (the first entry of a repeated pair, the one that fires), and the translation-reference rule flags a `_milestones` key over a pair no milestone of the object declares.
16+
- **Docs.** `content/docs/ui/translations.mdx` and the i18n standard's reference table name the key.

‎content/docs/protocol/kernel/i18n-standard.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,7 @@ beneath an action entry are judged the same way under either.
11761176
| `objects.{object}._tabs.{tab}` | a filter-preset tab's `name` in `interfaceConfig.userFilters.tabs` on a page over that object (`interfaceConfig.source`, else the page's `object`) — a list view's own `tabs` has no renderer and is not resolvable |
11771177
| `objects.{object}._relatedLists.{list}` | the `list` of an object-form `relatedLists` entry on that object that authors a `label` — a dotted `object.field` is one key; a key over an entry with no `label`, a bare-string entry or a built-in tab is an orphan, because that tab's title is the child lookup field's `relatedListTitle`, translated on the child |
11781178
| `objects.{object}._validations.{rule}` | a validation rule's `name` in that object's `validations[]` or in an `objectExtensions[]` entry aimed at it — a `conditional` rule's `then` / `otherwise` branch included |
1179+
| `objects.{object}._milestones.{field}.{value}` | an `activityMilestones[]` entry of that object watching `field` and firing on `value` |
11791180
| `objects.{object}._actions.{action}` | an action bound to that object: one in its `actions`, or a stack-level action whose `objectName` is that object |
11801181
| `globalActions.{action}` | an action with **no** `objectName` — a key naming a bound action is an error whose message names the `objects.{owner}._actions.{action}` key to write instead, `{owner}` being the action's own `objectName` |
11811182
| `{action}.params.{param}` | a param's `name` on that action |

‎content/docs/references/system/translation.mdx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Translation data for a single object
100100
| **_tabs** | `Record<string, { label?: string }>` | optional | Filter-preset tab translations keyed by tab name |
101101
| **_relatedLists** | `Record<string, { label?: string }>` | optional | Record-page related list titles keyed by the relatedLists entry list name |
102102
| **_validations** | `Record<string, { message?: string }>` | optional | Custom validation-rule messages keyed by rule name (`ValidationRuleSchema.name`) |
103+
| **_milestones** | `Record<string, Record<string, { summary?: string }>>` | optional | Activity-milestone summary translations keyed by the watched field, then by the value the milestone fires on |
103104

104105
### Nested Shape: `ObjectTranslationData.fields[string]`
105106

@@ -169,6 +170,12 @@ Translation data for a single field
169170
| :--- | :--- | :--- | :--- |
170171
| **message** | `string` | optional | Translated rejection message — overlays the rule's authored `message` on every rejected write |
171172

173+
### Nested Shape: `ObjectTranslationData._milestones[string][string]`
174+
175+
| Property | Type | Required | Description |
176+
| :--- | :--- | :--- | :--- |
177+
| **summary** | `string` | optional | Translated milestone summary template — the same `{field}` tokens as the milestone's authored `summary` |
178+
172179

173180
---
174181

@@ -224,6 +231,7 @@ Translation data for a single object
224231
| **_tabs** | `Record<string, { label?: string }>` | optional | Filter-preset tab translations keyed by tab name |
225232
| **_relatedLists** | `Record<string, { label?: string }>` | optional | Record-page related list titles keyed by the relatedLists entry list name |
226233
| **_validations** | `Record<string, { message?: string }>` | optional | Custom validation-rule messages keyed by rule name (`ValidationRuleSchema.name`) |
234+
| **_milestones** | `Record<string, Record<string, { summary?: string }>>` | optional | Activity-milestone summary translations keyed by the watched field, then by the value the milestone fires on |
227235

228236
### Nested Shape: `PlatformTranslationData.picklists[string]`
229237

@@ -415,6 +423,7 @@ Translation data for a single object
415423
| **_tabs** | `Record<string, { label?: string }>` | optional | Filter-preset tab translations keyed by tab name |
416424
| **_relatedLists** | `Record<string, { label?: string }>` | optional | Record-page related list titles keyed by the relatedLists entry list name |
417425
| **_validations** | `Record<string, { message?: string }>` | optional | Custom validation-rule messages keyed by rule name (`ValidationRuleSchema.name`) |
426+
| **_milestones** | `Record<string, Record<string, { summary?: string }>>` | optional | Activity-milestone summary translations keyed by the watched field, then by the value the milestone fires on |
418427

419428
### Nested Shape: `ServedTranslationData.picklists[string]`
420429

@@ -669,6 +678,7 @@ Translation data for a single object
669678
| **_tabs** | `Record<string, { label?: string }>` | optional | Filter-preset tab translations keyed by tab name |
670679
| **_relatedLists** | `Record<string, { label?: string }>` | optional | Record-page related list titles keyed by the relatedLists entry list name |
671680
| **_validations** | `Record<string, { message?: string }>` | optional | Custom validation-rule messages keyed by rule name (`ValidationRuleSchema.name`) |
681+
| **_milestones** | `Record<string, Record<string, { summary?: string }>>` | optional | Activity-milestone summary translations keyed by the watched field, then by the value the milestone fires on |
672682

673683
### Nested Shape: `TranslationData.picklists[string]`
674684

@@ -892,6 +902,7 @@ Translation data for a single object
892902
| **_tabs** | `Record<string, { label?: string }>` | optional | Filter-preset tab translations keyed by tab name |
893903
| **_relatedLists** | `Record<string, { label?: string }>` | optional | Record-page related list titles keyed by the relatedLists entry list name |
894904
| **_validations** | `Record<string, { message?: string }>` | optional | Custom validation-rule messages keyed by rule name (`ValidationRuleSchema.name`) |
905+
| **_milestones** | `Record<string, Record<string, { summary?: string }>>` | optional | Activity-milestone summary translations keyed by the watched field, then by the value the milestone fires on |
895906

896907
### Nested Shape: `TranslationItem.picklists[string]`
897908

‎content/docs/ui/translations.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export default defineStack({
7979
| Column headers of a table in an action's result dialog or preflight panel | `objects.<name>._actions.<action>.resultDialog.columns.<field path>.<column path>` / `.preflight.columns.<field path>.<column path>` — a sibling of `fields`, both paths written literally, dots included |
8080
| Form sections | `objects.<name>._sections.<section>` |
8181
| Custom validation-rule messages | `objects.<name>._validations.<rule>.message` |
82+
| Activity-milestone timeline rows | `objects.<name>._milestones.<field>.<value>.summary` — keyed by the milestone's watched `field` and the `value` it fires on; the template keeps the authored `{field}` tokens, and a reader in that language reads the row composed from it, a select token named by its translated option label. A language with no entry reads the authored `summary` |
8283
| App navigation | `apps.<app>.navigation.<id>.label` |
8384
| Dashboard label / description | `dashboards.<name>.label` / `description` |
8485
| Dashboard widget title / description (the card-header subtitle) | `dashboards.<name>.widgets.<widgetId>.title` / `description` |

‎docs/audits/2026-07-unknown-key-strictness-ledger.counts/system.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ hand-patch a number here** — fix the code or the verdict and regenerate.
1919

2020
| Dir | Sites |
2121
|---|---|
22-
| `system/` | 409 |
22+
| `system/` | 410 |

‎examples/app-showcase/src/system/translations/index.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,13 @@ export const ShowcaseTranslationBundle = {
501501
_validations: {
502502
task_status_flow: { message: '任务状态流转无效。' },
503503
},
504+
// The object's one activity milestone (`status` → `done`), keyed by
505+
// the pair that fires it; `{title}` is the authored template's token.
506+
// A zh-CN reader's timeline row reads this; the stored row keeps the
507+
// authored English sentence for every other reader.
508+
_milestones: {
509+
status: { done: { summary: '✅ 任务已完成:{title}' } },
510+
},
504511
_views: {
505512
// The default list — keyed `default`, see showcase_project above.
506513
default: { label: '全部任务' },
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
//
3+
// `objects.<object>._milestones.<field>.<value>.summary` on the two lint
4+
// readers every object translation group has: the extractor walk that
5+
// scaffolds and gates the key, and the orphan rule that refuses a key nothing
6+
// reads. Both key on the pair an `activityMilestones` entry fires on.
7+
8+
import { describe, it, expect } from 'vitest';
9+
import { collectExpectedEntries } from './i18n-walk.js';
10+
import { validateTranslationReferences, TRANSLATION_TARGET_UNKNOWN } from './validate-translation-references.js';
11+
12+
const CASE = {
13+
name: 'crm_case',
14+
label: 'Case',
15+
fields: {
16+
subject: { name: 'subject', type: 'text', label: 'Subject' },
17+
status: { name: 'status', type: 'select', label: 'Status', options: [{ value: 'open', label: 'Open' }, { value: 'closed', label: 'Closed' }] },
18+
},
19+
activityMilestones: [
20+
{ field: 'status', value: 'closed', summary: 'Case closed — {subject}' },
21+
// The same pair again: the writer fires the first, so this one is never rendered.
22+
{ field: 'status', value: 'closed', summary: 'Never shown' },
23+
{ field: 'status', value: 'open', summary: 'Case reopened — {subject}' },
24+
],
25+
};
26+
27+
describe('collectExpectedEntries — an activity milestone\'s summary (#37524)', () => {
28+
const entries = collectExpectedEntries({ objects: [CASE] }, { warnedGroups: new Set() });
29+
const milestoneEntries = entries.filter((e) => e.path[2] === '_milestones');
30+
31+
it('emits one key per fired pair, seeded with the authored template, tokens and all', () => {
32+
expect(milestoneEntries.map((e) => [e.path, e.sourceValue])).toEqual([
33+
[['objects', 'crm_case', '_milestones', 'status', 'closed', 'summary'], 'Case closed — {subject}'],
34+
[['objects', 'crm_case', '_milestones', 'status', 'open', 'summary'], 'Case reopened — {subject}'],
35+
]);
36+
expect(milestoneEntries.every((e) => e.source === 'object' && e.objectName === 'crm_case')).toBe(true);
37+
});
38+
});
39+
40+
describe('validateTranslationReferences — _milestones (#37524)', () => {
41+
const stackWith = (milestones: Record<string, unknown>) => ({
42+
objects: [CASE],
43+
translations: [{ 'zh-CN': { objects: { crm_case: { _milestones: milestones } } } }],
44+
});
45+
46+
it('resolves a key over each declared pair', () => {
47+
expect(validateTranslationReferences(stackWith({
48+
status: { closed: { summary: '工单已关闭 — {subject}' }, open: { summary: '工单已重开 — {subject}' } },
49+
}))).toEqual([]);
50+
});
51+
52+
it('flags a value no milestone of the field fires on, and a field no milestone watches', () => {
53+
const findings = validateTranslationReferences(stackWith({
54+
status: { close: { summary: '已关闭' } },
55+
priority: { high: { summary: '高' } },
56+
}));
57+
expect(findings.map((f) => [f.rule, f.severity, f.path])).toEqual([
58+
[TRANSLATION_TARGET_UNKNOWN, 'error', 'translations[0]["zh-CN"].objects.crm_case._milestones.status.close'],
59+
[TRANSLATION_TARGET_UNKNOWN, 'error', 'translations[0]["zh-CN"].objects.crm_case._milestones.priority.high'],
60+
]);
61+
// A misspelt value is pointed at the declared one it nearly names.
62+
expect(findings[0].message).toContain('"closed"');
63+
for (const f of findings) {
64+
expect(f.message.length, f.message).toBeLessThanOrEqual(200);
65+
expect(f.hint.length, f.hint).toBeLessThanOrEqual(200);
66+
}
67+
});
68+
});

‎packages/lint/src/i18n-walk.ts‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
* ^ a bulk param spells its hint `help`; an ACTION param spells the same
8686
* idea `helpText` (`ui/bulk-action.zod.ts`'s known divergence)
8787
* objects.<name>._validations.<rule>.message
88+
* objects.<name>._milestones.<field>.<value>.summary (an `activityMilestones`
89+
* entry's summary template)
8890
* objects.<name>._relatedLists.<list>.label (an object-form `relatedLists`
8991
* entry that authors a `label`)
9092
* objects.<name>._actions.<action>.label
@@ -1002,6 +1004,28 @@ function pushValidationMessages(
10021004
}
10031005
}
10041006

1007+
/**
1008+
* Emit `objects.<object>._milestones.<field>.<value>.summary` for each
1009+
* `activityMilestones` entry (ADR-0052 §5b.2), seeded with its authored
1010+
* template, `{field}` tokens and all. Only the first entry of a `field` +
1011+
* `value` pair is emitted: the writer fires the first match, so a later
1012+
* entry's template is never rendered.
1013+
*/
1014+
function pushMilestoneSummaries(out: ExpectedEntry[], objectName: string, milestones: unknown): void {
1015+
if (!Array.isArray(milestones)) return;
1016+
const seen = new Set<string>();
1017+
for (const m of milestones) {
1018+
if (!m || typeof m !== 'object') continue;
1019+
const field = (m as any).field;
1020+
const value = (m as any).value;
1021+
if (typeof field !== 'string' || field.length === 0 || typeof value !== 'string' || value.length === 0) continue;
1022+
const pair = `${field}\u0000${value}`;
1023+
if (seen.has(pair)) continue;
1024+
seen.add(pair);
1025+
pushEntry(out, ['objects', objectName, '_milestones', field, value, 'summary'], (m as any).summary, 'object', { objectName });
1026+
}
1027+
}
1028+
10051029
/**
10061030
* Emit `objects.<object>._relatedLists.<list>.label` for every object-form
10071031
* `relatedLists` entry of an object that authors a `label` (the record page's
@@ -1653,6 +1677,12 @@ export function collectExpectedEntries(
16531677
// Custom validation-rule rejection messages (`_validations.<rule>.message`).
16541678
pushValidationMessages(out, objectName, obj.validations, 0);
16551679

1680+
// Activity-milestone summary templates (`_milestones.<field>.<value>.summary`,
1681+
// #37524): keyed by the watched field and the value the milestone fires on,
1682+
// the address `resolveObjectMilestoneSummary` reads. The first milestone
1683+
// declared for a pair is the one that fires, so a later duplicate gets no key.
1684+
pushMilestoneSummaries(out, objectName, obj.activityMilestones);
1685+
16561686
// Record-page related-list titles (`_relatedLists.<list>.label`): the
16571687
// `label` an object-form `relatedLists` entry authors on this parent,
16581688
// keyed by the entry's literal `list` (`object.field` is one key).

‎packages/lint/src/validate-translation-references.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3855,6 +3855,7 @@ describe('validateTranslationReferences — object-branch coverage vs the schema
38553855
fieldGroups: [{ key: 'basics', label: 'Basics' }],
38563856
actions: [{ name: 'convert_lead', label: 'Convert' }],
38573857
validations: [{ name: 'lead_needs_name', type: 'script', message: 'Name is required' }],
3858+
activityMilestones: [{ field: 'name', value: 'won', summary: 'Lead won: {name}' }],
38583859
},
38593860
],
38603861
views: [{ name: 'open_leads', objectName: 'crm_lead', label: 'Open Leads' }],
@@ -3920,6 +3921,11 @@ describe('validateTranslationReferences — object-branch coverage vs the schema
39203921
ghost: { _validations: { ghost_rule: { message: 'Ghost' } } },
39213922
path: 'translations[0].en.objects.crm_lead._validations.ghost_rule',
39223923
},
3924+
_milestones: {
3925+
kind: 'reference-checked',
3926+
ghost: { _milestones: { name: { ghost_value: { summary: 'Ghost' } } } },
3927+
path: 'translations[0].en.objects.crm_lead._milestones.name.ghost_value',
3928+
},
39233929
};
39243930

39253931
it('classifies every key `ObjectTranslationDataSchema` declares, and no key it does not', () => {
@@ -3955,6 +3961,7 @@ describe('validateTranslationReferences — object-branch coverage vs the schema
39553961
_actions: { convert_lead: { label: 'Convert' } },
39563962
_tabs: { urgent: { label: 'Urgent' } },
39573963
_validations: { lead_needs_name: { message: 'A name is required' } },
3964+
_milestones: { name: { won: { summary: 'Lead won: {name}' } } },
39583965
}),
39593966
);
39603967
expect(findings).toEqual([]);

0 commit comments

Comments
 (0)