Repository navigation
Commit 9404cb1
fix(metadata-protocol): a bare save of a name an enabled and a disabled package hold writes the enabled holder's row (#33889)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbBePzY6g11h3hyWk5ud4vWy)_
Fixes #32605
Clause-②: yes (widening) — a bare save of a name an enabled and a
disabled package both hold, refused 409 naming both when each held a
stored row, now writes the enabled holder's row; nothing the save door
accepted is refused
Metadata-protocol: none
## 维护者速读
- 改了什么:一个名字同时被启用包 E 和停用包 D 持有时,不带包名的保存现在写 E
的行(和不带包名的读取落在同一处)。不再写无归属行,不再改 D 的行,也不再报出 D 的名字。
- 为什么改:以前读取答的是 E,保存却落到别处:要么写出一个以后会遮住两个包的"环境自有"行,要么悄悄改了停用包的行,下次读取还看不到改动。
- 风险与回滚:只在环境里有停用包、且它和启用包持有同一个名字时生效,第一方应用里 0 处。原来两行并存时的 409 变成写入 E
的行(放宽,已声明)。回滚就是撤掉这个 PR,存储的数据不需要迁移。
- 先看:`packages/metadata-protocol/src/protocol-save.ts` 文件末尾的
`servedPackagelessSaveAddress`,以及保存门里调用它的那段(不带包名的发布态保存)。
- 两分钟验证:`pnpm --filter @objectstack/runtime exec vitest run
src/domains/meta-disabled-holder-served-stack.test.ts -t 32605`,预期 48
个用例全部通过(两种传输 × 两种注册顺序)。
- 需要你做的:无,席位落地。
## What changes
The epic ruling 6781691009 on #32354 decides this card: "a write
resolves its address exactly as the read at the same address resolves it
(D3/D5 symmetry)". It also says: "A bare save of that name is therefore
E's write. It is E's customization (D4: a package-less save under a name
one package holds is that holder's), it is bound to E, and it never
touches D's row."
`saveMetaItemUnaudited` resolves the address of a publish-mode save that
names no package. That step now asks a new module helper,
`servedPackagelessSaveAddress`, in `protocol-save.ts`, before it falls
back to `packagelessAddress` as before:
1. **The read's own judgment.** The helper first asks
`servedAddressJudgment`, the one judgment the bare reads use since
#32183 and #32354. The import is unchanged. When that judgment names a
served holder, the save writes there. When it refuses because two or
more holders are served, the save refuses too, with the save door's own
409 sentence, naming only the served holders.
2. **The row-only gap.** Some names a disabled package holds only as a
stored row, while an enabled package ships them. The read judgment
leaves that case to the read's content rule. If a disabled package is
among the stored rows' bindings, the address is judged over the enabled
bindings. One enabled binding is the address. Two or more are refused,
naming them. If none is left, the address is the package-unbound row
when one is stored (the row the read serves), otherwise the one enabled
package that ships the name.
3. Otherwise nothing changes. That covers a name no disabled package
holds, and a name only disabled packages hold.
`protocol.ts`, `registry-question.ts`, `seed-loader.ts` and
`protocol-meta-item-face.ts` are not edited.
| bare save, name held by enabled E and disabled D | FROM (main
1e65a38) | TO |
|---|---|---|
| both ship it, no stored row | package-unbound row written (200) | row
bound to E written (200) |
| both ship it, D's row only | D's row updated (200); next read still
E's code | E's row written; D's row byte-unchanged |
| both ship it, a row of each | 409 naming E and D | E's row updated
(widening); D's unchanged |
| two authored row holders E, D | 409 naming E and D | E's row updated
(widening); D's unchanged |
| E ships it, authored D holds a row | D's row updated; read serves E |
E's row written; D's unchanged |
| E ships it, package-unbound row plus D's row | D's row updated; read
serves the unbound row | the unbound row updated; D's unchanged |
| three row holders, D disabled | 409 naming E, F and D | 409 naming E
and F only |
| D enabled again (after the save) | 409 naming both | unchanged: read
and save 409 naming both |
| CONTROL: a name only E ships, an unrelated package disabled |
package-unbound overlay row | unchanged |
| CONTROL: a name only D holds (its row alone) | D's row updated |
unchanged (see open question in the report) |
## Tests
The new top-level `describe('[#32605] …')` goes into the shared harness
`packages/runtime/src/domains/meta-disabled-holder-served-stack.test.ts`
(ruling record 6583487846). It boots a real kernel (registry, metadata
service, `sys_metadata` on SQLite) and drives `PUT
/meta/dashboard/:name` with no package. It runs on both transports, the
runtime `HttpDispatcher` and `RestServer`'s `PUT` route, in both
registration orders, with save orders where two rows are stored. That is
12 cases × 4 = 48. Each case asserts the stored rows by binding,
byte-identity of D's row, the next bare read, and the 409 naming both
once D is re-enabled.
Ablations, each through `scripts/ablation-replace.mjs`. Every leg
rebuilt `@objectstack/metadata-protocol`, proved its marker in `dist/`
with `ablation-dist-preflight.mjs`, restored to HEAD's blob (`git diff
HEAD` empty), rebuilt, and proved the marker `--absent`:
<details><summary>ablation readings</summary>
- A, helper off (main's behaviour): `Failed Tests 40`. All 10 negative
cases fail × 4, both CONTROLs stay green. One failure reads `expected [
'null' ] to deeply equal [ 'com.qa.save_alpha' ]`.
- B, the row-only gap off: 12 failed (E ships with authored D row;
unbound plus D row; two authored beside D).
- C, the read-judgment refusal names every row binding: 4 failed. One
reads `expected '{"success":false,"error":{"code":"RES…' not to contain
'com.qa.save_authored_beta'`.
- D, the gap's two-holder refusal names every binding: 4 failed, same
message.
- E, the unbound arm off: 4 failed. One reads `expected [
'com.qa.save_alpha', …(2) ] to deeply equal [
'com.qa.save_authored_beta', 'null' ]`.
</details>
## Verification
<details><summary>suites and gates</summary>
- `@objectstack/metadata-protocol` test: 340 files passed, 9 skipped;
22883 tests passed. Typecheck clean.
- `@objectstack/runtime` test: 603 files passed; 10954 tests passed.
Typecheck plus `check:test-typecheck` OK.
- `@objectstack/rest` test: 412 files passed; 8442 tests passed.
- `pnpm lint`: exit 0.
- `dispatch-gates --commands`: 69 families derived. Run locally with
exit 0, and reconciled with `--ran` (see the report).
`check:dual-build-cjs-loads` is left to CI.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- signed: domain:server#5 · zhuangjianguo ·
session_01QsR2jUcj2x2Wr4UErwBi12 -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent a91ae04 commit 9404cb1
3 files changed
Lines changed: 376 additions & 4 deletions
File tree
- .changeset
- packages
- metadata-protocol/src
- runtime/src/domains
| 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 | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
331 | 333 | | |
332 | 334 | | |
333 | 335 | | |
334 | | - | |
| 336 | + | |
335 | 337 | | |
336 | 338 | | |
337 | 339 | | |
| |||
810 | 812 | | |
811 | 813 | | |
812 | 814 | | |
813 | | - | |
814 | | - | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
815 | 830 | | |
816 | | - | |
817 | 831 | | |
818 | 832 | | |
819 | 833 | | |
| |||
2780 | 2794 | | |
2781 | 2795 | | |
2782 | 2796 | | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
0 commit comments