Skip to content

fix(spec,i18n): an object's embedded listViews are served translated from the _views keys the extractor writes (#21006) - #21072

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-21006-translate-object-list-views
Oct 1, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-21006-translate-object-list-views

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #21006

Clause-②: no

What changed

translateObject (packages/spec/src/system/i18n-resolver.ts) now translates each view in an object document's embedded listViews. It overlays the view's label, its description and its bulkActionDefs[] copy (def label / confirmText / confirmLabel, param label / help / placeholder). These are the same strings translateView overlays on a served view document.

  • One key shape. The address is objects.OBJECT._views.VIEW.*, where VIEW is the record key under listViews. os i18n extract writes exactly that: its obj.listViews loop hands pushViewEntries the record key (packages/cli/src/utils/i18n-extract.ts). The record key is already bare, so viewTranslationKey, which strips a served view's OBJECT. prefix, is not involved, and the view's own optional name is never read. resolveViewLabel / resolveViewDescription and the embedded channel now share one private lookup (lookupViewText) of _views.VIEW.label / .description. No second key function exists.
  • Bulk-action copy goes through the existing translateBulkActionDefs, reading view.bulkActionDefs. That is the authored address the extractor reads. A served view document nests the same list under config, and translateView keeps reading it there.
  • Override order follows ADR-0029 D9.2a, as translateView applies it (the rule from metadata: a published org overlay on the built-in system_overview dashboard is never served — the plain read and the rendered board keep the shipped body while ?layers=true reports the overlay as effective #20680 / rest: the /meta dashboard item and list reads pass no packaged base to translateDashboard, so a published org overlay on a translated dashboard keeps the shipped widget title — per-layer child of #20680 #20730). Each string is judged by the existing valueOverridesPackagedBase against the same view in the packaged object's listViews. That packaged object is the packagedBase the REST read gate already supplies for objects (getPackagedObjectBase). A view the packaged base does not carry counts as authored. With no base supplied, the catalog applies.
  • Not changed: emptyState is not translated server-side on either channel. translateView never translated it, and the extractor's docblock names the client as its only reader.
  • ObjectLike gains an optional listViews member, typed as a string-keyed Record of unknown. It is a TS-only input shape: no export is added and no generated artefact moves. The only code that builds an ObjectLike in this repo (service-analytics' { name, fields }) still type-checks. The reverse verification is below.

The change lands where the claim said it would. translateObject produces the served labels, and the extractor is untouched.

Measured

H1, the key shape. An embedded listViews entry is an ObjectListViewSchema (data/object.zod.ts). Its copy-bearing keys that the extractor emits under _views.VIEW are label, description, emptyState.title / .message and bulkActionDefs[].*. All of them sit under the key shape the resolver already reads. Nothing needed a new key.

H2, the override order. translateView and translateDashboard both judge with valueOverridesPackagedBase against packagedBase (#20731 / #20680). The embedded channel uses the same predicate and the same three edges: no base means the catalog applies, a non-string label is never an override, and an edit back to the shipped string is a no-op.

H3, the door. GET /api/v1/meta/object goes meta-item-read-gate.ts translateMetaDocument / translateMetaList, then translateMetadataDocument('object'), then translateObject, with packagedBase from getPackagedObjectBase. metadata-protocol/src/protocol.ts names translateObject only in a docblock and does not call it. I measured the door once through the REST route handlers. The protocol double served the REAL SysAccount (@objectstack/platform-objects/identity), getPackagedObjectBase answered the same object, and the i18n service served the REAL shipped en / zhCN bundles (@objectstack/platform-objects/apps). It ran as a scratch test that is not committed.

read (zh-CN unless noted) before (spec dist at 2f2fa11d7) after (spec dist at this branch)
item label (object) 身份链接 身份链接
item listViews.mine.label My Links 我的链接
item listViews.by_provider.label By Provider 按提供方
list listViews.mine.label My Links 我的链接
org overlay mine = My Links (edited-21006), item My Links (edited-21006) My Links (edited-21006) (the overlay wins)
same overlay, sibling by_provider By Provider 按提供方
en, item listViews.mine.label My Links My Links

The CLI's coverage still counts the same keys. i18n-coverage takes its key set from the extractor's collectExpectedEntries, which this PR does not touch. pnpm check:i18n-coverage exited 0 and the CLI's i18n unit tests passed (below), so extract and serve now agree.

Tests

New file packages/spec/src/system/i18n-resolver.object-list-views.test.ts, 21 cases. The sys_account fixture is transcribed from identity/sys-account.object.ts, with its _views leaves taken verbatim from the shipped en / zh-CN bundles. Every view is parsed by ObjectListViewSchema and the bundle by TranslationBundleSchema.

  • sys_account's mine tab is served 我的链接 in zh-CN, and every sibling tab is translated too.
  • Controls: a view with no catalog entry keeps its authored label; an object with no _views gets the same listViews reference back; no bundle gets the same reference back; an object with no listViews gains none.
  • The view is keyed by its record key, never by its name. BCP-47 base-language matching applies, and a default-locale request does not walk the fallback chain.
  • description and bulk-action copy are translated from the embedded view's own address.
  • Override order: an edited label wins in zh-CN and en, each tab is judged separately, no base means the catalog applies, a reset restores the translation, and the edge cases hold (edit back to the shipped string, inline map). A tab the base does not ship keeps its label. The object-scalar rule and the tab rule are independent.
  • Neither input is mutated, and translateMetadataDocument('object') reaches the change.

Reverse verification. The fix was committed first. Each mutation went through scripts/ablation-replace.mjs, which reported the anchor hit, the blob moved, and then restored to blob == HEAD with git diff HEAD empty.

  • Leg 1: replace the translateObjectListViews(...) call with doc.listViews. Result: 15 failed / 6 passed of 21. The 6 that passed are the controls and the edited-wins cases, which pass when nothing is translated.
  • Leg 2: replace the per-view valueOverridesPackagedBase(...) with false. Result: 5 failed / 16 passed. All 5 failures are override cases.
  • Cross-package type: inject listViews: 5 into service-analytics' ObjectLike literal. tsc answered src/plugin.ts(1056,61): error TS2322, saying type number is not assignable to the string-keyed Record of unknown. That is the rebuilt .d.ts; the old one would have answered an excess-property error. Restored.

Local verification (HEAD 402ab32f5)

The spec closure (①) is empty, because packages/spec has no workspace dependencies. Consumer closures were built with turbo run build --filter='@objectstack/rest^...' and with the @objectstack/cli^... / @objectstack/plugin-approvals^... packages that were not built yet.

  • pnpm --filter @objectstack/spec build → 0. check:generated → ✓ All 15 generated artifacts are up to date.
  • pnpm --filter @objectstack/spec typecheck → 0 (check:test-typecheck: OK). vitest run src/system → 49 files / 1720 passed.
  • Consumers, one reading per package:
    • @objectstack/rest, the five meta-*i18n* tests: 5 files / 96 passed.
    • @objectstack/metadata-protocol, full suite: 195 passed / 3 skipped files, 2896 tests passed.
    • @objectstack/cli, --project unit test/i18n- + test/platform-page-i18n-parity: 22 files / 292 passed. The integration tier is declared to CI.
    • @objectstack/service-analytics, full suite: 150 files / 3458 passed. Its typecheck → 0.
    • @objectstack/platform-objects, full suite: 59 files / 948 passed.
    • @objectstack/plugin-approvals, src/translations: 3 files / 11 passed.
  • dispatch-gates.mjs --commands over this diff (84 families) plus check:i18n, check:i18n-coverage and check:i18n-walk-parity: 83 of 84 ran and exited 0. check:dual-build-cjs-loads first answered PREREQUISITE NOT MET (exit 3) and exited 0 after the missing packages were built. --ran reconciliation: 84 derived, 83 run, 0 NOT-MEASURED, 1 UNRUN.
    • NOT MEASURED: check:type-check-debt. Reason: --re-measure runs tsc over the whole workspace and was killed twice at the 570 s foreground budget; it has no narrowing option. CI's Lint & Repo Gates owns it. The type-check this diff owes was measured: spec and service-analytics typecheck both 0.
  • Lint, a measured narrowing. eslint --no-inline-config --format json over the two changed TS files: 2 files, 0 errors, 0 warnings. Both files are in the population, by eslint --print-config. eslint.config.mjs enables no type-aware linting (no parserOptions.project), so this diff cannot move a verdict on any untouched file. The full pnpm lint run belongs to CI.

Acceptance notes

  • The extractor's pushViewEntries docblock (packages/cli/src/utils/i18n-extract.ts) names translateView as the server-side reader of _views.VIEW.label / .description. After this PR, translateObject is a second server-side reader, for the object-nested channel. The docblock lags in a file outside this card's surface. Noted, not filed.
  • _views.VIEW.emptyState.* is still read client-side only, on both channels. That is unchanged and is stated as design in the extractor's docblock.
  • This branch is based on 2f2fa11d7 and was not merged with main before opening. origin/main is 21 commits ahead. None of those commits touches i18n-resolver.ts, its tests, the REST meta read gate, the extractor or the platform catalogs. Their ui/view.zod.ts change is docblock-only, and their rest-server.ts change is outside the translation path. PR CI runs on the merge ref.

objectui follow-up (not in this PR)

objectui's packages/app-shell/src/hooks/useServedViewItems.ts documents the /meta/object-embedded views as untranslated by the server. Once this lands, isServedView should also answer true for a view id that is a key of the served /meta/object document's listViews, read from the pre-merge useMetadata().getItemsByType('object'). Then viewTabLabel (ObjectView.tsx) and the AppHeader crumb draw those labels as given instead of a second viewLabel pass, in which the bundle would win an edit back. The seat files that child after this lands.


Generated by Claude Code

claude added 3 commits October 1, 2026 03:08
…ws from the _views keys the extractor writes

An object document's embedded `listViews` are now translated through the
same `objects.<object>._views.<key>` lookup a served view document uses
(label, description, bulk-action copy), keyed by the record key the i18n
extractor's `pushViewEntries` writes. A published override still beats the
packaged catalog, judged per view against the packaged object's own
`listViews` by the existing `valueOverridesPackagedBase` comparison.

Claude-Session: https://claude.ai/code/session_017VaLJnYwhPsanVCe9dMCJU
Co-authored-by: Claude <noreply@anthropic.com>
…an update def, as the schema requires

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

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/spec, touching 7 documentable anchor(s).

10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/data-modeling/object-extensions.mdx (via listViews (symbol, a field of interface ObjectLike))
  • content/docs/getting-started/build-with-claude-code.mdx (via listViews (symbol, a field of interface ObjectLike))
  • content/docs/kernel/contracts/metadata-service.mdx (via listViews (symbol, a field of interface ObjectLike))
  • content/docs/kernel/services-checklist.mdx (via listViews (symbol, a field of interface ObjectLike))
  • content/docs/protocol/kernel/i18n-standard.mdx (via listViews (symbol, a field of interface ObjectLike))
  • content/docs/protocol/kernel/plugin-spec.mdx (via listViews (symbol, a field of interface ObjectLike))
  • content/docs/protocol/objectui/layout-dsl.mdx (via listViews (symbol, a field of interface ObjectLike))
  • content/docs/ui/actions.mdx (via listViews (symbol, a field of interface ObjectLike))
  • content/docs/ui/forms.mdx (via listViews (symbol, a field of interface ObjectLike))
  • content/docs/ui/views.mdx (via listViews (symbol, a field of interface ObjectLike))

⛔ 1 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-5.mdx (via listViews (symbol, a field of interface ObjectLike))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 54 of 206 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 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 — 137 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 5dbeb7d7b7e1deb7a64bd3178d2faada69c3097c → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 188246744e59e986b53180824d6a9529965f6b94 — the merge of head 402ab32f5d8eb1969eecd3032547a58575561007 into base 5dbeb7d7b7e1deb7a64bd3178d2faada69c3097c, 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 188246744e59e986b53180824d6a9529965f6b94 && git checkout 188246744e59e986b53180824d6a9529965f6b94
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 5dbeb7d7b7e1deb7a64bd3178d2faada69c3097c 402ab32f5d8eb1969eecd3032547a58575561007 && git checkout -B drift-repro 5dbeb7d7b7e1deb7a64bd3178d2faada69c3097c && git merge --no-ff 402ab32f5d8eb1969eecd3032547a58575561007

node scripts/docs-audit/affected-docs.mjs --json 5dbeb7d7b7e1deb7a64bd3178d2faada69c3097c

⚠️ 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 5dbeb7d7b7e1deb7a64bd3178d2faada69c3097c → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 402ab32f5d8eb1969eecd3032547a58575561007
Local-runs: none

Inputs read: card #21006 (body and all three comments: triage 5923336850, claim 5923678939, os-dev-report 5924833736), PR #21072 (body, its three-file list, the net diff of +466/-21 against the merge base 2f2fa11d7; GitHub reports the PR mergeable against main at 5dbeb7d7b), and the head's check-runs. The helpers the diff calls were read at the head through git show (reading only; nothing was built, run or re-run). Check-runs were read at 2026-10-01T04:47Z.

① Derived judgments

  1. translateObject now overlays each embedded listViews entry's label, description and bulkActionDefs[] copy (def label / confirmText / confirmLabel, param label / help / placeholder) from objects.OBJECT._views.KEY.*, KEY being the record key under listViews. RIGHT. The extractor's obj.listViews loop hands pushViewEntries the record key from Object.entries(obj.listViews) (packages/cli/src/utils/i18n-extract.ts about :1242 to :1244) and writes label, description, emptyState.* and bulkActions.DEF.* under that root; the resolver's new lookupViewText reads objects[o]._views[k][attr] and the existing lookupBulkActionNode reads _views[k].bulkActions[def]. One key shape, as the triage ruling requires; the view's own optional name is never consulted (pinned).
  2. The served-view channel is unchanged. resolveViewLabel and resolveViewDescription are rewritten through lookupViewText with the same guards (no bundle or no object name falls back to the authored value). RIGHT, behavior-preserving; translateView itself is untouched.
  3. Override order on the embedded channel: per string, valueOverridesPackagedBase(packagedView, attr, value) where packagedView is the same key in packagedBase.listViews, an empty record when the base is known but lacks the view, and undefined when no base was supplied. RIGHT. This is the one comparison (metadata: a published org overlay on the built-in system_overview dashboard is never served — the plain read and the rendered board keep the shipped body while ?layers=true reports the overlay as effective #20680) and the same three edges translateView applies (packagedConfig = base.config ?? {}): no base means the catalog applies; an empty or non-string value is never an override; and packagedPart answers an empty record for a known base lacking the list, so a view the base does not ship counts as authored for its label and for every bulk def alike. That matches ADR-0029 D9.2a as the view and dashboard translators apply it since fix(spec,metadata-protocol): a dashboard's packaged translation catalog yields to a published org overlay (#20680) #20728, fix(spec,metadata-protocol): a view's packaged translation catalog yields to a published org overlay (#20731) #20770 and i18n: a published org overlay on a packaged view label is served to a zh-CN reader as the catalog translation (进行中), not the edit — the view twin of #20680 #20731. One consequence shared with translateView, named so it is not silent: a view the base does not ship that carries no description at all would still take a catalog description, because a non-string is never an override; that is the ruled edge, not a new one.
  4. Bulk defs are read from view.bulkActionDefs (the authored address) with the packaged VIEW as the parent, where translateView reads config.bulkActionDefs with the packaged CONFIG. RIGHT: the two channels carry the list at different addresses, and translateBulkActionDefs's sixth parameter is the parent that holds bulkActionDefs in both cases.
  5. emptyState stays untranslated server-side. RIGHT: the resolver at the head has no emptyState reader apart from the new docblock sentence, and the extractor's docblock names the client as its only reader. The same answer on both channels; the card did not ask for it.
  6. Reference identity: translateObjectListViews returns the same listViews reference when nothing matched, and translateObject spreads listViews only when it changed; a listViews that is not a record is handed back as is. RIGHT; the controls pin it (no _views entry, no bundle, no listViews).
  7. ObjectLike, exported from @objectstack/spec/system and listed by name in packages/spec/api-surface/system.json, gains an optional listViews member typed as a string-keyed record of unknown. Judged as a published .d.ts change on an INPUT shape: no export is added, and packages/spec/api-surface-signatures.json hashes only the define* functions, so no generated artefact moves (the head's Build Core is green, which carries check:generated). Accept set: no input that was refused is now accepted; the only type-level effect is that a caller whose listViews is typed as something other than a string-keyed record would now miss the constraint, and no such caller exists in the repo (rest passes any, service-analytics passes { name, fields }, and the authored ObjectSchema.listViews is a record). RIGHT, and the dev named it rather than leaving the no silent.
  8. The REST door needs no change: translateMetaDocument and translateMetaList in packages/rest/src/meta-item-read-gate.ts (about :1913, :2001 and :2036) already pass packagedBase from getPackagedObjectBase for object on both the item and the list read, so the override order reaches GET /api/v1/meta/object and GET /api/v1/meta/object/:name through translateMetadataDocument('object'). RIGHT; the dev's door reading (zh-CN mine served as the catalog's translation after, an org overlay winning, the sibling tab still translated) is consistent with that path. Not re-measured here.
  9. The CLI coverage key set is unchanged because the extractor is untouched, so extract and serve now agree on the same keys. RIGHT.
  10. Tests: packages/spec/src/system/i18n-resolver.object-list-views.test.ts parses its fixtures through ObjectListViewSchema (exported at packages/spec/src/ui/view.zod.ts about :4732) and TranslationBundleSchema (whose _views node is a strict object that carries bulkActions.DEF.params.PARAM.{label, help, placeholder}), and carries the three pins the card and the triage ruling asked for: sys_account.mine served as the catalog's zh-CN translation, an org overlay winning (in zh-CN and in en), and the control (a view with no catalog entry, and an object with no _views entry, unchanged by reference). The translateMetadataDocument('object') dispatch is pinned too. RIGHT.
  11. File surface: the three files sit inside the claim's surface (i18n-resolver.ts, its test beside it, one .changeset for @objectstack/spec at patch). i18n-extract.ts and objectui are untouched, as the claim's two bars require. RIGHT.

② Semver level

.changeset/21006-translate-object-list-views.md declares @objectstack/spec: patch. RIGHT: the diff closes a seam where a declared contract (the _views keys the extractor writes and TranslationBundleSchema declares) was not delivered by translateObject; no export is added, no accept set widens, and the only .d.ts movement is an optional member on an input shape. The changeset prose names what a reader observes (both /meta/object reads, the key shape, the override rule, the unchanged control) and the function pair that does it, and it matches the diff. Clause-②: no in the claim, the PR body and the changeset is RIGHT by the criterion (does the card widen an accept set or enlarge the public face): it pulls the served document back to the declared contract, and the ObjectLike member is an input shape, not a widening. The path limb (packages/spec/src/** outside tests) is what owes this at-tier record, and this record is it. No Regen-provenance: line is owed, since no generated artefact moved.

③ Boundary flags

  • open_questions: none in the report.
  • The ObjectLike member the dev flagged: answered in ① item 7.
  • Deviation, PR assignee not set (the dev's classifier refused the write): the seat's bookkeeping, not a contract item; the seat sets it.
  • Deviation, the branch was not merged with main (21 commits behind at the time of the report): not blocking. GitHub reports the PR mergeable, the dev's overlap scan names no touched file among those commits, and PR CI runs on the merge ref. If the landing rules of the moment want a fresh base, the seat merges origin/main; no re-review is owed for that merge unless the diff changes.
  • Deviation, the dispatch-gates STALE TREE note (84 families derived from the branch's copies): answered by the head's check-runs, which are the gate verdicts (below).
  • NOT MEASURED locally, check:type-check-debt: answered by CI, Type Check · debt ledger is green on the head.
  • Out-of-scope finding 1 (the extractor's pushViewEntries docblock names translateView as the sole server-side reader of _views.VIEW.label and .description; after this PR translateObject is a second one): escalated to the seat as a docblock-only drift in a file the claim bars; a one-line child or a fold into the next extractor card. Not blocking.
  • Out-of-scope finding 2 (emptyState read client-side only on both channels): design as the extractor's docblock states it; no action.
  • The objectui follow-up (useServedViewItems.isServedView must count a /meta/object-embedded view as served, so viewTabLabel and the AppHeader crumb draw the served label instead of a second viewLabel pass): the card already names it and the seat files it after this lands. Not blocking here; it is the condition for the console not to translate an org edit back.

Check-runs on the head, as read

Completed, success (22): Auto Label, Build Core, Check Changeset, Check Documentation Links, Check PR Size, Dogfood Regression Gate, Dogfood Regression Gate (1/3), (2/3), (3/3), Dogfood Verify CLI, Flag docs affected by code changes, Governed Surface Queue Guard, No other open PR may claim the same issue, No other open PR may claim the same single-writer path, Part-of PR must not also close its card, Spec property liveness, Test Core (4/6), The card this PR closes must claim this branch, Type Check · consumer gates, Type Check · debt ledger, Type Check · source gates, filter.
Completed, skipped by design (3): Build Docs, Console Pin Gate, Packed-tarball smoke (opt-in).
Still in progress at the reading (8): Lint & Repo Gates, Temporal Conformance (live PG + MySQL), Test Core (1/6), (2/6), (3/6), (5/6), (6/6), Type Check · workspace.
No check-run on this head has failed. The seat re-reads every check before landing; the eight named above were not yet concluded when this record was written.

Implemented-by: claude/issue-21006-translate-object-list-views
Reviewed-by: session_017VaLJnYwhPsanVCe9dMCJU

VERDICT: PASS


Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 1, 2026 04:57
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 1, 2026 04:57
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 1, 2026
Merged via the queue into main with commit c27404f Oct 1, 2026
37 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-21006-translate-object-list-views branch October 1, 2026 05:30
akarma-synetal pushed a commit to akarma-synetal/objectui that referenced this pull request Oct 7, 2026
… views (objectui#11336) (objectstack-ai#11620)

Fixes objectstack-ai#11336
Clause-②: no

## What changed

`@objectstack/spec` 17.6.0 (objectstack-ai/objectstack#21072,
`c27404f0a9`) translates the `listViews` an object document embeds on
the server, from `objects.OBJECT._views.KEY` and with a published edit
kept over the packaged catalog. The console still ran its own catalog
over those labels a second time. This PR counts such a view as served,
so the switcher tab and the breadcrumb draw its label as given.

- `packages/app-shell/src/hooks/useServedViewItems.ts`
- `isServedView(served, objectName, viewId)` answers true for a
`/meta/view` document named `viewId`, as before. It now also answers
true when `viewId` is a key of the served `objectName` document's own
`listViews`.
- That document is read before the merge, from
`useMetadata().getItemsByType('object')`. The merged `listViews` the
label sites hold mixes the document's own entries with view documents
and a container's expansion, and only the document's own entries were
translated by `translateObject`.
- Only the canonical `listViews` key is read, and the entry must be a
record. The server translates no other spelling, so a view a stored
document embeds under the legacy `list_views` keeps the bundle. The
probe below measures this.
- `useServedViewItems()` returns both reads as one record. It is held in
a module-level `WeakMap` keyed on the two cache arrays, so its identity
depends on the payloads, never on a React memo (AGENTS.md objectstack-ai#10).
- The docblock bullet "The server's `translateObject` does not translate
those" is corrected.
- `packages/app-shell/src/views/ObjectView.tsx` (`viewTabLabel`,
`viewOriginLabel`) and `packages/app-shell/src/layout/AppHeader.tsx`
(the crumb) now pass the object name to the predicate. Their comments
now name both reads.
- Tests:
- The two existing objectstack-ai#11295 suites now serve the `/meta/object` document
as well, and their stale prose is corrected.
- The old "object-embedded view is named by the bundle" control now uses
a view only the client derives (a stack container's expansion).
  - New objectui#11336 cells cover the tab and the crumb.
  - A unit file pins the predicate's edges and the hook's identity.
- `.changeset/11336-served-embedded-listviews.md`:
`@object-ui/app-shell` patch.

No export, prop, type member or i18n key is added to any package entry.
`useServedViewItems` and `isServedView` are not reachable from
`@object-ui/app-shell`'s entry: `exports` maps only `.` and
`./styles.css`, and both names are absent from `src/index.ts` and
`src/hooks/index.ts`. The control `useRecentItems` has 2 hits in
`src/index.ts`.

## Premise check (measured on `origin/main`, not taken from the card)

- **The label sites read the served object.** `ObjectView` and
`AppHeader` receive `objects` from `useMetadata().objects`
(`AppContent`). That getter is
`mergeViewsIntoObjects(readType('object'), readType('view'))`.
`getItemsByType('object')` returns the cache's own `/meta/object` items,
mutated only by `normalizeSchemaReferenceKeys`, which touches field
reference keys. The merge copies the served document's own `listViews`
entries under their record keys, and those keys win collisions. So an
embedded tab's id is the key the served document carries.
- **The server translates them.** A probe ran against the installed
`@objectstack/spec` 17.6.0 (`system.translateObject`, locale `zh-CN`, a
catalog with `objects.sys_account._views.mine.label`):

  | Case | Served label |
  | --- | --- |
  | `listViews.mine` | `我的链接` |
  | sibling `other`, no catalog entry | `Other` |
| `mine` carrying an org edit (`Links I own`), with `packagedBase` |
`Links I own` (the catalog loses) |
  | legacy `list_views.mine` | `My Links` (untranslated) |

- **Not translated by any server:** a stack container's expansion.
`translateView` does not walk a container's nested `listViews`, so that
kind still goes through the bundle.

## Evidence (head `0a2c2af`)

- `pnpm exec vitest run` on the three touched test files (repo-root
spelling), before the merge at `5b212d6`: `Test Files 3 passed (3)`,
`Tests 35 passed (35)`. The full-package run below covers them again on
the merged head.
- **Reverse verification**, run after commit through
`ablation-replace.mjs` (anchor hit 1 time; blob changed, then restored
equal to HEAD; `git diff HEAD` empty afterwards). The object-document
branch was cut (`if (!objectName) return false;` became `return
false;`), and the predicted cells went red: `Tests 7 failed | 28 passed
(35)`.
- Red: the two ObjectView "published edit the object read served" cells,
the two AppHeader cells, and three unit cells (embedded key answers; key
answers only under its object; identity record answers after a refetch).
- Green on both sides: the zh-CN served-string cells (the catalog says
the same thing), the no-catalogue and container controls, and every
objectstack-ai#11295 cell.
- `pnpm --filter @object-ui/app-shell type-check` (`tsc --noEmit && tsc
-p tsconfig.test.json`): exit 0 on the merged head, after the
`@object-ui/app-shell^...` dependency closure was built. `tsc -p
tsconfig.test.json --listFiles` lists all three touched test files.
- `pnpm exec vitest run packages/app-shell/` on the merged head: `Test
Files 1000 passed | 1 skipped (1001)`, `Tests 9930 passed | 9 skipped
(9939)`, exit 0. The run held the shared verify lock; wall-clock figures
are omitted because the box is shared.
- ESLint on the six touched source and test files: 0 errors. Per-file
warning counts equal `fd060f0767`'s (ObjectView 174, AppHeader 22, the
two objectstack-ai#11295 suites 3 and 17, the hook 0). The new unit file has 0
warnings.
- Root gates run locally, each exit 0: `check-changeset-presence`,
`check-changeset-no-major`, `check:changeset-claims` (with the changeset
committed), `check:pending-changeset-literals`,
`check:new-line-citations` (0 new), `check:control-bytes`,
`check:vi-mock-specifiers`, `check:vi-mock-inherit`,
`check:vi-mock-override-shape`, `check:test-path-roots`,
`check:unreferenced-sources`. CI runs the rest.

## Acceptance notes

- **Older servers.** A console with this change, talking to a server
whose spec predates `c27404f0a9` (17.0 to 17.5), draws embedded views'
labels as authored. Today the console's second pass translates them. I
found no version gate in app-shell: the only server-capability signals
it reads are the runtime config's `features.*` flags, and none of them
says "embedded listViews are served translated". The CLI-shipped pairing
is unaffected, because `@objectstack/console` is built at the objectui
SHA pinned per framework release. The exposed pairing is
`@object-ui/console` run on its own cadence against an older 17.x
server. No gate is added here; the question is in the report.
- Observation, out of this card's surface and not filed:
`useNavTargetLabel` (nav-entry labels) passes a view's label through
`viewLabel` without asking `isServedView`, for both channels. No
reproduction was run, and no carrier is known.
- `objectui#11303` kept the console path for embedded `listViews`
because the server did not translate them then. That reason is gone with
17.6.0, which `pnpm-lock.yaml` resolves.

Implemented by the dispatched `os-dev` agent, session
`https://claude.ai/code/session_015W8GBu6sBiqus2L2xjMsAL`.

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

---------

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 protocol:system size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant