Repository navigation
Commit a96bf3c
fix(objectql): a refused first install leaves nothing of itself, even over a tenant's object (#28839)
domain:server#2 · os-project-manager · session_0186vfjHHMsRXC9EUT9hTFMo
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XJn3tHAnFh4h1yjpiKahdTG)_
Refs #28697
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
**改了什么**:首次安装一个包时,如果注册表在注册过程中拒绝了它,这个包不会留下任何东西,包括它叠在租户已有对象(及租户的覆盖层)、无主覆盖层或别的包的扩展之上的情况;原来在那里的内容和尝试之前读起来完全一样。
- **为什么改**:被拒的安装应当让系统保持原样,运维修好包再装即可。拒绝本身(错误码、状态、文字)不变。
- **风险与回滚**:objectql patch。所有 `registerApp`
现在都经过注册表已有的"被拒即放回"(升级已经在用的那一套),首次安装不再走卸载式撤回;干净的安装、升级和运维卸载行为不变,禁用状态的启动种子照旧保留。回滚即
revert 本 PR。
- **先看**:`packages/objectql/src/engine.ts` 的
`registerApp`(一处调用替换了原来的分支和撤回路径);`registry-module-mock.ts`
的注释与成员;`registry.ts` 只改了 `uninstallPackage` 的文档注释。
- **两分钟验证**:`pnpm --filter @objectstack/objectql exec vitest run
src/package-refused-first-install-over-tenant.test.ts
src/package-refused-registration-withdrawn.test.ts`,预期 7 + 24 passed。
- **需要你做的**:无,席位落地。
## What changes
- **A refused first install leaves nothing of itself, in every case.**
When `ObjectQL.registerApp` registers a package id for the first time
and the registry refuses it part-way, no package record, object,
extension, app, item, picklist extension, namespace, navigation
contribution, contributed kind or datasource definition of the package
remains. This now also holds when the package layers over an object a
tenant already holds (with or without the tenant's overlay layer), over
an overlay with no owner, or over another package's extension of one of
its objects. What was there reads exactly as before: who holds each
layer, how it is classified, its priority, its body, and the object as
served.
- **One mechanism.** Every registration body now runs through the
registry's existing `SchemaRegistry.restoringOnRefusal`, the restore a
refused upgrade already uses. The engine's separate uninstall-based
withdrawal of a refused first install, and the check that decided
whether it was safe, are removed: the restore covers every case the
withdrawal did, and the cases it could not take.
- **Unchanged:** what is refused and every refusal's code, status and
words; a clean install, a clean upgrade and a refused upgrade; an
operator's uninstall; a persisted "disabled" state for the id still
applies to its next install. `SchemaRegistry.uninstallPackage`'s
`keepBootSeed` option stays available and unchanged; only its doc
comment changes, since the engine no longer calls it for a refused
install.
- The shared registry test double's comment now says what `registerApp`
reads from it; one member nothing reads any more is dropped from it.
- Changeset: `patch` for `@objectstack/objectql`. It carries a sentence
superseding the pending changeset line that said the engine passes
`keepBootSeed` when it withdraws a refused first install.
## Tests
-
`packages/objectql/src/package-refused-first-install-over-tenant.test.ts`
(new, 7 tests). Refused first installs of a package that layers over a
tenant's object (with or without the tenant's overlay), over an overlay
with no owner, or over another package's extension. Each asserts the
same code and status, that nothing of the package remains, and that the
existing object reads exactly as before the attempt. A fifth case keeps
the boot seed of disabled packages. Controls: a clean first install over
a tenant's object takes ownership with the tenant's layer as its
overlay, as before; an operator's uninstall of it still removes the
package.
- `package-refused-registration-withdrawn.test.ts`: the control for a
body that took over a tenant's object now asserts the behaviour (nothing
of the package, the tenant's object owned and served as before). Every
other case in the file is unchanged.
## Acceptance notes
- Through the HTTP doors, the tenant case is pinned at the unit layer
only; the existing install-local dogfood file (first installs and
upgrades refused part-way) runs green on this engine.
- Reading every open PR touching `objectql/src/engine.ts` or
`registry.ts` before opening this one: only #28811 touches `registry.ts`
(the `extend` refusal block and a new removal verb), away from these
hunks; `git merge-tree` against it and against `origin/main` is clean.
## Verification
All readings below are on the tree of `c10fd4ae` (the same tree as the
commit the runs were taken on).
<details><summary>Red first on base (`693e1003`)</summary>
- The new file on base: 5 failed, 2 passed. Each of the five passed its
code-and-status assertion and failed at the package-state comparison;
the two controls pass on base.
</details>
<details><summary>Green</summary>
- New file 7/7; `package-refused-registration-withdrawn.test.ts` 24/24;
`package-refused-upgrade-keeps-installed.test.ts` 13/13;
`engine.test.ts` green (180 tests across these four files).
- `pnpm --filter @objectstack/objectql exec vitest run`: 522 files,
10010 tests, all green (`VERDICT command-exit 0`).
- `pnpm --filter @objectstack/objectql typecheck`: exit 0
(`check:test-typecheck` included).
- Dogfood, with the `@objectstack/dogfood^...` closure built under the
lock (objectql dist carrying the new call, the removed path's log line
absent): `install-local-refused-package-leaves-nothing` 4/4.
</details>
<details><summary>Ablation (unit files; objectql tests import src),
through ablation-replace, restore proven blob == HEAD and `git diff
HEAD` empty</summary>
- The restore limited to installed ids (first installs registered bare,
no withdrawal): 11 failed, 33 passed over the three registration files.
Red: the five new cases, the flipped tenant control, and the five
first-install registry cases of the withdrawal file, which this call now
carries. The upgrade file stays 13/13.
</details>
<details><summary>Derived gates (64)</summary>
- 63 exit 0. `check:dual-build-cjs-loads` exit 3: NOT MEASURED, it needs
every package's dist (a full `pnpm build`). `check:dts-closure` and the
teardown self-test were re-run after the dist closure finished and the
self-test's pinned fixture was fetched; both exit 0. `dispatch-gates
--ran`: 64 accounted, 63 run, 1 NOT MEASURED.
- CI runs the full farm on this PR.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01FEkQ5oL2i4xH7Mu7va3kxr
---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5oL2i4xH7Mu7va3kxr)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent fa59f78 commit a96bf3c
6 files changed
Lines changed: 233 additions & 147 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
| 334 | + | |
338 | 335 | | |
339 | 336 | | |
340 | 337 | | |
| |||
5176 | 5173 | | |
5177 | 5174 | | |
5178 | 5175 | | |
5179 | | - | |
5180 | | - | |
5181 | | - | |
5182 | | - | |
5183 | | - | |
5184 | | - | |
5185 | | - | |
5186 | | - | |
5187 | | - | |
5188 | | - | |
5189 | | - | |
5190 | | - | |
5191 | | - | |
5192 | | - | |
5193 | | - | |
5194 | | - | |
5195 | | - | |
5196 | | - | |
5197 | | - | |
5198 | | - | |
5199 | | - | |
5200 | | - | |
5201 | | - | |
5202 | | - | |
5203 | | - | |
5204 | | - | |
5205 | | - | |
5206 | | - | |
5207 | | - | |
5208 | | - | |
5209 | | - | |
5210 | | - | |
5211 | | - | |
5212 | | - | |
5213 | | - | |
5214 | | - | |
5215 | | - | |
5216 | | - | |
5217 | | - | |
5218 | | - | |
5219 | | - | |
5220 | | - | |
5221 | | - | |
5222 | | - | |
5223 | | - | |
5224 | | - | |
5225 | | - | |
5226 | | - | |
5227 | | - | |
5228 | | - | |
5229 | | - | |
5230 | | - | |
5231 | | - | |
5232 | | - | |
5233 | | - | |
5234 | | - | |
5235 | | - | |
5236 | | - | |
5237 | | - | |
5238 | 5176 | | |
5239 | 5177 | | |
5240 | 5178 | | |
| |||
9324 | 9262 | | |
9325 | 9263 | | |
9326 | 9264 | | |
9327 | | - | |
9328 | | - | |
9329 | | - | |
9330 | | - | |
9331 | | - | |
9332 | | - | |
9333 | | - | |
9334 | | - | |
9335 | | - | |
9336 | | - | |
9337 | | - | |
9338 | | - | |
9339 | | - | |
9340 | | - | |
9341 | | - | |
9342 | | - | |
9343 | | - | |
9344 | | - | |
9345 | | - | |
9346 | | - | |
9347 | | - | |
9348 | | - | |
| 9265 | + | |
| 9266 | + | |
| 9267 | + | |
| 9268 | + | |
| 9269 | + | |
| 9270 | + | |
| 9271 | + | |
| 9272 | + | |
| 9273 | + | |
| 9274 | + | |
9349 | 9275 | | |
9350 | 9276 | | |
9351 | 9277 | | |
| |||
9524 | 9450 | | |
9525 | 9451 | | |
9526 | 9452 | | |
9527 | | - | |
| 9453 | + | |
9528 | 9454 | | |
9529 | 9455 | | |
9530 | 9456 | | |
| |||
9540 | 9466 | | |
9541 | 9467 | | |
9542 | 9468 | | |
9543 | | - | |
9544 | | - | |
9545 | | - | |
9546 | | - | |
9547 | | - | |
9548 | | - | |
9549 | | - | |
9550 | | - | |
9551 | | - | |
9552 | | - | |
9553 | | - | |
9554 | | - | |
9555 | | - | |
9556 | | - | |
9557 | | - | |
9558 | | - | |
9559 | | - | |
9560 | | - | |
9561 | | - | |
9562 | | - | |
9563 | | - | |
9564 | | - | |
9565 | | - | |
9566 | | - | |
9567 | | - | |
9568 | | - | |
9569 | | - | |
9570 | | - | |
9571 | | - | |
9572 | | - | |
9573 | | - | |
9574 | | - | |
9575 | | - | |
9576 | | - | |
9577 | | - | |
9578 | | - | |
9579 | 9469 | | |
9580 | 9470 | | |
9581 | 9471 | | |
| |||
0 commit comments