Repository navigation
Commit e2d0dab
fix(objectql): list a runtime-authored bound action on the object it names (#28388)
<!-- claude-projects-attribution: {"github_login":"os-zhuang"} -->
_Requested by **Sam** · [project
thread](https://claude.ai/code/project/chan_01LjZwNRFiG2fkp8SNf6rHNx?thread=cmsg_01LjZwNRFiG2fkp8SNf6rHNxQLLDJM47eag51AoZaxz8Ha)_
Fixes #28356
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么:** 运行时经元数据入口(`PUT /api/v1/meta/action/NAME`、Studio、AI)保存的、带
`objectName` 的独立 action,现在会挂到它所指对象的 `actions` 上;删除后立即从对象上撤下。
- **为什么改:** 之前注册表只把代码包发布的绑定 action 挂到对象上,运行时保存的 action
能执行却不出现在任何对象界面上,保存成功但用户找不到按钮。
- **风险与回滚:** 只改 `SchemaRegistry` 读时挂接的取数范围与两处删除时的缓存失效;启动期审计仍只看代码包
action。回滚即 revert 本 PR。
- **先看:** `packages/objectql/src/registry.ts` 的 `boundServedActions`(同名
bare key 遮蔽 composite key 的那一行);同文件 `removeOverlayEntry` /
`removeRuntimeShadow` 新增的
`invalidateAll`;`packages/objectql/src/bound-action-foreign-object.test.ts`
新增 describe 块。
- **两分钟验证:** `pnpm --filter @objectstack/objectql exec vitest run
src/bound-action-foreign-object.test.ts`,预期 23 passed;新块 5
条覆盖保存、重存、删除、无目标对象、overlay 替换。
- **需要你做的:** 无,席位落地。
## What changes
- `SchemaRegistry.attachBoundActions` now attaches every bound
standalone `action` the registry serves (new private
`boundServedActions`), not only code-shipped ones. A runtime row reaches
the registry through the save door's write-through and the boot's
`sys_metadata` hydration; it was dispatchable through the router's rung
2 but listed on no served object, so no client drew it.
- One item per name, with `getItem`'s precedence: a bare-key entry (an
ADR-0005 overlay) shadows the composite entries of its name, so the
attached entry is the declaration rung 2 resolves.
- The boot audits (`findUnboundActionTargets`, the bound-action
collision audit) keep reading the code-only population, so a runtime
action naming a missing object never fails a boot.
- `removeOverlayEntry` and `removeRuntimeShadow` (the delete heal's
tiers) now drop the cached object folds when they retire an `action`
entry, as `unregisterItem` already did. Without it a deleted runtime
action stayed listed on the cached object.
- The registry holds no org-scoped row (the protocol's hydration
declines one), so the attach crosses no organization.
## Tests
- New describe block in
`packages/objectql/src/bound-action-foreign-object.test.ts` (real
`ObjectStackProtocolImplementation` + real registry):
- saved action is listed by `getMetaItem` object, `getMetaItems` object
and `registry.getObject`, after the owner's own actions; control object
unchanged;
- attached entry is the rung 2 declaration by reference;
- re-save serves the new body; delete withdraws it from the cached
object and from the served read;
- a runtime action naming a missing object is listed nowhere and
`findUnboundActionTargets()` stays empty;
- a bare-key overlay of a packaged bound action is attached in its
place, and lifting the shadow serves the packaged one again.
- Ablations (each through `scripts/ablation-replace.mjs`, mutation
landed on disk, restored to the HEAD blob, `git diff HEAD` empty):
- attach population back to `boundCodeActions` ⇒ 4 of the new cases red;
- invalidation removed from `removeOverlayEntry` ⇒ the delete case red;
- invalidation removed from `removeRuntimeShadow` ⇒ the shadow-lift case
red.
- A first attempt at the second ablation was a no-op (replacement
contained the anchor); the tool refused it before running, and it was
redone with a marker.
- `pnpm --filter @objectstack/objectql typecheck && pnpm --filter
@objectstack/objectql test` at 0b2103f: 505 files / 9828 tests passed
(lock VERDICT command-exit 0).
## Acceptance notes
- Not measured: a restart that rehydrates the stored row from
`sys_metadata` (the dev server's `--fresh` store dies with the process).
The hydrated row registers under the bare key, which the new population
includes; the unit cases drive the write-through path.
- Out of scope, noted: `removeOverlayEntry` / `removeRuntimeShadow` also
skip the fold invalidation for `picklist` entries, which `registerItem`
/ `unregisterItem` do invalidate. Not measured.
- The console side needs no change: `useConsoleActionRuntime` reads
`objectDef.actions`, which now carries the action.
## Verification
<details><summary>Live: fresh todo server, before and after</summary>
`examples/app-todo` with `pnpm dev -- --fresh`, signed in as the seeded
admin, then `PUT /api/v1/meta/action/rt_probe_action` with `objectName:
todo_task`, `type: url`.
- origin/main 80b561b: PUT 200; `GET /meta/action` lists
`rt_probe_action`; `GET /meta/object/todo_task` and `GET /meta/object`
list the 8 packaged actions only.
- This branch (objectql rebuilt): both object reads list the 8 actions
then `rt_probe_action`; after `DELETE /meta/action/rt_probe_action`
(200) the object lists the 8 again.
</details>
<details><summary>Derived gates at 0b2103f</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 62 commands, all run, exit codes captured
before any pipe.
- 60 exit 0.
- `node scripts/check-plugin-teardown-shape.mjs --self-test` exit 3 on
the shallow clone (positive-control commit unreachable); after fetching
that commit, exit 0 (48 cases pass).
- `pnpm check:dual-build-cjs-loads` exit 3, PREREQUISITE NOT MET
(workspace not fully built): NOT MEASURED locally, CI's Lint and Repo
Gates runs it.
- `--ran` reconciliation: 62 derived, 61 run, 1 NOT-MEASURED (the one
above).
- `eslint --no-inline-config` on the two changed source files: exit 0.
Repo-wide `pnpm lint` is CI's.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QUs3BsEVeiZG9ncdEjdtiu)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 8c8c5b5 commit e2d0dab
3 files changed
Lines changed: 194 additions & 21 deletions
File tree
- .changeset
- packages/objectql/src
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
498 | 506 | | |
499 | 507 | | |
500 | 508 | | |
| |||
3913 | 3921 | | |
3914 | 3922 | | |
3915 | 3923 | | |
3916 | | - | |
3917 | | - | |
| 3924 | + | |
| 3925 | + | |
| 3926 | + | |
| 3927 | + | |
| 3928 | + | |
| 3929 | + | |
3918 | 3930 | | |
3919 | 3931 | | |
3920 | 3932 | | |
| |||
3925 | 3937 | | |
3926 | 3938 | | |
3927 | 3939 | | |
| 3940 | + | |
3928 | 3941 | | |
3929 | 3942 | | |
3930 | 3943 | | |
| |||
3955 | 3968 | | |
3956 | 3969 | | |
3957 | 3970 | | |
3958 | | - | |
| 3971 | + | |
3959 | 3972 | | |
3960 | 3973 | | |
3961 | 3974 | | |
| |||
3997 | 4010 | | |
3998 | 4011 | | |
3999 | 4012 | | |
4000 | | - | |
4001 | | - | |
| 4013 | + | |
| 4014 | + | |
| 4015 | + | |
| 4016 | + | |
| 4017 | + | |
| 4018 | + | |
4002 | 4019 | | |
4003 | | - | |
4004 | | - | |
| 4020 | + | |
| 4021 | + | |
4005 | 4022 | | |
4006 | 4023 | | |
4007 | 4024 | | |
| |||
4020 | 4037 | | |
4021 | 4038 | | |
4022 | 4039 | | |
4023 | | - | |
4024 | | - | |
4025 | | - | |
4026 | | - | |
4027 | | - | |
4028 | | - | |
4029 | | - | |
4030 | | - | |
| 4040 | + | |
| 4041 | + | |
| 4042 | + | |
| 4043 | + | |
| 4044 | + | |
| 4045 | + | |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
| 4049 | + | |
4031 | 4050 | | |
4032 | 4051 | | |
4033 | 4052 | | |
| |||
4046 | 4065 | | |
4047 | 4066 | | |
4048 | 4067 | | |
4049 | | - | |
| 4068 | + | |
4050 | 4069 | | |
4051 | 4070 | | |
4052 | 4071 | | |
| |||
4056 | 4075 | | |
4057 | 4076 | | |
4058 | 4077 | | |
4059 | | - | |
| 4078 | + | |
4060 | 4079 | | |
4061 | 4080 | | |
4062 | 4081 | | |
| |||
4067 | 4086 | | |
4068 | 4087 | | |
4069 | 4088 | | |
| 4089 | + | |
| 4090 | + | |
| 4091 | + | |
| 4092 | + | |
| 4093 | + | |
| 4094 | + | |
| 4095 | + | |
| 4096 | + | |
| 4097 | + | |
| 4098 | + | |
| 4099 | + | |
| 4100 | + | |
| 4101 | + | |
| 4102 | + | |
| 4103 | + | |
| 4104 | + | |
| 4105 | + | |
| 4106 | + | |
| 4107 | + | |
| 4108 | + | |
| 4109 | + | |
| 4110 | + | |
| 4111 | + | |
| 4112 | + | |
| 4113 | + | |
| 4114 | + | |
| 4115 | + | |
| 4116 | + | |
| 4117 | + | |
| 4118 | + | |
| 4119 | + | |
| 4120 | + | |
| 4121 | + | |
| 4122 | + | |
| 4123 | + | |
| 4124 | + | |
| 4125 | + | |
| 4126 | + | |
| 4127 | + | |
| 4128 | + | |
| 4129 | + | |
4070 | 4130 | | |
4071 | 4131 | | |
4072 | | - | |
4073 | | - | |
4074 | | - | |
| 4132 | + | |
| 4133 | + | |
| 4134 | + | |
4075 | 4135 | | |
4076 | 4136 | | |
4077 | 4137 | | |
| |||
4940 | 5000 | | |
4941 | 5001 | | |
4942 | 5002 | | |
4943 | | - | |
| 5003 | + | |
4944 | 5004 | | |
4945 | 5005 | | |
4946 | 5006 | | |
| |||
6151 | 6211 | | |
6152 | 6212 | | |
6153 | 6213 | | |
| 6214 | + | |
| 6215 | + | |
| 6216 | + | |
6154 | 6217 | | |
6155 | 6218 | | |
6156 | 6219 | | |
| |||
6227 | 6290 | | |
6228 | 6291 | | |
6229 | 6292 | | |
| 6293 | + | |
| 6294 | + | |
| 6295 | + | |
| 6296 | + | |
6230 | 6297 | | |
6231 | 6298 | | |
6232 | 6299 | | |
| |||
0 commit comments