Repository navigation
fix(objectql,runtime)!: a package-less action is kept on its own owner key, and a route serves the one on its key - #33821
Conversation
…ey; the route serves the one on its key Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…eset Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…ackage-less action on their own key Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…d on main as controls Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 22 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 10 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 40 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a867bd2f52bdd1bbc527567919f8a99fb9d7fa78 && git checkout a867bd2f52bdd1bbc527567919f8a99fb9d7fa78
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 1e65a389e12e7c07e2121378d1d0755226c2ad60 8f2c22d91d14b0b8fb2c6693b349b7759dd60213 && git checkout -B drift-repro 1e65a389e12e7c07e2121378d1d0755226c2ad60 && git merge --no-ff 8f2c22d91d14b0b8fb2c6693b349b7759dd60213
node scripts/docs-audit/affected-docs.mjs --json 1e65a389e12e7c07e2121378d1d0755226c2ad60
|
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f Contract-review-handoff: review#2 — CONTRACT_REVIEW_TIER unavailable (the maintainer routes contract-tier reviews to the review seat, 2026-11-15T12:18Z) · head 8f2c22d A security#1 order for public card #33282. The card's seat ruling is the order's rule. Seat notes:
Generated by Claude Code |
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f Contract-review-handoff: review#1 — CONTRACT_REVIEW_TIER unavailable (review#2 is off duty and the maintainer routes this account's contract reviews to review#1, 2026-11-15T12:21Z) · head 8f2c22d A security#1 order for public card #33282. The card's seat ruling is the order's rule. Seat notes:
Generated by Claude Code |
|
review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH Contract-review-claim: session_016WV4cy7hQ5MvQ83ByNZ8ZH · head 8f2c22d · 2026-11-15T12:37:59Z |
|
review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH Contract reviewServed-tier: First full review of this head. Face: narrowing ( ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentThe narrowing against the published contract on Per file:
No must-fix, no should-fix. Nits (accepted deviations; none changes the verdict):
Implemented-by: VERDICT: PASS |
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f 席位核对ACCEPT at
Implemented-by: os-dev (security#1 order, |
…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>
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none —
skills/**andcontent/docs/**already teach that an action is keyed by its package, its object and its name, and that the router reaches an action bound to the object before an object-less one; no authored key, value or meaning changes.维护者速读
lead的 action 与环境的无对象 action 同名时两者都保留,不论注册先后;/actions/lead/NAME读绑定lead的那条,其它路由读环境的无对象那条。action类型的无包槽位与 action 路由的选取,单条无包 action 的存储与读法不变(有对照测试);回滚即 revert 本 PR。packages/objectql/src/registry.ts(keepPackagelessActionOwnerKeys与移除时的packagelessActionEntryToRetire)、packages/runtime/src/action-execution.ts(packagelessActionOnRouteBeside)、packages/runtime/src/action-package-addressing.test.ts末尾的新 describe。pnpm --filter @objectstack/runtime exec vitest run src/action-package-addressing.test.ts -t "own key",预期 12 个测试全绿。What changes
Rule: an action is identified by
(owner, owning object, name)(ADR-0150 D4). The platform's package-less action bound toleadand the environment's object-less action of the same name are two items under two keys, never one contested name. Binding first, then owner:/actions/lead/NAMEserves the platform's item bound tolead; the environment's object-less item serves every other route; ADR-0150 D3's environment-first applies within one key, so the environment changesleadby authoringNAMEbound tolead. On every route the declaration the gates judge and the handler the dispatch runs are one item's.packages/objectql/src/registry.ts: a package-less action registered over the bare slot keeps the slot's present item when its owner key is another, in that key's own slot (keepPackagelessActionOwnerKeys). One key keeps one item, the later registration; a stored row replaces the name's stored row on any key (the environment's store holds one row of a name). The bare-slot readers (bareSlotEntriesOf,boundServedActions) see each key's item; the removal of a stored row retires that row, never the platform's item of another key, and the next key's item takes the bare slot. NewgetEnvironmentScopedActions(name): the environment-scoped action items of a name, one per owner key.packages/objectql/src/action-package-addressing.ts,package-scoped-resolver.ts: the owner-key view (actionOwnerScopedRegistry) reads the environment-scoped action on its own key;PackageScopedRegistrygains the optionalgetEnvironmentScopedActions.packages/runtime/src/action-execution.ts: the bare route takes the package-less action on its own key, bound first, then object-less (packagelessActionOnRouteBeside), where the by-name read answered another key's; beside one package holder the platform's item alone on the bound rung is served (platformItemOnBoundRung); the environment address/actions/_env/OBJECT/NAMEanswers404where another package-less action of the name is bound toOBJECT./actions/lead/NAMEanswers what the platform'slead-bound item alone answers there (no declaration); the caller-package route; the stored-row (sys_metadata) model.Tests
packages/objectql/src/action-package-addressing.test.ts, new top-level describe "the registry keeps one package-less action per owner key": 6 cases (4 pins, 1 one-key pin that holds on main, 1 control).packages/runtime/src/action-package-addressing.test.ts, new top-level describe "a route serves the package-less action on its own key, and runs that item's handler": 12 cases —leadserves the platform's item and runs its handler, and itsrequiredPermissionsgatelead(403 PERMISSION_DENIED), each in both registration orders beside 0 and 1 package holders; the environment's object-less item serves every other route in both orders beside 0, 1 and 2 holders (the 0-holder case a control); beside 2 holdersleadanswers no declaration; the environment address; controls: one key keeps one item, each package-less item alone.Acceptance notes
scripts/ablation-replace.mjs(anchor 1 to 0, blob changed), restored to the HEAD blob withgit diff HEADempty:ablation-dist-preflightmarker absent from 8 built files, present in 4 after the restore build): objectql 4 red / 2 green (the one-key pin and the control), runtime 8 red / 4 green (the controls and the one-key pin).lead, 0 holders), 10 green.lead, 1 holder), 10 green.[#32751], andcase 2of[#32365]) keep their answers; the change is scoped so they hold.packages/objectql/src/registry.tsin the object-extension follow area; it has merged and this branch carries it; no hunk is shared. None of the 55 open pull requests read before the open touches the seven files of this diff.Verification
All readings on head
8f2c22d91d(after mergingorigin/main) unless named.Package suites and typechecks
Derived gate families (dispatch-gates --commands, reconciled with --ran)
Dogfood battery
Generated by Claude Code