Repository navigation
Commit 7d06248
fix(metadata-protocol): the read naming no bundle member serves a declared override of the canonical member (#34322)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNTugWasvhTMrtCZiFGrZYK)_
Fixes #32849
The last exit of the card: with #33815 (the member read) and #34169 (the
layered member read), every read that serves Z's member now serves its
declared override (see Acceptance notes for why nothing is left).
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:X 发 `welcome` 邮件模板的 `fr-FR`,附加包 Z 发它的规范成员 `en-US`,App 的 `.custom`
pair 存了一行声明覆盖 Z 的 `en-US`(`overrides.package: Z`)。#33815 / #34169 之后,点名
`?member=en-US` 的读已给出覆盖;但不点名成员的读(普通读、执行读、`?layers=true` 分层读,以及靠分层读找已发布行的
`/published`)仍给出 Z 原版 `zeta en-US`。现在它们与 `?member=en-US` 一致,给出覆盖。
- 为什么改:不点名成员就是读规范成员,和点名 `en-US` 是同一个请求;声明了的覆盖应在每个给出 Z 该成员的出口被服务(ADR-0146
D8 第 2 项、ADR-0150 D4),同一请求不能因写法不同给出两份内容。
- 风险与回滚:只改一个判定函数
`declaredMemberOverrideAddressOf`:不点名成员时按规范成员判定,而不是直接放弃;点名成员的读一字未动。未声明覆盖、未声明的
pair 行、声明给 X 的行(仍 409)、X 自己的成员、草稿读的地址、被禁用的 Z 均不变(已钉、已消融)。回滚即还原本
PR,存储数据不变。
- 先看:`packages/metadata-protocol/src/protocol-meta-item-face.ts` 中
`declaredMemberOverrideAddressOf` 开头 `addressed` 那两行。
- 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run
--maxWorkers=2 src/package-scoped-exact-qualifier.test.ts -t 'naming no
member'`,预期 7 条全绿。
- 需要你做的:无,席位落地。
## What changes
Own files (three):
`packages/metadata-protocol/src/protocol-meta-item-face.ts`,
`packages/objectql/src/package-scoped-exact-qualifier.test.ts`,
`.changeset/32849-nomember-read-declared-override.md`. No edit to
`protocol.ts`, `protocol-save.ts`, `protocol-meta-item-reads.ts` or
`protocol-meta-layered-reads.ts`: both callers already hand the
predicate the selector they resolved (`undefined` when none was named),
so the one predicate change reaches both.
`declaredMemberOverrideAddressOf` answered `undefined` when no member
was named. It now judges the member the read addresses,
`bundleMemberDiscriminator(type, member)`: the selector, or the
canonical member (`en-US`) when none was named. That is the member
`getMetaItem` and `getMetaItemLayered` read when no member is named, and
naming the canonical value is the same request
(`resolveBundleMemberSelector`'s contract). Every check below it (one
enabled shipper of that member, no environment item of it, an active row
of it that is the shipper's served override) is unchanged and now runs
at that member. A type with no members still answers `undefined`. A
bundle that ships no canonical member has no shipper of it, so it is
left as it was.
| read (fixture: X ships `fr-FR`, Z ships `en-US`; both install orders)
| before (`main` b8456eb) | after |
|:--|:--|:--|
| bare, no member, the pair row declares Z for `en-US` | `zeta en-US` |
`pair en-US`, stamped Z, envelope Z (= `?member=en-US`) |
| bare execution read, no member, same row | `zeta en-US` | `pair
en-US`, stamped Z |
| bare `?layers=true`, no member, same row | code `zeta en-US`, overlay
null, effective `zeta en-US` | code `zeta en-US`, overlay `pair en-US`,
effective `pair en-US`, envelope Z (= `?package=Z`) |
| `GET /meta/email_template/welcome/published`, same row (REST door,
temporary probe) | no overlay found; fell through to the snapshot exit |
200 `pair en-US` (the layered read's overlay exit) |
| `?member=en-US`, `?package=Z`, layered `?member=en-US` | `pair en-US`
| unchanged |
| bare `?member=fr-FR` (X's own) | `suitex fr-FR` | unchanged |
| strict draft read, no member, a pair draft pending | `pair en-US
draft` (stamped the pair) | unchanged; the layered draft layer too |
| no row / undeclared pair row | `zeta en-US`, no overlay | unchanged |
| row declares X (#32606 shape) | 409 naming X and Z (plain and layered)
| unchanged |
| Z disabled | plain: Z's withheld item; layered: no overlay | unchanged
|
| door step 1c, `packagelessLayeredReadRefusal` | no refusal | unchanged
|
Nothing refused becomes served or the reverse; no authorable key or
value moves. Same reading as #33815 and #34169 (review-b, 6894129336):
an existing declaration taking effect on one more read exit is
`Metadata-protocol: none`, patch.
## Tests
New top-level describe in the shared real-`SchemaRegistry` harness
`packages/objectql/src/package-scoped-exact-qualifier.test.ts`, beside
#34169's: `[#32849] the read naming no member serves the pair's declared
override of the canonical member an addition Z ships, as ?member=en-US
does` (7 tests):
- fix pin, both install orders: plain bare (no member) equals
`?member=en-US` (`pair en-US`, Z, Z); the execution read the same; bare
layers equal `?package=Z`'s with `effective` deep-equal; step 1c refuses
nothing; layered `?member=en-US` unchanged; X's `fr-FR` untouched.
- draft pin: the plain strict draft read naming no member serves the
pair's draft; the layered draft layer is that draft; `?package=Z` has
none.
- CONTROL no override x2 (no row / undeclared pair row): Z's own, no
overlay, on plain, execution and layered.
- CONTROL row declares X: 409 `RESOURCE_CONFLICT` naming X and Z on
plain and layered.
- CONTROL Z disabled: plain answers Z's withheld item, layered has no
overlay.
BASE measured on `main` b8456eb before any edit, with a temporary
probe in this harness (both install orders and the four CONTROL
arrangements) and a temporary probe at the REST doors (`packages/rest`,
real `SchemaRegistry`, the pair row stored and hydrated): plain bare and
execution bare served `zeta en-US`; layered bare answered overlay null,
effective `zeta en-US`; `?member=en-US`, `?package=Z` and layered
`?member=en-US` served `pair en-US`. At the doors: `GET
/meta/email_template/welcome` 200 `zeta en-US`, `/layers` effective
`zeta en-US`, `/published` found no overlay. After the fix the same door
probe answered 200 `pair en-US` on all three. Neither probe is
committed.
<details><summary>Ablations (each through
`scripts/ablation-replace.mjs`, metadata-protocol rebuilt under the
verify lock, `ablation-dist-preflight` marker present in dist,
auto-restore blob equals HEAD (`17592e66` / `70eb6082`) with `git diff
HEAD` empty, rebuilt, marker absent from all 24 dist files)</summary>
Run: `-t 'naming no member'` (7 tests).
| | mutation | result |
|:--|:--|:--|
| A1 | the fix reverted: `addressed` is the named `member` again (none
named answers `undefined`) | 3 failed, 4 passed: both fix pins, `bare,
no member: expected [ 'zeta en-US', 'com.acme.zeta', …(1) ] to deeply
equal [ 'pair en-US', 'com.acme.zeta', …(1) ]`; the draft pin, `bare
?layers=true with drafts, no member: expected [ 'zeta en-US', 'pair
en-US draft' ] to deeply equal [ 'pair en-US', 'pair en-US draft' ]` |
| A2 | `isServedOverrideRowOf(row, shipper, installed)` OR-ed with an
always-true term | 2 failed, 5 passed: the undeclared-row CONTROL,
`expected [ 'zeta en-US', 'pair en-US', …(2) ] to deeply equal [ 'zeta
en-US', null, …(2) ]`; the X-declared CONTROL, `the read answered; a
refusal was expected` |
| A3 | the plain read's draft guard removed (the strict draft read
naming no member re-addressed to Z) | 1 failed, 6 passed: the draft pin,
`No pending draft exists for email_template/welcome.` |
| A4 | the layered draft address taken after the arm re-addresses the
read | 1 failed, 6 passed: the draft pin, `expected [ 'pair en-US', null
] to deeply equal [ 'pair en-US', 'pair en-US draft' ]` |
| A5 | the disabled-shipper guard made unreachable | 1 failed, 6 passed:
the disabled CONTROL, `bare ?layers=true, no member: expected [ 'zeta
en-US', 'pair en-US', …(2) ] to deeply equal [ 'zeta en-US', null, …(2)
]` |
A2's first attempt used a constant-foldable marker (`'…' !== ''`): the
build folded it away, so the dist pre-flight could not find the marker,
and the reading was discarded and taken again with a marker the build
keeps (`String(row.id) !== '…'`); both attempts read the same. A5's
first attempt never got the build lock (queue-timeout), so its green run
was on the unmutated dist and was discarded; the second attempt is the
one above. The no-row CONTROL is an unchanged-outcome pin by
construction (no row, nothing to re-address).
</details>
## Acceptance notes
- **Why `Fixes`:** the card asks that every exit serving Z's member
serve the declared override. Exits now covered: the member read and the
bare execution read (#33815); the layered member read (#34169); the
plain, execution and layered reads naming no member, and `/published`
through the layered read (this PR). Z's list, its execution list,
`listServedOverrides` and `?package=Z` served it before #33815.
- **A bundle with no shipped canonical member** (X ships `fr-FR`, Z
ships `de-DE`, the pair declares Z for `de-DE`): measured with the fix,
the read naming no member serves X's `suitex fr-FR` (the registry's
bare-name fallback) and never Z's member, so there is no Z exit there;
the predicate is left as it was (no one shipper of `en-US`). In that
arrangement the layered read naming no member answered no layers at all
while the plain read served `suitex fr-FR`, measured at the protocol
only; the predicate does not reach it (same on `main`). Noted here, not
filed: the door reading was not taken (the verify lock timed out).
- **`/published`:** the door reads no query parameter, so its only exit
is the read naming no member. In the door probe it moved from "no
overlay" to 200 `pair en-US`. The before-side then fell through to the
metadata service's snapshot (`getPublished`); the probe's snapshot
double does not model email templates, so the harness answered 404
there. In a real kernel that exit serves the snapshot, which is not a
refusal. No refused read became served and no served read became
refused.
- Same declaration reading as #33815 and #34169: `Clause-②: no`,
`Metadata-protocol: none`, patch.
## Verification
All readings on head `884050fa14` (the fix commit `b8a667f4` with
`origin/main` 43dd565 merged in), after `pnpm install
--frozen-lockfile` and a closure build under the verify lock (`VERDICT
command-exit 0`). Every build and suite ran under
`scripts/pm/os-verify-lock.sh`; each line is the run's own verdict.
<details><summary>Suites (touched packages and direct
dependents)</summary>
- `@objectstack/metadata-protocol` typecheck exit 0; test exit 0, `Tests
22946 passed | 45 skipped (22991)`.
- `@objectstack/objectql` test exit 0, `Test Files 598 passed (598)`,
`Tests 13355 passed (13355)`.
- `@objectstack/cli` `vitest run --project unit` exit 0, `Tests 6010
passed (6010)`; the integration tier is left to CI.
- The other direct dependents of metadata-protocol (client,
cloud-connection, rest, runtime, plugin-approvals, plugin-email,
plugin-security, service-automation, service-messaging, service-package)
and the objectql/cli typechecks were still queued behind the shared
verify lock when this PR opened. Their local readings go in the os-dev
report on #32849; CI's Test Core and TypeScript Type Check run them all.
</details>
<details><summary>Gates</summary>
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 64 derived families (3 paths, 144 changed
lines vs the 3000 threshold). 61 exit 0 on `884050fa14`.
- `check:engine-double-contract` first exit 1, caused by a temporary
probe file present during that run (the gate named it). Re-run after the
probe was deleted: exit 0.
- `check:dual-build-cjs-loads` exit 3 `PREREQUISITE NOT MET` (14
packages outside this diff's closure have no `dist/`). Not measured
locally; CI's Lint & Repo Gates runs it on a full build.
- `check:type-check-debt` exit 3: its closure build queued behind the
verify lock and timed out. Not measured at open time; re-run reported on
#32849.
- `pnpm lint` exit 0.
- Body gates on this body: `check-changeset-no-major` 0,
`check-adr-0087-registration` 0, `check-closing-keyword-parity` 0 (with
`GITHUB_EVENT_PATH`), `check-partof-closing-keyword` 0 (with `PR_BODY`).
- `git merge-tree --write-tree --name-only` of `884050fa14` against the
open area PR heads: `origin/claude/area-E1-33308` (#34147, `624b7ff3`)
exit 0, no conflict; `origin/claude/area-E1-34059` (#34238, `6f89ebf9`)
exit 0, no conflict. Neither touches this PR's files.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
Co-authored-by: Claude <noreply@anthropic.com>1 parent 35c9a30 commit 7d06248
3 files changed
Lines changed: 139 additions & 5 deletions
File tree
- .changeset
- packages
- metadata-protocol/src
- objectql/src
| 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 | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
515 | 524 | | |
516 | 525 | | |
517 | 526 | | |
518 | 527 | | |
519 | 528 | | |
520 | | - | |
| 529 | + | |
| 530 | + | |
521 | 531 | | |
522 | 532 | | |
523 | 533 | | |
524 | | - | |
| 534 | + | |
525 | 535 | | |
526 | 536 | | |
527 | 537 | | |
528 | | - | |
| 538 | + | |
529 | 539 | | |
530 | 540 | | |
531 | 541 | | |
| |||
536 | 546 | | |
537 | 547 | | |
538 | 548 | | |
539 | | - | |
| 549 | + | |
540 | 550 | | |
541 | 551 | | |
542 | 552 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1452 | 1452 | | |
1453 | 1453 | | |
1454 | 1454 | | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 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 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
1455 | 1567 | | |
1456 | 1568 | | |
1457 | 1569 | | |
| |||
0 commit comments