Skip to content

fix(spec): a published fieldPatches label is served by every object read, not only /layers - #29624

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-3eznxf
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-3eznxf

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Fixes #29564

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:translateObject 的字段 label 与选项 label 两个槽位改走既有的 valueOverridesPackagedBase 比较,与 description / inlineHelpText / inlineTitle 及对象三标量同一条规则。
  • 为什么改:对象扩展发布的 fieldPatches 改了字段标签后,只有 /layers 能看到,无包名读、?package= 基础包读和列表读都被目录(catalog)里的出厂标签盖回去了。
  • 风险与回滚:租户覆盖层对字段标签或选项标签的改名,从此也会压过目录翻译(与对象改名 The i18n catalog is resolved ahead of the document, so a tenant's own Studio rename never reaches either /meta/object read — and neither do extension scalar overrides #8284 同理);回滚即还原 i18n-resolver.ts 的两处判断。
  • 先看:packages/spec/src/system/i18n-resolver.ts 的 translateField(两处新判断与选项基线的取法),再看 packages/rest/src/meta-object-field-patch-i18n.test.ts。
  • 两分钟验证:pnpm --filter @objectstack/rest exec vitest run src/meta-object-field-patch-i18n.test.ts(先建 spec),预期 7/7 通过,补丁标签 Headline / Queued 在 zh-CN 与 en 两个语言下都原样返回。
  • 需要你做的:无,席位落地。

What changes

  • packages/spec/src/system/i18n-resolver.ts, translateObject → translateField:
    • The field label (catalog, then the built-in system-field label) is applied only while valueOverridesPackagedBase(packagedField, 'label', def.label) is false, i.e. only while the served label still equals the same field's label in packagedBase.
    • Each option label is applied only while it still equals the label of the packaged field's option with the same value (found with the existing packagedPart finder, matched by String(value) as the dashboard filter options are).
    • A picklist-bound served field (picklist set) is judged against no field-level baseline: its options are the list's, resolved onto the served field on every read (resolvePicklistFieldsOnto) and never present on the packaged declaration, so the catalog (field-level, then picklists.LIST) applies to them exactly as before. The registry fold never applies an option patch to a picklist-bound field either.
    • The docblock paragraph that said a field label stays a flat catalog ?? document now states the rule above.
  • One comparison, no second application: nothing re-applies the patch after translation; the two slots ask the same predicate their siblings ask.

Why

ADR-0146 D10 admits a base field's label and option label through an object extension's fieldPatches, and the registry folds the patch onto every read. The served /meta exit (packages/rest/src/meta-item-read-gate.ts, translateMetaDocument / translateMetaList) localizes the folded body with translateMetadataDocument('object', …), which wrote the catalog's field label and option labels unconditionally. The showcase catalog carries an en entry for every showcase_task field, so the shipped text replaced the patch on the bare, ?package= and list reads (reproduced on main 50e35a28, report 6588058932). The objectql pin reads registry bodies directly and never runs this localization, which is why it stayed green.

Tests

  • packages/spec/src/system/i18n-resolver.test.ts: new block "translateObject — a field label and its option labels yield to a diverged value" (9 cases: the patched label and option through the type dispatch in en and zh-CN; per-field and per-option judgment; untouched document; no base; absent or empty served label; a field or option the base does not declare; a picklist-bound field keeps the list's labels; an injected system field's built-in label; no input mutation). The old case "leaves FIELD labels alone — the rule is scoped to the three scalars" pinned exactly the branch this changes, so it is replaced by "judges a FIELD label by the same rule".
  • packages/rest/src/meta-object-field-patch-i18n.test.ts (new, 7 cases): a REAL SchemaRegistry with an owner and a fieldPatches extender; the protocol double's getPackagedObjectBase reads the registry. It drives translateMetaDocument and translateMetaList and asserts the patched field label, patched description and patched option label in zh-CN and en, the untouched siblings still translated, and the no-extension control.

Acceptance notes

  • Side effect, by the The i18n catalog is resolved ahead of the document, so a tenant's own Studio rename never reaches either /meta/object read — and neither do extension scalar overrides #8284 rule: a tenant overlay's rename of a field label or option label is now served over the catalog too, the way an object rename already is.
  • A field the packaged base does not declare (an extension's own field) counts as diverged on every slot, as its description / inlineHelpText slots already did. So a catalog entry for such a field's label is no longer served. In this repository no producer writes one: the i18n extractor walks objects only, and no generated bundle carries an extension field. Named here because a third-party bundle could.
  • Not changed, noted only: formula-option-labels.ts (objectql) and the analytics dimension labels call translateObject without a packagedBase, so they keep applying the catalog unconditionally (no base means the rule infers nothing). Not measured to diverge on a public read.

Verification

Head 6d0f0e01, base origin/main 81cd9eb0.

Ablation (both slots), each leg rebuilt and proved in dist

Each leg: node scripts/ablation-replace.mjs (anchor 1 → 0, blob changed), pnpm --filter @objectstack/spec build, node scripts/ablation-dist-preflight.mjs @objectstack/spec MARKER (marker present in 2 built files), then both pins; the tool restored the source (blob equals HEAD, git diff HEAD empty).

  • Label slot (the guard made always-true): spec pin 3 failed / 389 passed; REST pin 4 failed / 3 passed.
  • Option slot (the early return disabled): spec pin 2 failed / 390 passed; REST pin 4 failed / 3 passed.
  • Restore: spec rebuilt, preflight --absent for both markers (absent from all 588 built files, tree clean); spec pin 392/392, REST pin 7/7.
Package suites
  • pnpm --filter @objectstack/spec test: 801 files, 23707 passed, 1 todo. pnpm --filter @objectstack/spec typecheck: green (test layer OK).
  • pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2: 384 files, 7402 passed, 352 skipped. pnpm --filter @objectstack/rest typecheck: green.
Derived gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 6d0f0e01: 79 families. Reconciled with --ran: 79 accounted, 78 run with exit 0, 1 NOT MEASURED: pnpm check:dual-build-cjs-loads exit 3 (prerequisite: the whole workspace's dist/ is not built in this container; left to CI). check-plugin-teardown-shape.mjs --self-test first exited 3 on the shallow clone; after fetching its pinned fixture commit it exits 0 (48 cases). Local-only: check:skill-frame-freshness 0; check:dev-prereqs refuses (35 workspace packages unbuilt, only the rest closure was built).

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (No formatter ran; pnpm lint was not run locally, it is CI's run.)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (none were stale: the derived spec checks are green)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

Generated by Claude Code

… value

translateObject wrote the catalog's field label and option labels over
every served field, so an object extension's fieldPatches label was served
only by /layers. Both slots now go through valueOverridesPackagedBase
against the same field (and option) in the packaged base, as the field's
description, inlineHelpText and inlineTitle already do.

Claude-Session: https://claude.ai/code/session_01JQwxbX91BzYkHsRob9kBV8
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 Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

1 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 60 of 216 client-bound route-ledger rows — the other 156 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 156: 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; 101 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 — 168 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 5bd615effe96ea05b4d9744a48a345ec804de208 → packageMentionDocs.

Which tree this was computed on

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

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

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#3 · os-warren · session_01JQwxbahe4v7GBD94QeSnir

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 6d0f0e0141c7696c681c7ff4092a605a6f64b972
Local-runs: none
Scope: packages/spec/src/system/i18n-resolver.ts + packages/rest/src/meta-item-read-gate.ts, packages/rest/src/form-routes.ts, packages/objectql/src/registry.ts (getPackagedObjectBase, applySystemFields, patchedField, resolvePicklistFields), packages/metadata-protocol/src/protocol.ts (getPackagedObjectBase), packages/spec/src/data/field-customization.ts (BASE_FIELD_DISPLAY_WHITELIST), docs/adr/0146 D10, packages/cli/src/utils/i18n-extract.ts, examples/app-showcase (account.extension.ts, system/translations/index.ts)

Inputs read: card #29564 body and all six comments (triage 6585653138, server claim 6587958154, server report 6588058932, ruling 6588078025, spec claim 6588881236, dev report 6590029843); PR #29624 body, its four files and the net diff against main; the check-runs on the head (see ② for the gate line).

① Derived judgments

  • Accept-set change (served behaviour). translateObject → translateField applies the catalog's field label (then builtinSystemFieldLabel) only while !valueOverridesPackagedBase(packagedField, 'label', def.label), and each option label only while !valueOverridesPackagedBase(packagedOption, 'label', opt.label), packagedOption found by packagedPart(owner, 'options', String(value) match). Right. It is the fix the ruling (6588078025) asked for — the two slots under the EXISTING comparison — and the behaviour ADR-0146 D10 already contracts in writing: "the ADR-0029 D9.2a scalar yield applies to it as to the three scalars". The diff adds two guards and nothing else; packages/rest/src/meta-item-read-gate.ts is untouched and nothing re-applies a patch after translation. Confirmed: no second application.
  • The base reaching the comparison is the pre-fold owner. registry.getPackagedObjectBase (packages/objectql/src/registry.ts:6254) returns owner.definition by reference (only validations widens, per i18n: a tenant's rewrite of an objectExtensions-contributed validation rule message still loses to that package's translation, on the refusal and on /meta #27559), the protocol hands it through (protocol.ts:3507), and all three served object exits pass it: item (meta-item-read-gate.ts:3102), list per element by item.name (:3038) and the public form route (form-routes.ts:383). Right — the item read, the list read and the ?package= base read all localize the folded body against the same owner declaration, so the three reads the card measured now answer alike; /layers stays untranslated.
  • Built-in system-field labels now sit under the same guard. Right, and safe: applySystemFields runs BEFORE contributor storage (registry.ts:4396 → the contributor pushed at :4551), so the owner's stored definition carries created_at etc. with their English labels; an undiverged served label equals the packaged one and the fallback still applies. A tenant-authored object has no code owner → base undefined → the fallback applies as before.
  • Picklist-bound fields take no field-level option baseline (packagedOptionsOwner = picklist === undefined ? packagedField : undefined). Right and necessary: the owner declaration carries picklist and no options (they are written onto the served body after the fold by resolvePicklistFields, registry.ts:8467), so without the guard packagedPart would answer {} and withhold every picklists.<name> translation. Nothing is lost by it: patchedField never patches a picklist-bound field's options (!picklistBound).
  • A field or option the base does not declare counts as diverged. packagedObjectField → {}, packagedPart → {}. Right (judged under ③): it is the convention description / inlineHelpText / inlineTitle, listViews and validations already use, and the base is documented as the owner's declaration BEFORE objectExtensions fold (TranslateDocumentOptions.packagedBase).
  • Side effect: a tenant overlay's field or option rename is served over the catalog. Stated in the PR and the changeset. Right — the The i18n catalog is resolved ahead of the document, so a tenant's own Studio rename never reaches either /meta/object read — and neither do extension scalar overrides #8284 rule the object scalars follow; the conservative edges (no base, empty value, exact-string rename) are unchanged because the predicate is the same function.
  • No public surface moves. valueOverridesPackagedBase stays module-private, scalarOverridesPackagedBase's key union is unchanged, no export is added, BASE_FIELD_DISPLAY_WHITELIST is untouched. Callers without a base (objectql/src/formula-option-labels.ts:157, analytics) keep the unconditional catalog. Right.
  • Test accept-set. The old spec case "leaves FIELD labels alone — the rule is scoped to the three scalars" pinned exactly the branch ADR-0146 D10 contradicts; replacing it is right. The new block (9 cases) and the REST pin (7 cases over a real SchemaRegistry, both exits) cover the scenarios judged in ④.

② Semver level

  • Changeset .changeset/29564-field-label-catalog-yields.md: @objectstack/spec patch, body carries Clause-②: no and Metadata-protocol: none, matching the PR body. Right. Nothing an author writes changes (no key, value or type added, refused or redefined); the served read moves to what ADR-0146 D10 and ADR-0029 D9.2a already contract, i.e. a bug fix in a released package — the same class and declarations as spec(i18n): translateObject writes translated field help onto an undeclared help key — the console warns ~520× per page load and drops the value #21948 (help slot) and the The i18n catalog is resolved ahead of the document, so a tenant's own Studio rename never reaches either /meta/object read — and neither do extension scalar overrides #8284 line. Not semantic: the catalog entry's meaning ("the translation of the packaged declaration") is unchanged; what changes is that the resolver stops applying it to a value that is not that declaration. @objectstack/rest gains only a test and owes no changeset. Check Changeset: success.
  • Clause-②: no — right: no authorable capability widens or narrows.
  • Gate line (check-runs on 6d0f0e01 at review time): every completed run is success or skipped — Lint · ESLint, Lint & Repo Gates, all Lint · scoped gates, Type Check · source gates / debt ledger, Check Changeset, Governed Surface Queue Guard, Spec property liveness, PR-body guards, Dogfood Regression Gate, Plan Test Core shards, Build UI Deps. Also success since the first read: Type Check · consumer gates, Lint · CI, release & engine gates. Still in_progress when this record was rendered (no failure among 33 completed runs): Test Core (1–8/8), Build Core, Type Check · workspace, Type Check UI, Test UI (1–16/16), Build & E2E UI, Live E2E UI. Their conclusions are the gate verdicts for the derived families (dual-build-cjs-loads among them); this PASS is on the contract and the design, and stands only once those land green — a red there reopens it.

③ Boundary flags

  • Dev open_questions[0] — an extension's own field, undeclared in the base, now counts as diverged on the label slot. Answer: A, keep (as shipped). (1) packagedObjectField's {} answer is already load-bearing for three slots of the same function; a no-baseline exception for label would be a second base-selection shape, which ADR-0029 D9.2a forbids. (2) The base's contract (TranslateDocumentOptions.packagedBase) is the owner's declaration before the fold; the catalog is its translation. (3) Verified, not trusted: the extractor walks config.objects and picklistExtensions only (i18n-extract.ts:1132, 1461, 1988); the one in-repo code extension that adds fields (examples/app-showcase/src/data/extensions/account.extension.ts: loyalty_tier, linkedin_url, csat_score) has no entry in examples/app-showcase/src/system/translations/index.ts, and HotCRM declares no objectExtensions. So no in-repo read moves. The third-party case (a vendor bundle hand-writing objects.<target>.fields.<added>.label) is named in the PR's acceptance notes; if a real producer appears, the recorded path is to widen getPackagedObjectBase with code extenders' fields the way i18n: a tenant's rewrite of an objectExtensions-contributed validation rule message still loses to that package's translation, on the refusal and on /meta #27559 widened validations, not to special-case the resolver.
  • Dev flag: pnpm lint not run locally. Answered by the head: Lint · ESLint and every Lint · gate success.
  • Dev flag: check:dual-build-cjs-loads NOT MEASURED locally (workspace dist unbuilt). Left to CI; see the gate line.
  • Dev deviation: main moved 12 commits after the branch point, not merged. Verified: git diff --stat 81cd9eb0 origin/main over packages/spec/src/system, packages/rest/src/meta-item-read-gate.ts, packages/rest/src/form-routes.ts, packages/objectql/src/registry.ts is empty.
  • Side effect (tenant overlay rename served over the catalog) — stated in PR and changeset, per the ruling's instruction; accepted.
  • Out-of-scope note (callers without a base keep the unconditional catalog) — correct reading, nothing owed here.
  • Card "Wanted": find why the existing pin did not catch this — answered in the PR body and the REST pin's docblock: registry-extension-field-patches.test.ts reads registry bodies and never runs the REST localization; /layers is the one untranslated door. Consistent with the server report's measurement.

④ Design judgment

packages/spec/src/system/i18n-resolver.ts — judged against ruling 6588078025, ADR-0146 D10 and ADR-0029 D9.2a, and against its first consumer (meta-item-read-gate.ts item and list exits over getPackagedObjectBase). Holds. Break attempts, each read in the live tree:

  1. No packaged base (tenant object, partial protocol double, null): packagedObjectField(undefined) → undefined → predicate false → catalog and built-in labels apply exactly as before. Pinned (undefined and null).
  2. Picklist-bound field: owner declares picklist, no options; guard sets the owner to undefined → list translations apply; field-level entry still wins over picklists.<name>. Pinned. The field's own label is still judged against the packaged field (it is declared there) — right.
  3. Built-in system label: created_at undiverged → 创建时间; renamed → kept. Pinned; the pin's base declares the field, which matches the live shape because injection precedes storage.
  4. Option matched by value: both sides String(); the fold matches === on string values, so a patched option is found; a value the base lacks → {} → diverged → kept (pinned blocked); opt.value === undefined returned untouched as before.
  5. Tenant overlay rename: diverged → kept (stated side effect); a rename to the exact packaged string → catalog applies (unchanged conservative edge).
  6. List read vs item read: both exits pass the base from getPackagedObjectBase(item.name); the REST pin drives translateMetaDocument and translateMetaList in en and zh-CN. The ?package= read localizes the same folded body by object name, independent of the query.
  7. Absent or empty served label: predicate false → catalog fills. Pinned.
  8. Array-shaped fields (flattened reads): packagedObjectField matches by name; unchanged.
  9. Input mutation: { ...def } and options.map return fresh objects; pinned on both documents.
  10. /layers: untranslated, unchanged.

Findings:

  • Must-fix: none.
  • Should-fix (non-blocking, follow-up or next touch): the packagedPart docblock still says "One finder for both translators (translateDashboard, translateView)"; translateObject's option slot is now a third caller. Cosmetic.
  • Should-fix (non-blocking): the card asked for a pin "over the path a booted stack takes". The REST pin runs the real exits over a real SchemaRegistry, which is the seam the defect lived in, and the seat's file surface named exactly that; a dogfood case driving the booted showcase with ?locale=zh-CN (beside showcase-object-extension-meta-read.dogfood.test.ts, which does not read a locale) would close the card's wording fully. Not owed on this PR.

Implemented-by: claude/project-thread-3eznxf
Reviewed-by: session_01JQwxbahe4v7GBD94QeSnir (seat subagent)

VERDICT: PASS


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#3 · os-warren · session_01JQwxbahe4v7GBD94QeSnir

维护者速读

席位核对

ACCEPT · domain:spec#3 · head 6d0f0e0141c7696c681c7ff4092a605a6f64b972 · 2026-11-02T22:49Z

  1. Shape: four files: packages/spec/src/system/i18n-resolver.ts (two guards + docblock), packages/spec/src/system/i18n-resolver.test.ts (9 cases; the old "leaves FIELD labels alone" case replaced), packages/rest/src/meta-object-field-patch-i18n.test.ts (new REST pin), .changeset/29564-field-label-catalog-yields.md (@objectstack/spec patch). Inside the claim (6588881236); meta-item-read-gate.ts untouched; no protocol.ts file touched.
  2. Premise, measured: reproduced by the server card thread (6588058932); the reviewer traced the packaged base from getPackagedObjectBase through the item, list and form exits, the picklist-bound guard, the system-label fallback and option matching by value.
  3. Gates: dev local 79 derived / 78 exit 0 / 1 NOT MEASURED (check:dual-build-cjs-loads, left to CI); both slots ablated red in spec and REST pins, restored green. On this head 64 check-runs, 55 success, 9 skipped, none failing; mergeable_state clean.
  4. Accepted deviations: none beyond the stated side effect (tenant overlay label rename served over the catalog, per The i18n catalog is resolved ahead of the document, so a tenant's own Studio rename never reaches either /meta/object read — and neither do extension scalar overrides #8284), which the ruling 6588078025 asked the PR to state.
  5. Out of scope: reviewer should-fixes left as follow-ups, not pushed: the packagedPart docblock lists two callers of three (cosmetic); a dogfood ?locale=zh-CN case on the booted showcase would close the card's wording fully. Skills-docs: n/a (Metadata-protocol: none).
  6. Landing: not governed (check-governed-merges --pr 29624: NOT governed, 392 changed lines), Clause-②: no, contract review at CONTRACT_REVIEW_TIER PASS on this head (6590221751). Seat lands it: pr_ready + automerge_enable.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 22:50
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 2, 2026 22:50
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 59775a0 Nov 2, 2026
65 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-3eznxf branch November 2, 2026 23:12
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…ender adds, so /meta translates a dependent package's added fields (objectstack-ai#34156)

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

## 维护者速读

- **改了什么**:依赖包通过 `objectExtensions` 给基础包对象新增的字段(如 carbon 包给
`crm_account` 加的 `cb_market`),在中文等非默认语言下读 `/api/v1/meta/object`
时,字段名和选项名现在按该依赖包自己的翻译包显示,不再是英文。
-
**为什么改**:此前对象的"出厂基准"只算基础包自己声明的字段,依赖包加的字段被当成"后来手工改过",于是翻译一律不套用;新建记录表单读的就是这个接口,所以中文界面里出现英文选项。
- **风险与回滚**:只扩了基准里"基础包没声明、由代码依赖包新增"的字段;基础包自己的字段、对象名称、`fieldPatches`
改的文字、租户和 `.custom` 加的字段都按原样不动。回滚即 revert 本 PR。
- **先看**:`packages/objectql/src/registry.ts`(`packagedAddedFields` 与
`getPackagedObjectBase`,重写后的 ⛔
段)、`packages/objectql/src/protocol-packaged-object-base.test.ts`(边界钉子)、`packages/objectql/src/protocol-meta-effective-schema.test.ts`(中文读回再保存仍存英文原文)。
- **两分钟验证**:`pnpm --filter @objectstack/rest exec vitest run
--maxWorkers=2 src/meta-object-field-patch-i18n.test.ts`,预期 12
passed,其中新增组断言 zh-CN 下 `cb_market` 为「市场」、选项为「内销 / 出口」,基础包自己被改名的字段仍保持原文。
- **需要你做的**:无,席位落地。

Fixes objectstack-ai#33800

Half 2 of the card (a dependent package's `fieldPatches`
label/description getting its own translation) is out of this PR by
maintainer ruling 6896340775: D stands and it has its own card. Until
that card lands, patched text shows as written in every language.

Clause-②: no
Metadata-protocol: none

## What changes

**The defect, measured on `origin/main` 45dee17.** A select field
`cb_market` added by a dependent code package through
`objectExtensions`, with the zh-CN rows in that package's pack, was
served under zh-CN as `Market` / `Domestic` / `Export`. That held on the
item read and on the list read (`translateMetaDocument` /
`translateMetaList`, over a real `SchemaRegistry`). `translateObject`
worked as designed. Its input was the problem:
`SchemaRegistry.getPackagedObjectBase` returned the owner's declaration
alone, so the field had no packaged counterpart and every slot of it
counted as authored after the fact.

**Origin.** The label and option-label divergence checks came in with
objectstack-ai#29624 (59775a0, shipped in 18.3.0). It was not objectstack-ai#29948, and not 18.4.0:
the path is identical from 18.3.0 to 18.4.0 (measured:
`translateObject`, `packagedObjectField`, `valueOverridesPackagedBase`,
`getPackagedObjectBase` and `translateMetaDocument` agree at the 18.3.0
and 18.4.0 tags).

**The fix (seat ruling 6895879286, option A).** `getPackagedObjectBase`
now also carries every field that a CODE `extend` contributor adds under
a name the owner does not declare (`packagedAddedFields`). It uses the
same filter as `packagedRules` (`ownership === 'extend' &&
isCodeArtifactBody`). This extends objectstack-ai#27559's rule-name principle to field
names: the catalog rows for such a field can only translate what its
extender ships. Boundaries, each one pinned:
- An owner-declared field stays the owner's, even when an extender
redeclares it (objectstack-ai#8037).
- Same-name extenders resolve to the fold's winner (ascending priority).
- `fieldPatches` are not merged, and the scalars are untouched.
- Fields from a tenant overlay or a stored (`_provenance: 'org'`)
extension, the `.custom` pair's included, stay diverged.
- The ⛔ at the former registry.ts:8140 is rewritten and keeps the objectstack-ai#8037
reason.
- The base is returned BY REFERENCE only when no code extender ships a
rule or adds a field. No caller relies on reference equality: the
callers are `metadata-protocol`'s echo restore and base accessor, the
REST read gate, and objectql's `engine-validation-messages`, which reads
`.validations` only.

**The save door agrees with the read.** `restoreTranslatedObjectEchoes`
(objectstack-ai#29673) reads the same accessor. A zh-CN read of the added field,
echoed back by a PUT, is stored as the extender's source text (`Market`,
`Domestic`, `Export`), both over a stored row and with none.

**Extender-added `listViews`: not applicable, no card.**
`ObjectExtensionSchema` refuses `listViews` on an extension
(`packages/spec/src/data/object.zod.ts`, its guidance: "`listViews`
cannot be contributed through an object extension"). So
`translateObjectListViews` never sees a view an extender added.

**Stale comments rewritten:** the
`TranslateDocumentOptions.packagedBase` doc, the `packagedObjectField`
doc, the `translateObject` docblock sentence on undeclared fields, and
the `i18n-resolver.test.ts` comment on the undeclared-field pin. These
are comment-only changes in `@objectstack/spec`.

**Contract declaration.** `Clause-②: no`. No accept set, export, schema
or response shape changes, and nothing previously served is refused.
What changes is the label text that non-default-locale
`/api/v1/meta/object` reads serve for fields a code extender adds; the
changeset says so. Default-locale reads are unchanged. Not breaking, so
no `!`, banner or ADR-0087 marker, and the dogfood battery is not owed.

## Tests

- `packages/objectql/src/protocol-packaged-object-base.test.ts` (the
existing harness for `getPackagedObjectBase`, per ruling 6583487846): a
new top-level describe with 7 cases. The BY REFERENCE pin is flipped:
with the shared fixture's `loyalty_tier` extension the base is now a
copy that carries the field, and a label-only extension still returns
the owner by reference.
- `packages/rest/src/meta-object-field-patch-i18n.test.ts` (the existing
harness for the meta-object extension i18n exit): a new top-level
describe with 5 cases (item read, list read, base fields, owner field
redeclared, tenant-added field).
- `packages/objectql/src/protocol-meta-effective-schema.test.ts` (the
existing objectstack-ai#29673 door harness): a new top-level describe with 2 cases
(with and without a stored row).

Red before the fix (45dee17 + pins): objectql 4 failed / 9 passed; rest
4 failed / 8 passed (`expected 'Market' to be '市场'`).

## Acceptance notes

- **The reporter's package shape (seat item 2) was not measured
directly**: `steedos-labs/os-project-blackcat-crm` is not readable from
this session. The card's own facts point to a code package rather than a
stored `object_extension` row. The fields come in "through
`objectExtensions`" (the manifest key of a code package), they carry no
`__c` suffix, and the package "passes validate".
- Extender-added `listViews`: none can exist (the extension schema
refuses the key), so there is nothing to translate and no card to file.
- The seat ruling asks the reporter to confirm which page and version
their 18.3.0 Chinese reading came from. On this path 18.3.0 and 18.4.0
behave the same (objectstack-ai#29624 shipped in 18.3.0).

## Verification

All on head `ecffbe8d0` (origin/main `86350e125` merged), unless a line
names another head.

<details><summary>Pins, typecheck, generated artifacts (locked, final
head)</summary>

```
os-verify-lock: VERDICT command-exit 0 · held the lock 904s
closure   :: exit 0 :: pnpm --workspace-concurrency=2 --filter @objectstack/rest... build
pins-oql  :: exit 0 :: Test Files 2 passed (2) :: Tests 38 passed (38)
pins-rest :: exit 0 :: Test Files 1 passed (1) :: Tests 12 passed (12)
oql-tc    :: exit 0 :: pnpm --filter @objectstack/objectql typecheck
rest-tc   :: exit 0 :: pnpm --filter @objectstack/rest typecheck
spec-gen  :: exit 0 :: pnpm --filter @objectstack/spec check:generated
dts-closure / published-files / sourcemap-no-sources-content / lean-entry-closure / test-source-alias / nul-bytes / type-check-debt :: exit 0
```
</details>

<details><summary>Package suites (head c856cd3: the fix merged with
origin/main fb79d47; the final head adds only a test import and a main
merge that touches no package of this diff's behaviour)</summary>

```
oql-test  :: exit 0 :: Test Files 598 passed (598) :: Tests 13250 passed (13250)
mp-test   :: exit 0 :: Test Files 342 passed | 9 skipped (351) :: Tests 22923 passed | 43 skipped
rest-test :: exit 0 :: Test Files 413 passed (413) :: Tests 8459 passed | 332 skipped
spec-test :: exit 0 :: Test Files 843 passed (843) :: Tests 26966 passed | 1 todo
```
</details>

<details><summary>Ablations (each leg: ablation-replace, objectql build,
ablation-dist-preflight, pins, restore with blob == HEAD)</summary>

```
A1 drop the owner-declared guard     -> 3 red: BY REFERENCE (label-only/redeclare), owner's redeclared field (objectql), owner field redeclared (rest)
A2 drop the code-artifact filter     -> 1 red: carries nothing from a stored (tenant-provenance) extension
A3 fold code fieldPatches into base  -> 7 red: does not fold fieldPatches (objectql) + 6 of the published fieldPatches cases (rest)
final build exit 0 · absent-preflight exit 0 · every leg "restored == HEAD blob"
```
A3's first run was a no-op: the anchor sat inside its own replacement,
and ablation-replace refused it with a drop of 0. It was rerun with a
different anchor, and the line above is that rerun. A1's first run
failed the dts build (an unused binding) and was rerun clean.
</details>

<details><summary>Gate sweep and PR-body gates</summary>

`dispatch-gates --commands` derived 93 families. 92 were run locally
with exit codes recorded and exit 0, after one fix:
`check:test-source-alias` asked for a module-top `@objectstack/spec/ui`
import in the rest pin file, which is added.
`check:dual-build-cjs-loads` is left to CI. `pnpm lint` exit 0. Run with
this body: `check-changeset-no-major`, `check-adr-0087-registration`,
`check-closing-keyword-parity`, `check-partof-closing-keyword`, all exit
0. `git merge-tree --write-tree` is clean against origin/main, objectstack-ai#33821
(already merged) and objectstack-ai#34025 (the one open PR touching
`i18n-resolver.ts`).
</details>

---

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

---------

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