Repository navigation
Commit bfd1049
fix(core, console): the offboarding hand-over's owner follows each object's Change Owner switch (#36869)
Fixes #35399
Clause-②: no
Metadata-protocol: semantic
Skills-docs: none — no file under `skills/` teaches the object switch
`userActions.transfer` or the offboarding hand-over (`git grep -i
'userActions\|change owner\|assigned-work' -- skills` on the branch head
hits only list-view and interface `userActions`, a different key)
## 维护者速读
-
管理员封禁用户并交接其记录时:对象关闭了“更改负责人”,该对象记录的负责人就不再交接;明细对象默认不交接,作者打开开关后照常交接。不交接的记录仍计数,弹窗写明“该对象保持负责人不变”,不再误说“该字段可填多人”。
- 属于“记录负责人变更与离职交接”专题:离职交接与“更改负责人”按同一个开关判定。
- 若判错,会多交接或少交接某对象的负责人,其他用户字段不受影响;可撤回:作者改开关即可,已交接的记录可再用“更改负责人”改回。
- 无
## What changes
- **One rule for both doors.** `userAssignedWorkFields`
(`packages/core/src/security/user-assigned-work.ts`) no longer carries
its own `controlled_by_parent` reading (`accessFollowsMaster` is gone).
An `owner_id` that is the platform's reassignable owner
(`isTransferEligible`) follows `resolveUserActionTransfer` from
`@objectstack/spec/data`, the resolution `changeOwnerOffReason` refuses
Change Owner by. Off by the derived default on a detail, on otherwise,
author-overridable both ways.
- **Counted, not moved, with a reason.** A switched-off owner is no
longer left out. Its row is counted with `transferable: false` and
`reason: 'transfer_off'`. A multi-valued field's row now says `reason:
'multi_valued'`. `transferUserAssignedWork` moves only `transferable`
rows, so `remaining` counts only what another call could move. New
exported type `UserAssignedWorkHoldReason` (`@objectstack/core`). The
client's `UserAssignedWorkSummary` row gains the optional `reason`
member.
- **App-authored user fields are unchanged.** An approver or assignee is
handed over whatever the switch says. An `owner_id` on an object the
platform gives no owner (`systemFields: false`) is app-authored too.
- **Optional-master corner (scope note 2): follows the switch as is.**
On a switched-off detail with `required: false` master, a null-master
row keeps its owner. The docblock and the admin guide say how a Modify
All holder moves it by hand.
- **The panel words a row by why it stays.** `UserAssignedWorkPanel`
picks `console.assignedWork.ownerKept` for `transfer_off`. Only a
multi-valued row keeps `notTransferable`. The new key is in all 11 UI
locales: ten are hand-translated, and zh-Hant is generated from zh-Hans
(`gen:zh-hant`). The existing `notTransferable` text was already the
multi-valued sentence and is unchanged.
- **Stale prose rewritten** (scope notes 2, N2, and 3): the
`user-assigned-work.ts` docblock lead sentence (rewritten per object),
`security.assignedWork.count` in `packages/client/src/index.ts`,
`registerUserWorkEndpoints` in `packages/rest/src/rest-server.ts`, the
admin guide's hand-over section (which this change made false), and the
Change Owner paragraph of the data API page.
- **N4 (scope note 7069035638):** a dogfood case for
`assertAssignableUser` on the real showcase, through the Change Owner
door that shares it. A new owner who exists but sits outside the
caller's organization (the caller's own `GET /data/sys_user/:id` answers
404, as armed) gets the same answer as an id that exists nowhere:
status, code, field, and message apart from the id. The owner stays.
File surface beyond the claim's list, declared:
`packages/core/src/security/index.ts` (the type export),
`content/docs/permissions/administrator-guide.mdx` and
`content/docs/api/data-api.mdx` (prose this change made false or
incomplete). The dogfood case went into the existing Change Owner
dogfood file, not a new one.
## Tests
All runs at head `a31b2c96` unless named (the core, client and dogfood
runs were at `21720ae6` and `285d2848`. The later commits touch only
`ui/` test files, the generated zh-Hant pack and docs).
- `@objectstack/core`, whole package: `Test Files 156 passed (156)`,
`Tests 3740 passed (3740)`. The `[#35399]` describe has 11 cases: switch
on (bare and object form), switch off (bare and object form), derived
default on a detail, the twin under every other sharing model, an
app-authored `owner_id` on a `systemFields: false` object, a parity pin
of the roster against `resolveUserActionTransfer` and
`changeOwnerOffReason` over 9 definitions, count, transfer (with no read
or write naming the detail's owner), and the optional-master null-master
row. The #35344 interim pin (left out of the roster) is subsumed: the
same fixtures now pin counted-not-moved, as the describe's lead comment
says.
- `@objectstack/client`, whole package: `Test Files 59 passed (59)`,
`Tests 820 passed (820)`.
- `@objectstack/rest`: `src/user-work-routes.test.ts` 7/7 (only a
comment changed in `rest-server.ts`).
- Typecheck: `@objectstack/core`, `@objectstack/client`,
`@objectstack/rest` `typecheck` exit 0 (core's runs its test-layer gate
too), and `@object-ui/app-shell` `type-check` exit 0 (src and
`tsconfig.test.json`), after building its dependency closure.
- Dogfood, `test/change-owner-endpoint.dogfood.test.ts` on the real
showcase: `Tests 7 passed (7)`, including the new N4 case.
- UI: `ActionParamDialog.banAssignedWork-30205.test.tsx` 16/16 (two new
`objectstack#35399` cases). `ui/packages/i18n/` whole package
(`--maxWorkers=1`): `Test Files 108 passed (108)`, `Tests 2011 passed /
13 skipped`.
- The i18n run first went red, and both causes are fixed in this PR.
zh-Hant is generated, so it is now regenerated from zh-Hans with
`gen:zh-hant` instead of hand-written. The de paired-quote pin moves 134
to 135, with its note, for the one new de pair.
- **Declared narrowing:** `@object-ui/app-shell`'s whole package (2476
test files) was not run locally. One `--maxWorkers=2` attempt was
stopped by its recorded PID after about 30 minutes on this shared box.
CI's sharded `Test UI` runs it.
## Acceptance notes
- **The nested `security.sharingModel` spot is no longer read by the
hand-over.** The removed `accessFollowsMaster` read `sharingModel ??
security.sharingModel`, as the access gates do. The spec's switch
default (`derivedTransferDefault`) reads only the declared top-level
`sharingModel`, and `security` is not an `ObjectSchema` key. So a
raw-registered object that spells its detail model only in the nested
spot now hands its owner over, and Change Owner already offered the
action on it. The two doors agree, and a parity pin covers this shape.
`git grep` finds no producer that writes `security: { sharingModel }`
outside tests on this tree, so no card is filed. If the nested spot
should count, the fix is one line in the spec's
`derivedTransferDefault`, and both doors follow it.
- **Spec prose for the switch** (`transfer`'s `.describe` in
`object.zod.ts`, the `user-action-transfer.ts` docblock) still names
only the Change Owner action. Neither statement is false (the switch
still does not gate a plain `owner_id` write). Adding "and the
offboarding hand-over" is a `packages/spec` `.describe` edit with
`gen:schema && gen:docs`, outside this claim's file surface, so it is
left for the seat to route.
- Behaviour change for authors, named in the changeset: an object with
`userActions.transfer: false` used to have its owners handed over and
now keeps them. A detail with `userActions.transfer: true` used to keep
its owner and now hands it over.
## Verification
Read first, by risk:
1. `packages/core/src/security/user-assigned-work.ts`:
`ownerTransferOff` and the roster loop (the only rule change).
2. `packages/core/src/security/user-assigned-work.test.ts`: the
`[#35399]` describe, especially the parity pin against
`resolveUserActionTransfer` and `changeOwnerOffReason`.
3. `ui/packages/app-shell/src/views/UserAssignedWorkPanel.tsx`:
`notTransferableKey`.
Two-minute check: `pnpm --filter @objectstack/core exec vitest run
src/security/user-assigned-work.test.ts` shows every `[#35399]` case
green. In the console, ban a user who owns an invoice line on the
showcase: the line's row says it is not handed over because the object
keeps its owner, and the hand-over leaves it.
<details><summary>Local gates (dispatch-gates --ran: 110 derived, 106
run, 4 NOT MEASURED, 0 UNRUN)</summary>
- 106 derived families exit 0. `pnpm check:test-source-alias` went red
once, on this PR's own test, which loaded the locale packs inside a test
body. That load moved to module top, and the gate is green at
`a31b2c96`. `pnpm --dir ui exec vitest run scripts/` was SIGKILLed once
under memory pressure. Re-run alone at `a31b2c96`, it gave `Test Files
172 passed / 2 skipped`.
- NOT MEASURED, exit 3 (the gate refused its own prerequisite):
`check-plugin-teardown-shape --self-test` (shallow clone), `spec
check:skill-examples` (no built client-react),
`check:dual-build-cjs-loads` (needs a whole-tree build),
`check:type-check-debt` (re-measure prerequisite). CI runs all four.
- `node scripts/check-nul-bytes.mjs` exit 0 at `a31b2c96`.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYnUnriLNg19SxQdg2p)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>1 parent b01d8f9 commit bfd1049
23 files changed
Lines changed: 349 additions & 98 deletions
File tree
- .changeset
- content/docs
- api
- permissions
- packages
- client/src
- core/src/security
- qa/dogfood/test
- rest/src
- ui/packages
- app-shell/src/views
- i18n/src
- __tests__
- locales
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
475 | | - | |
476 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
477 | 479 | | |
478 | 480 | | |
479 | 481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
132 | 140 | | |
133 | 141 | | |
134 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
257 | 260 | | |
258 | 261 | | |
259 | 262 | | |
260 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
261 | 271 | | |
262 | 272 | | |
263 | 273 | | |
| |||
7042 | 7052 | | |
7043 | 7053 | | |
7044 | 7054 | | |
7045 | | - | |
7046 | | - | |
7047 | | - | |
| 7055 | + | |
| 7056 | + | |
| 7057 | + | |
| 7058 | + | |
| 7059 | + | |
7048 | 7060 | | |
7049 | 7061 | | |
7050 | 7062 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
| 696 | + | |
696 | 697 | | |
697 | 698 | | |
698 | 699 | | |
| |||
0 commit comments