Repository navigation
feat(spec): an object extension places the fields, groups and child lists it brings (place) - #36236
Conversation
…ists it brings (place)
An objectExtensions entry gains `place`: { field, group, after|before },
{ group: {...}, after|before } and { list, after|before, label?, columns? }.
The parse refuses a placement of a field the extension does not add, both
anchors at once, an item placed twice or next to itself, and a field whose
own group disagrees with its placement. defineStack refuses a list (or a
placed group's relatedList) that is not a child object of the extension's
own package pointing at the target, and a group key the target declares.
Claude-Session: https://claude.ai/code/session_01L6bhgUxeTKkCvZ2iariHQf
Co-Authored-By: Claude <noreply@anthropic.com>
…place, and os validate names a placement that will not land The fold places each extension's own fields, groups and child lists after every contributor's fields are merged, in ascending priority then package name, so the record page, the forms and Studio read one arrangement. Where the extended object declares no relatedLists / fieldGroups the automatic arrangement stays and the boot log names the placement (Sales ruling 7073014077, arm (a), one switch). An item that is not the extension's own is skipped and named. The manifest loop carries place onto the extension def. os validate warns on a placement not applied and on a missing anchor. Claude-Session: https://claude.ai/code/session_01L6bhgUxeTKkCvZ2iariHQf Co-Authored-By: Claude <noreply@anthropic.com>
…he parent's relatedLists, and Studio shows it with its source Flips the hiding #35923 shipped (Sales ruling 7073014077): an unplaced list whose child belongs to another package than the parent shows at the end of the tabs, before a trailing approvals / stream run; a placed one sits at the entry the server splices in. A child of the parent's own package, or one no package owns, is still the parent's to list. Studio's tab-list editor shows such a list read-only with a from-package badge and previews it where the record page draws it. Claude-Session: https://claude.ai/code/session_01L6bhgUxeTKkCvZ2iariHQf Co-Authored-By: Claude <noreply@anthropic.com>
… D10 notes, and regenerated artifacts The semantic entry object-extension-place-and-cross-package-lists states the flip of #35897's hiding for a child list another package brings; the #35897 entry's later-change clause now points to it. Type aliases for the three placement schemas, so the reference docs import them. Claude-Session: https://claude.ai/code/session_01L6bhgUxeTKkCvZ2iariHQf Co-Authored-By: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 44 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 15 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 176 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 1140eed193f9f1e2669f0c3193134eb76d3c8a95 && git checkout 1140eed193f9f1e2669f0c3193134eb76d3c8a95
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 76cb36661da9dba890c83e2130ff624f1ed29e90 42d56e66cbcb04222ddfae95496b5f17d0542db2 && git checkout -B drift-repro 76cb36661da9dba890c83e2130ff624f1ed29e90 && git merge --no-ff 42d56e66cbcb04222ddfae95496b5f17d0542db2
node scripts/docs-audit/affected-docs.mjs --json 76cb36661da9dba890c83e2130ff624f1ed29e90
|
… pinned to parse Claude-Session: https://claude.ai/code/session_01L6bhgUxeTKkCvZ2iariHQf Co-Authored-By: Claude <noreply@anthropic.com>
The field and list placement schemas have one shape, so they are pinned isomorphic; the group placement nests ObjectFieldGroupSchema, which has a parsed shape, so it gains ObjectExtensionGroupPlacementParsed. api-surface and export-origins regenerated. Claude-Session: https://claude.ai/code/session_01L6bhgUxeTKkCvZ2iariHQf Co-Authored-By: Claude <noreply@anthropic.com>
…not tracker ids `os migrate meta` prints a semantic entry's reason verbatim, and its pin refuses a tracker id there. The new entry and the clause it narrows in related-lists-declared-is-tab-list now point at each other by entry id. Claude-Session: https://claude.ai/code/session_01L6bhgUxeTKkCvZ2iariHQf Co-Authored-By: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Posted 2026-11-22T04:22Z. The brief handed to the isolated schema-face reviewer for PR #36236 ( Contract review brief — PR #36236 @
|
|
repo:objectstack#1 · os-sales · session_01L6bhgXtcSJVbw8Gny1ERbP 维护者速读扩展包声明「我的字段、分组、子表排在原对象哪一项后面」这件事整体做对了,按你 02:36 的两条裁定:原对象声明了页签表或分组才生效,没声明就照旧并在启动日志里说明;别的包装上的子表不再被页签表藏起来,没写位置的排在页签末尾(审批、动态之前)。合并只在服务端做一次,记录页、表单和 Studio 看到同一个结果;Studio 保存时不会把扩展包的位置写进原对象。 席位核对 — REWORK (L1-c) · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Contract reviewServed-tier: Reviewed 2026-11-22T04:28Z on PR #36236 (card #35901), read-only: the net diff against ① Derived judgments
② Semver levelClause-②: yes (widening) The changeset declares the protocol kind ③ Boundary flags
④ Design judgment
Both migration entries: the new entry states the flip, the unchanged cases and the census; I confirmed the HotCRM half of the census. The one-clause edit to the #35897 entry points at the new entry. Hold. ADR-0085 note and ADR-0146 D10 note: add-only, dated, and they agree with the ruling. The D10 sentence "refused at parse or at Implementing files: the fold wiring, the manifest loop, the once-per-registry notes, Findings:
S1 to S4 each earn a delta review of their fix. Implemented-by: VERDICT: PASS |
…ery door, and anchors resolve in any order Review round 1 on the placement change: - The merge judges a placed group's relatedList as it judges a list placement, skipping it on a foreign owner, and drops from a placed group's fields any name the extension does not own: a manifest body reaches the registry unparsed and the stored object_extension door runs no defineStack. - A field is owned by where it comes from: an owner field an extension redeclares for its display, or a field an earlier extension declares, is not the extension's to place (skipped in the merge, refused by defineStack where the extended object is in the stack). - Each pass places in rounds, so an anchor another placement brings is found whatever the order, as os validate already assumed. - A list placement's columns are judged by validateRelatedListRefs as a relatedLists entry's are. - Prose: the place describe, the #35897 entry's history sentence, the ADR-0085 and ADR-0146 notes, the guide and the changeset's HotCRM line. Claude-Session: https://claude.ai/code/session_01L6bhgUxeTKkCvZ2iariHQf Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgUxeTKkCvZ2iariHQf
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Posted 2026-11-22T05:16Z. Delta brief for the schema-face reviewer on PR #36236 ( |
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Contract reviewServed-tier: Delta review 2026-11-22T05:18Z of PR #36236 (card #35901), read-only. It follows the record on Earlier findings:
① Derived judgments
② Semver levelClause-②: yes (widening) Unchanged: protocol kind ③ Boundary flags
④ Design judgment
Migration entries and ADR notes: the #35897 entry's sentence is now history and points at the new entry; the ADR-0085 note states that the parent cannot hide another package's list; the ADR-0146 note states ownership by origin and that the merge judges every door. Add-only, and they agree with the code and the ruling. No must-fix, no should-fix.
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-sales · session_01L6bhgXtcSJVbw8Gny1ERbP 维护者速读上一轮唯一的必改项已修好:扩展包在分组里点名别的包的子列表,现在合并时会跳过并在启动日志里写明是谁的列表,不会再把主对象自己的列表挪走;通过已存的扩展记录(不经过 defineStack)进来的也一样拦住。Fable 复核提的另外几条也一起做了:扩展包不能挪它只是"重新声明显示属性"的主对象字段;锚点不管书写或注册先后都能找到;列表放置的列名按 relatedLists 同样规则检查。两条文字小问题已改。新头 席位核对 — ACCEPT (L1-c, delta) · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob 维护者速读扩展包(比如 HotCRM 的模块往别人的对象上加字段)现在可以用 Tier H approval request · 2026-11-22T05:20Z · @os-zhuang, PR #36236 (#35901, epic #35896) is ready for your review on head Why it needs a human. It touches governed paths, What it does. Reviews.
Gates.
Still owed after merge. A later #35902 slice flips the skills' cross-package sentence to match (seat 4 holds it). After your approval, the seat readies this PR and lands it through the queue. The PR carries |
…ension its new manifest dropped (objectstack-ai#36325) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_ Fixes objectstack-ai#35609 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:开发者在本地开发热重载时删掉扩展包给别人对象加字段的声明、或升级/重装一个不再加这些字段的扩展包后,这些字段会立刻从对象上消失,不再需要重启。 - 为什么做:修复「扩展包升级后旧字段还挂在对象上」的数据配置错误,替做扩展包升级和本地开发热重载的构建者解决。 - 出错会怎样:最坏情况是某个包重新注册时误撤了它仍声明的扩展字段,字段在界面和接口上暂时消失;已存数据不受影响,回滚此改动或重启即可恢复。 - 要你做什么:无。 ## What changes `SchemaRegistry.replacingPackageBody` (the wrapper around every `ObjectQL.registerApp` body registration, which since objectstack-ai#33050 withdraws the items a new body no longer ships) now does the same for object extensions: - Before the body registers, it notes the package's current `extend` layer of each object. After it registers, a layer that is a new contributor is one this body wrote (the extend splice always replaces the package's layer with a new contributor). - The layers the previous body wrote, for objects the new body no longer extends, are withdrawn through `withdrawObjectExtension`, the existing per-object withdrawal the `object_extension` item delete uses (uninstall's package-wide walk is not reused: it also removes owned objects). Only the very layer the previous body wrote is withdrawn, so a layer another door registered under the package id since (the `object_extension` item door) is kept. - `withdrawObjectExtension` now records the object's layers in an open registration run before it removes one (`noteObjectEntry`), so a refusal later in the run (a later artifact member, the run-end follow door) puts the extension back. Outside a run this is a no-op, so the item-delete caller is unchanged. - The record (`packageBodyExtensions`) is put back on refusal and forgotten by `uninstallPackage`, beside `packageBodyItems`. Everything an extension contributes rides on its one contributor layer (fields, `fieldPatches`, label texts, validations, indexes), so all of it leaves together. Stored data is untouched: the column keeps its values and schema sync drops nothing; the field is no longer served. ## Measure first (the card's steps), on main `c30ce97cd7` | Path | Re-registers without uninstalling? | Dropped extension's field still served on main? | What said anything | |:--|:--|:--|:--| | Bare `registerApp` (card repro) | yes | yes: field, validation and index all served, `com.t.mod:extend` layer kept | nothing | | `os dev` reload: `metadata:reloaded` → `ObjectQLPlugin.refreshReloadedPackages` → `registerApp` | yes (refresh, never uninstall) | yes | nothing: no warn, schema sync adds only | | `os dev` reload, full standalone composition (`createStandaloneStack`, the artifact door's `_reloadAndAnnounce`) | yes | NOT MEASURED on this composition: neither the first run nor the hand-over round got the shared verify lock (the round queued about 80 minutes behind two dogfood batteries). The probe is written (a two-package composed artifact, the extension dropped by the door's own reload, plus a CONTROL reload) and is held by the seat; it reaches the same `metadata:reloaded` hook measured in the row above | nothing | | install-local upgrade 1.0.0 → 1.0.1 dropping the extension (`manifest.register`, no uninstall) | yes | yes: `crm_line` served and `find` returned `cb_account` | the dry run's plan DID say so: `plan.fields.removed` names `crm_line.cb_account`, `environment.columns` `reasons: ['removed'], rows: 1`; removed fields need no confirmation (`schemaUpgradeVerdict`: reported, refused by nothing), so the upgrade answered 200 and then kept serving the field the plan said was removed | | install-local re-install of the same id and version without the extension | yes | yes | nothing | Stored column, both before and after the fix: `crm_line.cb_account` keeps its column and its value `ACME` (schema sync drops no column). After the fix every row above reads "no": the object serves `name` only, `find` no longer returns `cb_account`, the column still holds `ACME`, and the dry run's plan is unchanged (it already named the field as removed; now the runtime agrees with it). ## Tests - `packages/objectql/src/reregister-extension-withdraw-35609.test.ts` (new): re-register without the extension (fields, validation and index gone, owner kept); CONTROL rename; another package's extension of the same target untouched; same body again keeps it; an extension registered under the id outside a body kept; a refusal later in the run puts it back (and the record with it); the reload door drops it, CONTROL reload keeps it. - `packages/cloud-connection/src/marketplace-install-local-reregister-extension-withdraw-35609.test.ts` (new): real kernel, SQL driver, real schema sync, the install-local door: upgrade dropping the extension (plan names the field, object no longer serves it, column keeps its value), same-version re-install, CONTROL upgrade keeping it. <details><summary>Readings (ablation: the four fixed objectql files put back to main, then restored byte-identical to HEAD)</summary> One locked run, `unfixed-vs-fixed` legs over the same two commands. The objectql and cloud-connection suites both resolve `@objectstack/objectql` to `packages/objectql/src` (stack frames read `../objectql/src/...`), so no dist rebuild was involved; the on-disk proof is the marker count (`packageBodyExtensions` in `registry-items.ts`: 0 in the unfixed leg, 9 in the fixed leg) and the restore was proven by an empty `git diff HEAD` and matching `git hash-object` = `HEAD:path` for each file. - UNFIXED (main's four files): `reregister-extension-withdraw-35609.test.ts` 5 failed / 3 passed (the controls pass), `package-refused-upgrade-keeps-installed` and `manifest-service-artifact-refusal-restores` green: `Tests 5 failed | 76 passed (81)`. Install-local readings: `served after upgrade [ 'cb_account', 'name' ]`, `find` returns `"cb_account":"ACME"`, re-install without the extension `[ 'cb_account', 'name' ]`. - FIXED (HEAD): `Test Files 3 passed (3) · Tests 81 passed (81)`; install-local `served after upgrade [ 'name' ]`, `find` row has no `cb_account`, `column after upgrade {"hasColumn":true,"values":["ACME"]}`, re-install without the extension `[ 'name' ]`. - `pnpm --filter @objectstack/objectql test` at the fix (objectql src as on head `555ef3e2c7`): `Test Files 627 passed (627) · Tests 14240 passed (14240)`. - `pnpm --filter @objectstack/objectql typecheck`: exit 0 (`tsc --noEmit`, then `check:test-typecheck: OK`, debt held). </details> ## Acceptance notes - Clause-②: no. Nothing is refused: a body registered again is never refused over an extension it drops; the dropped layer is withdrawn. - Owned objects a re-registered body no longer ships are still kept until a restart; `ingestReloadedObjects`' docblock calls that deliberate ("same lifecycle as their tables"). Not touched here. - `ObjectQLPlugin.refreshReloadedPackages`' docblock still says items removed from the artifact stay registered until restart; that has been out of date since the item withdrawal landed and is now out of date for extensions too. Not edited (outside this card's file surface). Carried by objectstack-ai#36328. - Inferred, not exercised: a withdrawal (this one, an uninstall, an `object_extension` item delete) is not asked the run-end record-currency follow door, which judges registered layers only. A withdrawn extension carrying a currency code field another package's amount follows would leave that pair unjudged until the follower re-registers. Same gap for the two existing withdrawal doors; not filed. Carried by objectstack-ai#36328. - Inferred edge: if a withdrawn layer was the object's last contributor (an extension with no owner, already an ADR-0029 violation), the entry is closed and a refusal later in the run restores the contributor list without reopening the entry. Unreachable through a valid registration. - Serial constraint: objectstack-ai#36236 (shares `registry.ts`, and places extension items in the fold) has since landed on `main` as `d33bf5a2`. `overlap-check` against `origin/main` `d8599c2ca2` reads clean, and GitHub reports the PR mergeable. This PR's CI ran on the merge with `99fbaa6d`, before objectstack-ai#36236 landed, so the joint tree is first tested in the merge queue. Read, not run: a placement rides on its extension's contributor layer and is applied in the fold, so a withdrawn layer takes its placements with it. `registry-object-registration.ts` is not touched. - Prior rulings: `check-prior-rulings --card 35609` over the four files read; no conflict. The closest precedents are the item withdrawal this extends (same wrapper, same restore discipline), ADR-0144 D2/D6 (the run-end follow door, unchanged), ruling A on objectstack-ai#35228 (one extension per target per package, unchanged) and ruling 6624345766 (facade form: `registry.ts` gains only a state field, docblocks and host wiring; `check:facade-delegation-only` green). Since main grew `registry.ts`, the file also sits under its facade line ceiling (6426, ruling 6897467376): the long objectstack-ai#35609 prose lives in the facet docblock in `registry-items.ts`, and the ceiling is not raised. ## Verification <details><summary>Merge-queue red at 555ef3e, fixed at 368b000 (repo:objectstack#7)</summary> - What failed: the merge queue dequeued this PR (merge-group run 45007098161, job 137160994478, `Lint · repo & tooling gates`). `check-facade-delegation-only --self-test` case N6 printed: `the committed registry is red: is 6441 lines, over its line ceiling of 6426 by 15`. The PR was green on its own head. Main had grown `registry.ts` to 6409 lines, and this PR's +32 went over the ceiling. - Fix (`53d2506ddb`, `368b000bed`): merged `origin/main` `4e55e4eb72` (a merge, no rebase, no force-push). Then I did what the rule says to do: "a file in facade form does not grow". The detailed extension-withdrawal prose moved from the facade docblocks to the facet docblock on `ItemsFacet.replacingPackageBody` (`registry-items.ts`). The facade keeps a short contract paragraph, and the field doc is one line. The ceiling row is untouched, so the check is not weakened. - Comment-only proof: both files were transpiled with `removeComments`, before and after `368b000bed`. Each pair is byte-identical (`registry.ts` sha256 prefix `b87e53ad1efa` both sides, `registry-items.ts` `afb1b850be15` both sides). A control leg with one injected token compared different (cmp exit 1). - `pnpm check:facade-delegation-only`: exit 0. `N6 the committed registry is well-formed against this checkout` passes, and the check prints `packages/objectql/src/registry.ts: 6421 lines, ceiling 6426 (5 left; ruling 6897467376)`. - `dispatch-gates --commands` at `368b000bed`: 73 derived. 71 exit 0. `check:dual-build-cjs-loads` and `check:type-check-debt` exit 3 (PREREQUISITE NOT MET: no full `dist/`), so NOT MEASURED locally and carried by CI's Build Core and debt-ledger lanes. `--ran` with exit codes: 73 derived, 71 run, 2 NOT-MEASURED, 0 unrun. Gate derivation read a tree 7 commits behind the newest `origin/main` `ff60149900`. None of this PR's files moved there, so I did not merge again. - `overlap-check --branch`: `VERDICT clean exit 0` against `origin/main` `ff60149900`. - NOT MEASURED locally: the `@objectstack/objectql` test suite and typecheck at the merged head. Reason: the shared verify lock. Three 9-minute tries all ended in queue-timeout behind a dogfood battery (holder pid 13599, more than 39 minutes). This is a declared narrowing. The fix commit compiles to identical JS (proof above), and CI's Test Core and Type Check lanes run both on the merge. The objectql dependency closure did build under the lock (`VERDICT command-exit 0`). </details> <details><summary>Local gates at 555ef3e</summary> - `dispatch-gates --commands`: 73 commands derived; all run. 70 exit 0. `check:query-options-erasure` went red (test surface 236 to 237) on a cast in the new cloud-connection pin; fixed in `555ef3e2c7` and re-run green (236). `check:dual-build-cjs-loads` and `check:type-check-debt` exited 3 (PREREQUISITE NOT MET: no full `dist/`, and the closure build never got the shared lock): NOT MEASURED locally, CI's `Lint & Repo Gates` carries both. - Re-run on the final head after the last edit: `cross-package-test-inputs`, `test-source-alias`, `nul-bytes`, `refd-timer-probe`, `tier-file-adoption`, `issue-citations`, `doc-authoring`, `facade-delegation-only`: all exit 0. - `dispatch-gates --ran`: 73 derived, 73 run, 0 unrun. - `overlap-check --branch=HEAD`: clean against origin/main and objectstack-ai#36236. - Not run locally, declared to CI: `test:repo`, the full cloud-connection suite (only the new file was run), and the Build Core / Type Check workspace lanes. CI has since run all of them at this head (round below). - Dogfood battery: not owed (no `!`, no narrowing arm). </details> <details><summary>Hand-over round (repo:objectstack#7) at the same head 555ef3e: the local gaps closed</summary> No commit in this round; the head declared final stays `555ef3e2c7`. CI ran this head on the merge with `99fbaa6d` (`b97f554d`), and every gate-carrying check-run concluded `success`. - Cloud-connection new file, rerun after the cast removal: `Test Core` at this head, `@objectstack/cloud-connection:test` printed `src/marketplace-install-local-reregister-extension-withdraw-35609.test.ts (3 tests)` passed. The objectql file printed `src/reregister-extension-withdraw-35609.test.ts (8 tests)` passed. All 10 `Test Core` shards: success. - Cloud-connection typecheck: `Type Check · workspace` ran `@objectstack/cloud-connection:typecheck`; `Tasks: 124 successful, 124 total`; success. - `check:dual-build-cjs-loads`: `Build Core` step "Every published require entry point actually loads": success. - `check:type-check-debt`: `Type Check · debt ledger` step "Re-measure the type-check DEBT / TEST_DEBT ledger": success, lane verdict success. - Derived gates re-run locally at `555ef3e2c7`, against `origin/main` `c448c615`: `dispatch-gates --commands` derived 73 commands. 68 exited 0. Five exited 3, PREREQUISITE NOT MET (no built `dist/`; the closure build never got the lock). CI carries all five at this head with success: `dts-closure` (Build Core "Sweep the built closure for vanished declarations"), `dual-build-cjs-loads`, `lean-entry-closure` (Build Core "The lean engine entry loads no forbidden or unlisted package"), `sourcemap-no-sources-content` (Build Core "No published source map embeds source text") and `type-check-debt` (above). `dispatch-gates --ran` with the exit codes recorded: 73 derived, 68 run, 5 NOT-MEASURED (derived from exit 3), 0 unrun. - Still NOT MEASURED: the full `createStandaloneStack` reload probe. Reason: the shared verify lock. This round queued about 80 minutes behind two dogfood batteries (holder pid 5424 over 67 minutes), and retaking the same slot after each exit 99 put the call back behind newer arrivals. No CI job runs this probe. </details> Two-minute check: `pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/reregister-extension-withdraw-35609.test.ts` prints 8 passed; revert `registry-items.ts` to `origin/main` and the same command prints 5 failed. Read first, by risk: `packages/objectql/src/registry-items.ts` (`replacingPackageBody`, the identity test that decides which layers the body wrote), `packages/objectql/src/registry-platform-global.ts` (`withdrawObjectExtension` now notes the run), `packages/objectql/src/registry.ts` (host wiring and the record). Written by repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh (PM-dispatched dev run); continued after the hand-over by repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jTeURPvEm465RcoYEC <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC --> --------- Co-authored-by: Claude <noreply@anthropic.com>
objectstack-ai#35928) (objectstack-ai#36316) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XTRdLmK9YYgMSCJ7NH2PuUY)_ repo:objectstack#7 · zhuangjianguo · session_01QsR2jVTYADzVWfarACx5j3 Fixes objectstack-ai#35928 Clause-②: yes (widening: one new public read, `POST /api/v1/automation/_record-starts`, and the UI exports that read it) Metadata-protocol: added Skills-docs: none — no skill under `skills/**` teaches the console's stage confirms; `content/docs/automation/flows.mdx` and `content/docs/frontend/plugins/plugin-grid.mdx` document the read and the list in this change. Ruling-ref: 7073655354 ## 维护者速读 - 用户在列表单元格或记录页改阶段时,确认框在原来那句话下面列出这次改动会启动的流程名称(按用户语言显示),带审批的流程标「发起审批」;以前只写「可能触发相关自动化」。 - 属于行内编辑专题,按维护者的裁定「能改这条记录的人都看到流程名称」,让用户确认前就知道保存后会发生什么。 - 出错时最多是清单少列或不显示,确认框退回今天那句话,保存本身不受影响;整个改动可以直接撤回。 - 无。 ## What changes **Server (one new read).** - `@objectstack/spec/api`: `RecordUpdateStartsRequestSchema` (`{ object, recordId, changes }`, strict), `RecordUpdateStartSchema` (`{ name, label, startsApproval }`), `RecordUpdateStartsResponseSchema`, and the contract entry `listRecordUpdateStarts` (`POST /api/v1/automation/_record-starts`). `_record-starts` joins the `/automation` domain's reserved position literals (underscore-led, so the package-namespace install gate is not narrowed). - `@objectstack/spec/contracts`: `RecordUpdateStartsInput` and the optional `IAutomationService.listRecordUpdateStarts`. - `@objectstack/spec/automation`: `recordChangeTriggerHookEvents` / `recordChangeTriggerFiresOnUpdate`, the record-change token grammar MOVED out of `@objectstack/trigger-record-change` (whose `triggerTypeToHookEvents` now delegates to it), so the trigger and the preview read one rule. - `@objectstack/service-automation`: `AutomationEngine.listRecordUpdateStarts` (`record-update-starts.ts`). A flow is asked only when it is enabled and armed on a `record_change` trigger for this object whose token binds an update; whether it starts is `startConditionHolds`, the one start-condition gate every run attempt passes, over the variables `seedRunVariables` seeds (`record`, its flattened fields, `previous`). The approval mark is the presence of an `APPROVAL_NODE_TYPE` node (ADR-0019). A condition that throws is not listed. Hooks are never listed (ADR-0077 §2). - `@objectstack/runtime`: the `/automation` domain's `_record-starts` door, mounted in the dispatcher plugin and recorded in the route ledger. Order: query parameters refused `400 VALIDATION_ERROR`; body parsed through the request schema (`400 VALIDATION_FAILED`); `501` when the engine has no preview; the record read AS THE CALLER through the `/data` door's own `get` (`callData`), so an unreadable record answers `404 RECORD_NOT_FOUND` exactly like an absent one and the engine is never asked; a read that answers no record is refused the same `404`; every `changes` key must be a declared field of the object (else `400 VALIDATION_FAILED` on `changes.KEY`, the engine never asked); then the engine is handed `previous` = the record read, `record` = that record with `changes` applied, and the caller's `userId` / `tenantId`. Anonymous `401`. - `@objectstack/client`: `client.automation.listRecordUpdateStarts(request)`. **UI (two confirms, one reader).** - `@object-ui/plugin-detail`: `stageChangeStarts.tsx` — `useRecordUpdateStarts(ask)` (asks the route once per pending move through the host's `apiFetch`, parses the answer through `RecordUpdateStartsResponseSchema`, answers `[]` while in flight, refused, failing, malformed or empty) and `StageChangeStarts` (the list under the sentence: each flow by its label translated through `activeFlowsBundle` + the spec's `translateFlow`, the flow runner's reading; an approval flow marked). Exported for the grid. - Record page: `recordPathStageChange.tsx` draws it in both confirmations (the path's `AlertDialog` and the header stage menu's `RequiredFieldsDialog`, via a new optional `notice` slot in `@object-ui/fields`). - List cell: `ObjectGrid`'s state-machine confirm draws it; `StateChangeConfirm` gains an optional `ask` (the row's record id and the move). - `@object-ui/i18n`: `activeFlowsBundle` moves here from `@object-ui/app-shell`'s module-internal `utils/flowsBundle` (its three app-shell importers repointed), since the confirms' packages do not depend on the console; two keys in all eleven packs: `detail.stageChangeStartsHeading`, `detail.stageChangeStartsApproval`. - The confirm's sentence is never replaced (not this card: objectstack-ai#35685 S3). A move that starts nothing, and a failed read, leave the confirm exactly as today. Docs: `content/docs/automation/flows.mdx` (§ Which flows a record update would start), `content/docs/frontend/plugins/plugin-grid.mdx` (the confirm now names the flows). Changesets: `35928-record-update-starts-read.md`, `35928-stage-confirm-names-flows.md`, both carrying the Clause-② and Metadata-protocol lines. ## Tests - Engine `record-update-starts.test.ts` (8): condition holds / does not hold; approval mark CONTROL (an approval flow and a plain flow side by side); no condition; create / delete / other object / obsolete never named while `record-before-write` is; an unevaluable condition not named; an unarmed engine answers nothing; `current_user` evaluated as the writer named. - Door `automation-record-update-starts.test.ts` (13): a member is answered (body parsed through the response schema) and the engine is handed exactly the record read as the caller; empty list; unreadable record `404 RECORD_NOT_FOUND` with the engine never asked; unreadable and absent answer alike; anonymous `401` before any read; malformed body `400 VALIDATION_FAILED`; query parameter `400 VALIDATION_ERROR`; `501` without the preview; a GET of the literal is not this door.; a change key that is not a field `400 VALIDATION_FAILED` on that key (an undeclared key, a key off the field-name grammar, an inherited member name), the engine never asked; a change on an object the registry does not declare refused alike; a read that answers no record `404 RECORD_NOT_FOUND`, never previewed; and the ledger row names `RecordUpdateStartsRequestSchema` / `RecordUpdateStartsResponseSchema`, as the clone and publish-drafts suites pin theirs. - Spec `automation-api.zod.test.ts`: contract count and the new entry's method/path; request strictness; a leaked `condition` / `nodes` dropped by the response parse. Each `changes` key is held to the field-name grammar (refused: a dotted, an upper-case, a digit-initial, a spaced and an empty key). - List cell, in its confirm's harness `ObjectGrid.autosave-35685.test.tsx` (new top-level describe, 3): list (request body pinned, labels, approval mark under the unchanged sentence), empty, failure (and Change still saves the move). - Record page, in each confirm's harness (new top-level describe in each, 3 + 3): `record-path.stageChange-28199.test.tsx` (the path's confirmation) and `RecordStageMenu-35891.test.tsx` (the header stage menu's dialog): list, empty, failure (a refused read, a network error and a malformed envelope each draw no list). - `stageChangeStarts-label-35928.test.tsx` (2): a flow named by its translation where the app's `flows` bundle has one, by its authored label where not; nothing drawn for no flows. - Ablation (one-shot under the verify lock, restored by trap, `git diff HEAD` on both sources empty): removing the `StageChangeStarts` render from `ObjectGrid.tsx` and from both confirmations in `recordPathStageChange.tsx` turns exactly the three `list:` pins red (`Tests 3 failed | 6 passed`); empty and failure pins stay green, as they should. ## Acceptance notes - Card acceptance: "Changing a stage that starts a flow shows that flow by name in both confirms" — pinned in both confirms (list cell, and both record-page confirmations) and measured live (below); "a stage with nothing attached shows no list" — the empty pins; "a read failure falls back to the generic sentence" — the failure pins. - Residual, stated in the contract docblocks and `flows.mdx`: the preview binds the caller's user id and tenant only, not their positions, request params or expand as a live run does, so for a condition reading those the preview can differ from the save in either direction (it can miss a flow, or list one a negated test of the writer would stop); the seat files the follow-up for positions. - Residual (not widened here): conditions are judged on the record as the CALLER reads it (field-level security applied), so a condition that reads a field the caller cannot see is judged on what they see, and one that throws on a missing field is not listed. The preview can therefore under-list for a caller with masked fields; it never reveals a masked value. Documented in `flows.mdx`. - Residual: the header stage menu's dialog asks with the stage alone; values typed into that dialog for required fields are not part of the preview's `changes`. - Two existing confirm suites (`RecordStageMenu-35891`, `record-path.stageChange-28199`) now stub `fetch` with a `501` answer in `beforeEach`, so the new read does not leave for the network under test; no existing assertion changed. Across the touched UI packages the run shows 0 `ECONNREFUSED`. - The approval mark is the ruling's test, "the flow contains an approval node". Measured live, showcase's `showcase_project_closure` reaches its sign-off approval through a `subflow` node (the approval node lives in `showcase_closure_signoff`), so the preview lists it with `startsApproval: false`. Following subflow references for the mark is a reading beyond the ruling: filed objectstack-ai#36322. - Overlap (`overlap-check.mjs` at the head below, exit 1, reported and not merged around): objectstack-ai#36296 and objectstack-ai#36236 have landed and are merged in. objectstack-ai#36335 (part of objectstack-ai#35979) moves `activeFlowsBundle` into `@object-ui/i18n` too and conflicts in `ui/packages/i18n/src/flowsBundle.ts`, `ui/packages/i18n/src/index.ts` and `ui/packages/app-shell/src/views/metadata-admin/previews/flow-label-translations.tsx`; it lands after this PR and drops its copy of the move. Every other open PR that shares a file merges cleanly. - Declaration correction: the claim and ruling 7073655354 read `Metadata-protocol: none`, but the three new `@objectstack/spec/api` schemas enter the `api` authorable-surface shard (10 keys), which `Check Changeset` reads as `added` (`none-baseline-moved`). The line is `added` and `@objectstack/spec` is graded `minor`, as objectstack-ai#32251, objectstack-ai#35789 and objectstack-ai#31883 were for new api request/response schemas. No flow or other metadata key is added, so the ruling's "no new authorable key" still holds. ## Verification - Read first: `packages/runtime/src/domains/automation.ts` `respondToRecordUpdateStarts` (the order of refusals and the caller-scoped read that admits the engine), then `packages/services/service-automation/src/record-update-starts.ts` (which flows are asked and the one gate they pass). - Live, on a fresh showcase (`pnpm dev -- --fresh`), as a member created by the admin (`role: user`, not an admin): - `Website Relaunch` `status: active → completed`: `200 {"flows":[{"name":"showcase_project_closure","label":"Project Closure with Sign-off (nested pause)","startsApproval":false}]}` - same record `→ on_hold` (CONTROL): `200 {"flows":[]}` - same record `budget 150000 → 250000`: `200 {"flows":[{"name":"showcase_budget_approval","label":"Project Budget Approval","startsApproval":true}]}` - an absent record: `404 RECORD_NOT_FOUND`; anonymous: `401 UNAUTHENTICATED`; a body without `changes`: `400 VALIDATION_FAILED` naming `changes`. - Zone 2 premise, measured before any code: the same kind of member reads `GET /api/v1/meta/flow` (200, 33 flows with labels, the admin's set) and `GET /api/v1/meta/flow/showcase_closure_signoff` (200, its nodes). - The console itself was not driven in a browser (its dist is not built in this container); both confirms are pinned through the real components above. - Local, all under `scripts/pm/os-verify-lock.sh` (shared box): - touched UI packages (`plugin-detail`, `plugin-grid`, `fields`, `i18n`): `Test Files 1131 passed | 2 skipped` · `Tests 13186 passed | 38 skipped`; after folding the pins into their harness files the three files plus the label file: `Tests 77 passed (77)`. - type-check: `tsc --noEmit` (src and test projects) for `i18n`, `fields`, `plugin-detail`, `plugin-grid`, and src for `app-shell`; `service-automation`, `runtime`, `client` exit 0. - server: engine 8/8, door 9/9, `route-ledger.conformance` + `automation-api-contract-mounts` + `http-dispatcher` green, client conformance 11, spec `automation-api.zod` + `address-grammar` 87, `trigger-record-change` 122. - `dispatch-gates.mjs --commands` (129 families) run and reconciled with `--ran`: `129 run, 0 NOT-MEASURED`. First pass reds were all this diff's own owed artefacts, fixed and re-run green: spec `gen:api-surface` / `gen:docs` / `gen:export-origins` / `gen:declaration-map` / `gen:strictness-ledger` (api count 533 → 536: the three new schemas), the route-ledger census sentence (149 → 150), and `check:test-source-alias` (a spec/automation alias in the trigger package's vitest config; the door test pays `@objectstack/metadata` at collection). - Re-verified after the hand-over (seat 7), main `b3bcfefc` merged in at `472457d9`, the generated surfaces regenerated at `6bd111ff` (`gen:schema` → spec build → `gen:api-surface` → `gen:export-origins` → `gen:declaration-map` → `gen:docs` → `gen:strictness-ledger`; `check-regen-pending` clear), the changeset correction at `99bfd857`. Under the verify lock at `6bd111ff`: - type-check exit 0: `@object-ui/i18n`, `fields`, `plugin-detail` (src and test; the hand-over's stale-dist red is gone after the closure build), `plugin-grid`, `app-shell`; `@objectstack/spec`, `runtime` (src and test layer, after building `@objectstack/driver-turso`), `service-automation`, `client`, `trigger-record-change`. - tests: `runtime` Tests 11745 passed | 25 skipped; `service-automation` 4224 passed; `client` 820 passed; `trigger-record-change` 122 passed; spec `automation-api.zod` + `address-grammar` 87 passed; `plugin-detail` + `plugin-grid` + `fields` + `i18n` Test Files 1135 passed | 2 skipped, Tests 13300 passed | 38 skipped. - `dispatch-gates.mjs --commands` (129 families): run at `99bfd857` (the six that started before that commit re-run on it) and reconciled with `--ran`: `129 derived, 128 run, 1 NOT-MEASURED, 0 UNRUN`. The one NOT-MEASURED is `check:dual-build-cjs-loads` (exit 3, PREREQUISITE NOT MET: it needs every package's dist, which this container does not build); CI runs it in its Lint jobs, green at this head. - CI at `99bfd857`: every check-run green or skipped by design. Check Changeset shows two runs: the `synchronize` run (09:07Z, before the body said `added`) red, the `edited` run (09:08Z) green. - Contract review rework (L2 at `99bfd857`), at `3ba211dc` and `d2279e6c` (head): - the door refuses a change key that is not a declared field of the object and a read that answers no record; the request schema holds each change key to the field-name grammar; the ledger row is pinned; the preview's caller binding is stated in the contract docblocks and `flows.mdx`; `_record-starts` joins the address module's literal list. - ablation, one-shot under the verify lock (`ablation-replace.mjs`, restored by trap, blob == HEAD and `git diff HEAD` empty after each): the declared-field refusal disabled → `Tests 2 failed | 11 passed` (the two refusal pins); the no-record refusal disabled → `Tests 1 failed | 12 passed` (its pin). - local: `runtime` Test Files 637 passed, Tests 11749 passed | 25 skipped; door suite 13/13 at the head; spec `automation-api.zod` + `address-grammar` 88 passed; type-check exit 0 for `spec`, `runtime` (src and test layer, at `d2279e6c`), `service-automation`, `client`, `plugin-detail`. - `dispatch-gates.mjs --commands` at `3ba211dc`: `129 derived, 129 run, 0 NOT-MEASURED, 0 UNRUN`; the 37 families that read test files re-run at `d2279e6c` (a one-line test-type fix), all exit 0. - CI at `d2279e6c`: 70 check-runs, 61 success and 9 skipped by design, Check Changeset green. - Delta round (L1-d 7078831268, L2 nit N3 from 7078841748), at `41487226` (head): the 401 and 501 pins assert `body.error.code` (`UNAUTHENTICATED`, `NOT_IMPLEMENTED`) beside the status; the spec changeset names the undeclared-change-key `400 VALIDATION_FAILED` and the no-record `404` among the door's refusals; the caller-binding limit reads "can differ from the save in either direction" in the request schema's docblock, `RecordUpdateStartsInput` and `flows.mdx`. Door suite 13/13; type-check exit 0 for `spec` and `runtime` (src and test layer); `dispatch-gates.mjs --commands` at `41487226`: `129 derived, 129 run, 0 NOT-MEASURED, 0 UNRUN`; CI at `41487226`: 70 check-runs, 61 success and 9 skipped by design. https://claude.ai/code/session_01FEkQ5keqTTiV8ptWFNc6ZF https://claude.ai/code/session_01QsR2jVTYADzVWfarACx5j3 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jVTYADzVWfarACx5j3 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…nsions entry; judge residual jobs at composition (objectstack-ai#36338) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_ Fixes objectstack-ai#35711 Clause-②: no (narrowing) Metadata-protocol: narrowed Skills-docs: none — no skill teaches placing `objectExtensions` or `jobs` in a manifest-less input of a `'preserve'` composition; the refusal names both entries and prescribes the fix ## 维护者速读 - 用户能看到什么变化:应用作者把几个包拼成一个产物时,若某个没有包标识的部分给别人的对象加了字段,这些字段现在能正常使用;以前字段直接消失,写入时报字段不存在,启动日志也一句不提。 - 为什么做:拼包产物里不属于任何包的"剩余部分"的对象扩展没有任何环节去登记,属于同一组拼包问题的最后一个漏洞;同时两个没有包标识的部分声明同名定时任务时,拼包不拦、启动时两个都不运行。 - 出错会怎样:拼包时新拦下三种写法(剩余部分里的同名定时任务;剩余部分和持有产物标识的那个包给同一对象各加一段扩展;剩余部分给同一对象加两段扩展,即使别的包也扩展了这个对象),不论选哪种拼包方式,只要产物里带有多个包就会拦;作者会在校验时看到点名两处的报错;已构建的产物照常启动,只多一条错误日志;撤回本次合并即可恢复原状,不涉及数据迁移。 - 要你做什么:无。本次虽然收紧拼包规则,但不在受管范围,座位会在完整回归测试对准最终版本之后自行合入。 ## What changes Measured first, on main `c30ce97cd7`, through the real `os serve` (`packages/cli/bin/run-dev.js serve`, SQLite in memory), on `composeStacks([owner, other, noManifest], { manifest: 'preserve' })`: - **Residual extension.** The input without a manifest extends `probe_account` with `residual_note`. `GET /api/v1/meta/object/probe_account` listed no `residual_note`; `POST /api/v1/data/probe_account` with it answered `400 INVALID_FIELD`; the boot logged nothing about it. `os build` of the same config exits 0 and carries the entry at the artifact's top level (`1 Extensions`), so a built artifact reaches the same drop. Producers: a composition yields `packages[]` beside a residual under `'preserve'` with an input that has no manifest, and under any strategy (`'preserve'`, `'first'`, `'last'`, an index) once an input is itself a multi-package artifact, whose own top-level collections are then residual; a flat composition of inputs that carry no `packages[]` is one package with no residual. - **Residual jobs.** Two inputs without a manifest declaring job `probe_nightly`: `composeStacks` accepted them; the boot (with scheduled work on) logged `NOT SCHEDULED` at `error` and armed neither. The fix, REGISTER rather than refuse, because the residual already has an owner: ADR-0130 D4 registers every residual item under `manifest.id`, and the engine already registers the residual's objects and items there; an extension was the one residual entry no door registered. - **`packages/metadata/src/plugin.ts`.** The residual rule `unclaimedTopLevel` (the one copy every door reads) now lists a top-level `objectExtensions` entry (type `object_extension`) when it names a target and no package body carries an entry EQUAL to it by value. Not by target: the flattened top level repeats each body's entry and a built artifact loses the references, but each copy still holds what its body's entry holds; an equal entry is also the case where nothing is lost. The metadata door still registers no extension (it never registered a body's either). - **`packages/objectql/src/plugin.ts`.** The `manifest` service registers those entries after every body, under the residual's id, through the registry's `extend` verb with the same contribution a body's entry builds: `objectExtensionContribution` (`engine-registration.ts`) is the one reading of an `objectExtensions` entry, and `registerApp` step 2b now builds a body's contribution through it too, so the two cannot drift (it carries `place`, which objectstack-ai#36236 added to step 2b on main). Two follow-ons of registering: - Under `'preserve'` the residual's id is the last input-with-a-manifest's body too, and the registry keeps one extension of a target per package. A residual entry for a target that body also extends (or two residual entries for one target) keeps only the last one's fields; the boot says so once per target at `error`, like the objectstack-ai#35228 arm A1 line for one body. - An entry whose field names a picklist no package body declares is not registered and is named at boot (`warn`), the residual objects' own rule (the boot's picklist audit would refuse the field). - **`packages/spec/src/stack.zod.ts`, the composition door.** The residual door now mirrors that reading: an `objectExtensions` entry is claimed by a body only when a body carries an equal entry; the owner body's entries for a target the residual also extends are judged with the residual's, body first (the boot's registration order), so the objectstack-ai#22934 sentence ("only the last of these entries' fields register") is now true at that door. `jobs` is judged there by name (a body's job name claims the slot), where `TOP_LEVEL_COLLECTIONS_NEVER_RESIDUAL` used to drop it (that set is the owner-stamp mirror and is unchanged). - **The `jobs` row's wording, at every door.** It said only the last entry is kept; the binder schedules none. Now: `The runtime keys jobs by name: the metadata keeps only the last of these entries, and the job scheduler refuses a name two enabled jobs share, so when both are enabled neither runs.` (exact only for two enabled jobs; a disabled one counts no collision). One row, so it stays byte-identical across doors. - ADR-0087 semantic entry `stack-residual-extension-registered-and-jobs-judged`, changeset `minor` for spec, metadata and objectql. Newly refused at composition (`STACK_CROSS_REFERENCE_INVALID`, 422), under every manifest strategy once the result carries `packages[]` (`'preserve'`, and `'first'`/`'last'`/an index with a multi-package input): 1. two residual jobs of one name; 2. a residual extension for an object the body carrying `manifest.id` extends with other fields; 3. two residual extensions of one object, also when another package body extends that object (the claim is by value now; it was by target, so both counted as that body's copies and composed). Unchanged: one residual extension for an object ANOTHER package extends (both register), a residual entry equal to a body's, every package-claimed extension, one residual job. Not refused, a known gap left to the binder (stated in `residualEntryPredicate`'s docblock and the migration entry): a residual job that shares its name with a package body's job, with other content, composes as that body's copy, and the boot schedules neither of the two enabled jobs. Read from code, not driven. ## Tests New pins, named after the card: - `packages/spec/src/stack-residual-extension-jobs.test.ts` — residual job pair refused (code `STACK_CROSS_REFERENCE_INVALID`, status 422, exact sentence); the single-stack door says the same row; residual extension sharing the owner body's slot refused, body entry first; residual extension of a target another body extends composes; two residual extensions of a target another body extends refused (shape 3); `'first'` and `'last'` with a nested multi-package input refuse a residual job pair (with a CONTROL that the artifact carries `packages[]`); an equal entry is a copy; CONTROLS: one residual job composes, each body's own job name, two packages each extending one target, the owner body's own pair reported once. - `packages/metadata/src/unclaimed-top-level-residual-extension.test.ts` — `unclaimedTopLevel` lists the residual entry, composed and as built JSON, never the body's flattened copy; CONTROLS: nothing listed when every extension is a body's, no residual without `packages[]`. - `packages/objectql/src/manifest-service-residual-object-extension.test.ts` — on a kernel through the `manifest` service: the residual field is served (composed and built JSON); it serves exactly what the same entry serves from a body (parity), and a `place`d entry too (anti-vacuity: the placement changes what is served); CONTROL a package-claimed extension unchanged, nothing logged; the owner-slot pair serves the last fields with one `error` line; a dangling-picklist entry is not registered and is named at `warn`. <details><summary>Package suites and typecheck</summary> Head `058d5c2815`. Since f4e83b0 the change is docblocks, the migration entry, the changeset, the `jobs` row's last clause (now "so when both are enabled neither runs") and two spec pins (contract review S1, S2, N3, N4); the spec pin file re-ran here: 13 passed. The objectql and metadata readings below are from f4e83b0 (`origin/main` d8599c2 merged in, then the one-reading unification); neither package changed since. The spec suite's last full run is seat 4's at 5a41a05 (870/870 files, 27886 tests); since then `packages/spec` changed only by the main merge and a type cast, and its pin was re-run here. - `pnpm --filter @objectstack/objectql exec vitest run --project local --maxWorkers=2` — Test Files 628 passed (628), Tests 14272 passed - `pnpm --filter @objectstack/metadata exec vitest run --maxWorkers=2` — Test Files 82 passed (82), Tests 2638 passed - `src/stack-residual-extension-jobs.test.ts` (spec) — 13 passed at 058d5c2 (9 at f4e83b0); `src/unclaimed-top-level-residual-extension.test.ts` (metadata) — 3 passed; `src/manifest-service-residual-object-extension.test.ts` (objectql) — 6 passed - typecheck: `pnpm --filter @objectstack/spec typecheck` exit 0 (tsc, `check:scripts-typecheck`, `check:test-typecheck` OK), re-run at 8f58c38 (058d5c2 adds comments only); `@objectstack/metadata` exit 0; `@objectstack/objectql` exit 0 (`check:test-typecheck` OK). The first objectql run after the unification found TS2345 at step 2b (the shared definition is typed `unknown` per key); fixed in f4e83b0 by handing it to the registry as the residual caller does. - These ran outside the verify lock (declared narrowing): the lock was held by two sibling dogfood batteries for about 100 minutes; the battery below ran under it. </details> <details><summary>Ablation (each fix reverted after commit, through scripts/ablation-replace.mjs; every restore proven blob == HEAD, `git diff HEAD` empty)</summary> - A, metadata listing removed: the metadata pin turns red (1 failed of 3). - B, objectql registration call deleted: the objectql pin turns red (3 failed of 4 at that time). - C, spec `jobs` judged by slot again: the spec jobs pin turns red (1 failed of 9). - D, spec owner-body pairing removed: the owner-slot pin turns red (1 failed of 9). - E (seat 7, at f4e83b0), `place: ext.place` replaced by `place: undefined` in `objectExtensionContribution`: the objectql pin turns red (1 failed of 6, the placement anti-vacuity); restore proven blob == HEAD (cbc7b4d), `git diff HEAD` empty. </details> <details><summary>Real boot (os serve) after the fix</summary> Same probe as the measure-first reading, at 5957d21: `GET /api/v1/meta/object/probe_account` lists `residual_note`; `POST /api/v1/data/probe_account` with it answers a created record. </details> ## Acceptance notes - Measure-first, step 2 (producers): `packages[]` beside a residual comes from `'preserve'` with an input that has no manifest, and from any strategy once an input is itself a multi-package artifact (its own top-level collections are residual); `'first'`/`'last'`/an index over inputs that carry no `packages[]` compose one flat package with no residual. `os build` carries the composed top level as is (`1 Extensions`, exit 0). This corrects the first version of this note, which said `'preserve'` only; the composition door's docblock always said every strategy. - objectstack-ai#36236 landed on main with `place` in `registerApp` step 2b's extension literal. Merging main here, the residual builder would have registered a residual entry without its placement; the two are now one call (`objectExtensionContribution`), `place` included, and the parity pin covers a placed entry. - The residual extension's dangling-picklist judgement reads the stack's own bodies, like the residual objects' rule; a field naming a picklist an already-installed package declares is treated as dangling (not registered, named at boot): conservative, not silent. - The `jobs` row's sentence changed at every door (it said the last entry is kept; the binder schedules none). The objectstack-ai#22934 rows stay one table, byte-identical across doors. - `defineStack` on a hand-built `packages[]` stack judges its whole top level as one package (`stack.KEY[i]`), unchanged here. ## Open items (follow-up cards) - objectstack-ai#36431: a residual job sharing its name with a package body's job (other content) composes and the boot schedules neither (contract review S2, L1). Whether composition should refuse a job name shared across packages is for the maintainer to rule. - objectstack-ai#36432: a residual picklist named only by a residual extension is still refused as unreferenced at validate, build and boot (L1); `packages/metadata/src/picklist-references.ts` still tells authors a composed stack's top-level `objectExtensions` entry is not registered, which after this PR holds only for an entry naming a picklist no body declares (review N1); `sameAuthoredValue` (metadata) hand-copies the spec's `deepEqualAuthored` and no test holds them equal (review N5). - Not carried by either card: `logResidualSameTargetExtensions` also reports an owner-body pair for a target the residual does not extend, a second line beside `registerApp`'s (review N2). ## Verification First files to read (by risk): `packages/spec/src/stack.zod.ts` (`residualEntryPredicate`, `ownerBodyExtensionEntries`, the `jobs` row), `packages/objectql/src/plugin.ts` (`registerUnclaimedTopLevelExtensions`), `packages/metadata/src/unclaimed-top-level-residual-extension.test.ts`. Two-minute check: `pnpm --filter @objectstack/objectql exec vitest run --project local --maxWorkers=2 src/manifest-service-residual-object-extension.test.ts` (after building the objectql closure) — 6 passed. Local gates at 058d5c2: 100 derived families (`dispatch-gates --commands`), reconciled with `--ran` (exit codes recorded): 100 run, 0 NOT MEASURED. Seven first exited on a prerequisite (five spec `dist/` gates: `dist` predated the last comment commit; `check:dual-build-cjs-loads`: not every package built; the cli test: `MODULE_NOT_FOUND`) and were re-run after the full closure build: exit 0 each. `check:type-check-debt` exit 0 (its full re-measure, 0 raw tsc errors). `check:nul-bytes` exit 0. `overlap-check` clean before each push. PR check-runs at 058d5c2: Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, Governed Surface Queue Guard, Type Check UI, Test UI, Build & E2E UI, Live E2E UI, Dogfood Regression Gate and Check Changeset success; Lint UI skipped (no `ui/` path). Dogfood battery at 058d5c2: `os-verify-lock: VERDICT command-exit 0` (closure build exit 0, then `pnpm --filter @objectstack/dogfood test`): Test Files 484 passed, 3 skipped (487); Tests 4107 passed, 68 skipped (4175). The same counts at f4e83b0. Clause-② reading (seat 7): the diff refuses at composition three shapes that compose today (listed under What changes), under every manifest strategy once the result carries `packages[]`, so it is a narrowing, declared `no (narrowing)` as the claim's conditional names. The contract review at f4e83b0 named the third shape and the reach beyond `'preserve'`, which the first version of this body left out. No governed path is in the diff: the seat lands it with `--land` once the dogfood battery is pinned to the head. Registering the residual extension is the REGISTER judgement stated under What changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Fixes #35901
Clause-②: yes (widening)
Metadata-protocol: semantic
Skills-docs: follow-up #35902
维护者速读
What changes
An
objectExtensionsentry gainsplace, a list of{ field, group, after | before },{ group: { key, label, … }, after | before }and{ list, after | before, label?, columns? }entries. The registry applies them once, infoldExtendersOntoDefinition, after every contributor's fields are merged, so every reader (record page, forms, Studio, the data and metadata doors) gets one arrangement.packages/spec/src/data/object.zod.ts): the three placement shapes andObjectExtensionSchema.place. The parse refuses a field outside the extension's ownfields, both anchors at once, an item placed twice or next to itself, and a field whose owngroupdisagrees with its placement.defineStack(collectExtensionPlacementErrorsinstack.zod.ts) refuses a list, or a placed group'srelatedList, that is not a child object of the extension's own package pointing at the target, a group key the target declares, and a placed field (or a placed group'sfieldsentry) the target declares. The extension'sfieldGroups/relatedListskeys now prescribeplace. TherelatedListsdescribe states the cross-package exception.packages/objectql/src/registry-extension-placement.ts, wired intoregistry-object-registration.ts#foldExtendersOntoDefinition): three passes (groups, fields, lists) over the extensions in ascending priority, then package id. A field joins a group's member list (a group with nofieldsgets its current members written out on the served copy first, so its order does not move). A list is spliced intorelatedLists; no anchor means the end of the tabs, before a trailingsys_approval_request/sys_activityrun. An anchor the object lacks sends the item to the end. An item the object (or the base the fold starts from) already arranges keeps that position, so a folded body re-folds to itself. Notes go once per registry to the boot log (console.warn, likereportFieldPatchMisses).engine-registration.tscarriesplaceonto the extension def.PLACEMENT_ARRANGES_DECLARED_ONLY(read only byarrangementDeclared). List placements apply only where the target declares a non-emptyrelatedLists; group and field placements only where it declaresfieldGroups. Elsewhere the automatic arrangement stays and the boot log names the placement, including that a list entry'slabel/columnsand a field'safter/beforeare inert, and pointing torelatedListTitle/relatedListColumnson the child's FK (Fable's three points).os validate(packages/lint/src/validate-extension-placement.ts, in the reference-integrity suite):extension-placement-not-appliedandextension-placement-anchor-missing, both warnings, withos explainentries. It sees a target only when the target is in the same stack, so the boot log stays the main channel; both texts say so.deriveRelatedLists): on a parent that declaresrelatedLists, a side list whose child belongs to another package than the parent is kept (placed ones sit at the spliced entry; unplaced ones after the listed lists).arrangeDeclaredTabsranks an unnamed related tab before a trailing run of listed approvals / stream tabs.RelatedListsEditor): such a list shows read-only among the unlisted rows with a "from " badge, and the preview draws it where the record page does. The editor still edits only the authored layers, so a save never copies an extension's placements into the owner.object-extension-place-and-cross-package-lists(states the flip); the relatedLists 管记录页页签的显示和顺序:声明了就只显示列出来的;附件、审批、动态用对象名 sys_attachment、sys_approval_request、sys_activity 列进来 #35897 entry's "a later change" clause now points to it. The two entries name each other by entry id, not by tracker number:os migrate metaprints an entry's text verbatim andpackages/cli/test/migrate-meta-engine-guidance.test.tsrefuses a tracker id there (ce3ab59). Dated notes in ADR-0085 §2 and ADR-0146 D10. Changeset carries both declaration lines and narrows relatedLists 管记录页页签的显示和顺序:声明了就只显示列出来的;附件、审批、动态用对象名 sys_attachment、sys_approval_request、sys_activity 列进来 #35897's note in its own text.ObjectExtensionFieldPlacementandObjectExtensionListPlacementhave one shape, so they are pinned isomorphic inpackages/spec/src/type-alias-convention.pin.test.ts(886 → 888, with its history line).ObjectExtensionGroupPlacementnestsObjectFieldGroupSchema, which has a parsed shape, so it gainsObjectExtensionGroupPlacementParsed;api-surfaceandexport-originsregenerated (33961ec).Rulings applied: 7073014077 (F1 + F2 = 「父对象声明了才生效」; an unplaced other-package list on a declared parent goes at the end of the tabs, 「装了就自动排在末尾」, flipping 7072511859's hiding).
Small calls (the thread's, accepted at claim 7072929733):
fieldsgets that group's current members materialised on the served copy, and the field'sgroupset to the group.sys_approval_request/sys_activity;before:one of those that the parent leaves unlisted is that same position and is not named as a miss.sys_metadata) and the two differ; package-less children keep relatedLists 管记录页页签的显示和顺序:声明了就只显示列出来的;附件、审批、动态用对象名 sys_attachment、sys_approval_request、sys_activity 列进来 #35897's rule.defineStack, and by a skip plus warning in the merge, for every placement shape and whichever door registered the extension (a manifest body reaches the registry unparsed; the storedobject_extensionrow is parsed only): a field by where it comes from (the owner's, then the extension folded first), a group'sfieldsand itsrelatedList, and a list. The merge skips a list (or a group placing one) only on a positive verdict (the child is registered and owned by another package, or by none); an absent child is never a verdict, since its package may register it later in the boot.os validate. An anchor another placement brings is found whatever order the two are written or registered in (each pass places in rounds), which is whatos validatealready accepted.Follow-up for #35902 (from Fable's review, corrected by the L2): nothing in HotCRM changes meaning today. Its modules use
objectExtensions(o2c, psa, revenue) but none writesplace, and none of its objects declaresrelatedLists. About 30 of its objects already declarefieldGroups, so a field or group placement there applies as soon as a module writes one; a list placement waits until the parent declares its tab list.Review round 1 (reviewed head
ce3ab59e; fixes inc151007b)relatedListwith the samechildPackageOfverdict as pass 3 and skips the group, named, on a foreign owner; an unregistered child is no verdict. Pinned for a raw body and for a body parsed byObjectExtensionSchemaand registered throughregisterObjectExtension(the stored door, which runs nodefineStack). The registry can receive an unparsedplace(the manifest loop inengine-registration.tsreads the authored manifest as is), so the merge also drops from a placed group'sfieldsany name the extension does not own, named.placementContributorsOftakes the owner's field names: an extension owns only the keys of itsfieldsthat neither the owner nor an extension folded earlier declares. A display-only redeclaration of an owner field therefore cannot place it (merge: skipped, named).defineStackrefuses such a placement, at the entry and in a placed group'sfields, where the stack defines the extended object.placeInRounds: rounds in placement order; what still waits when a round places nothing goes to the end, named).os validateand the merge now agree.columnsare judged byvalidateRelatedListRefsas arelatedListsentry's are (related-list-column-unknown, error), top level and package bodies, with the same field / injected-column / path rules; its explanation says so.placedescribe now says what is refused where; another package's same group key is merged once and named, not refused.defineStackrefuses that at build, and on an unbuilt body the served entry names a list the record page places nothing for.relatedList: falsedoes).columnsrules.Tests
packages/spec/src/data/object-extension-place.test.ts: the three shapes and every parse refusal, at its path.packages/spec/src/stack-extension-place.test.ts:defineStackrefusals (ADR-0112 envelope) and the missing-anchor no-refusal; round 1: a redeclared owner field placed at the entry or in a group'sfieldsis refused, placing its own field beside the redeclaration is not.packages/objectql/src/registry-extension-placement.test.ts: tax_id after industry; before an anchor and at the end; a group that lists members; industry removed → last in the group plus one log line; an added group; lists after / before / at the end; owner position wins; two packages at one anchor by priority, then package name, in both registration orders; uninstall and disable restore the owner's order; re-fold is idempotent; arm (a) for lists and groups with the log text; foreign items skipped and named; an unregistered child is no verdict; the manifest loop carriesplace; the pure function returns by reference. Round 1: a group placing the owner's list (raw and through the stored door) is not added; its own or an unregistered list is (control); a group's foreign field is left out; a redeclared owner field, and a field an earlier extension declares, are not moved; forward anchors for lists, groups across packages and fields; an anchor nobody brings still goes to the end.packages/lint/src/validate-extension-placement.test.ts: control, not-applied for lists and groups, each missing anchor, sibling anchors, package bodies, suite membership.packages/lint/src/validate-related-list-refs.test.ts(round 1): a placement's columns, control, unknown at the top level and in a package body, a child outside the stack unjudged.ui/packages/app-shell/src/utils/__tests__/deriveRelatedLists.otherPackage-35901.test.ts,ui/packages/plugin-detail/src/synth/__tests__/buildDefaultPageSchema.test.ts(trailing run),ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.relatedListsOtherPackage-35901.test.tsx.Acceptance notes
placewritten, every object is served as before (the fold returns the merged body by reference when no extension carries placements).relatedLists/fieldGroupskeeps its automatic arrangement; nothing is dropped.packages/objectql/src/registry-extension-placement.ts(the splice and the idempotence rule),ui/packages/app-shell/src/utils/deriveRelatedLists.ts(the flip branch),packages/spec/src/stack.zod.ts#collectExtensionPlacementErrors.pnpm --filter @objectstack/objectql exec vitest run src/registry-extension-placement.test.ts→ 34 passed.Verification
Local runs
vitest run --project localon the two new files plus every test touchingObjectExtensionSchema/objectExtensions/relatedListsandsrc/migrations: all passed.tsc --noEmitclean; the new file (23) plus the extension, overlay and engine-registration tests (135): passed.tsc --noEmitclean; the new rule, suite membership and rule explanations (33): passed.deriveRelatedListsand tab-arrangement tests (95) and the Studio tab-list tests: passed. Three app-shell util files fail locally only because@objectstack/clientwas not built in this container; they do not import the changed code.pnpm --filter @objectstack/spec check:generated --fix: regenerated and committed.pnpm check:spec-parsed-alias: OK (888 pinned isomorphic); the pin test passed;tsc -p tsconfig.test.jsonreports nothing in the pin file.os migrate metaprints; specsrc/migrationstests (198) passed.42d56e66(74 check-runs: 63 success, 11 skipped), and once3ab59ebefore the round-1 fixes.defineStack, migrations and alias-pin tests (227) passed,tscclean; objectqltscclean, the placement file (34) and every extension / overlay / engine-registration test (23 files, 373) passed; linttscclean, related-list refs, placement, suite and explanation tests (52) passed;check:generated --fixregenerated.507fac34(no conflicts); the protocol index regenerated from the merged tree (42d56e66). On the merged tree: alias gate OK, 640 semantic entries with no tracker id, objectql extension and placement tests (13 files, 155), lint (52) and spec placement / migrations / object tests (21 files, 657) passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgUxeTKkCvZ2iariHQf