Skip to content

feat(spec): the paired .custom package declares an installed object's field-group and tab arrangement - #36517

Merged
os-zhuang merged 11 commits into
mainfrom
claude/issue-36498-custom-package-arrangement
Nov 22, 2026
Merged

os-zhuang merged 11 commits into
mainfrom
claude/issue-36498-custom-package-arrangement

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #36498

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up #36541

维护者速读

  • 环境管理员可以给已安装软件包里的对象整体重排记录页:把原厂字段挪到别的分组、调换分组顺序、调换或隐藏子表页签;不写这份排布,页面和以前完全一样。
  • 属于「记录页标签与分组」专题的第三层(原始软件包、继承软件包之后的环境管理员覆盖),让客户不改原厂包也能按自己的习惯排页面。
  • 排错了只影响这一个对象的记录页、表单和预览的摆放,数据不受影响,但把没有默认值的必填字段藏起来会让用户在表单里建不了记录;删掉这份排布或停用环境定制包,页面立刻回到原厂加扩展包的样子。
  • 审批这次公开配置格式的新增:对象扩展多了两项只有环境定制包能写的排布设置。

What changes

The record page is arranged in three layers. The package that owns an object declares fieldGroups and relatedLists; a package that extends it places what it brings with place; this PR adds the third: the object extension of the paired .custom package may declare the whole arrangement, over both.

Spec keys touched (packages/spec/src/data/object.zod.ts, related-list-entry.ts, field-customization.ts, kernel/metadata-read-decorations.ts):

Key Change
ObjectExtensionSchema.fieldGroups New. An array of ObjectFieldGroupSchema, the shape an object's fieldGroups takes; keys unique. Was refused at parse with a prescription naming place.
ObjectExtensionSchema.relatedLists New. An array of ObjectExtensionRelatedListEntrySchema: a bare name (a child, a relationship, or one of the three built-in tab names) or { list, label?, columns?, hidden? }. Was refused at parse the same way.
ObjectExtensionRelatedListEntryObjectSchema.hidden New, on this entry only. RelatedListEntryObjectSchema (an object's own entry) still refuses hidden, now with a sentence saying where it belongs.
METADATA_READ_DECORATIONS _relatedListsArrangement added: derived on read, stripped on write, never authorable.
BASE_FIELD_DISPLAY_WHITELIST Unchanged (see hidden, below).

New exports: CUSTOM_ARRANGEMENT_KEYS, extensionArrangementKeys, relatedListEntryHidden, relatedListNameCovers, RELATED_LISTS_ARRANGEMENT_DECORATION, RelatedListsArrangement, readRelatedListsArrangement, the two entry schemas and their types.

Who may write them. The schema admits the keys on any extension, because a parse does not know the writing package. The writer is judged where the package is known, by one judge (judgeExtensionArrangement, packages/metadata-protocol/src/protocol-extension-arrangement.ts) on the __c precedent's predicate (isCustomizationPackage), at the same doors as the __c reservation:

  • save, publish and restore of an object_extension item (objectExtensionItemRefusal): VALIDATION_ERROR / 400, one issue per key;
  • os validate and os build (findExtensionArrangementRefusals, in the validate/build parity roster);
  • marketplace install (marketplace-install-local-plugin.ts): VALIDATION_ERROR / 422 with details.refusals.

Each refusal names the key, the object and the package and prescribes place with an example entry. An extension that reaches the registry past those doors is skipped by the fold and named in the boot log.

Which .custom package is served. The doors judge by the suffix; the fold decides by role. It serves only the object's own pair: the .custom package of the App the object belongs to, asked of pairsOf over the installed manifests (packages/metadata-core/src/customization-pair-lookup.ts, the list isPairOf tests against). That list is the App's pair first and then, while one is installed, a per-package pair an earlier version created. A .custom writer outside the list is skipped and named in the boot log, alone or beside the pair. Where both listed pairs write one key, the App's pair is served and the other is named. Fold order decides nothing (ADR-0146 D2).

The merge (packages/objectql/src/registry-custom-arrangement.ts, wired into foldExtendersOntoDefinition after applyExtensionPlacements): the owner's arrangement, then every extension's place, then the .custom key replaces the result, whole. A key the extension does not write keeps the result of the first two steps. Nothing is merged entry by entry.

  • Fields: a field no group lists is not dropped; it shows after the last group. A group that lists fields shows exactly its list, so a field of the owner or of another extension that no list names loses a group naming such a group, and a listed field's own group follows the group that lists it. The served object still passes an object parse.
  • Tabs: the served relatedLists is the arrangement's shown entries, then the entries of the list it replaced that it does not name (before a trailing approvals / activity-stream run). { list, hidden: true } hides that list, whichever package brings it. What a served relatedLists cannot say travels in the _relatedListsArrangement read decoration ({ packageId, hidden, unlisted }), stamped on the served by-name read and the served object list, not on the execution face. Where the arrangement hides every tab of a declared list, the served list is empty and unlisted: 'hidden' beside it says it is still a declared list.
  • Removing a key, or uninstalling or disabling the .custom package, serves the first two steps again. Nothing is stored in the base or in another package.

The record page (ui/packages/app-shell/src/utils/deriveRelatedLists.ts, ui/packages/plugin-detail/src/synth/buildDefaultPageSchema.ts): both readers read the decoration through readRelatedListsArrangement. A list the environment hides is not derived; where the arrangement replaced the automatic tab list, a list no entry names still shows after the listed ones, and so does the attachments tab. An empty served list beside unlisted: 'hidden' is read as a declared list that names nothing, so a list the owner hid by leaving it out stays hidden. With no decoration served, both answer exactly as before; each reader's suite ends with a block that pins that against literal values.

hidden on a field did not enter BASE_FIELD_DISPLAY_WHITELIST. The whitelist's admission test is "display only: never changes what is stored, validated or computed". FieldSchema.hidden fails it on three counts: a hidden field is left out of the search companion column (the stored value changes), a form's required check skips it (required && hidden !== true, the validation verdict changes), and default search and export columns drop it. So the whitelist is not widened. The explicit arrangement form is a .custom field group whose visibleWhen is false: { key: 'off_page', label: 'Not shown', fields: ['fax'], visibleWhen: 'false' } keeps a vendor field off the record page and the forms. Two limits, now stated in the key's description, the whitelist's doc comment, the docs page and the changeset:

  • It is presentation only, not access control: the field stays readable and writable through the API.
  • It is not for a required field that has no default: the create form no longer shows the field while the save still requires it, so the form cannot be submitted.

The per-user tab order still layers on top. The console keeps each reader's tab order and hidden tabs as a diff over the host's default order (ui/packages/plugin-detail/src/synth/relatedArrangement.ts), and the default order is deriveRelatedLists over the served object. The environment layer is in the served object, so the reader's order is laid over it unchanged. A list the environment hides is not derived, so a reader's saved arrangement cannot bring it back.

Docs and changeset: content/docs/data-modeling/object-extensions.mdx gains "Arranging the whole record page"; .changeset/36498-custom-package-arrangement.md (minor on the eight packages moved). The changeset no longer says a non-.custom writer is refused on every path: where no door judges it, the key is not applied and the boot log names it.

Tests

The acceptance bullets of the card are reproduced over a base + extension package + .custom fixture (com.vendor.crm, com.acme.tax, com.vendor.crm.custom, object crm_lead), and the App pair over two installed packages in the HotCRM shape (an App com.hotcrm and a module of it, com.hotcrm.sales, that owns the object); HotCRM itself is not edited.

Suite What it pins
packages/objectql/src/registry-custom-arrangement.test.ts A base field moved to another group and two groups swapped; an unlisted base field after the last group, in both membership spellings; an extension package's placed field not in the arrangement still shows, last; two tabs swapped and one hidden; an unlisted tab shows last; every tab of a declared list hidden (the owner lists two of its three lists, the arrangement hides both; and the one-entry case): the served list is empty and the read says unlisted: 'hidden'; only relatedLists written keeps the groups of the first two steps; removing both keys, uninstalling and disabling the pair each restore; a non-.custom writer is skipped with a boot-log line naming place; a .custom package that is not the object's pair is skipped and named, beside the pair and alone; an object a module owns with two .custom writers, in both fold orders: the App's pair is served and the other named; an installed per-package pair is read, and comes second to the App's pair; re-fold idempotence. The layout is asserted through deriveFieldGroupLayout, the derivation the record page, the forms and the preview share.
packages/objectql/src/protocol-custom-arrangement.test.ts Through the real protocol and engine: the pair's save is admitted; the by-name and list reads serve the arrangement and the decoration; the execution face is undecorated; a writable non-.custom package's save is refused once (VALIDATION_ERROR / 400, place named), nothing stored; re-saving without the keys and disabling the pair restore.
packages/metadata-protocol/src/protocol-extension-arrangement.test.ts The judge and the publish-door refusal, with the .custom control.
packages/cli/test/validate-build-extension-arrangement.test.ts, packages/cli/src/utils/extension-arrangement.test.ts os validate and os build each refuse once and name place; the .custom control passes; the parity roster row.
packages/cloud-connection/src/marketplace-install-local-extension-arrangement.test.ts Install refuses once (422, details.refusals), nothing installed; the .custom control installs.
packages/spec/src/data/object-extension-arrangement.test.ts, object-extension-place.test.ts The two keys' shapes and refusals, hidden accepted on the extension entry only, the contradiction and place-beside-arrangement refusals, the whitelist unchanged.
ui/packages/app-shell/src/utils/__tests__/deriveRelatedLists.customArrangement-36498.test.ts, ui/packages/plugin-detail/src/synth/__tests__/buildDefaultPageSchema.customArrangement-36498.test.ts The reader: hidden lists, unlisted-shown, an empty served list beside unlisted: 'hidden' (the list the owner left out stays hidden; without the decoration the empty list reads as before), and the pin that nothing moves with no decoration served.

Readings at head 7052770cd, this round (the review's three should-fix items). The first round's readings are in the first os-dev-report comment on the card.

Scoped suites

At head 7052770cd, tree clean, each run outside the shared verification lock, one at a time.

  • pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/registry-custom-arrangement.test.ts src/protocol-custom-arrangement.test.ts src/registry-extension-placement.test.ts: exit 0, Test Files 3 passed (3), Tests 73 passed (73). The fold suite alone: Tests 33 passed (33).
  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/data/object-extension-arrangement.test.ts src/data/field-customization.test.ts src/data/related-list-entry.test.ts: exit 0, Test Files 3 passed (3), Tests 158 passed (158).
  • pnpm --filter @object-ui/app-shell exec vitest run --root ../.. --maxWorkers=2 packages/app-shell/src/utils/__tests__/deriveRelatedLists.customArrangement-36498.test.ts: exit 0, Tests 21 passed (21).
  • pnpm --filter @object-ui/plugin-detail exec vitest run --root ../.. --maxWorkers=2 packages/plugin-detail/src/synth/__tests__/buildDefaultPageSchema.customArrangement-36498.test.ts: exit 0, Tests 10 passed (10).
  • pnpm --dir ui exec vitest run --maxWorkers=2 scripts/: exit 0, Test Files 172 passed | 2 skipped (174), Tests 5127 passed | 2 skipped (5129).
  • Before them: pnpm --filter @objectstack/spec run check:generated --fix rebuilt the spec and regenerated content/docs/references/data/object.mdx (the two descriptions), exit 0; the objectql dependency closure and objectql were built, exit 0.
Ablation: each changed behaviour broken once, the suite turns red, the file restored

Each leg goes through node scripts/ablation-replace.mjs: the anchor must hit once, the tool prints the blob before and after, the suite runs, the file is restored. After each leg the file's blob equals the one at HEAD and git diff HEAD is empty. All six ran at 7052770cd. No build step is in a leg: each suite imports the mutated file from source.

  • Fold, the whole step switched off (if (writers.size === 0) to >= 0): Tests 27 failed | 6 passed (33).
  • Fold, the pair test switched off (if (!pairs.includes(packageId)) to a condition that never holds): Tests 4 failed | 29 passed (33). The four: the .custom package that is not the pair, the module-owned object in both fold orders, and the .custom id named after the module.
  • Tab reader, the decoration not read (readRelatedListsArrangement(objectDef) to (undefined)): Tests 11 failed | 10 passed (21).
  • Tab reader, the empty-list reading switched off (unlisted === 'hidden' to a value never served): Tests 2 failed | 19 passed (21). The two are the new empty-list cases.
  • Page synthesis, the decoration not read: Tests 3 failed | 7 passed (10).
  • Page synthesis, the empty-list reading switched off (entries.length === 0 && unlistedTabs !== 'hidden' to entries.length === 0): Tests 1 failed | 9 passed (10). The one is the new empty-list case.
  • The door-judge leg of the first round was not re-run: no file it reads changed.
Gates
  • node scripts/pm/dispatch-gates.mjs --commands at 7052770cd: 131 commands derived from the branch's 46 changed paths.
  • 125 answered exit 0, run one at a time outside the lock. Among them the ratchets this round's files move: pnpm check:facade-delegation-only (registry.ts stays at its line ceiling: the one host line added is paid for by folding a doc line into a trailing comment), pnpm check:registry-log-declared, pnpm check:test-source-alias, pnpm check:nul-bytes, and the spec family (check:generated, check:docs, check:api-surface, check:authorable-surface, check:export-origins, check:liveness).
  • NOT MEASURED locally: check:skill-examples, check:dual-build-cjs-loads, check:i18n, check:i18n-coverage, check:i18n-walk-parity, reason: each answered exit 3, PREREQUISITE NOT MET. The worktree was rebuilt for this round with the spec and the objectql closure only, and these read the built output of the CLI and of other packages. The check-runs on this head are their reading.
  • The UI scripts suite is derived as pnpm --dir ui exec vitest run scripts/; it was run with --maxWorkers=2 added (the bare spelling was killed for memory in the first round) and is counted under the scoped suites.
  • node scripts/pm/dispatch-gates.mjs --ran: Run reconciliation — 131 derived, 125 run, 5 NOT-MEASURED, 1 UNRUN; the one is the UI scripts suite under its derived spelling.
  • node scripts/check-platform-checklist.mjs --changed-from origin/main: exit 0, 7 anchored file(s) in the change set, 54 anchor(s) judged, 0 lost.
  • Check-runs on 7052770cd: 70 runs, 61 success, 9 skipped (opt-in, queue and schedule-only jobs), 0 failed. Test Core 10 of 10, Test UI 16 of 16, the Lint lanes, the Type Check lanes, Build Core, Check Changeset, Spec property liveness and Governed Surface Queue Guard are success.

Acceptance notes

  • Contract review, first record: three should-fix items, each answered on this head.
    • Hiding every tab of a declared list revealed the lists the owner hid. Answered in the readers' reading of the decoration, not in the served shape: the fold still serves an empty list, and unlisted: 'hidden' beside it now reads as a declared list that names nothing. This was the smaller change: the decoration's shape and the fold's output are as they were, and the documented rule (a list the owner hides by leaving it out stays hidden until the arrangement names it) now holds in the empty case too. Pinned in the fold suite and in both reader suites.
    • The choice among .custom writers did not know the App pair. The fold now asks pairsOf, never isCustomizationPairOf; the arm that served the writer folded last is gone. One call made here: an installed per-package pair of an earlier version is admitted, second to the App's pair, because the lookup module prescribes isPairOf / pairsOf for every read that serves a package's customizations.
    • The recipe for keeping a base field off the page now states its two limits in the four published places.
  • Carriers of what this PR does not do:
    • Item 6 of the card, the ADR-0146 D10 note: the row on ADR revisions, week of 2026-11-21: rolling checklist of ADR text out of step with main (one governed PR) #36086. An implementation PR does not edit docs/adr/**; the sentences this change puts out of step and their replacement wording are in the report.
    • The skills guide for the two keys: objectstack-data skill: teach the .custom package's object-extension arrangement (fieldGroups and relatedLists) from PR #36517 #36541.
    • Hiding a built-in tab (attachments, approvals, the activity stream) of an installed object from the environment's layer is not possible as built: hidden is for relationship entries, and an unlisted built-in tab shows. A separate finding, which the seat files.
    • Three paths where a non-.custom writer's key is only skipped with a boot-log line, where main refused it at parse: a code-defined stack that boots without os validate or os build; a stack that names no package id, which os validate passes; and package duplicate and orphan adoption. Nothing is applied on any of them. A follow-up, not a change on this head.
    • The save and install doors could also refuse a .custom writer that is not the object's pair: they can read the installed manifests, which the CLI door cannot. As built they judge by the suffix, and the fold skips such a writer with a boot-log line. A follow-up.
    • Editor UI for these keys: the follow-up card, not this PR. Studio shows the merged result because it reads the served object.
  • Calls that stand as built:
    • Fields: "replaced whole" is read for both membership spellings, so an unlisted field always lands after the last group, never inside a group its owner had named.
    • Tabs: a list the object's owner hides by leaving it out of its own relatedLists stays hidden until the arrangement names it; "unlisted shows last" applies to the tabs the first two steps showed.
    • A place entry beside the arrangement key that replaces it, in one extension, is refused at parse.
    • A name in a .custom arrangement that the object does not have (a field in a group's list, a tab entry) is not judged at defineStack, os validate or install. The layout derivation and the tab reader skip a name nothing answers to, as they do for an object's own arrangement, so a vendor upgrade that removes a field does not make the environment's next save fail.
  • Overlap: an open draft PR edits another region of packages/spec/src/data/object.zod.ts (field history defaults); the later lander merges main.
  • Size: 3,566 changed lines, over the 3000 changed-line human-merge threshold, so it lands as a Tier H surface does.

Verification

Read first, by risk:

  1. packages/objectql/src/registry-custom-arrangement.ts, two hunks. servedWriter: a writer is admitted when its package is a .custom package and is in pairsOf of the object's owner, and the served one is chosen by its position in that list; this decides whose arrangement an installed object shows. The field hunk under // ── fieldGroups: it rewrites or removes a field's own group on the served copy (never on a stored body) so that a listing group shows exactly its list; this decides where an unlisted field lands.
  2. packages/spec/src/data/object.zod.ts, the ObjectExtensionSchema hunk: the two guidance refusals are removed and the keys are admitted on every extension; the writer is refused at the doors instead. Check that every door a package's extension passes is listed above, and the two key descriptions against what the fold does.
  3. ui/packages/app-shell/src/utils/deriveRelatedLists.ts, the naming line and the final loop: an empty served list beside unlisted: 'hidden' becomes an empty naming map, so the loop takes the declared arm and shows only what is named or brought by another package. hiddenByArrangement runs before the !naming early exit. All of it is inert when readRelatedListsArrangement answers undefined.

Two-minute check, one command:

pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/registry-custom-arrangement.test.ts

Expected: 33 cases pass; the case titles read as the card's acceptance bullets and the review's three items.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY

… whole arrangement (WIP)

ObjectExtensionSchema gains fieldGroups and relatedLists, written only by a
base's paired .custom package: the registry fold applies them last, replacing
the owner's arrangement and the extensions' placements key by key, and the
save, validate, build and install doors refuse any other writer, prescribing
place. Work in progress: reader, docs and generated baselines follow.

Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
Co-authored-by: Claude <noreply@anthropic.com>
… tabs and shown-last rule (WIP)

The tab reader and the default page synthesis read the served
`_relatedListsArrangement` decoration: a list the environment hides drops
its tab, and where the object's own tab list was automatic an unlisted
list shows after the listed ones. With no decoration served both readers
answer as before. Docs page gains the arrangement section.

Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
Co-authored-by: Claude <noreply@anthropic.com>
…ngeset, and the registry facade back under its line ceiling

The getter's contract docblock moves to the registration facet so
registry.ts stays within its facade line ceiling.

Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation protocol:data tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 22, 2026
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 6 package(s): @objectstack/cli, @objectstack/cloud-connection, @objectstack/lint, @objectstack/metadata-protocol, @objectstack/objectql, @objectstack/spec, touching 90 documentable anchor(s). ⚠️ 6 changed file(s) yielded no anchor (packages/metadata-protocol/src/index.ts, packages/spec/api-surface/data.json, packages/spec/authorable-surface/data.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

75 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 96b7975b0587bd3268884ea44f3b3170d90187d3.

⛔ 20 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 6 changed file(s) yielded no anchor (packages/metadata-protocol/src/index.ts, packages/spec/api-surface/data.json, packages/spec/authorable-surface/data.json, …) — pages documenting those are invisible to this run
  • 2 anchor(s) matched too much of the corpus to be a work list: objectName (symbol, 59 pages), os validate (command, 93 pages)
  • 7 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 68 of 251 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 189 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 96b7975b0587bd3268884ea44f3b3170d90187d3 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 78ec27d016cc83838cb53ba1c515abaa0d03c815 — the merge of head 7052770cd8e35f0577a027a6cf69a06dfde0dc19 into base 96b7975b0587bd3268884ea44f3b3170d90187d3, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 78ec27d016cc83838cb53ba1c515abaa0d03c815 && git checkout 78ec27d016cc83838cb53ba1c515abaa0d03c815
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 96b7975b0587bd3268884ea44f3b3170d90187d3 7052770cd8e35f0577a027a6cf69a06dfde0dc19 && git checkout -B drift-repro 96b7975b0587bd3268884ea44f3b3170d90187d3 && git merge --no-ff 7052770cd8e35f0577a027a6cf69a06dfde0dc19

node scripts/docs-audit/affected-docs.mjs --json 96b7975b0587bd3268884ea44f3b3170d90187d3

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 96b7975b0587bd3268884ea44f3b3170d90187d3 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…nement

A `.refine()` on the `fieldGroups` array was a new position at which a
rule reaches the runtime and not the published JSON Schema, so the
schema build refused it against the dropped-refinements ledger. The
rule moves into the extension's existing refinement, which that ledger
already records; the refusal's path and message are unchanged.

Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
Co-authored-by: Claude <noreply@anthropic.com>
…ension arrangement keys

The entry object's interface takes the schema's type name
(ObjectExtensionRelatedListEntryObject) so its reference page keeps an
import line. Regenerated: api-surface, authorable-surface,
declaration-map, export-origins, json-schema.manifest, the strictness
ledger counts and content/docs/references.

Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
Co-authored-by: Claude <noreply@anthropic.com>
…stom-package-arrangement

engine-registration.ts: main moved the extension contribution into
objectExtensionContribution (shared with residual entries); the two
arrangement keys ride it.

Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
Co-authored-by: Claude <noreply@anthropic.com>
… anchors

The translation-reference rule was sized against an extension that
could not declare field groups. The shared extension fold now carries
`fieldGroups`, and the rule adds each group key to the target's
`_sections` anchors, so a bundle key for a group the arrangement brings
is not reported as an orphan. The connector redactor's decoration
fixture lists the new read decoration.

Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
Co-authored-by: Claude <noreply@anthropic.com>
…ves the field

A placement sets the placed field's `group` to the owner's group. Where
the `.custom` arrangement replaces the groups and has no group of that
key, the field kept a `group` naming nothing, and folding the served
body again answered differently. The fold now takes such a `group` off
a field the `.custom` extension does not declare, so the field shows
after the last group and a refold is the identity.

The two suites' layout helper no longer reports the trailing bucket
when it holds system fields only. The changeset lists the lint package.

Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmT4eA4YqtxfiPyLPih

Contract-review-claim: session_01ADHkmT4eA4YqtxfiPyLPih · head f87f5e2 · 2026-11-22T19:06Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmT4eA4YqtxfiPyLPih

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: f87f5e242f156a96a4fb7d3052df372aeb29b2cc
Local-runs: none
Scope: packages/spec/src/data/field-customization.ts, packages/spec/src/data/object.zod.ts, packages/spec/src/data/related-list-entry.ts, packages/spec/src/kernel/metadata-read-decorations.ts + packages/objectql/src/registry-custom-arrangement.ts, packages/objectql/src/registry-object-registration.ts, packages/objectql/src/registry.ts, packages/objectql/src/engine-registration.ts, packages/objectql/src/registry-revision.ts, packages/metadata-protocol/src/protocol-extension-arrangement.ts, packages/metadata-protocol/src/protocol-meta-item-face.ts, packages/metadata-protocol/src/protocol-meta-list-reads.ts, packages/metadata-protocol/src/protocol-object-extension-item.ts, packages/cli/src/utils/extension-arrangement.ts, packages/cli/src/commands/compile.ts, packages/cli/src/commands/validate.ts, packages/cloud-connection/src/marketplace-install-local-plugin.ts, packages/lint/src/object-graph.ts, packages/lint/src/validate-translation-references.ts, ui/packages/app-shell/src/utils/deriveRelatedLists.ts, ui/packages/plugin-detail/src/synth/buildDefaultPageSchema.ts (each implementing file read at the hunks of this diff only; code outside the diff was read, not reviewed). Tests, generated baselines, content/docs and the changeset were read as evidence only.

① Derived judgments

Check-runs on the head: 70 runs, 61 success, 9 skipped (opt-in and schedule-only jobs), 0 failed, 0 pending. Test Core 10 of 10, Test UI 16 of 16, the Type Check lanes, Lint and Repo Gates, Check Changeset, Spec property liveness and Governed Surface Queue Guard are success. These are the gate verdicts; nothing was re-run.

Accept-set and public-surface changes the diff implies:

  • ObjectExtensionSchema.fieldGroups (array of ObjectFieldGroupSchema) and ObjectExtensionSchema.relatedLists (array of ObjectExtensionRelatedListEntrySchema): previously refused at parse on every extension by the two guidance rows, now accepted at parse on every extension. Widening. Right: a parse does not know the writing package, and the __c precedent (ADR-0146 D10) also judges the package at the doors and not in stack.zod.ts.
  • What that trades away: the refusal of a non-.custom writer is no longer at parse. It now sits at item save, restore and draft promotion (objectExtensionItemRefusal step 8), os validate, os build and the marketplace install (step 1c-arrangement); every other entry falls to the registry fold, which skips the key and names it in the boot log. Read in the tree: mergeObjectDefinitions copies named keys only, so the two keys reach the object through applyCustomArrangement alone, and that function applies a writer only when isCustomizationPackage(packageId) holds. So a non-.custom extension is never applied at any door; where no door judges it, the outcome is an inert key with a warning, not a refusal. That is the card's item 2 (three doors, on the __c precedent) and is right; it is not "refused exactly as before" on three paths, named in N1.
  • ObjectExtensionRelatedListEntryObjectSchema and its hidden key: new. The built-in tab names stay refused in the object form through the inherited list pattern (pinned by the spec suite). Right.
  • RelatedListEntryObjectSchema gains a hidden guidance row. hidden was already refused there as an unknown key; the refusal stays and gains a sentence. No narrowing.
  • New refinements on ObjectExtensionSchema (duplicate group keys, the object's two membership rules over the extension's own fields, contradictory shown and hidden entries, place beside the key that replaces it): each fires only on an input carrying a key that was refused before. No narrowing.
  • BASE_FIELD_DISPLAY_WHITELIST: unchanged. Right: hidden is read by packages/objectql/src/search-companion.ts (a hidden field leaves the companion column) and by the form routes' required reading, so it fails the display-only test the ADR states.
  • METADATA_READ_DECORATIONS gains _relatedListsArrangement. Every strip is list-driven (stripReadDecorations, the export strip in packages/runtime/src/domains/packages.ts, the clone strips), so the new key is stripped on every write and on export with no further edit. It is stamped on the served by-name read and the effective served list only, never on the per-package layer, the execution face or a draft read. Right.
  • New exports (CUSTOM_ARRANGEMENT_KEYS, extensionArrangementKeys, relatedListEntryHidden, relatedListNameCovers, RELATED_LISTS_ARRANGEMENT_DECORATION, RelatedListsArrangement, readRelatedListsArrangement, the two entry schemas and types; judgeExtensionArrangement and its envelope; SchemaRegistry#getRelatedListsArrangement): additive. Right.
  • VisibleObjectExtension.fieldGroups in @objectstack/lint is a new required member of an exported interface; additive for readers, and the type lanes are green.

② Semver level

The changeset declares minor on @objectstack/spec, objectql, metadata-protocol, cli, cloud-connection, lint, @object-ui/app-shell and @object-ui/plugin-detail. That matches what the diff publishes: new accepted keys, new exports, one new read decoration, and nothing that refuses an input accepted on main. Check Changeset is success.

Clause-②: yes (widening) — on the PR body and in the changeset, and it agrees with ①: every changed position accepts more or the same; none narrows. Metadata-protocol: added is the lane's declaration and is consistent with a new accepted key and a new served decoration.

One sentence of the changeset overstates (evidence only, the changeset is the lane's): "was already refused at parse, and is still refused" does not hold on the three paths of N1.

③ Boundary flags

SQL push-down: no finding. The diff adds no query, no id materialisation and no in-app join; the fold and the readers work on metadata bodies already in memory.

Security: no hunk changes who can read or write a record or a field. A hidden tab and a field in a hidden group are presentation: the list and the field still read over the API under the caller's permissions. The arrangement is written by whoever may write a .custom package (the metadata write door's existing authority); the decoration serves a package id and the hidden list names to every reader of the served object, the same class of name an object's own relatedLists already serves. One thing to carry into the prose: nothing in the diff teaches hiding as a permission, and nothing says it is not one (part of S3).

The dev's five forks and the sixth open_questions row:

  1. Several .custom writers. The doors judging by the suffix predicate: right as built; the card names the __c precedent, and the CLI door has no installed base to ask. The choice among several admitted writers is wrong as built: S2. One part needs the maintainer: a .custom package that is not the pair of the object's App, writing alone, is applied (the "else the one folded last" arm). The card says only the paired package (「只对配对的 .custom 包放开」) and ADR-0146 D2 fixes the customer's layer "by role, never by publish order"; neither says whether another App's pair may arrange this object, and the save and install doors could refuse it where the CLI cannot.
  2. A list the owner hid by leaving it out stays hidden until the arrangement names it: right as built. It matches the card's purpose for item 4 (what an upgrade or a later package brings is not lost) without revealing what the vendor chose not to show, and it is stated in the key's description. S1 is one case where the build does not keep this rule.
  3. hidden on relationship entries only: needs the maintainer. The card's item 1 lets the list name the three built-in tabs and item 4 says hiding is written. As built, the environment has no way to hide the attachments tab or the activity stream of an installed object: it cannot leave one out (unlisted shows, or is carried), cannot write hidden on it, and cannot patch the object's enable keys. The dev's reason for A (a second switch beside the object's own) does not apply to the environment, which holds no first switch. Additive later; nothing built here blocks it, so it is not graded.
  4. No field-hide key; a .custom group with visibleWhen: 'false': right as built as the mechanism (the card's item 5 delegates the choice to the admission test, and the test is applied correctly). The published wording of the recipe is incomplete: S3.
  5. Names not cross-checked against the installed object: right as built. Read in the tree: an unknown field name in a group's fields is skipped by deriveFieldGroupLayout (the object parse does not judge it either); an unknown list name names no list in relatedListNamingEntries and places nothing; an unknown hidden name hides nothing. Not judged at os validate or at install. A refusal would make the environment's next save fail after a vendor upgrade removes a field, which the card's "no upgrade-time merging" rules out. A lint warning is a fair follow-up.
  6. Skills-docs follow-up (skills/objectstack-data/SKILL.md): the seat's to file; not judged here.

Other flags:

④ Design judgment

packages/spec/src/data/field-customization.ts — holds. CUSTOM_ARRANGEMENT_KEYS is the one list the fold and the judge both read through extensionArrangementKeys; "written" includes an empty array, which the fold and the spec suite agree on. The hidden paragraph agrees with the code it cites.

packages/spec/src/kernel/metadata-read-decorations.ts — holds; see ①.

packages/spec/src/data/related-list-entry.ts — relatedListNameCovers, relatedListEntryHidden and readRelatedListsArrangement hold against their consumers, with one gap in what RelatedListsArrangement can say (S1).

packages/spec/src/data/object.zod.ts — the two keys, the entry schema and the five refinements hold against the card's items 1 to 4 and against the fold. Findings S1 and S3 touch its published descriptions.

S1 (should-fix) — hiding every tab of a declared tab list reveals the lists the owner hid. Trace: the owner declares relatedLists: ['a', 'b'] and leaves its own child list c out; the .custom extension writes relatedLists: [{ list: 'a', hidden: true }, { list: 'b', hidden: true }]. In applyCustomArrangement, shown is empty and carried is empty (both entries are covered), so the served relatedLists is [] with the decoration unlisted: 'hidden'. In deriveRelatedLists, relatedListNamingEntries answers null for an empty list ("absent, or empty"), and the loop's if (!naming) arm pushes every list not hidden by name, so c now shows, and so does every other own-package list the owner left out. The same happens with a one-entry owner list whose entry is hidden. This contradicts the key's own description ("A list the object's own relatedLists hides by leaving it out stays hidden until this list names it"), the decoration's unlisted: 'hidden' ("the served list's own rule") and fork 2 as built. No suite covers the case (the fold suite hides one of several; the reader suite's hidden control uses a non-empty list). A served empty list cannot say "declared, and nothing shows", so the fix belongs in the reader's reading of the decoration or in what the fold serves; either moves the head. Presentation only: no record becomes readable that was not.

S2 (should-fix) — the choice among several .custom writers does not know the App pair. registry-custom-arrangement.ts picks the first admitted writer for which isCustomizationPairOf(writer.packageId, context.ownerPackageId) holds, else the writer folded last. ADR-0146 D3 as amended makes the unit the App: the pair of an object owned by a module of an App is the App's .custom package, and packages/metadata-core/src/customization-pair-lookup.ts states the rule for every caller: ask pairOf or isPairOf, never isCustomizationPairOf(pair, base) directly. For an object a module owns (the HotCRM shape the card is accepted against), the predicate never matches the real pair, so with two .custom writers the one served is decided by fold order, which ADR-0146 D2 rules out for the customer's layer ("by role, never by publish order"), and the boot log may name the real pair as the one skipped. The module's jsdoc and the changeset both say "the pair of the object's owner is served". With one writer the fallback serves it, which is why every suite is green; the two-writer case in the fold suite uses an owner that is its own unit. The registry already resolves pairs through pairOf with the installed manifests (registry.ts, the holder lookup), so the fold's context can carry the pair id.

S3 (should-fix) — the published recipe for hiding a base field omits what it breaks. The fieldGroups description in object.zod.ts, the BASE_FIELD_DISPLAY_WHITELIST jsdoc, the docs page and the changeset prescribe a group whose visibleWhen is false, and the PR body says it "changes nothing else". Read in the tree: a field claimed by a hidden section is not mounted, and the form skips the unmounted control at submit-time validation (ui/packages/components/src/renderers/form/form.tsx, hiddenSectionFieldNames), while the server still requires it. So a base field that is required with no default, hidden this way, makes the create form unsubmittable: the save is refused naming a field the user cannot see. The repo already treats this hazard as blocking on form views (requiredInGatedSection.ts). The recipe also does not say that the field stays readable and writable over the API, the sentence ObjectFieldGroupSchema.requiresFeature carries for the same mechanism ("Presentation only"). The description should say both: not for a required field without a default, and not access control. Read from the code, not run.

Implementing files, against the contract:

  • registry-custom-arrangement.ts — agrees with the description sentence by sentence apart from S1 and S2. Checked by reading: a key not written keeps steps 1 and 2; a listed field's group follows the listing group and a non-listed field of the owner or another extension loses a group naming a listing or missing group, so the served object still passes the object's two membership rules; a bare child covers its relationships in both the carry-over and the hiding; carried entries go before a trailing approvals and stream run; nothing is stored, and the decoration is keyed on the served body.
  • registry-object-registration.ts, registry.ts, engine-registration.ts, registry-revision.ts — agree: the step runs after applyExtensionPlacements, the contribution carries the two keys, the accessor reads the served fold's own body.
  • protocol-extension-arrangement.ts, protocol-object-extension-item.ts — agree: one judge, refusal in every non-.custom package, prescription inside the message, the item door asks it after the binding check (an item bound to no package is refused earlier at step 1).
  • protocol-meta-item-face.ts, protocol-meta-list-reads.ts — agree: the decoration rides the faces _withheldFields rides and no other.
  • cli/src/utils/extension-arrangement.ts, compile.ts, validate.ts — agree, and validate and build call the same function (parity roster row present).
  • marketplace-install-local-plugin.ts — agrees: every delivered package is judged before any write, 422 with one row per key.
  • lint/src/object-graph.ts, validate-translation-references.ts — agree with the widened surface; the dev's note that a place-brought group is probably still not a section anchor predates this PR and is not this diff's.
  • deriveRelatedLists.ts, buildDefaultPageSchema.ts — agree with RelatedListsArrangement as documented, and are inert with no decoration; S1 is the case the documented shape cannot express.

N1 (nit) — three paths accept a non-.custom writer's key where main refused it at parse, each ending in the fold's skip and boot-log line: a code-defined stack that boots without os validate or os build; a stack naming no package id, which os validate now passes (judgeExtensionArrangement skips a subject with no package id, though no .custom package can be the writer there); and the package duplicate and orphan adoption in protocol-package-commits.ts, where the __c judge is asked and this one is not (not verified whether the copy loop routes an object_extension row through the save door). Nothing is misapplied on any of them. Follow-up card, not a change on this head.

N2 (nit) — content/docs/data-modeling/object-extensions.mdx and the changeset repeat the recipe of S3 and the "pair of the object's owner" wording of S2; they follow whatever those fixes say.

S1, S2 and S3 are open on this head and earn a delta review of their fixes. Forks 1 (the lone non-pair writer) and 3 go to the maintainer.

Implemented-by: claude/issue-36498-custom-package-arrangement
Reviewed-by: session_01ADHkmT4eA4YqtxfiPyLPih

VERDICT: PASS

…ab list stays a declared one; the field-hide recipe states its limits

Three should-fix items of the contract review of the paired `.custom` arrangement.

- Hiding every tab of a declared tab list revealed the lists the owner hid. The
  fold has nothing left to serve there, and an empty `relatedLists` alone reads
  as "none declared, every list shows". The two readers of the served tab list
  (the record page's tab reader and the default page synthesis) now read an
  empty list beside `unlisted: 'hidden'` as a declared list that names nothing.
- The choice among `.custom` writers did not know the App pair. The fold now
  asks `pairsOf` over the installed manifests (the App's pair first, then an
  installed per-package pair an earlier version created) and serves only a
  writer in that list, chosen by its position there and never by fold order. A
  `.custom` package that is not the object's pair is skipped and named, alone
  or beside the pair.
- The published recipe for keeping a base field off the page (a `.custom` group
  whose `visibleWhen` is false) now says it is presentation only, not access
  control, and that it is not for a `required` field without a default.

The docs page and the changeset follow, and the changeset no longer says a
non-`.custom` writer is refused on every path.

Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmT4eA4YqtxfiPyLPih

Contract-review-claim: session_01ADHkmT4eA4YqtxfiPyLPih · head 7052770 · 2026-11-22T20:32Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmT4eA4YqtxfiPyLPih

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 7052770cd8e35f0577a027a6cf69a06dfde0dc19
Local-runs: probe — one python3 -I one-liner printed a saved GitHub read-tool result (card comments); nothing built, run or re-run
Scope: packages/spec/src/data/field-customization.ts, packages/spec/src/data/object.zod.ts, packages/spec/src/data/related-list-entry.ts, packages/spec/src/kernel/metadata-read-decorations.ts + packages/objectql/src/registry-custom-arrangement.ts, packages/objectql/src/registry-object-registration.ts, packages/objectql/src/registry.ts, packages/objectql/src/engine-registration.ts, packages/objectql/src/registry-revision.ts, packages/metadata-protocol/src/protocol-extension-arrangement.ts, packages/metadata-protocol/src/protocol-meta-item-face.ts, packages/metadata-protocol/src/protocol-meta-list-reads.ts, packages/metadata-protocol/src/protocol-object-extension-item.ts, packages/cli/src/utils/extension-arrangement.ts, packages/cli/src/commands/compile.ts, packages/cli/src/commands/validate.ts, packages/cloud-connection/src/marketplace-install-local-plugin.ts, packages/lint/src/object-graph.ts, packages/lint/src/validate-translation-references.ts, ui/packages/app-shell/src/utils/deriveRelatedLists.ts, ui/packages/plugin-detail/src/synth/buildDefaultPageSchema.ts. Delta round on the record in PR comment 7084262686 (head f87f5e2): the rework is one commit, and it changes the four hits files' prose (three of them; metadata-read-decorations.ts is untouched) and five implementing files (registry-custom-arrangement.ts, registry-object-registration.ts, registry.ts, deriveRelatedLists.ts, buildDefaultPageSchema.ts); those were read whole at the changed regions, the rest of the scope stands as the earlier record judged it. Code outside the diff (packages/metadata-core/src/customization-pair-lookup.ts, registry-packages.ts, ADR-0146) was read, not reviewed. Tests, generated pages, content/docs and the changeset were read as evidence only.

① Derived judgments

Check-runs on the head: 74 runs (70 on the push, four re-run on the PR body edit), 63 success, 11 skipped (opt-in, queue-verdict and schedule-only jobs, and the body-edit re-runs of Auto Label and Check PR Size), 0 failed, 0 pending. Test Core 10 of 10, Test UI 16 of 16, the Type Check lanes, the Lint lanes, Build Core, Check Changeset, Spec property liveness and Governed Surface Queue Guard are success. These are the gate verdicts; nothing was re-run.

What the rework changes in the accept set and the public surface, against the earlier record's ①:

  • The parse accept set is unchanged. In the hits files the rework edits description strings and doc comments only: CUSTOM_ARRANGEMENT_WRITER and the fieldGroups description in object.zod.ts, the header and the whitelist doc comment in field-customization.ts, the RelatedListsArrangement doc comment in related-list-entry.ts. No schema, refinement, constant or export moves. Right.
  • The served set narrows against the earlier head, not against main: a .custom writer that is not in pairsOf(owner, installed manifests) is no longer applied when it writes alone (the "folded last" arm is gone). The two keys are new in this PR, so nothing published is taken away. Right, and it is the reading the seat fixed for fork 1 from the card (「只对配对的 .custom 包放开」).
  • The reader's reading of one served shape changes: an empty relatedLists beside _relatedListsArrangement.unlisted: 'hidden' is a declared list naming nothing. The decoration's shape and the fold's output are unchanged, and with no decoration both readers answer as on main (traced in ④). Right.
  • CustomArrangementContext.ownerPackageId became customizationPairs; the interface is new in this PR, so no published member is renamed. ObjectRegistrationHost gains getPackage (internal host). Right.
  • Every other judgment of the earlier record's ① stands on this head: the files that carry them did not change.

② Semver level

The changeset still declares minor on @objectstack/spec, objectql, metadata-protocol, cli, cloud-connection, lint, @object-ui/app-shell and @object-ui/plugin-detail, and the rework adds no package and publishes nothing beyond what the earlier record judged: new accepted keys, new exports, one read decoration. Check Changeset is success (both runs).

Clause-②: yes (widening) — on the PR body and in the changeset, and it agrees with ①: no input accepted on main is refused. The sentence the earlier record called an overstatement is corrected: the changeset now says a writer that is not a .custom package was refused at parse, is refused at the five doors, and where no door judges it the key is not applied and the boot log names it.

③ Boundary flags

SQL push-down: no finding. The rework adds no query, no id materialisation and no in-app join. pairsOf reads package records already held in the registry's memory, once per fold and only when an extension writes an arrangement key.

Security: no hunk changes who can read or write a record or a field. The field-hide recipe now says in every published place that it is not access control.

The dev's open question (round 2), answered: A is consistent, B is not needed.

  • pairsOf exists on main (packages/metadata-core/src/customization-pair-lookup.ts). It answers the App's pair first (pairOf: customizationPackageId(appOf(base)), by id, whether or not that pair is installed), then the per-package pair BASE.custom only while a package of that id is installed and it is not the App's pair; empty when the base has no pair of either kind (no package id, or the base is itself a .custom package). isPairOf is membership in that list.
  • That module states the rule for callers: pairOf is for where a customization lands; isPairOf / pairsOf are for "every read that serves or lists a package's customizations". The fold is such a read. ADR-0146 D3 merge question 12 says a per-package pair of an earlier version is "served as it is" until the migration ceremony re-identifies it, "so nothing a customer built goes dark on upgrade".
  • The card's 「只对配对的 .custom 包放开」 excludes packages that are not the object's pair. A per-package pair is, under D3 and under isPairOf, still one of the object's pairs until the ceremony runs. Serving it second to the App's pair keeps D2 ("by role, never by publish order"): the choice is by position in pairsOf, and both fold orders are pinned.
  • B would make the save door accept an arrangement into an installed per-package pair (the doors judge by the suffix) that no read then serves, on a package the ADR says is served as it is. That is the worse of the two.

Where the installed manifests come from at fold time, as asked: installedManifestsOf(this) over the registry's own getPackage (the package collection), read live when the fold runs, not captured at boot. The fold's result is cached per object (mergedObjectCache), and that cache is dropped by any registration or withdrawal on that object and by every enable or disable; installPackage and uninstallPackage drop it only for a package that is disabled. So:

  • The pair's own contribution arriving or leaving drops the object's cache, and the engine installs a package's record before it registers that package's objects and extensions (registerPackageBody, step 1 before 2 and 2b). A per-package pair's record is therefore in place when its extension is folded, and its uninstall withdraws its contribution. Fresh.
  • The App's pair needs no record of its own; it needs the owner's and the App's records when the fold runs. With the App registered before its member (the member declares the App in dependencies) those are in place. Fresh.
  • One order is not covered: see N3.

Flags carried, each still without a change on this head:

④ Design judgment

No must-fix, no should-fix.

S1: closed — the readers now read an empty served relatedLists beside unlisted: 'hidden' as a declared list naming nothing. Traced on this head:

  • The original case (owner declares ['a', 'b'], leaves its own c out; the pair hides a and b): the fold serves [] with { hidden: ['a', 'b'], unlisted: 'hidden' }, unchanged. In deriveRelatedLists, relatedListNamingEntries answers null for the empty list and the new line substitutes an empty map; a and b leave at hiddenByArrangement, and c takes the declared arm: not in the map, unlistedShown false, so a side list of the object's own package is not derived, a body table stays at its group without a tab, and another package's list still shows. c stays hidden. In arrangeDeclaredTabs the early return is skipped for 'hidden', names is empty, an unlisted attachments tab ranks null and is not drawn, related tabs then approvals then the stream follow in build order.
  • The one-entry case (owner ['a'], the pair hides a): the same path, the same result.
  • An object with no arrangement: readRelatedListsArrangement answers undefined, the substituted value is null, which is what relatedListNamingEntries answered alone, and arrangeDeclaredTabs receives undefined and returns at the same early return. Byte for byte the main behaviour.
  • An owner's own empty relatedLists with no decoration: null naming, every list shows, as on main. An empty list the pair writes over an automatic list: the fold serves [] with unlisted: 'shown', the substitution does not fire, every list not hidden shows. Hiding every list over an automatic list: the same, minus the hidden ones.
  • The fold and the decoration shape are unchanged, as stated. The served readers of relatedLists in the tree are these two; the Studio editor reads a draft.
  • Pinned in the fold suite (both cases) and in both reader suites, each with a no-decoration control.

S2: closed — servedWriter admits a writer only when its package is a .custom package and is in context.customizationPairs(), which the fold fills with pairsOf(owner package, installedManifestsOf(registry)); among admitted writers the one earliest in that list is served and the other named; a .custom writer outside the list is skipped and named, alone or beside the pair. isCustomizationPairOf is no longer imported or called anywhere in the diff, and fold order decides nothing. For the HotCRM shape (an App and a module of it that owns the object) the App's pair is served in both fold orders, and a .custom id named after the module is skipped unless a package of that id is installed. An object registered with no package has no pair, so nothing is applied to it; that follows the seat's reading for fork 1 and the card (an environment's own object is edited on the object itself). The module's doc comment, the key descriptions, the docs page and the changeset now say "the pair of the App the object belongs to".

S3: closed — the fieldGroups description, the BASE_FIELD_DISPLAY_WHITELIST doc comment, the docs page and the changeset each state both limits: presentation only, not access control (the field stays readable and writable through the API); and not for a required field with no default (the create form no longer shows the field while the save still requires it). Both sentences agree with the code the earlier record read (hiddenSectionFieldNames in the form renderer; the server-side required check). The generated reference page carries the same text.

N2: closed — the docs page and the changeset follow S2 and S3, and the changeset's "still refused" sentence is corrected (②).

N1: accepted deviation, follow-up (the changeset now states two of the three paths; no card number is named yet).

The hits files on this head:

  • packages/spec/src/data/object.zod.ts — holds. CUSTOM_ARRANGEMENT_WRITER agrees with the fold sentence by sentence: written by the pair of the object's App; a writer that is not a .custom package is refused at the doors and skipped by the merge; a .custom package that is not the pair is not refused at the doors and not applied. See N5 for the one thing it leaves unsaid.
  • packages/spec/src/data/related-list-entry.ts — holds. The RelatedListsArrangement comment now states the empty-list reading, and both readers implement it. See N4.
  • packages/spec/src/data/field-customization.ts — holds; comment only, and accurate.
  • packages/spec/src/kernel/metadata-read-decorations.ts — unchanged by the rework; holds as before.

Implementing files the rework changes, against the contract:

  • registry-custom-arrangement.ts — agrees. The pairs are asked once, only when a key is written (pinned by a context that throws). The two skip messages name the package, the object and, for a non-pair, the object's pair.
  • registry-object-registration.ts, registry.ts — agree: the fold's host carries getPackage, every caller reaches the fold through the registry's host, and the owner is the own contributor (the packaged owner, also under a tenant overlay).
  • deriveRelatedLists.ts, buildDefaultPageSchema.ts — agree with the documented decoration and are inert without it (S1 above).

N3 (nit) — the served fold now depends on the installed package records, and no install or uninstall of an enabled package drops mergedObjectCache. If an object's fold is cached after the pair's extension is registered and before the App's record (or a record in the owner's dependency chain) arrives, the cached answer skips the App's pair and the boot log names it as "not the customization package", until the next registration on that object or the next enable or disable. Not shown reachable by reading: the engine installs each package's record before its contributions, and a member that declares its App in dependencies is expected to register after it; no suite pins the reverse order. The same class of dependence is already on main in the placement step (childPackageOf reads other objects' owners at fold time). Follow-up card: drop the cache when a package record is installed or removed, or pin the order.

N4 (nit) — readRelatedListsArrangement reads any unlisted other than 'shown' as 'hidden'. Since this round 'hidden' beside an empty list hides every own-package side list, so a decoration with a missing or misspelt unlisted now fails toward hiding where it used to change nothing. The server writes one of the two values on every path read, so no served object takes this arm. Left as it is.

N5 (nit) — the two key descriptions say "the paired .custom package of the App the object belongs to" and do not say that an installed per-package pair of an earlier version is still read, second to it; the docs page and the changeset do. Not false, and the case ends with the migration ceremony. A fix moves the head; left for the skills and reference follow-up (#36541) or the ADR text card (#36086).

Nits alone; the round ends here.

Implemented-by: claude/issue-36498-custom-package-arrangement
Reviewed-by: session_01ADHkmT4eA4YqtxfiPyLPih

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY

维护者速读(席位记录 · head 7052770cd8)

  • 改了什么:环境管理员可以用应用配套的 .custom 包,对已安装对象的字段分组和记录页子表页签重新排版:哪些字段归哪组、子表页签的顺序,以及隐藏某个子表页签。写了哪个键,就整体替换原包和其他扩展包在这个键上的排法;没写的键保持原样。只有应用配对的 .custom 包能写这两个键。其他包写会在发布、校验、安装时被拒;不是配对的 .custom 包写了不生效,启动日志里会点名。
  • 为什么:属于运行界面设计专题(记录页排布的第三层:配对的 .custom 包可以给安装来的对象声明完整的分组和页签排布(原始包完整声明、继承包只能声明插入位置,这两层不变) #36498)。卡上你的原话是「软件包字段、子表自定义分三种」,以及「同意,立卡」。
  • 风险:改了对外发布的元数据协议(新增两个可写键,spec minor)。用组的 visibleWhen: false 藏基础字段只影响显示,字段仍可经 API 读写,不是权限控制;也不能用来藏没有默认值的必填字段,否则新建表单提交不了。这两点已写进字段描述、文档页和 changeset。最坏情况是排版不生效,不会改数据。
  • 要你做什么:批准合并。契约审核(L2)已通过:首审 7084262686 PASS,带 3 条应修;返工后增量 7085456800 PASS,Head-sha 7052770cd8e35f0577a027a6cf69a06dfde0dc19。改动 3566 行,超过 3000 行人工合并线,所以需要你批。
  • 席位意见:建议批准。

席位核对

ACCEPT at head 7052770cd8 (seat repo:objectstack#2, reviewer of record).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY

Hand-off for approval: L1 ACCEPT at head 7052770cd8e35f0577a027a6cf69a06dfde0dc19, all checks green. Tier H (over 3000 lines, schema face). Same-head contract review PASS 7085456800 (CONTRACT_REVIEW_TIER), on the record of 7084262686. The seat lands it after an approval is on record.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 22, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 22, 2026 22:16
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 45ef94e Nov 22, 2026
80 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-36498-custom-package-arrangement branch November 22, 2026 22:46
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
…flows.FLOW.nodes.NODE_ID.label (objectstack-ai#36383)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbYV2nRmpjdz5BmCf9psuMXA)_

Part of objectstack-ai#35979 (Asked item 2 only, as ruled in comment 7076440876; Asked
item 1 is PR objectstack-ai#36335, merged)

repo:objectstack#7 · zhuangjianguo · session_01QsR2jTrJZvNaijgX3NxBMc

Clause-②: yes (widening: a new translation key
`flows.FLOW.nodes.NODE_ID.label`; the new exports
`FLOW_TECHNICAL_NODE_TYPES` and `isFlowTechnicalNodeType` from
`@objectstack/spec/automation`; and `@object-ui/i18n`'s exported
`FlowLabelTranslations` type gains the member `screenTitle`, and its
`stepLabel` parameter accepts a `config`)
Metadata-protocol: added
Skills-docs: follow-up objectstack-ai#36401

## 维护者速读

- 用户能看到什么变化:应用包现在可以给流程里每个步骤(开始、判断、通知、结束等)写各语言名称;手册里的流程图和 Studio
流程画布都按读者语言显示这些步骤名,中文下不再夹英文。已发布语言的应用在检查里会多出这些步骤的缺译提示。
- 为什么做:HotCRM 销售手册的审批流程图在中文下仍显示英文的判断和通知步骤,维护者在卡上选了「补上翻译位,可以翻译」。
- 出错会怎样:只影响显示和缺译提示,不改流程运行和任何数据;可直接撤回。
- 要你做什么:无。

## What changes

Both halves are on this branch: the key, its validation and its coverage
demand, and the readers that draw it (on `main` since PR objectstack-ai#36335 merged
the shared flow-label resolution into `@object-ui/i18n`).

- **The key** (`packages/spec/src/system/translation.zod.ts`).
`flows.FLOW.nodes.NODE_ID.label`, a strict entry with one plain-text
leaf, `label`, overlaying the node's own `FlowNode.label`. It addresses
every node but a `screen` (whose `screens.NODE_ID.title` covers
`config.title ?? node.label`) and an `approval`
(`approvals.NODE_ID.label`), so one string keeps one key. `nodes` was an
unknown-key alias onto `screens`; it is now the real group (`node`
aliases onto it). The `## nodes` docblock section states the rule; the
convention list gains the row.
- **Start and end nodes (ruling item 3).** Keyed like any other step;
the viewer supplies no words of its own. Measured on
`examples/app-showcase` at c448c61: of the start/end labels, 25 are
`End` and 11 `Start`, but the rest name an outcome or a trigger
(`Approved` x5, `Rejected` x5, `Signed Off`, `Declined`, `On Task
Created` x3, `Daily at 06:00`, ...), which a generic word would erase.
- **Validation**
(`packages/lint/src/validate-translation-references.ts`). A `nodes` key
over an unknown node is `translation-target-unknown` with the nearest
node offered; over a `screen` it is pointed at `screens.NODE_ID.title`,
over an `approval` at `approvals.NODE_ID.label`. The reverse slips now
point at the new key: a `screens` or `approvals` key over any other node
says `its label is keyed nodes.NODE_ID.label` (two existing messages
gain that clause instead of "so nothing resolves").
- **The demand** (`packages/lint/src/i18n-walk.ts`,
`i18n/missing-flow`). Every top-level node the docs embed draws at its
default `detail: business` altitude, minus screens and approvals, which
were already demanded; and, since the embed's branch list names the step
each branch of a drawn decision leads to, a folded technical step a
branch names (seat reading L2 S1; live case: app-todo's
`check_recurring` branching to the `compute_next_due_date` script).
`decisionBranchTechnicalTargets` mirrors which out-edges the viewer
lists (`flow-branches.ts` `decisionBranches`). Region-nested nodes are
accepted by validation but not demanded: the embed does not draw them.
`packages/cli/src/utils/i18n-coverage.ts` only updates the bucket's
description.
- **The readers** (`ui/packages/i18n/src/flowLabels.ts`). The shared
`stepLabel` now reads each step's one key by node type:
`approvals.NODE_ID.label` for an approval, `screens.NODE_ID.title` for a
screen with no `config.title`, `nodes.NODE_ID.label` for any other node.
The docs viewer's `type: flow` embed (`metadata-viewer.tsx`, new
`flowStepName`) names each drawn step and each decision-branch target by
it; the Studio canvas (`FlowCanvas`, and `flow-region-view`'s
`RegionNode` for nested region nodes) and the inspector heading read the
same `stepLabel` unchanged, so a nested node's key, which validation
accepts, has a reader.
- **A titled screen (seat reading S3).** A screen with its own
`config.title` shows that heading at run time, translated under
`screens.NODE_ID.title`; its canvas label has no key. The docs embed
names such a screen by its heading (translated where the bundle carries
it), unless the heading holds a `{{ }}` hole a drawing cannot fill, in
which case it keeps the authored label. `FlowLabelTranslations` gains
`screenTitle` for this read. The Studio canvas keeps a titled screen's
authored label, since that is the label the designer edits.
- **One table for business altitude**
(`packages/spec/src/automation/flow-altitude.ts`). The viewer's private
`TECHNICAL_NODE_TYPES` set becomes `FLOW_TECHNICAL_NODE_TYPES` +
`isFlowTechnicalNodeType` in `@objectstack/spec/automation`; the viewer
folds steps by it and the walk demands by it, so they agree on which
steps a reader sees.
- **Examples.** `app-crm`'s lead-conversion wizard gets its three drawn
steps in zh-CN (its baseline stays 0). The ratchet in
`scripts/i18n-coverage-baseline.json` is raised for the new population,
as the PR that first walked the validation-message family did:
`app-showcase` 317 -> 425 (+108, one of them the folded
`showcase_inquiry_purge.purge` a branch names), `app-todo` 106 -> 130
(+24, two of them `todo_task_completion.compute_next_due_date` in its
two translated locales); the other 12 configs are unchanged (the ten
bundle packages stay 0, `check:i18n` in sync).
- **Ledger and pins.** `liveness/translation.json` gains `flows.nodes`
(+ `label`), `live`, citing `flowLabelTranslations`, `flowStepName`,
`FlowCanvas` and `RegionNode`. `flows-translation-face.test.ts`: the
`node.label` row now lists `nodes.NODE.label` beside
`approvals.NODE.label`.
- **Generated.** `api-surface/automation.json`,
`export-origins/automation.json`,
`content/docs/references/system/translation.mdx`, the strictness-ledger
counts and the liveness state counts, regenerated by `check:generated
--fix`.

## Read first (by risk)

1. `packages/lint/src/i18n-walk.ts`, the new loop at the end of
`walkScreenFlows`: what is demanded (top level, not technical, not
screen/approval).
2. `ui/packages/i18n/src/flowLabels.ts` `stepLabel` and
`metadata-viewer.tsx` `flowStepName`: which key each node type reads,
and the titled-screen rule.
3. `packages/spec/src/system/translation.zod.ts`, the `nodes` entry and
the `nodes` / `steps` alias changes.
4. `packages/lint/src/validate-translation-references.ts`, the `nodes`
block and the two redirect clauses.

Two-minute check: `pnpm --filter @objectstack/cli exec vitest run
--project unit test/i18n-flow-node-coverage.test.ts`; expect 6 passed,
including HotCRM's `opportunity_approval` shape asking for its start,
decision, notify, loop and end labels and nothing for its approvals,
screen or record write.

## Tests

<details><summary>Pins</summary>

- `packages/cli/test/i18n-flow-node-coverage.test.ts` (new family file,
like the screen / approval / refusal family files beside it): the walker
harvests exactly the drawn steps with no other key, seeded with the
authored label; a folded step only where a drawn decision's listed
branch names it, once (a conditions-free decision lists every out-edge;
a `conditions` decision its default and its claimed labels; an unclaimed
label and a non-decision source name nothing); nothing for any other
`FLOW_TECHNICAL_NODE_TYPES` step or an id-less node; every harvested key
parses and is kept by `TranslationDataSchema`; the coverage gate lists
them in the flow bucket and goes quiet once translated.
- `packages/lint/src/validate-translation-references.test.ts`: a new
top-level describe (clean run over start / decision / loop / nested
notify / end beside the other groups; `nodes` over an approval and over
a screen redirected; unknown node with suggestion), the two changed
redirect messages, and the one-line-verdict arm list gains the four new
arms.
- The screen, approval and liveness-gate family files in
`packages/cli/test/` pin exact key lists of their own family; they now
read every key but the `nodes` family (one predicate per file, pointing
at the new file).
- `ui/packages/components/src/__tests__/metadata-viewer.test.tsx`: a new
top-level describe: start / decision / notify / end by `nodes`, an
untitled screen by `screens` title, a titled screen by its translated
heading and a holed heading by its label, a decision-branch target by
`nodes`, and the business view folding exactly
`FLOW_TECHNICAL_NODE_TYPES`.
-
`ui/packages/app-shell/src/views/metadata-admin/previews/FlowCanvas.test.tsx`:
`stepLabel` reads each group by node type (and never another type's
group under the same id); the canvas draws a decision's and a nested
notify's translation; the inspector heading titles a decision by its
`nodes` key with the authored label beside it.
</details>

<details><summary>Runs at cafc3fd (the spec half) unless
noted</summary>

- `@objectstack/lint` whole suite (before the L2 S1 widening): `Test
Files 225 passed (225)`, `Tests 9431 passed (9431)` (at eabf0e6; lint
unchanged since).
- `@objectstack/cli` unit project, the 60 i18n / translation / lint test
files: 18 failures at eabf0e6, all exact key lists in the three family
files above; after the predicate, those 4 files `Tests 52 passed (52)`.
- `@objectstack/spec`: `flows-translation-face.test.ts` +
`translation.test.ts`, `Tests 238 passed (238)`.
- `pnpm --filter @objectstack/spec check:generated`: 5 stale before
regeneration, all 5 green after `--fix`.
- `node scripts/check-i18n-coverage.mjs`: before the baseline edit
`app-crm 0 -> 3`, `app-showcase 317 -> 424`, `app-todo 106 -> 128`;
after: `OK (14 config(s), 552 baselined untranslated string(s), none
new)`. `pnpm check:i18n`: all ten bundle packages in sync. `pnpm
check:i18n-walk-parity`: 17 declared, 15 walked, 2 exempted.
- Derived gate sweep at cafc3fd (`dispatch-gates --commands`, 127
commands): 126 exit 0, 1 NOT MEASURED (`check:dual-build-cjs-loads`,
exit 3 for want of a full build; left to CI). `dispatch-gates --ran`:
127 accounted for.
</details>

<details><summary>Runs at bc0171d (the reader half, after merging main
at dda5e74)</summary>

- ui, from `ui/`: `FlowCanvas.test.tsx` +
`flowNodeLabels.sites-13200.test.ts`, 64 tests passed;
`metadata-viewer.test.tsx` at its final edit, `Tests 22 passed (22)`
(two runs before it failed on the test's own isolation: a shared i18n
instance and a locale-specific string, both fixed in the test).
- `pnpm --filter @object-ui/i18n run type-check`,
`@object-ui/components`, `@object-ui/app-shell`: all exit 0 (after
building app-shell's dependency closure, 68 of 68 tasks).
- `pnpm --filter @objectstack/spec check:generated --fix`: the 2
artifacts the merge deferred plus the liveness counts regenerated, all 3
re-checked green.
- Derived gates for the files changed since the first sweep
(`dispatch-gates --commands`, 96 commands): 96 exit 0. `dispatch-gates
--ran`: 96 accounted for, 0 NOT MEASURED (derived from recorded exit
codes).
- `overlap-check.mjs`: merges cleanly with `origin/main` at 316f757.
</details>

<details><summary>Runs at 04d28e0 (the L1 / L2 rework)</summary>

- `@objectstack/lint` whole suite: `Test Files 225 passed (225)`, `Tests
9444 passed (9444)`.
- `@objectstack/cli` unit project, the 4 flow family files: `Tests 53
passed (53)` (the new folded-branch-target pin included).
- `node scripts/check-i18n-coverage.mjs`: `app-showcase 424 -> 425`,
`app-todo 128 -> 130` before `--update`; the new keys are
`flows.showcase_inquiry_purge.nodes.purge.label` and
`flows.todo_task_completion.nodes.compute_next_due_date.label`.
`check:generated` green after rebuilding spec.
- Derived gates for the files changed since bc0171d (`dispatch-gates
--commands`, 105 commands): 105 exit 0; `--ran`: 105 accounted for, 0
NOT MEASURED.
- `overlap-check.mjs`: clean against `origin/main` and the open PRs
sharing files (objectstack-ai#36517, objectstack-ai#36527).
</details>

## Acceptance notes

- `flows.FLOW.label` is still demanded only for a flow with a screen or
an approval node, although item 1's viewer draws the label of every
embedded flow. Not widened here, by the seat's word: filed as objectstack-ai#36400.
- HotCRM's own translations (`opportunity_approval`: 9 of 11 drawn
steps) are a follow-up in that repository now that the key has a reader:
objectstack-ai#36402.
- The i18n skill's text for the new key is owed: objectstack-ai#36401.
- A titled screen whose heading holds a `{{ }}` hole is drawn in the
docs embed by its authored label, which has no key, so it stays in the
authored language: carded as objectstack-ai#36530 with the L2's N2. Every other step
the embed names has a key and a reader.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jTrJZvNaijgX3NxBMc)_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QsR2jTrJZvNaijgX3NxBMc

<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jTrJZvNaijgX3NxBMc -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
…hole arrangement (fieldGroups, relatedLists) (objectstack-ai#36568)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi91tYCagMT6JaQ6YA5YqnWwi)_

Fixes objectstack-ai#36541

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用 AI 写配置的客户,想给已安装软件包里的对象重排记录页(换字段分组、调页签顺序、隐藏页签)时,AI
现在知道这份排布要写在该软件包配套的环境定制包里;以前技能没讲这件事,AI 要么不会用,要么写进别的扩展包后被拒收。
- 属于「记录页标签与分组」专题:环境管理员整页排布的能力上一步已经上线,这一步把它教给 AI 作者,并补一道考题。
- 如果教错,AI 会把排布写到会被拒收的位置,保存或校验时当场报错并给出改法,数据不受影响;撤回这次改动,技能文字就回到原样。
- 审批这次对外技能文字的改动(技能包属于受管范围,需要你来合入)。

## Fix round 1

Head `90a673de67`, one commit on top of `0db54351e8`, answering the
contract review of that head (record 7087999230).

- **S1, the refused writer is named by what the judge tests.** The
paragraph's last sentence read "In any other package both keys are
refused at those doors". That is false for a `.custom` package that is
not the object's pair: `judgeExtensionArrangement` returns no refusal
when `isCustomizationPackage(packageId)` holds
(`packages/metadata-protocol/src/protocol-extension-arrangement.ts:94`;
the predicate is the id's `.custom` suffix over a valid base,
`packages/spec/src/kernel/customization-package.ts:119`), and the key
descriptions say such a package "is not refused at those doors: the
registry merge does not apply what it writes here ... and the boot log
names it" (`CUSTOM_ARRANGEMENT_WRITER`,
`packages/spec/src/data/object.zod.ts:6832`). Both files read again on
`main` at `abe95a950d`: unchanged since `d463c46f`. The sentence now
reads "Outside a `.custom` package both keys are refused at those doors:
use `place`." The changeset's first bullet carries the same words.
- **Bytes.** The new wording is 7 bytes longer and the file had exactly
7 priced bytes of headroom, so nothing more is cut: 26,853 to 26,860
bytes, 6,709 to 6,710 tokens, ceiling 6,710 unchanged.
- **N1, case 27 asserts `place:`.** The token `place` also matched the
word "replaces", so an answer that never said what the add-on package
writes could pass. It is `place:` now, the token case 26 uses; the
reference answer already contains `place: [`. Regraded below.
- **N2 is left as it is.** No byte remains after S1, and the review ties
the clause to bytes being left.

## What changes

**One paragraph in `skills/objectstack-data/SKILL.md`, § Object
Extension Model** (lines 386 to 390 at head `90a673de67`), inside the
paragraph about an object an installed package ships, right after the
sentence that lists the doors of the `__c` rule:

> Only the pair's extension may also write `fieldGroups` and
`relatedLists`, shaped as on an object. A written key replaces that
arrangement whole (the owner's and every `place`): an unlisted field
shows after the last group, an unnamed tab still shows after the listed
ones, and `{ list: 'crm_note', hidden: true }` hides a tab. Outside a
`.custom` package both keys are refused at those doors: use `place`.

"Those doors" are the ones the sentence before it names: save, publish
and install, `os validate` and `os build`.

**What it teaches is what is on `main`** (PR objectstack-ai#36517, merge commit
`45ef94ef`; ADR-0146 D2, D3 and D10), read at `d463c46f`:

| Sentence | Where it is on `main` |
|:---|:---|
| The two keys, in an object's shapes |
`packages/spec/src/data/object.zod.ts:7070` (`fieldGroups`, an array of
the object's group schema) and `:7082` (`relatedLists`); the key list is
`CUSTOM_ARRANGEMENT_KEYS`,
`packages/spec/src/data/field-customization.ts:124` |
| `{ list, hidden: true }` |
`packages/spec/src/data/object.zod.ts:6703`: `hidden` is a boolean on
the extension's entry only; an object's own entry refuses it by name
(`:1347`) |
| A written key replaces whole; an unlisted field after the last group;
an unnamed tab still shows after the listed ones | the two key
descriptions, `packages/spec/src/data/object.zod.ts:6837` and `:6863`;
the fold is `applyCustomArrangement`,
`packages/objectql/src/registry-custom-arrangement.ts:144` |
| Only the pair writes them; outside a `.custom` package they are
refused and the writer is told to use `place` | one judge,
`judgeExtensionArrangement`,
`packages/metadata-protocol/src/protocol-extension-arrangement.ts:91`.
Its answer is `VALIDATION_ERROR` / 400 (`:116`); the message, measured
on this PR's eval shape: "`relatedLists` in the extension of object
'crm_account' in package 'acme_contracts': only the object extension of
a base's paired `.custom` package declares an object's whole arrangement
(ADR-0146 D10). Remove the key and place what this package brings with
`place`, e.g. `place: [{ list: 'contract', after: 'opportunity' }]`." |
| The doors | save
`packages/metadata-protocol/src/protocol-save.ts:1390`; publish
`protocol-history-and-publish.ts:1062`; restore
`protocol-authoring-gate.ts:129` (all three through
`objectExtensionItemRefusal`, `protocol-object-extension-item.ts:257`);
`os validate` `packages/cli/src/commands/validate.ts:895`; `os build`
`packages/cli/src/commands/compile.ts:948`; install
`packages/cloud-connection/src/marketplace-install-local-plugin.ts:3192`
(`VALIDATION_ERROR` / 422, one row per key in `details.refusals`) |

**Paid for in the same file; the token ceiling is not raised.** The file
had 0 tokens of headroom (6,710 of 6,710). The paragraph is 407 bytes
(400 before fix round 1); five restatements are cut, 405 bytes, and the
content of each stays in the bundle. The remaining 2 bytes come out of
the 2 priced bytes the file had under its ceiling:

| Cut from `SKILL.md` | Bytes | Where the content stays |
|:---|---:|:---|
| § Validation Patterns, the note that on insert an omitted optional
field reads as `null` in a predicate | 240 | `rules/validation.md` lines
80 to 83 (the same note) and line 17 (a `script` rule judges the merged
record: prior row plus this write) |
| § Index Patterns, "`unique` defaults to `false`; omit it when that is
what you mean." | 66 | `rules/indexing.md` line 11 |
| Quick Reference, the lifecycle row's "append-only objects must declare
one" | 42 | the `lifecycle` row of the optional-properties table in the
same file ("Required for append-only, high-write-rate objects") and
`rules/lifecycle.md` line 14 |
| The `sharingModel` heading's "(ADR-0090 D4; legacy aliases removed)" |
38 | `references/lint-rules.md` line 23 (`security-owd-alias`: a legacy
spelling is an error, ADR-0090 D4) |
| The `pluralLabel` row's `(e.g., "Accounts")` | 19 | the object JSON
example in the same file (`"pluralLabel": "Accounts"`) |

**The two readings** (tokens in the ratchet's convention, `ceil(utf8
bytes / 4)`, the release-stamp line not priced):

| | Before (`d463c46f`) | After (`90a673de67`) |
|:---|:---|:---|
| `skills/objectstack-data/SKILL.md` | 473 lines · 26,858 bytes · 6,710
tokens (ceiling 6,710) | 472 lines · 26,860 bytes · 6,710 tokens
(ceiling 6,710, unchanged) |
| All 14 `skills/*/SKILL.md` | 4,951 lines · 261,175 bytes | 4,950 lines
· 261,177 bytes |
| Ratcheted (authored) tokens, whole bundle | 197,573 | 197,573 |
| Eval fixtures (measured, not ratcheted) | 81,141 | 81,720 |
| Bundle total | 293,321 | 293,900 |

**One eval case**,
`skills/objectstack-data/evals/objects-fields-relationships.json` case
27: an add-on package put the tab arrangement (two tabs swapped, one
hidden) on its own extension of an installed object and `os validate`
refused it. The answer moves the arrangement to the object extension of
the base's paired `.custom` package and names `place` as what the add-on
package writes. `must_contain`: `hotcrm.custom`,
`defineObjectExtension`, `extend: 'crm_account'`, `relatedLists`,
`hidden: true`, `place:`.

Two riders in the eval directory:

- Case 26 (the `place` case) said in its reference answer that "an
extension has neither key". That stopped being true when the two keys
shipped, and the new paragraph says the opposite, so the parenthesis now
reads: only the object extension of HotCRM's paired `hotcrm.custom`
package writes those keys; here they are refused. Its prompt and
assertions are unchanged, so its case hash is unchanged.
- `evals/README.md` lists what the file covers and gains the new case's
topic.

**Changeset**: `.changeset/36541-skills-custom-arrangement.md`,
`@objectstack/skills` patch.

## Tests

The grader and gate readings are at head `90a673de67`, tree clean. The
door suites were run at `0db54351e8`; fix round 1 touches no file they
read.

<details>
<summary>The eval file's reference answers under its own
grader</summary>

`gradeAnswer` (`packages/qa/scenarios/src/skill-evals/grade.ts`) over
each case's `expected_output`, cases parsed by the runner's own
`parseEvalFile`. No model round was run.

| Tree | Reading |
|:---|:---|
| `d463c46f` (control) | 26 cases parsed, 0 refusals; reference answers
PASS 26/26 |
| `0db54351e8` (the head reviewed before) | 27 cases parsed, 0 refusals;
reference answers PASS 27/27; case 26 PASS; case 27 PASS |
| `90a673de67` | 27 cases parsed, 0 refusals; reference answers PASS
27/27; case 26 PASS; case 27 PASS |

Named answers for case 27, each graded under the assertions of both
heads and each as expected:

| Answer | At `0db54351e8` (`place`) | At `90a673de67` (`place:`) |
|:---|:---|:---|
| the reference answer | PASS | PASS |
| a short answer: the pair, the arrangement, `place: [...]` for the
add-on package | PASS | PASS |
| the pair and the arrangement, "the key replaces the tab list whole",
nothing about what the add-on package writes (the N1 control) | PASS |
FAIL, `missing=["place:"]` |
| the arrangement kept on the add-on package, the pair never named |
FAIL, `missing=["hotcrm.custom"]` | FAIL, `missing=["hotcrm.custom"]` |
| the pair named, the tab hidden by leaving it out (an object's own
rule) | FAIL, `missing=["hidden: true"]` | FAIL, `missing=["hidden:
true"]` |

At `0db54351e8` two more named answers were graded as expected: the
object redeclared with an `overrides` declaration (FAIL,
`forbidden=["name: 'crm_account'","overrides:"]`), and the pair named
with nothing said about the add-on package (FAIL, `missing=["place"]`).

The reference answer's extension, `{ extend: 'crm_account',
relatedLists: ['crm_opportunity', 'crm_contact', { list: 'crm_lead',
hidden: true }] }`, parses under `ObjectExtensionSchema`;
`judgeExtensionArrangement` answers 1 refusal for package
`acme_contracts` (path `objectExtensions[0].relatedLists`) and 0 for
`hotcrm.custom`.

`node ui/scripts/check-skill-eval-tokens.mjs`: exit 0, "Every
must_contain token is taught by its own skill bundle."

</details>

<details>
<summary>Which doors refuse: the suites of the merged protocol, run on
this head</summary>

The dispatch asked which doors actually refuse a writer that is not a
`.custom` package. Each door's suite was run, at `0db54351e8`, after
building its dependency closure (`turbo run build
--filter='@objectstack/cli^...'`, 64 tasks, exit 0), each run under the
shared verification lock:

| Door | Suite | Reading |
|:---|:---|:---|
| The judge, and the gate the save, publish and restore doors ask |
`packages/metadata-protocol/src/protocol-extension-arrangement.test.ts`
| exit 0, `Tests 13 passed (13)` |
| Save, through the real protocol and engine |
`packages/objectql/src/protocol-custom-arrangement.test.ts` | exit 0,
`Tests 6 passed (6)` |
| `os validate` and `os build`, both commands in process |
`packages/cli/test/validate-build-extension-arrangement.test.ts`,
`packages/cli/src/utils/extension-arrangement.test.ts` | exit 0, `Test
Files 2 passed (2)`, `Tests 10 passed (10)` |
| Install |
`packages/cloud-connection/src/marketplace-install-local-extension-arrangement.test.ts`
| exit 0, `Tests 5 passed (5)` |
| What a written key does (replaces whole, the unlisted field, the
unnamed tab, the hidden tab) |
`packages/objectql/src/registry-custom-arrangement.test.ts`,
`packages/spec/src/data/object-extension-arrangement.test.ts` | exit 0,
`Tests 33 passed (33)` and `Tests 53 passed (53)` |

The publish and restore doors are measured at the gate they call
(`objectExtensionItemRefusal`); that each of them calls it is read from
the call sites cited above, not from a run through the door.

</details>

<details>
<summary>Gates</summary>

`node scripts/pm/dispatch-gates.mjs --commands` at `90a673de67` derives
the same 50 commands as at `0db54351e8`. All 50 were run again on this
head, each exit code recorded before any pipe; `--ran` answers: "50
derived famil(ies) accounted for — 49 run, 1 NOT-MEASURED (1 DERIVED
from a recorded exit 3)", exit 0.

- 49 exit 0. Among them: `node scripts/check-skills-token-ratchet.mjs`
("60 authored bundle file(s) within their ceilings"; the data row reads
`6710 / 6710 (+0)`), `check:skill-docs`, `check:skill-served-sections`,
`check:skill-links`, `check:skill-identifier-liveness`,
`check:skill-compatibility`, `check:skill-frame-sync`,
`check:doc-authoring`, `check:doc-formula-expressions`,
`check:role-word`, `check:nul-bytes`, `check-empty-changeset`,
`check-changeset-no-major`, `check-adr-0087-registration`.
- NOT MEASURED: `pnpm check:dual-build-cjs-loads`, exit 3. It reads the
built output of every package and asks for a whole-workspace build; this
change touches no package source, and the full build was not made for
it. CI reads it.
- Outside the derived list, also run on this head: `check:skill-refs`
exit 0 ("10 generated files in sync"), `check:skill-examples` exit 0
("349 prose examples type-check across 3 surface(s)"), `node
ui/scripts/check-skill-eval-tokens.mjs` exit 0.
- The gates that read built output (`check:dts-closure`,
`check:published-files`, `check:sourcemap-no-sources-content`,
`check:driver-memory-census`, `check:lean-entry-closure`) answered exit
0 on a tree where the spec, lint, objectql, metadata-protocol and
client-react closures were built, not the whole workspace; their full
reading is CI's.

</details>

## Acceptance notes

1. **Overlap.** `node scripts/pm/overlap-check.mjs` at `90a673de67`:
`origin/main` (`abe95a950d`) merges cleanly; objectstack-ai#35129 and objectstack-ai#36559 merge
cleanly (objectstack-ai#36559 edits case 3 of the same eval file); draft objectstack-ai#36158
conflicts in `skills/objectstack-data/SKILL.md`. That one is known to
the seat and ruled: this card does not wait, and whichever of the two
lands second replays its text.
2. **`main` moved after the branch was cut**, `d463c46f` to
`abe95a950d`. It merges cleanly and the branch was not merged again.
3. **Both mechanism assumptions of the dispatch hold.** The refusal
fires at save, publish and install and at `os validate` / `os build`,
the doors the `__c` sentence already lists, so the paragraph says "at
those doors". `{ list, hidden: true }` is the schema's spelling.
4. **What the paragraph leaves to the refusal texts and the docs page**
(`content/docs/data-modeling/object-extensions.mdx`, "Arranging the
whole record page"), to stay inside the ratchet: a `place` entry beside
the key that replaces it is refused at parse with its own prescription;
a built-in tab is written as its bare name and cannot be hidden; a
`.custom` package that is not the object's pair is not refused, it is
skipped and named in the boot log (since fix round 1 the paragraph no
longer says the opposite; it still does not teach the skip); a list the
owner hid by leaving it out stays hidden until the arrangement names it;
a field is kept off the page by a group whose `visibleWhen` is false.
5. **Case 27's prompt carries two of its own `must_contain` tokens**
(`relatedLists`, `hidden: true`), because the colleague's refused
extension is quoted in it. The tokens the prompt does not hand over are
`hotcrm.custom`, `defineObjectExtension`, `extend: 'crm_account'` and
`place:`. With `place:` an answer that names `place` only in prose,
without an entry, does not pass; case 26 has the same property.
6. **`evals/README.md` is outside the file surface the claim lists.** It
is the index of the eval file and the same-file PR before this one
updated it with its case, so it is updated here too.
7. **The ceiling row is untouched at 6,710** and the file sits exactly
on it, with 0 tokens of headroom, as it did on `main`.

## Verification

**Read first:**

1. `skills/objectstack-data/SKILL.md` lines 386 to 390, the last
sentence first (fix round 1), beside `CUSTOM_ARRANGEMENT_WRITER` and the
two key descriptions in `packages/spec/src/data/object.zod.ts` (lines
6828 to 6888). The risk is a sentence that says more than the runtime
does.
2. The five deletions in the same diff, each against the home named in
the table above. The riskiest is the insert-null note: it leaves the
always-loaded file and stays in `rules/validation.md`.
3. Case 27, and the one changed parenthesis of case 26, in
`skills/objectstack-data/evals/objects-fields-relationships.json`.

**Two-minute check:** `node scripts/check-skills-token-ratchet.mjs`.
Expected: the data row reads `6710 / 6710 (+0)` and the last line reads
"60 authored bundle file(s) within their ceilings".

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmPTDM2MxHR8cvoMVUX

<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmPTDM2MxHR8cvoMVUX -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
…translatable (objects.OBJECT._relatedLists.LIST.label) (objectstack-ai#36574)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi98qMCtnkL9edrhDJZJffTAD)_
Fixes objectstack-ai#36528

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up objectstack-ai#36575

## 维护者速读

- 记录页上由父对象自己命名的子表页签标题,现在可以按语言翻译;切到中文等界面时显示译文,以前不论什么语言都显示原文。
- 属于「记录页的页签和字段分组改由父对象一处声明」专题,补上父对象给页签起名后无法翻译的缺口。
- 翻译写错只影响该页签标题的显示文字,数据与页签顺序不受影响;删掉这条翻译即恢复原文。
- 无

## What changes

A record page's tab title that an object-form `relatedLists` entry
declares on the parent (`{ list, label, columns }`) wins over the child
lookup field's `relatedListTitle`. The field's title had a translation
key; the winning title did not. It now has one, on the parent, keyed by
the entry's literal `list` (a dotted `object.field` is one key, indexed
directly):

```
objects.OBJECT._relatedLists.LIST.label
```

| Package | Change |
|:---|:---|
| `@objectstack/spec` | `ObjectTranslationDataSchema._relatedLists`: a
record of closed leaves whose one key is `label` (aliases `name` /
`title` / `heading` / `text` onto `label`, like `_tabs`), plus the
un-prefixed alias `relatedLists` onto `_relatedLists`. `translateObject`
overlays it onto the served object's labelled object-form entries
(`translateObjectRelatedLists`), along the locale chain, under the
ADR-0029 D9.2a / ADR-0146 D2 catalog rule every other slot follows (a
label that diverged from the packaged entry of the same `list` reads
only the pair's catalog). |
| `@objectstack/lint` | The extractor walk emits the key for each
labelled entry; the orphan rule (`translation-target-unknown`) flags a
key naming no labelled entry, with a distinct verdict when the object
names the list but gives it no `label`. The shared extension fold now
carries an extension's `relatedLists` (the `.custom` arrangement,
ADR-0146 D10) and `place` record entries, so a key over a labelled tab
an extension brings resolves. |
| `@objectstack/metadata-protocol` | The save door's translated-echo
restore puts a translated entry `label` back to its source text (matched
by `list`), with the existing `info` advisory, so a Studio save of an
object read in another language does not store the translation as the
title. |
| `@objectstack/objectql` | `getPackagedObjectBase` (the packaged base
the `/meta` read and the form route hand `translateObject`, and the echo
restore translates with) carries the tabs a code extender's `place`
splices into the owner's `relatedLists`, by the fold's own pass
(`applyExtensionPlacements`, so only where the owner declares
`relatedLists`), as it already carries the fields such an extender adds.
A placed title therefore compares equal to its packaged text and reads
the deployment catalog. The `.custom` arrangement stays the
customization layer, never part of the base. |

Precedence is unchanged (entry `label`, then the child FK's
`relatedListTitle`, then the child's plural label). Only an AUTHORED
entry `label` is translated: an entry with no label, a bare name and a
built-in tab gain nothing from the key, the rule the field-level
`inlineTitle` / `relatedListTitle` docblocks state.

**Where the record page reads the title.** The tab title comes from
`deriveRelatedLists`
(`ui/packages/app-shell/src/utils/deriveRelatedLists.ts`, `title:
entry.label`), handed to `buildDefaultPageSchema` as `options.related`
(`label: rel.title ?? rel.objectName`). Its `objectDef` is
`useMetadata().objects`, the `GET /meta/object` list read, which the
REST read exit translates per request
(`translateMetadataDocument('object', …)` → `translateObject`), outside
the ADR-0156 D3 cached part. So no `ui/` change is made.

**Extension-brought titles.** The registry fold splices a list placement
(`place`) and the paired `.custom` arrangement (`relatedLists`) into the
parent's served `relatedLists`. A placed title is translated from the
deployment catalog because the packaged base now carries the placed
entry (round 2, see Acceptance notes); a `.custom` title diverges from
the base and reads the pair's own translations (ADR-0146 D2). Pinned
through the read's real options (`packagedBase` from
`ObjectStackProtocolImplementation#getPackagedObjectBase`, the accessor
the REST read's `packagedObjectBaseOf` asks) in
`packages/objectql/src/registry-related-lists-label-translation-36528.test.ts`.

Also: `content/docs/protocol/kernel/i18n-standard.mdx` (example and the
key-resolution table), the regenerated
`content/docs/references/system/translation.mdx`,
`authorable-surface/system.json` and the strictness-ledger count, the
liveness ledger evidence for `objects`, and
`.changeset/36528-related-list-label-translation.md` (minor on spec,
lint, metadata-protocol, objectql).

## Tests

| Suite | What it pins |
|:---|:---|
| `packages/spec/src/system/i18n-related-lists-label-36528.test.ts` |
schema accepts the key (dotted list included), refuses an unknown leaf
key with the strict-object message, names `title` → `label` and
`relatedLists` → `_relatedLists`; overlay on a plain and a dotted entry
through the type dispatch, the served object still parses; label-less,
bare and built-in entries untouched; same array back when nothing
matched; locale ladder and fallback chain; catalog loses to a tenant
rewrite; pair translation for a changed label |
| `packages/lint/src/i18n-related-lists-label-36528.test.ts` | walk
emits only labelled entries; orphan rule resolves labelled keys, flags a
ghost / an unlabelled / a bare entry, resolves labelled entries a
`.custom` arrangement or a `place` brings (with the unlabelled control);
a key over a built-in tab and over a `hidden` `.custom` entry each get
their own reason; a dotted list is bracketed in the finding path;
verdict and hint each at most 200 characters |
|
`packages/metadata-protocol/src/protocol-translated-echo.related-lists-36528.test.ts`
| a translated echo restored (dotted list included) with its advisory
path; an author's own title kept; a title on an entry the source leaves
untitled kept |
|
`packages/objectql/src/registry-related-lists-label-translation-36528.test.ts`
| through the read's real options (an `ObjectQL` engine's registry,
`packagedBase` from
`ObjectStackProtocolImplementation#getPackagedObjectBase`): the packaged
base carries a code extender's placed tab and its title reads the
catalog; a tenant's rename of that title keeps its text; a `.custom`
arrangement's title is not in the base and reads the pair's translations
|
| `validate-translation-references.test.ts`,
`validate-security-posture.test.ts` | the schema-coverage table gains
`_relatedLists`; the extension receiver's key-read table gains `place`
and `relatedLists` |

<details>
<summary>Package suites and typecheck (round 2, at `6fd5bb85`, after a
full `pnpm build --concurrency=2`: 120 tasks, exit 0)</summary>

- `pnpm --filter @objectstack/objectql test`: `Test Files 633 passed
(633)`, `Tests 14345 passed (14345)`. This full suite holds every
in-package reader of the packaged base (`protocol-packaged-object-base`,
`protocol-meta-effective-schema`, `engine-validation-tenant-rewrite`,
`registry-field-patch-bases`, `registry-validation-rule-by-name`).
- `pnpm --filter @objectstack/lint test`: `Test Files 227 passed (227)`,
`Tests 9461 passed (9461)`.
- Scoped: `src/system/i18n-related-lists-label-36528.test.ts` (spec)
`Tests 10 passed (10)`;
`src/protocol-translated-echo.related-lists-36528.test.ts`
(metadata-protocol) `Tests 3 passed (3)`. The spec and metadata-protocol
sources are unchanged in round 2; their full suites were green in round
1 (`dcab40cb`, `4249fe4b`) and are declared to CI here, as is
`@objectstack/rest` (it reads the base; its source is unchanged).
- `typecheck` on objectql and lint: exit 0.

</details>

<details>
<summary>Ablation: each changed behaviour broken once, the suite turns
red, the file restored</summary>

Each leg via `node scripts/ablation-replace.mjs` (anchor hits once, blob
before/after printed, restored blob equals `HEAD`, `git diff HEAD`
empty). Every mutated file is imported from source by the suite that
runs, so no rebuild is in a leg.

- Round 2, at `8e2ca2b7`: the `relatedLists` spread of the placed
entries removed from `PlatformGlobalFacet.getPackagedObjectBase` (blob
`31877522` to `4549c158`): the objectql pin `Tests 1 failed | 2 passed
(3)`, `expected [ 'Tasks', 'crm_note' ] to deeply equal [ 'Tasks',
'Audit trail', 'crm_note' ]`; restored blob `31877522` equals `HEAD`,
`git diff HEAD` empty.
- Round 1: resolver overlay wiring removed from `translateObject`:
`Tests 4 failed | 6 passed (10)`.
- Round 1: walk call `pushRelatedListLabels` removed: `Tests 1 failed |
4 passed (5)`.
- Round 1: orphan rule's labelled-entry `continue` removed: `Tests 1
failed | 4 passed (5)`.
- Round 1: echo restore's `restored.push` for an entry removed: `Tests 1
failed | 2 passed (3)`.
- Round 1: extension fold's labelled-entry add removed (at `f0d2db85`):
`Tests 1 failed | 5 passed (6)`.

</details>

<details>
<summary>Gates</summary>

- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at `6fd5bb85`: 122 commands, each run with
stdin closed after the full build, all 122 `exit 0` (among them
`check:facade-delegation-only`, `check:i18n-walk-parity`,
`check:dual-build-cjs-loads`, `check-plugin-teardown-shape
--self-test`).
- `--ran`: `Run reconciliation — 122 derived, 122 run, 0 NOT-MEASURED, 0
UNRUN.`
- `node scripts/pm/overlap-check.mjs --branch=HEAD` before every push:
`VERDICT clean exit 0`.
- CI on `8e2ca2b7`: `Lint · repo & tooling gates` failed on this PR's
own change (`check-facade-delegation-only --self-test` N6:
`packages/objectql/src/registry.ts` at 6438 lines, over its 6426
ceiling; the same lane is green on main at `06c3e5ac`). Fixed in
`6fd5bb85` (net zero lines in the facade, the paragraph moved to the
facet). The `Lint & Repo Gates`, `TypeScript Type Check` and `Test UI`
aggregates on `8e2ca2b7` read that failure plus lanes `cancelled` when
the push of `6fd5bb85` superseded the run; no other lane failed.

</details>

## Acceptance notes

- **Merged main once** (`65ce7983`, which carries PR objectstack-ai#36517's `.custom`
arrangement). The orphan rule's extension fold accepts `_relatedLists`
keys for labelled entries a `.custom` arrangement or a `place` list
placement brings; its docblock that said `relatedLists` is not
translatable through an extension is corrected.
- **The extractor walk does not read `objectExtensions`** (for fields
neither): a labelled tab an extension brings is not scaffolded by `os
i18n extract` and not counted by coverage. The resolver translates it
and the orphan rule accepts its key; scaffolding extension surfaces is a
separate, pre-existing gap of the walk.
- **A `place` entry's label applies only where the extended object
declares `relatedLists`** (the registry's rule, and the packaged base
follows it). The orphan rule accepts its key regardless, the permissive
direction: its fold does not read whether the target declares the list
(the target may be another package's object the stack does not carry).
- **Sibling gap, not changed here:** the save door's echo restore does
not restore `listViews` copy or `validations[].message`, which
`translateObject` also translates.
- No in-repo object declares a labelled `relatedLists` entry today, so
no shipped bundle and no coverage ratchet moves.

### Round 2 (contract review 7088121343)

- **M1, route (a).** `getPackagedObjectBase` now carries the list
entries a code extender's `place` splices into the owner's
`relatedLists`, computed by the fold's own pass
(`applyExtensionPlacements` over the enabled code extenders, same
child-package rule), as it carries their added fields; only the lists
are read off. A placed title therefore compares equal to its packaged
base on the `/meta` read and the deployment catalog applies; a tenant's
rename still diverges and keeps its text. Every reader of the packaged
base was measured: the REST `/meta` list and item reads and the form
route (through `translateObject`, where `translateObjectRelatedLists`,
new in this PR, is the only code that reads the base's `relatedLists`),
the save door's echo restore (its `relatedLists` slot is this PR's, and
it now restores exactly what the read translates), the share-link label
(translates `{ name, label }` only), the validation-message reader
(reads `validations` only) and `getPackagedFieldPatchBases` (its bases
are read for `fields` only). No reader outside this card's slot changes
its verdict; Studio, the `.custom` arrangement fold and the
customization-diff and divergence checks do not read this base. Pinned
through the protocol accessor the REST read asks, with one ablation (red
without the carry). The `@objectstack/objectql` changeset entry is
`minor`, as the kind takes, with a sentence true of the head.
- **N1.** A key over a built-in tab (`sys_activity`, `sys_attachment`,
`sys_approval_request`) gets its own reason and hint, naming neither `{
list, label }` nor `relatedListTitle`.
- **N2.** A `.custom` entry with `hidden: true` no longer counts as
labelled; its key is flagged with its own reason.
- **N3.** A dotted list is bracketed in the finding path
(`_relatedLists["event.owner_id"]`).
- **Facade ceiling.** `registry.ts` is a facade at its 6426-line
ceiling; its docblock stays net zero there and the why-paragraph lives
on the facet's `packagedPlacedRelatedLists`.

## Verification

Read first, by risk:

1. `packages/spec/src/system/i18n-resolver.ts`,
`translateObjectRelatedLists`: which entries are translated (labelled
object-form only) and which catalog a label reads
(`valueOverridesPackagedBase` against the packaged entry of the same
`list`).
2. `packages/metadata-protocol/src/protocol-translated-echo.ts`, the
`relatedLists` block in `restoreTranslatedEchoes`: a save's entry label
is put back only when a read of the source translates to exactly it.
3. `packages/lint/src/validate-translation-references.ts`, the
`_relatedLists` leg and the extension-fold addition.

Two-minute check, one command:

```
pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/system/i18n-related-lists-label-36528.test.ts
```

Expected: 10 tests pass, among them the zh-CN title served on the
parent's `contact` and `event.related_to` entries.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmRdKNUzzADvuRJx6UT

<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmRdKNUzzADvuRJx6UT -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue protocol:data size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

3 participants