You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c3a4a30
Browse filesBrowse the repository at this point in the historyBrowse 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>
**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.
Copy file name to clipboardExpand all lines: content/docs/protocol/kernel/i18n-standard.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1174,7 +1174,7 @@ beneath an action entry are judged the same way under either.
1174
1174
|`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)) |
1175
1175
|`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 |
1176
1176
|`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|
1178
1178
|`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
1179
|`objects.{object}._milestones.{field}.{value}`| an `activityMilestones[]` entry of that object watching `field` and firing on `value`|
1180
1180
|`objects.{object}._actions.{action}`| an action bound to that object: one in its `actions`, or a stack-level action whose `objectName` is that object |
0 commit comments