Repository navigation
Commit 33ee9aa
fix(runtime): the base export serves the base's own document while a .custom override of it is live (#29687)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8HidkhJzbWECJnYCJR3RqC2)_
Fixes #29649
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:`GET /packages/BASE/export` 在 `.custom`
覆盖已发布时,改为输出基础包自己的那份文档(原样),不再把该项丢掉。
- 为什么改:真实 showcase 启动下,发布一个仪表盘/报表覆盖后,基础包导出少了这一项(#29597 的过滤器引入);#29640
合入后仪表盘/报表已好,但页面、应用、数据集、文档、书籍的覆盖仍会让该项从导出中消失。
- 风险与回滚:只动导出读取一个函数,只在某项声明覆盖本包时生效;回滚即还原 `packages.ts` 这一处。
- 先看:`packages/runtime/src/domains/packages.ts`(`ownDocumentsOf`)、新 pin
`packages-export-base-showcase-boot.integration.test.ts`。
- 两分钟验证:`pnpm --filter @objectstack/runtime exec vitest run
src/domains/packages-export-base-showcase-boot.integration.test.ts`,预期
8/8 通过。
- 需要你做的:无,席位落地。
## What changes
- `assemblePackageManifest`
(`packages/runtime/src/domains/packages.ts`): the per-package layer's
items now go through `ownDocumentsOf`. An item that declares it
overrides the exported package (the pair's override) is still never
exported under the base, as #29563 ruled, but it is now **replaced, in
its place, by the base's own code artifact** of the name
(`registry.getArtifactItem(type, name, BASE)`, the prefer-local
composite slot `registerApp` filled) when the layer lists no own item
beside it. Before, it was only dropped, which left the item out when the
layer held the override alone.
- New pin
`packages/runtime/src/domains/packages-export-base-showcase-boot.integration.test.ts`:
the #29563 harness (real `HttpDispatcher`, protocol, `ObjectQL` on
SQLite) plus the real `MetadataManager` holding the base's code
documents as `MetadataPlugin`'s artifact door stores them, which is the
shape every `defineStack` host boots with. Per type (view, dashboard,
report, page, app, dataset, doc, book) it asserts the base's whole
export is byte-identical before and after the published override, and
after a restart over the same database; the item is present and equal;
no item carries `overrides`; the pair's row is published; and for view,
dashboard and report the effective read and the pair's export serve the
override.
- Patch changeset for `@objectstack/runtime`.
## Why
ADR-0146 D8 item 3: `GET /packages/hotcrm/export` "carries the base
unchanged". The per-package layer merges the registry's items over the
metadata service's, one per `(name, package)` slot. A published
`.custom` override registered in the registry's bare slot wearing the
base's envelope therefore takes the base's slot, and the base's own item
is not listed at all. The #29563 filter then left nothing. The #29563
pin stayed green because its boot has no metadata service, so the layer
listed both documents.
#29600 (PR #29640, merged as 7dae3b3 while this card ran) takes the
dashboard, report and email_template copy out of the bare slot, which
closes this card's dashboard and report rows on its own. It deliberately
leaves page, app, dataset, doc and book in the bare slot (#29613), and
for those five the base export still loses the item. This fix holds the
D8 item 3 guarantee for every type at the export door, whatever the
registry holds.
## Tests
Measured on a real showcase boot (`pnpm --filter
@objectstack/example-showcase dev -- --fresh`), with the card's
reproduction (ensure-customization, draft PUT with `overrides`,
`publish-drafts`), counting items in `GET
/api/v1/packages/com.example.showcase/export`:
| tree | dashboard | report | view | page | app | dataset | doc | book |
whole base export |
|:--|:--|:--|:--|:--|:--|:--|:--|:--|:--|
| main b391feb | 3 → 2 absent | 4 → 3 absent | 36 → 36 equal | not
measured | not measured | not measured | not measured | not measured |
differs |
| main 7dae3b3 (#29640, no fix) | 3 → 3 equal | 4 → 4 equal | 36 → 36
equal | 29 → 28 absent | 1 → 0 absent | 4 → 3 absent | 8 → 7 absent | 1
→ 0 absent | differs |
| this branch (fix on b391feb) | 3 → 3 equal | 4 → 4 equal | 36 → 36
equal | — | — | — | — | — | identical, also after a restart (persistent
OS_HOME) |
| this branch (fix + 7dae3b3) | 3 → 3 equal | 4 → 4 equal | 36 → 36
equal | 29 → 29 equal | 1 → 1 equal | 4 → 4 equal | 8 → 8 equal | 1 → 1
equal | identical |
Pin, red first: on b391feb (pin alone) dashboard and report red
("expected [] to deeply equal" the shipped item), view green; on
7dae3b3 (pin alone) page, app, dataset, doc and book red the same way,
the other three green; with the fix 8/8 green. The export-read
neighbours stay green:
`packages-export-base-unchanged-per-type.integration.test.ts`,
`packages-export-override-declaration.test.ts`,
`packages-export-per-package-layer.test.ts` (4 files, 12/12 before the
pin grew to 8 types).
## Acceptance notes
- On the same real boot, a published page, app, dataset, doc or book
override is not served by the effective read at all: `GET
/api/v1/meta/page/showcase_start_here` (with or without
`?package=com.example.showcase`) answers the shipped label, and the
pair's export lists none of them. #29613 measured `getMetaItem` serving
these overrides from the bare slot on a harness with no metadata
service; on a real boot the metadata service's copy wins. This is
#29613's row-served path, reported there, not touched here.
- Studio's `studio-authoring.package-customize-restore-display`
acceptance[4] re-run belongs to the QA seat; the card's own reproduction
passes on a real boot (table above).
## Verification
<details><summary>Local gates</summary>
Head 51c4d1e (origin/main 7dae3b3 merged in). `node
scripts/pm/dispatch-gates.mjs --commands` derived 59 families; each run
with its exit code captured before any pipe, then `--ran`:
- 58 exit 0.
- NOT MEASURED (exit 3, prerequisite): `node
scripts/check-plugin-teardown-shape.mjs --self-test`, its positive
control is pinned to a commit this shallow clone cannot reach.
- `--ran` reconciliation: "59 derived famil(ies) accounted for, 58 run,
1 NOT-MEASURED".
- An earlier run on e373cc1 caught `check:query-options-erasure` (exit
1, the pin's `as any` driver query grew the test surface 236 → 237);
fixed in 51c4d1e, now exit 0 at 236.
Outside the derivation, also run: `pnpm lint` exit 0 (e373cc1; the
later commit only drops an `as any` in the pin); `pnpm --filter
@objectstack/runtime typecheck` exit 0 (51c4d1e); `pnpm --filter
@objectstack/runtime test` exit 0 on e373cc1, Test Files 530 passed
(530), Tests 8520 passed, 19 skipped; the new pin alone 8/8 on 51c4d1e.
</details>
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: not touched.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbac7S1AsbGi5a46PrB)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2ea6042 commit 33ee9aa
3 files changed
Lines changed: 384 additions & 1 deletion
File tree
- .changeset
- packages/runtime/src/domains
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 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 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
0 commit comments