Skip to content

Commit c3a4a30

Browse files
fix(lint)!: a _relatedLists translation key over a list the .custom arrangement hides or re-states without a label is refused (#37600)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuPE7uyDAJyqjwwMzomWv5ff)_ Fixes #36595 Clause-②: no (narrowing) Metadata-protocol: narrowed Skills-docs: follow-up #37620 ## 维护者速读 - 用户能看到什么变化:只影响作者跑 `os validate`。如果应用的定制包(`.custom`)把某个相关列表标签页隐藏了,或者改成不带标题的写法,而翻译包里还留着这个标签页标题的译文,现在会报错,提示这条译文没人读。以前这种译文校验能通过,但页面上本来就不会显示它。 - 为什么做:这是 #36595 剩下的第 4 项。校验规则先看到「原对象给这个列表写了标题」就放行了,没有考虑定制包会把整条替换掉,结果作者以为翻好了,实际页面看不到。 - 出错会怎样:最坏是把一条其实有用的译文误报成错。规则的判断和运行时 registry 应用定制编排的顺序、覆盖规则逐条对齐,有测试钉住;第一方示例和 HotCRM 里没有命中的写法。 - 要你做什么:这是收窄(以前能过的现在报错),属 Tier H,需要审批人批准;还欠契约审核(L2)。 ## What changes **The reading** (at `origin/main`): the registry applies the paired `.custom` arrangement after the owner's tab list and every `place` entry, and each arrangement entry REPLACES every entry it covers (`packages/objectql/src/registry-custom-arrangement.ts`, the `relatedLists` step; `relatedListNameCovers`: the same list, or a bare child for every list of that child). `{ list, hidden: true }` leaves no tab; a bare name or an entry with no `label` leaves the tab titled by the child FK's `relatedListTitle`. The lint fold (`validate-translation-references.ts`) checked the owner's labelled set first and `continue`d before the hidden check, and `object-graph.ts` dropped the arrangement's bare names (`.filter(isRec)`). So `_relatedLists.<list>` over an owner-labelled list the arrangement hides or names bare was accepted though nothing reads it. - **`packages/lint/src/object-graph.ts`**: `VisibleObjectExtension` gains `relatedListArrangement`, the extension's `relatedLists` as written, bare names included (`undefined` when it writes none). `relatedListEntries` is unchanged. - **`packages/lint/src/validate-translation-references.ts`**: per target, placements are folded first (the arrangement's own entries skipped), then every extension's arrangement in fold order, each in two passes as the registry reads it: first its entries drop every label (and earlier `hidden`) they cover, then it adds its own labelled entries and its hidden ones. So one entry never strips the label a sibling of the same arrangement gives (`[{ list: 'event.related_to', label }, 'event']` resolves in either order). The hidden message now matches by cover, so `{ list: 'event', hidden: true }` names `event.related_to` as hidden. A key over an owner-labelled list the arrangement re-states without a label names the arrangement, and its hint (like the hidden one) points at the owner's `label`. - **ADR-0087**: semantic entry `translation-related-list-key-under-arrangement-refused` at step 19 (`packages/spec/src/migrations/entries/semantic/19.…`; `PROTOCOL_VERSION` is 19.0.0, so `migrate meta --from 18` lists it), and the changeset is marked `registered`. No D2 conversion: dropping the key or re-stating the arrangement's entry with the owner's own label is the author's call. The remedy names the owner's label because an object read translates a label only while it still equals the packaged one; its surface names the labelled bare child `{ list: 'event', label }` covering the owner's `event.related_to`. - **Docs**: the `_relatedLists` row of the reference-rule table in `content/docs/protocol/kernel/i18n-standard.mdx` states the arrangement's effect. - **Changeset**: `@objectstack/lint` minor with the BREAKING note, `@objectstack/spec` patch (the ledger entry). Small calls made here (no card), per seat route 7120211674 (option A, item 4 only): - The lint fold applies every extension's `relatedLists` as an arrangement, as it already did for `hidden`. The registry serves only the object's own pair and names the other writers, which is a separate refusal at publish / `os validate`. This fold does not re-derive which package is the pair. - `os i18n extract` (`i18n-walk.ts`) still scaffolds `_relatedLists.<list>` from the owner's labelled entries and reads no extension, as before this change. In a stack that holds both the owner and its `.custom` pair, it can scaffold a key this rule now refuses. That universe difference predates this PR (the extractor reads no extension at all). It is filed with the object-read pair-catalog gap as #37622, not widened in this PR. ## Why The card's item 4 (from the contract review of #36574): a permissive lint that let a translator ship a title the record page never shows. Items 1–3 landed in #36813. ## Verification - `packages/lint/src/i18n-related-lists-arrangement-36595.test.ts` (new, 7 tests): - An owner-labelled list the arrangement hides is refused with the hidden message. - The same list named bare, as `{ list }` or as `{ list, hidden: false }`, is refused with the no-label message, which names the `.custom` arrangement. - A bare child beside its labelled dotted list in one arrangement leaves the label, in either order (fails on `61beb993c`). A sibling cancelling a `hidden` entry has no pin: a list both shown and hidden in one arrangement is refused at save by the object schema (`refuseContradictoryRelatedListEntries`). - A bare child hides or strips the dotted owner entry. - The arrangement is applied after a placement that another package folds later, at higher priority. - A relabelled list and lists the arrangement does not cover resolve. - Control: with no arrangement, nothing changes. - Red first: against `origin/main`'s two source files, 4 of the 6 fail; with the change, 6/6 pass. - `i18n-related-lists-label-36528.test.ts` (the existing `_relatedLists` pins, the `hidden: true` one included): unchanged and passing. - Local runs, head `b18f2ca55` (contract-review fixes; `61beb993c` before): - `@objectstack/lint` full vitest: 237 files, 9,687 passed. - `tsc --noEmit` and eslint on the touched files: exit 0. - `@objectstack/spec` vitest `src/migrations`: 201/201. - `check:generated --fix`: all up to date. `gen:migration-registry` picks up the entry. `check:upgrade-guide`: ok. - `node scripts/check-adr-0087-registration.mjs --base origin/main`: ✓ registered. `check-empty-changeset`: ✓. `overlap-check`: exit 0. - Dogfood battery: on `61beb993c`, os-dev report 7196396955 (one load timeout in an unrelated install-local case, green when rerun alone). On the final head `b18f2ca55`: VERDICT command-exit 0, Test Files 488/491 (3 skipped), Tests 4135/4203 (68 skipped), no failure; os-dev report 7197867160. Contract review (L2) is owed before landing: the diff declares `Clause-②: no (narrowing)` and adds a `packages/spec/src/**` ledger entry. Tier H: an authorized approval is needed to land. ## 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 6592546 commit c3a4a30

6 files changed

Lines changed: 255 additions & 18 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@objectstack/lint': minor
3+
'@objectstack/spec': patch
4+
---
5+
6+
fix(lint)!: a `_relatedLists` translation key over a list the `.custom` arrangement hides or re-states without a label is refused, as nothing reads it
7+
8+
Clause-②: no (narrowing)
9+
Metadata-protocol: narrowed
10+
Skills-docs: follow-up #37620
11+
12+
<!-- adr-0087: registered translation-related-list-key-under-arrangement-refused -->
13+
14+
**BREAKING** for a translation bundle that carries `objects.<object>._relatedLists.<list>` over a list the object's owner labels but the paired `.custom` package's `relatedLists` (ADR-0146 D10) re-states. `objectstack validate` and the other doors that run `translation-target-unknown` now report such a key as an error, where 18.x accepted it. Drop the key, or re-state the arrangement's entry with the owner's own `label` (`{ list, label }`) and keep it: an object read translates a label only while it still equals the packaged one.
15+
16+
**Why.** The registry applies the `.custom` arrangement after the owner's tab list and every `place` entry, and each arrangement entry replaces every entry it covers: the same list, or, for a bare child name, every list of that child (`relatedListNameCovers`). An entry `{ list, hidden: true }` leaves no tab, and a bare name or an entry with no `label` leaves the tab titled by the child lookup field's `relatedListTitle`. In both cases the served object has no `label` on that list for the key to translate. The rule judged the owner's label first and accepted the key before it looked at the arrangement, and it never saw the arrangement's bare names.
17+
18+
**What changes in `@objectstack/lint`.**
19+
20+
- The rule folds the arrangement's entries after the owner's entries and every placement, as the registry does. A list the arrangement labels resolves. A list it hides, names bare or names without a label does not resolve, whatever label the owner or a placement gave it; a labelled bare child such as `{ list: 'event', label }` covers the owner's `event.related_to` too. Lists the arrangement does not cover keep what they had. Each arrangement is read in two passes, as the registry reads it, so one entry never strips the label a sibling entry of the same arrangement gives (`[{ list: 'event.related_to', label }, 'event']` resolves in either order).
21+
- A key over a list the arrangement hides gets the "hidden by the `.custom` arrangement" message, now also when a bare child name such as `{ list: 'event', hidden: true }` hides a dotted list such as `event.related_to`. A key over an owner-labelled list the arrangement re-states without a label names the arrangement too, and its hint points at the owner's `label`.
22+
- `VisibleObjectExtension` (`object-graph.ts`, internal) carries the extension's `relatedLists` as written, bare names included, as `relatedListArrangement`.
23+
24+
Measured first-party exposure: none. No example or first-party package ships a `.custom` arrangement that re-states an owner-labelled list together with a key for it.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ beneath an action entry are judged the same way under either.
11741174
| `objects.{object}._views.{view}` | the key the view registry assigns a view over that object: a `listViews` / `formViews` map key, or the default `list`'s `name` — `default` when it has none (see [ObjectUI Integration](#objectui-integration)) |
11751175
| `objects.{object}._sections.{section}` | a `fieldGroups[].key`, a named section of a form view over that object (a `formViews` entry or the default `form`), or a named section of a `record:details` component on a page bound to it |
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 |
1177-
| `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 |
1177+
| `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. The paired `.custom` arrangement's `relatedLists` is applied after the owner's list and every placement: a list it hides, names bare or names without a `label` is an orphan whatever label the owner gave it, and a list it labels resolves |
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 |
11791179
| `objects.{object}._milestones.{field}.{value}` | an `activityMilestones[]` entry of that object watching `field` and firing on `value` |
11801180
| `objects.{object}._actions.{action}` | an action bound to that object: one in its `actions`, or a stack-level action whose `objectName` is that object |
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
//
3+
// [#36595] `objects.<object>._relatedLists.<list>` against the paired `.custom`
4+
// arrangement (ADR-0146 D10). The registry applies the arrangement after the
5+
// owner's list and every placement, and each of its entries REPLACES every
6+
// entry it covers (`registry-custom-arrangement.ts`): a bare name or an
7+
// unlabelled entry leaves the tab no `label` to translate, and
8+
// `{ list, hidden: true }` leaves no tab at all. A key over a list the owner
9+
// labelled but the arrangement re-states that way is read by nothing, and the
10+
// translation-reference rule says so.
11+
12+
import { describe, it, expect } from 'vitest';
13+
import { validateTranslationReferences, TRANSLATION_TARGET_UNKNOWN } from './validate-translation-references.js';
14+
15+
const ACCOUNT = {
16+
name: 'account',
17+
label: 'Account',
18+
fields: { name: { name: 'name', type: 'text', label: 'Name' } },
19+
relatedLists: [
20+
{ list: 'contact', label: 'People' },
21+
{ list: 'event.related_to', label: 'Meetings' },
22+
'case',
23+
],
24+
};
25+
26+
const KEY = (list: string) =>
27+
`translations[0]["zh-CN"].objects.account._relatedLists${list.includes('.') ? `["${list}"]` : `.${list}`}`;
28+
29+
function judge(objectExtensions: unknown[], keys: Record<string, unknown>) {
30+
return validateTranslationReferences({
31+
objects: [ACCOUNT],
32+
objectExtensions,
33+
translations: [{ 'zh-CN': { objects: { account: { _relatedLists: keys } } } }],
34+
});
35+
}
36+
37+
describe('validateTranslationReferences — _relatedLists under a `.custom` arrangement (#36595)', () => {
38+
it('flags a key over an owner-labelled list the arrangement hides, saying it is hidden', () => {
39+
const findings = judge(
40+
[{ extend: 'account', relatedLists: [{ list: 'contact', hidden: true }] }],
41+
{ contact: { label: '联系人' } },
42+
);
43+
expect(findings.map((f) => [f.rule, f.severity, f.path])).toEqual([[TRANSLATION_TARGET_UNKNOWN, 'error', KEY('contact')]]);
44+
expect(findings[0].message).toContain('hidden');
45+
expect(findings[0].message.length).toBeLessThanOrEqual(200);
46+
});
47+
48+
it('flags a key over an owner-labelled list the arrangement names bare, or as an entry with no label', () => {
49+
for (const restated of ['contact', { list: 'contact' }, { list: 'contact', hidden: false }]) {
50+
const findings = judge([{ extend: 'account', relatedLists: [restated] }], { contact: { label: '联系人' } });
51+
expect(findings.map((f) => f.path), JSON.stringify(restated)).toEqual([KEY('contact')]);
52+
expect(findings[0].message, JSON.stringify(restated)).toContain('carries no `label` in the `.custom` arrangement');
53+
expect(findings[0].hint, JSON.stringify(restated)).toContain("owner's `label`");
54+
expect(findings[0].message.length).toBeLessThanOrEqual(200);
55+
expect(findings[0].hint.length).toBeLessThanOrEqual(200);
56+
}
57+
});
58+
59+
it('a bare child hides or strips every list of that child: the dotted owner entry included', () => {
60+
const hidden = judge(
61+
[{ extend: 'account', relatedLists: [{ list: 'event', hidden: true }] }],
62+
{ 'event.related_to': { label: '会议' } },
63+
);
64+
expect(hidden.map((f) => f.path)).toEqual([KEY('event.related_to')]);
65+
expect(hidden[0].message).toContain('hidden');
66+
const bare = judge([{ extend: 'account', relatedLists: ['event'] }], { 'event.related_to': { label: '会议' } });
67+
expect(bare.map((f) => f.path)).toEqual([KEY('event.related_to')]);
68+
});
69+
70+
it('one arrangement entry never strips what a sibling entry of the same arrangement wrote, in either order', () => {
71+
// The registry collects the arrangement's entries first, then drops what
72+
// they cover from the owner's list: a bare child beside its labelled
73+
// dotted list leaves that label served.
74+
for (const arrangement of [[{ list: 'event.related_to', label: 'Meetings' }, 'event'], ['event', { list: 'event.related_to', label: 'Meetings' }]]) {
75+
expect(judge([{ extend: 'account', relatedLists: arrangement }], { 'event.related_to': { label: '会议' } }), JSON.stringify(arrangement))
76+
.toEqual([]);
77+
}
78+
// A sibling that would cancel a `hidden` entry is a list both shown and
79+
// hidden in one arrangement, which the object schema refuses at save
80+
// (`refuseContradictoryRelatedListEntries`), so it has no pin here.
81+
});
82+
83+
it('applies the arrangement after every placement, whatever the extensions\' order', () => {
84+
// Two packages: the placing one folds AFTER the arrangement's (higher
85+
// priority, later in the artifact), and the arrangement still replaces
86+
// the placed entry, as the registry applies it.
87+
const findings = validateTranslationReferences({
88+
packages: [
89+
{ manifest: { id: 'com.example.crm.custom', objectExtensions: [{ extend: 'account', priority: 100, relatedLists: ['quote'] }] } },
90+
{ manifest: { id: 'com.example.quotes', objectExtensions: [{ extend: 'account', priority: 300, place: [{ list: 'quote', after: 'contact', label: 'Quotes' }] }] } },
91+
],
92+
objects: [ACCOUNT],
93+
translations: [{ 'zh-CN': { objects: { account: { _relatedLists: { quote: { label: '报价' } } } } } }],
94+
});
95+
expect(findings.map((f) => f.path)).toEqual([KEY('quote')]);
96+
});
97+
98+
it('accepts a key over a list the arrangement labels, and over owner lists it does not cover', () => {
99+
expect(judge(
100+
[{ extend: 'account', relatedLists: [{ list: 'contact', label: 'Clients' }, { list: 'event.owner_id', hidden: true }] }],
101+
{ contact: { label: '客户' }, 'event.related_to': { label: '会议' } },
102+
)).toEqual([]);
103+
// One relationship does not cover its sibling or its bare child.
104+
expect(judge(
105+
[{ extend: 'account', relatedLists: ['event.owner_id', 'case'] }],
106+
{ contact: { label: '联系人' }, 'event.related_to': { label: '会议' } },
107+
)).toEqual([]);
108+
});
109+
110+
it('control: with no arrangement, the owner\'s labels resolve as before', () => {
111+
expect(judge([], { contact: { label: '联系人' }, 'event.related_to': { label: '会议' } })).toEqual([]);
112+
expect(judge(
113+
[{ extend: 'account', place: [{ list: 'quote', after: 'contact', label: 'Quotes' }] }],
114+
{ contact: { label: '联系人' }, quote: { label: '报价' } },
115+
)).toEqual([]);
116+
});
117+
});

‎packages/lint/src/object-graph.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,17 @@ export interface VisibleObjectExtension {
418418
* `validations`, carrying them changes nothing about which entries survive.
419419
*/
420420
relatedListEntries: AnyRec[];
421+
/**
422+
* [#36595] Its `relatedLists` as written, bare names included (`undefined`
423+
* when it writes none): the `.custom` arrangement (ADR-0146 D10). Where the
424+
* key is written, each entry REPLACES every entry of the owner and of the
425+
* placements that it covers (`relatedListNameCovers`), so a bare name or an
426+
* unlabelled entry takes a title away and `{ list, hidden: true }` takes the
427+
* tab away (`registry-custom-arrangement.ts`, `@objectstack/objectql`). The
428+
* one reader that needs the bare names is the `_relatedLists.LIST` check of
429+
* `validate-translation-references.ts`.
430+
*/
431+
relatedListArrangement?: unknown[];
421432
/**
422433
* [#33494] Set on an entry the host's registry already holds
423434
* ({@link StoredObjectExtension}), folded in at its priority but never
@@ -510,6 +521,7 @@ export function objectExtensionsByTarget(
510521
...(Array.isArray(ext.relatedLists) ? ext.relatedLists : []),
511522
...(Array.isArray(ext.place) ? ext.place : []),
512523
].filter(isRec),
524+
...(Array.isArray(ext.relatedLists) ? { relatedListArrangement: ext.relatedLists } : {}),
513525
label: ext.label,
514526
fieldPatches: isRec(ext.fieldPatches)
515527
? Object.fromEntries(

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

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ import {
276276
pageTabItemKey,
277277
walkAddressedPageComponents,
278278
} from '@objectstack/spec/system';
279-
import { isRecordPageBuiltinTab, relatedListEntryHidden } from '@objectstack/spec/data';
279+
import { isRecordPageBuiltinTab, relatedListEntryHidden, relatedListEntryName, relatedListNameCovers } from '@objectstack/spec/data';
280280
import { walkFlowNodes } from './flow-walk.js';
281281
import { objectExtensionsByTarget, packagesOf, recordsOf, suggestName } from './object-graph.js';
282282
import { walkPageComponents } from './page-walk.js';
@@ -507,6 +507,12 @@ interface ObjectFacts {
507507
* only to say so.
508508
*/
509509
relatedListHidden: Set<string>;
510+
/**
511+
* The lists whose label (from the owner or a placement) a `.custom`
512+
* arrangement entry replaced with none: the tab shows, untitled by any
513+
* `label` — read only to name the arrangement in the finding.
514+
*/
515+
relatedListStripped: Set<string>;
510516
}
511517

512518
/** Everything a `flows.<name>.screens.<node_id>` key may legally name. */
@@ -678,6 +684,7 @@ function emptyFacts(): ObjectFacts {
678684
relatedListLabels: new Set(),
679685
relatedListNames: new Set(),
680686
relatedListHidden: new Set(),
687+
relatedListStripped: new Set(),
681688
};
682689
}
683690

@@ -1440,27 +1447,61 @@ function buildUniverse(stack: AnyRec): Universe {
14401447
const key = strName(group.key);
14411448
if (key) facts.sections.add(key);
14421449
}
1443-
// `_relatedLists.<list>` is keyed by a labelled entry's `list`: a
1444-
// `.custom` arrangement's `relatedLists` entry (ADR-0146 D10) and a
1445-
// list placement's `place` entry each title a tab of the target, and
1446-
// where the target declares `relatedLists` the served target carries
1447-
// that entry, which `translateObject` translates as it does the
1448-
// target's own (a placed entry is part of the packaged base it is
1449-
// compared with, `getPackagedObjectBase`). A placement on a target
1450-
// that declares none is not applied, and its key is accepted here all
1451-
// the same: this fold does not read whether the target declares the
1452-
// list. An arrangement entry with `hidden: true` titles no tab.
1450+
// `_relatedLists.<list>` is keyed by a labelled entry's `list`: a list
1451+
// placement's `place` entry titles a tab of the target, and where the
1452+
// target declares `relatedLists` the served target carries that entry,
1453+
// which `translateObject` translates as it does the target's own (a
1454+
// placed entry is part of the packaged base it is compared with,
1455+
// `getPackagedObjectBase`). A placement on a target that declares none
1456+
// is not applied, and its key is accepted here all the same: this fold
1457+
// does not read whether the target declares the list. The `.custom`
1458+
// arrangement's entries are folded after every placement, below.
1459+
const arranged = new Set<unknown>(extension.relatedListArrangement ?? []);
14531460
for (const entry of extension.relatedListEntries) {
1461+
if (arranged.has(entry)) continue;
14541462
const list = strName(entry.list);
14551463
if (!list) continue;
14561464
facts.relatedListNames.add(list);
1457-
if (relatedListEntryHidden(entry)) {
1458-
facts.relatedListHidden.add(list);
1459-
continue;
1460-
}
14611465
if (typeof entry.label === 'string' && entry.label.length > 0) facts.relatedListLabels.add(list);
14621466
}
14631467
}
1468+
// [#36595] The `.custom` arrangement (ADR-0146 D10) is applied after the
1469+
// owner's list and every placement, as the registry applies it
1470+
// (`registry-custom-arrangement.ts`): each of its entries REPLACES every
1471+
// entry it covers (`relatedListNameCovers`: the same list, or a bare child
1472+
// for each list of that child). So a labelled entry titles the tab, a
1473+
// bare name or an unlabelled entry leaves it the child FK's
1474+
// `relatedListTitle`, and `{ list, hidden: true }` leaves no tab, whatever
1475+
// label the owner or a placement gave the lists it covers. Lists it does
1476+
// not cover keep what they had.
1477+
//
1478+
// Two passes per arrangement, as the registry reads one: it collects the
1479+
// arrangement's entries first and only then drops what they cover from the
1480+
// tab list steps 1–2 gave, so one entry never strips a label or a `hidden`
1481+
// a sibling entry of the SAME arrangement wrote, in either order.
1482+
for (const extension of extensions) {
1483+
const arrangement = (extension.relatedListArrangement ?? [])
1484+
.map((entry) => ({ entry, list: relatedListEntryName(entry) }))
1485+
.filter((e): e is { entry: unknown; list: string } => typeof e.list === 'string' && e.list !== '');
1486+
for (const { list } of arrangement) {
1487+
facts.relatedListNames.add(list);
1488+
for (const labelled of [...facts.relatedListLabels]) {
1489+
if (!relatedListNameCovers(list, labelled)) continue;
1490+
facts.relatedListLabels.delete(labelled);
1491+
facts.relatedListStripped.add(labelled);
1492+
}
1493+
for (const hidden of [...facts.relatedListHidden]) {
1494+
if (relatedListNameCovers(list, hidden)) facts.relatedListHidden.delete(hidden);
1495+
}
1496+
}
1497+
for (const { entry, list } of arrangement) {
1498+
if (relatedListEntryHidden(entry)) facts.relatedListHidden.add(list);
1499+
else if (isRec(entry) && typeof entry.label === 'string' && entry.label.length > 0) {
1500+
facts.relatedListLabels.add(list);
1501+
facts.relatedListStripped.delete(list);
1502+
}
1503+
}
1504+
}
14641505
}
14651506

14661507
// ── Stack-level views: `_views` names + form-section names ──
@@ -2172,11 +2213,18 @@ export function validateTranslationReferences(stack: AnyRec): TranslationRefFind
21722213
`Drop this key: a built-in tab takes no \`label\` here.`);
21732214
continue;
21742215
}
2175-
if (facts.relatedListHidden.has(listName)) {
2216+
if ([...facts.relatedListHidden].some((hidden) => relatedListNameCovers(hidden, listName))) {
21762217
orphan(listWhere, listPath,
21772218
`Related list "${listName}" of object "${objectName}" is hidden by the \`.custom\` ` +
21782219
`arrangement (\`hidden: true\`), so no tab shows a title from this key.`,
2179-
`Drop this key, or show the tab (drop \`hidden\`) and give the entry a \`label\`.`);
2220+
`Drop this key, or show the tab (drop \`hidden\`) with the owner's \`label\` on the entry.`);
2221+
continue;
2222+
}
2223+
if (facts.relatedListStripped.has(listName)) {
2224+
orphan(listWhere, listPath,
2225+
`Related list "${listName}" of object "${objectName}" carries no \`label\` in the \`.custom\` ` +
2226+
`arrangement, which replaces the owner's entry, so no title reads this key.`,
2227+
`Drop this key, or re-state the arrangement's entry with the owner's \`label\` ({ list, label }).`);
21802228
continue;
21812229
}
21822230
const named = facts.relatedListNames.has(listName);

0 commit comments

Comments
 (0)