Repository navigation
Commit d9b72aa
fix(metadata-protocol): the bare draft save beside a disabled package's rows writes the one enabled holder's draft (#39035)
Fixes #38753
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户能看到什么变化:作者在不指定包的情况下保存草稿时,如果同名条目有一个已停用包的数据和唯一一个启用包的数据,保存现在会写到启用包的草稿上,不再报冲突并点出已停用包的名字。
- 为什么做:这是「停用的包一律不算数」这项工作的最后一格,前一个合并已修好删除和丢弃草稿,这次补上保存草稿。
- 出错会怎样:最坏情况是这类草稿保存写到了启用包上而非报冲突;已停用包的数据不会被改动,撤回这次合并即可恢复原来的报错行为。
- 要你做什么:无。
## What changes
- `packages/metadata-protocol/src/protocol-save.ts`, `saveMetaItem`:
just before the ambiguous-draft-address refusal
(`disabledRowHoldersRefusal`), a draft save naming no package whose
draft rows are bound to a disabled package D and to the one enabled
holder E the read naming no package counts is re-addressed to E
(`soleEnabledRowHolder`): `request.packageId = E`, `draftAddress`
cleared, `followedBase = E`, as the row-held-base follow a few lines
above does, so the named-base rule and the late override re-judgment
judge E. Before: `409 RESOURCE_CONFLICT` naming D and E, while the bare
read serves E and the bare publish save writes E's row. With two or more
enabled holders `soleEnabledRowHolder` answers nothing and the refusal
naming only the enabled holders stands.
- The `packagelessHolderRefusal` docblock's "Known gap" paragraph is
reworded: the delete, the draft discard and now the draft save all act
at the one enabled holder first.
- `packages/rest/src/meta-disabled-package-doors.test.ts`: four new
cells on PR #38948's fixture (both save orders, D shipping the name in
code or not): the bare draft save's effect on the stored rows equals its
effect without D (E's draft replaced, nothing else), D's rows
byte-unchanged, no refusal. The second-enabled-shipper CONTROL now also
pins the draft save's `409` naming the two enabled shippers, never D,
with nothing written.
- `.changeset/38753-draft-save-cell.md`: `patch` for
`@objectstack/metadata-protocol`.
This is the last cell of #38753 (PR #38948 merged the rest as `Part
of`), so this PR closes it.
## Tests
<details><summary>Red first, fix, ablation (local, under the verify
lock)</summary>
- Red on `742b2442` (test only, fix absent): the four new draft-save
cells failed with `RESOURCE_CONFLICT:409:Name the package this save is
for, then send it again ... dashboard 'one_shipper_dash' belongs to 2
packages ('app.disabled_demo', 'app.healthy_demo') ...`; the other 11
cells of `-t 38753` (the extended CONTROL included) passed.
- Green on `d059c60f` after rebuilding `@objectstack/metadata-protocol`:
`-t 38753` 15 passed / 82 skipped.
- Ablation (`scripts/ablation-replace.mjs --hold`, anchor `if (sole !==
undefined) {` turned into a branch that never runs): rebuilt,
`ablation-dist-preflight` found the marker in `dist/index.cjs` and
`dist/index.js`; the four draft-save cells went red with the same 409
naming D and E, 11 passed. Restore leg: blob equal to HEAD, `git diff
HEAD` empty, `git status --porcelain` empty; rebuilt, preflight
`--absent` (marker absent from all 24 built files, tree clean); `-t
38753` 15 passed.
</details>
<details><summary>Suites and typecheck on 4fecd59 (local, under the
verify lock)</summary>
- `@objectstack/metadata-protocol`, full suite: 381 files passed / 9
skipped; 23940 tests passed / 45 skipped.
- `pnpm turbo run typecheck --filter=@objectstack/metadata-protocol
--filter=@objectstack/rest`: 33 of 33 tasks passed (rest's test layer
compiles under `check:test-typecheck`, 0 errors).
- `@objectstack/rest` full suite and `test:repo`: not run locally; CI's
Test Core shards are the evidence.
</details>
<details><summary>Gates on 4fecd59</summary>
- `dispatch-gates --commands` derived 72 families; all 72 run locally
with exit codes; `--ran` reconciliation: 69 run, 3 NOT MEASURED
(`check:dual-build-cjs-loads` exits 3, it needs every package's `dist/`;
`check-comment-mask-corpus.mjs` and `check:query-options-erasure` did
not finish inside a 240 s per-gate cap). 68 of the 69 run exit 0.
- `pnpm check:closed-ceremony-text` exits 1, and will be red in `Lint &
Repo Gates`: see the acceptance notes.
- `overlap-check`: clean against `origin/main` 444dce6, 0 open PR heads
sharing a file.
</details>
## Acceptance notes
- `protocol-enabled-holders.ts`'s module docblock and
`soleEnabledRowHolder`'s own docblock still describe its callers as "the
bare delete and draft discard"; the draft save is now a third caller.
That file is read-only on this claim's surface, so the wording is left;
noted, not filed.
- **`check:closed-ceremony-text` goes red on this PR for a reason
outside its diff.** `trackedFiles()` in
`scripts/check-closed-ceremony-text.mjs` reads `git ls-files -z --
packages content/docs .changeset` through `execFileSync` with Node's
default 1 MiB `maxBuffer` (1,048,576 bytes). That output is 1,048,565
bytes on `origin/main` 444dce6 and 1,048,601 bytes on this head; adding
`.changeset/38753-draft-save-cell.md` (36 bytes with its NUL) crosses
the limit, and the gate dies with `spawnSync git ENOBUFS` in both its
self-test and its sweep. Any PR that adds a tracked file under those
roots now trips it. The script is outside this claim's file surface, so
it is not edited here; reported for filing as a reproducible defect.
## Verification
Run `pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2
src/meta-disabled-package-doors.test.ts -t 38753` after building
`@objectstack/metadata-protocol`: 15 pass, including the four "the bare
draft save writes E's draft" cells.
Riskiest hunks: `packages/metadata-protocol/src/protocol-save.ts` (the
new re-address block in `saveMetaItem`, and that `followedBase` now also
carries the sole enabled holder into the named-base rule and the late
override re-judgment).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ)_
<!-- signed: repo:objectstack@os-support-ai · os-support-ai ·
session_01WGufzhKEbEnW8pwZRgK2gJ -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f2ca884 commit d9b72aa
3 files changed
Lines changed: 76 additions & 9 deletions
File tree
- .changeset
- packages
- metadata-protocol/src
- rest/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| |||
946 | 947 | | |
947 | 948 | | |
948 | 949 | | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
949 | 970 | | |
950 | 971 | | |
951 | 972 | | |
| |||
3643 | 3664 | | |
3644 | 3665 | | |
3645 | 3666 | | |
3646 | | - | |
3647 | | - | |
| 3667 | + | |
| 3668 | + | |
3648 | 3669 | | |
3649 | 3670 | | |
3650 | | - | |
3651 | | - | |
3652 | | - | |
3653 | | - | |
| 3671 | + | |
| 3672 | + | |
| 3673 | + | |
| 3674 | + | |
| 3675 | + | |
3654 | 3676 | | |
3655 | 3677 | | |
3656 | 3678 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1485 | 1485 | | |
1486 | 1486 | | |
1487 | 1487 | | |
1488 | | - | |
1489 | | - | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
1490 | 1491 | | |
1491 | 1492 | | |
1492 | 1493 | | |
| |||
1534 | 1535 | | |
1535 | 1536 | | |
1536 | 1537 | | |
1537 | | - | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
1538 | 1563 | | |
1539 | 1564 | | |
1540 | 1565 | | |
| |||
1547 | 1572 | | |
1548 | 1573 | | |
1549 | 1574 | | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
1550 | 1585 | | |
1551 | 1586 | | |
1552 | 1587 | | |
| |||
0 commit comments