Skip to content

Commit 9670e99

Browse files
fix(metadata-protocol)!: same-name reads that name no package answer the environment's doc first and read a disabled holder as absent (#38640)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9BzWvmsAKskRGFXQ4iwDJDW)_ Fixes #34452 Fixes #34190 Fixes #34440 Clause-②: no (narrowing) Metadata-protocol: none Skills-docs: none — no key an author writes changes; the moved answers are reads that name no package, which the skills teach as "name the package" already ## 维护者速读 - 用户能看到什么变化:同名元数据在不点名包的读取下只给一个答案;环境自己的文档先答,停用包当作不存在,过去随保存或注册顺序变的答案不再变。 - 为什么做:同名读取折叠组的读门半边(共八张卡,本 PR 收其中三张),写门与水合的半边另开第二个 PR。 - 出错会怎样:依赖旧答案、不点名包去读共享名字的调用方会改拿环境条目或 409 冲突;点名包即可读回原来那份,改动可整体撤回。 - 要你做什么:无(契约复审由席位送审)。 ## What changes Three criteria, one commit each: 1. **#34452** (04e0ebc, ruling 6942962369): beside ONE enabled holder of a doc name, a package-less entry in the registry's bare slot (a stamp-less registration, or the hydrated package-less row) is the environment's own item and answers first on the bare plain read, `/layers` and both `/published` doors, as it already did beside two holders, agreeing with the registry and `MetadataFacade`. The holder's address still reads its own doc. `refuseAmbiguousBareDocRead` (packages/metadata-protocol/src/protocol-meta-item-reads.ts) now answers the entry beside one or more enabled holders. 2. **#34190** (4bd9450): the in-process `getMetaItemLayered` naming no package, of a doc two or more enabled packages hold with no package-less entry, refuses 409 `RESOURCE_CONFLICT` naming each holder, as `getMetaItem` does; it swallowed the refusal and read the layers of the holder registered last. The HTTP transports already refused through their own step. 3. **#34440** (586b7ed, seat choice A on the card's own acceptance): a package-less row beside a disabled holder's row and enabled holders' rows of a name no enabled package ships is judged over the served set (`servedRowHolderOf`, packages/metadata-protocol/src/protocol-meta-item-face.ts), giving the answer the doors give when the disabled holder is absent (#33210 pins): two or more enabled holders are refused naming exactly them, one is served. The judgment had left such a row "as it was", so the read followed save order (D, package-less, E answered 404) and `/layers` named the disabled package. The disabled holder may hold the name as a stored row, or in code alone beside two or more enabled packages' rows (on `main` every bare door answered 404 in that form; contract review S4, 2aa6a1c). Beside rows bound to ONE package the read is left as it was (contract review S2, 65e2140). Plus (ef33907) two ADR-0087 semantic entries under step 19, `doc-bare-read-environment-entry-first` and `disabled-holder-package-less-row-bare-read-judged-as-absent`, and the changeset `.changeset/34452-same-name-bare-reads.md` (BREAKING banner, FROM and TO per criterion). Contract review 7265093897 (PASS, three should-fix), fixed in four commits: - **S1, N1** (e10d0b2): the entry and the changeset said the #34190 layered read served the holder registered FIRST; it served the one registered LAST, as the card's reading, the code comment and the pin say. The entry's surface now says a package-less row counts as the environment's entry once it is in the registry's bare slot. - **S2** (65e2140): with `if (rows.unbound) return undefined` removed, a package-less row beside rows bound to ONE enabled package, the disabled package holding the name only as code, was re-addressed to that package: measured on `RestServer`, every bare door moved from 404 to 200 serving the enabled package's row, outside the declared surface. The guard its twin `storedRowHoldersRefusal` keeps (unbound, fewer than two bound packages) is restored, so the cell answers 404 as on `main` (the same early return there), with or without an environment item in the bare slot. Whether that 404 is right is outside this PR; the seat carries it. - **S3** (db57853): beside one holder the plain read serves the environment's entry under the holder's envelope. It did the same beside two or more holders before this PR, and PR 2's #34417 hydration fix does not reach it (measured with PR 2's build: the read grafts the envelope from the artifact the name lookup answers). The entry's acceptance and the changeset name it as a known deviation, tracked in #38659. - (9a03d07) the CLI pin that no semantic entry's printed guidance cites a tracker id (`migrate-meta-engine-guidance`, Test Core 2/12 on db57853) read `#38659` in that acceptance; the acceptance now says a follow-up card carries it, and the entry's header comment names #38659. Delta contract review 7266936020 (PASS, S1 to S3 and N1 closed, one new should-fix), fixed in one commit: - **S4, N3** (2aa6a1c): the second entry's surface and the `servedRowHolderOf` jsdoc said the disabled package holds the name as a stored row; the judgment asks whether any holder of the name is disabled, the registry's holders and the rows together. Measured on `RestServer` with the face's judgment as on `main` (merge-base 7213177): with two enabled packages' rows, a package-less row and a disabled package holding the name in code alone, the plain read, `/layers` and `/published` answered 404 in both registration orders and both save orders; at this head they refuse 409 naming exactly the two enabled packages. The surface, the reason, the jsdoc and the changeset's FROM now name that holder form, and four RestServer pins hold the cell. The changeset's deviation sentence names the lock (`full`) too. ## Tests - packages/runtime/src/domains/meta-disabled-holder-artifact-door.test.ts: the `[measured, unresolved]` pin for #34452 is replaced (forced change: it pinned the FROM) by two `[#34452]` pins (a stamp-less bare entry, and a hydrated package-less row, beside one holder: every bare door and both registry readers answer the entry, the holder's address its own doc), and one `[#34190]` pin (in process, the layered read naming no package refuses 409 naming both; each holder's address reads its own layers). - packages/runtime/src/domains/meta-disabled-holder-served-stack.test.ts: `[#34440]` describe, booted kernel with sqlite, both registration orders, three save orders each for two enabled holders (409 naming exactly E and F on the plain read, `/layers`, `/published` and the execution read; each exact address its own row; `?package=D` 404) and for one enabled holder (E's row on every bare door), before and after a reboot. 12 tests. - packages/rest/src/meta-disabled-package-doors.test.ts: `[#34440]` describe on `RestServer` with the real protocol and registry, same matrix without a reboot. 12 tests, plus four S4 pins (both registration orders, two save orders: two enabled rows and a package-less row beside a disabled code holder are refused 409 naming exactly the two enabled packages on the plain read, `/layers` and `/published`) and the S2 CONTROL (2 tests, both registration orders): an enabled package's row and a package-less row beside a disabled code holder answer 404 on the plain read, `/layers` and `/published`, with and without an environment item in the bare slot. ## Acceptance notes - #34452: beside one holder the served entry wears the holder's envelope (`_packageId`, `_provenance: package`, lock `full`) on the plain read; the pins check labels. Known deviation, tracked in #38659 (contract review S3). - #34190 addendum (REST `/diff` with `?package=`) is outside this PR's file surface: `fetchCurrentMetaDocument` in packages/rest/src/rest-server.ts reads by name and ignores `?package=`. Reported to the seat. - #34440: the no-package-less-row CONTROL (E, F, D rows) is the existing ruling-Q2 test (409 naming E and F), unchanged. - The save door also reads this judgment (`servedPackagelessSaveAddress`); for the two cell shapes it answered the same before and after (two enabled holders: 409 naming them; one: that holder's address). The write-door cells (#34346, #34417) are PR 2. ## Verification The details below were measured on head `ef33907bdf` (or its parent for runs made before the changeset commit, which touches no code); the contract review delta is measured on the new head (last block). All in this container, heavy runs under `scripts/pm/os-verify-lock.sh` (shared box). <details><summary>Suites</summary> - `pnpm --filter @objectstack/metadata-protocol test`: Test Files 372 passed, 9 skipped; Tests 23649 passed, 45 skipped. - `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains`: Test Files 244 passed; Tests 7447 passed, 6 skipped. - `pnpm --filter @objectstack/rest test`: Test Files 441 passed; Tests 9065 passed, 351 skipped. - Full dogfood, `pnpm build` (123/123 tasks) then `pnpm --filter @objectstack/dogfood test`: lock VERDICT command-exit 0; Test Files 495 passed, 3 skipped (498); Tests 4187 passed, 68 skipped (4255); no failure. - Typecheck of metadata-protocol, runtime, rest and spec: exit 0 each. </details> <details><summary>FROM, then TO (#34440)</summary> The new `[#34440]` RestServer pins against the pre-fix `dist/` (head 4bd9450): 12 of 12 red, for example "expected [ 'plain', 200, undefined ] to deeply equal [ 'plain', 409, 'RESOURCE_CONFLICT' ]" with the body serving `healthy row` or `package-less row` by save order; "expected [ 'plain', 404, 'RESOURCE_NOT_FOUND' ] …" for one order; `/layers` 409 naming `app.disabled_demo` beside one enabled holder. After the fix and a rebuild: the file's 75 tests pass, and the 12 runtime `[#34440]` pins pass (193 in the file). </details> <details><summary>Ablation (dev-ablation.md: commit first, mutate with ablation-replace, rebuild, dist preflight, run, restore from HEAD, prove an empty git diff HEAD, rebuild, preflight --absent)</summary> | arm | mutation | pins red | restored | |:--|:--|:--|:--| | #34452 | the doc entry answers beside two or more holders again (`>= 2`) | artifact-door `[#34452]`: 4 of 4 | diff empty, marker absent | | #34190 | the layered read swallows the refusal again (try/catch) | artifact-door `[#34190]`: 2 of 2 | diff empty, marker absent | | #34440 (a) | `if (rows.unbound) return undefined;` put back | rest `[#34440]` 12 of 12, runtime `[#34440]` 12 of 12 | diff empty, marker absent | | #34440 (b) | the environment-item shortcut for callers off the item face put back | runtime `[#34440]` 2 of 12 (one holder, saved E, D, package-less, both registration orders: the hydrated package-less row is the registry's environment item, and `/layers` named D); rest 0 of 12 (its store double hydrates no registry item) | diff empty, marker absent | After every leg was restored: artifact-door 49 passed (6 skipped), runtime `[#34440]` 12 passed, rest `[#34440]` 12 passed. The first attempt at leg (a) was a no-op: `ablation-replace` refused it because the replacement contained its anchor and restored the file itself, so the script stopped; both #34440 legs then ran with a changed anchor text. </details> <details><summary>Gates</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` after the last commit: 192 commands, plus the four package typechecks, each run with `< /dev/null`. Reconciled with `--ran`: "100 derived, 100 run, 0 NOT-MEASURED, 0 UNRUN". Eleven first failed for a missing prerequisite (ten exit 3 for an unbuilt package or the shallow clone; the CLI test exit 1 for create-objectstack's missing `dist/`), and all eleven passed once `pnpm build` ran and the pinned fixture commit was fetched. `pnpm check:type-check-debt` passed under the lock. `node scripts/pm/overlap-check.mjs`: clean against origin/main 1d19acf. The CI-only families (Build Core, the dogfood shards, Temporal Conformance) are read from this PR's check-runs. </details> <details><summary>Contract review deltas (heads 9a03d07 and 2aa6a1c)</summary> - `pnpm --filter @objectstack/metadata-protocol test`: Tests 23649 passed, 45 skipped. `pnpm --filter @objectstack/rest test`: Tests 9067 passed, 351 skipped. `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains`: Tests 7447 passed, 6 skipped (these three at 65e2140; the two later commits change ledger and changeset text only). Spec migrations 209 passed and the CLI `migrate-meta-engine-guidance` test 3 passed on 9a03d07, against a rebuilt spec `dist/`; `check-adr-0087-registration` OK; metadata-protocol and spec typecheck exit 0. - Ablation of S2: the restored guard made conditional on a marker, rebuilt, dist preflight saw the marker; the S2 CONTROL went red (2 of 2: the doors served `healthy row`), the 12 other `[#34440]` RestServer tests and the two `contract review S4` tests the filter also ran stayed green; restored from HEAD, empty diff, rebuilt, preflight `--absent` clean. - S3 measurement: the stamp-less `[#34452]` and `[#34248]` pins run against PR 2's build with a temporary probe (removed): the plain read on both transports answered `_packageId` a holder and `_provenance: package` in the one-holder and the two-holder cell. - Gates: `node scripts/pm/dispatch-gates.mjs --commands` on 9a03d07, 100 commands each with `< /dev/null`, run after `pnpm --filter @objectstack/spec build` (an earlier run on db57853 read a spec `dist/` older than the entry edit, which is how the CLI pin passed locally and failed in CI). Reconciled with `--ran`: "100 derived, 100 run, 0 NOT-MEASURED, 0 UNRUN". `node scripts/pm/overlap-check.mjs`: clean against origin/main. Check-runs on 9a03d07: 60 success, 11 skipped, none failed. - S4 (2aa6a1c): the four new pins, with `protocol-meta-item-face.ts` swapped for its merge-base copy and metadata-protocol rebuilt, went 4 of 4 red (`[ 'plain', 404, 'RESOURCE_NOT_FOUND' ]`; a probe read 404 on `/layers` and `/published` too); with the file restored from HEAD (empty diff) and rebuilt, 4 of 4 green. `pnpm --filter @objectstack/rest test`: Tests 9071 passed, 351 skipped. Spec migrations 209, CLI `migrate-meta-engine-guidance` 3, `check-adr-0087-registration` OK, metadata-protocol and spec typecheck exit 0, after a spec and metadata-protocol rebuild. Gates on 2aa6a1c: 100 commands, `--ran` "100 derived, 100 run, 0 NOT-MEASURED, 0 UNRUN"; overlap-check clean. Check-runs on 2aa6a1c: 60 success, 11 skipped, none failed. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmQmQ1jpFsNcARMbY56 <!-- signed: repo:objectstack#3 · os-steve · session_01ADHkmQmQ1jpFsNcARMbY56 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9cbb41b commit 9670e99

11 files changed

Lines changed: 523 additions & 50 deletions
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
'@objectstack/spec': patch
4+
---
5+
6+
fix(metadata-protocol)!: the reads that name no package give one answer per name: the environment's doc entry first, and a disabled holder read as absent
7+
8+
Clause-②: no (narrowing)
9+
Metadata-protocol: none
10+
11+
<!-- adr-0087: registered doc-bare-read-environment-entry-first, disabled-holder-package-less-row-bare-read-judged-as-absent -->
12+
13+
**BREAKING** for a caller that reads a shared name without naming a package, shipped as `patch`: no key an author writes changes (`Metadata-protocol: none`). Three reads that named no package answered by registration or save order, or disagreed with the registry's own read of the same name; each now gives one answer. Naming the package (`?package=ID`, or `packageId` in process) reads that package's item exactly as before.
14+
15+
- **A doc the environment stores beside one enabled package's doc of the same name** (#34452, ruling 6942962369). FROM `GET /api/v1/meta/doc/NAME`, `/layers` and `/published` serving the package's doc while the registry and the metadata facade served the environment's own entry, TO every read that names no package serving the environment's entry, as it already did beside two or more holders. `?package=ID` still reads the package's doc. Known deviation, tracked in #38659: the plain read naming no package serves the entry under a holder's envelope (`_packageId` that holder, `_provenance: package`, lock `full`), as it already did beside two or more holders.
16+
- **The in-process layered read of a doc two or more enabled packages hold, with no environment entry** (#34190). FROM the layered read naming no package serving the layers of the package registered last, TO a `409 RESOURCE_CONFLICT` rejection naming each holder in `refusal.candidates`, as the item read and every HTTP door already answered.
17+
- **A package-less row beside a disabled package's row and enabled packages' rows of a name no enabled package ships** (#34440). FROM the plain read and the execution read following save order, `/published` serving the package-less row, `/layers` refusing with the disabled package among the candidates, and one save order answering 404 (every bare door answered 404 when the disabled package held the name in code alone beside two or more enabled packages' rows), TO the answer the reads give without the disabled holder: two or more enabled holders refused `409 RESOURCE_CONFLICT` naming exactly them in `details.candidates`, one enabled holder served, in every save order and after a restart. `?package=` of the disabled package still answers 404.
18+
19+
The fix for a caller that relied on the old answer: name the package it means. `os migrate meta --from 18` lists both entries.

‎packages/metadata-protocol/src/protocol-meta-item-face.ts‎

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,18 @@ const SERVED_HOLDER_JUDGED_ELSEWHERE: ReadonlySet<string> = new Set(['object', '
273273
* package ships no code item of the name (otherwise the shipped item is the
274274
* name's, ADR-0048 §3.3, and a row of another package never stands in for
275275
* it: {@link servedHolderAddressOf} and `packagelessContentPackage` judge
276-
* it), and when no package-less row and no
277-
* environment item is stored (a customization of no one holder, judged as
278-
* before). [#33210] On the item face (`options.refuseWithoutDisabled`) a
276+
* it). [#33210] On the item face (`options.refuseWithoutDisabled`) a
279277
* package-less row, or the registry's environment item, beside rows bound to
280278
* two or more packages with no disabled package among them is judged with
281279
* those rows instead ({@link storedRowHoldersRefusal}), so it is refused
282-
* naming them; beside one holder, none, or a disabled holder the read is left
283-
* as it was. Then the holders are the registry's served holders and the
280+
* naming them; beside one holder or none the read is left as it was.
281+
* [#34440] Beside rows bound to two or more packages, with a disabled holder
282+
* of the name (its own stored row among them, or the name in its code alone:
283+
* contract review S4), it is judged below with those rows on every door, as
284+
* the item face judges it with no disabled holder: a package-less row is no
285+
* holder and no tie-break. Beside one bound package or none the read is left
286+
* as it was.
287+
* Then the holders are the registry's served holders and the
284288
* packages the active rows are bound to, less every disabled package:
285289
*
286290
* - one → `{ kind: 'served' }`, read at its address, as the registry's
@@ -306,8 +310,7 @@ const SERVED_HOLDER_JUDGED_ELSEWHERE: ReadonlySet<string> = new Set(['object', '
306310
* package's address, so it makes that package no holder here: counted, it
307311
* re-addressed the read to an address that serves nothing, and two of them
308312
* were refused naming two such addresses. It still counts toward whether a
309-
* disabled package holds the name, and an unbound one still leaves the read
310-
* as it was.
313+
* disabled package holds the name.
311314
*
312315
* [#32354 contract review N2, #32408] Nor does a row bound to a holder's
313316
* customization pair (`pairsOf`): a pair row is bound over every holder it
@@ -340,7 +343,11 @@ export async function servedRowHolderOf(
340343
if ([...shippingPackageIds(host.shippedArtifactsOf(type, name, undefined, member))].some((id) => !disabled(id))) return undefined;
341344
const environmentItem = typeof registry.getEnvironmentScopedItem === 'function'
342345
&& registry.getEnvironmentScopedItem(type, name, member) !== undefined;
343-
if (environmentItem && options.refuseWithoutDisabled !== true) return undefined;
346+
// [#34440] Not left as it was here when a package is disabled: the
347+
// environment item may be a package-less row beside rows bound to two or
348+
// more packages, a disabled one among them, which is judged below over
349+
// the served set on every door (the plain read's face, `/layers`'s
350+
// refusal and the save door alike).
344351
// The item's active rows, read once: every row binds a holder, and only
345352
// the rows the reads serve make a served one (S4). An unprovisioned store
346353
// holds no row.
@@ -363,10 +370,20 @@ export async function servedRowHolderOf(
363370
const every: readonly string[] = registry.packageScopedHoldersOf(type, name, null, { includeDisabledPackages: true }) ?? [];
364371
const anyDisabled = [...every, ...rows.candidates].some(disabled);
365372
// [#33210] The no-disabled arm judges a package-less row itself
366-
// ({@link storedRowHoldersRefusal}); beside a disabled holder it leaves
367-
// the read as it was.
373+
// ({@link storedRowHoldersRefusal}).
368374
if (!anyDisabled) return options.refuseWithoutDisabled === true ? storedRowHoldersRefusal(host, type, name, member, every, activeRows, rows.candidates) : undefined;
369-
if (rows.unbound) return undefined;
375+
// [#34440 contract review S2] Beside rows bound to one package or none, a
376+
// package-less row leaves the read as it was, as its twin
377+
// {@link storedRowHoldersRefusal} leaves it (`holding.unbound` with fewer
378+
// than two candidates): whether the bare slot holds an environment item
379+
// then moves no answer.
380+
if (rows.unbound && rows.candidates.length < 2) return undefined;
381+
// [#34440, ADR-0150 D3] Beside a disabled holder a package-less row is
382+
// judged over the served set as it is with no disabled holder (#33210):
383+
// two or more served holders are refused naming only them, one is served
384+
// at its address, so every bare door gives the answer it gives when the
385+
// disabled holder is absent. Left as it was, the read followed save
386+
// order (one order answered 404) and `/layers` named the disabled package.
370387
const installed = installedManifestsOfEngine(host.engine);
371388
const pairRow = (row: { package_id?: unknown }): boolean =>
372389
typeof row.package_id === 'string' && every.some((holder) => pairsOf(holder, installed).includes(row.package_id as string));

‎packages/metadata-protocol/src/protocol-meta-item-reads.ts‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,18 @@ export async function judgeBareActionRead(
340340
* slot (a stamp-less registration, or a hydrated or saved row stamped with
341341
* the store's sentinel) exempts the name: it is the environment's own item,
342342
* which answers first, as the registry and `MetadataFacade.get` serve it.
343-
* That entry is returned when two or more enabled packages hold the name,
343+
* That entry is returned when one or more enabled packages hold the name,
344344
* because the layers must then serve it: the MetadataService keeps a doc by
345-
* name alone, so its copy is the holder registered last, and it answered
346-
* first ({@link bareDocServiceCopyDisplacesEntry}).
345+
* name alone, so its copy is a holder's (the one registered last), and it
346+
* answered first ({@link bareDocServiceCopyDisplacesEntry}).
347347
*
348-
* @returns the environment's entry beside two or more enabled holders, else
349-
* `undefined` (no such entry, or a name one package or none holds).
348+
* [#34452, ruling 6942962369] Beside ONE enabled holder too: the
349+
* environment's own item answers first whatever number of packages hold the
350+
* name, so the bare doors agree with the registry and `MetadataFacade.get`.
351+
* They served the one holder's doc while those two served the entry.
352+
*
353+
* @returns the environment's entry beside one or more enabled holders, else
354+
* `undefined` (no such entry, or a name no enabled package holds).
350355
* @throws {PackageScopedNameRefusedError} two or more enabled package holders.
351356
*/
352357
export function refuseAmbiguousBareDocRead(host: Pick<ProtocolHost, 'engine'>, name: string, member: string | undefined): unknown {
@@ -357,9 +362,9 @@ export function refuseAmbiguousBareDocRead(host: Pick<ProtocolHost, 'engine'>, n
357362
if (typeof registry?.resolveItem !== 'function') return undefined;
358363
const answer = registry.resolveItem('doc', name, null, member);
359364
// The registry's answer naming no package is the exempting entry (or a
360-
// name one package or none holds, which the count below leaves alone).
365+
// name no enabled package holds, which the count below leaves alone).
361366
if (answer === undefined || answer === null || storedItemPackageId(answer) !== undefined) return undefined;
362-
return (registry.packageScopedHoldersOf?.('doc', name) ?? []).length >= 2 ? answer : undefined;
367+
return (registry.packageScopedHoldersOf?.('doc', name) ?? []).length >= 1 ? answer : undefined;
363368
}
364369

365370
/**
@@ -1372,8 +1377,8 @@ export async function readMetaItem(host: Pick<ProtocolHost, 'artifactLockLayerAt
13721377
&& !(bareActionAnswer && (!serviceAnswerFitsBareAction(bareActionAnswer, fromService.data)
13731378
|| await servedFromDisabledHolder(host, request.name, fromService.data)))
13741379
&& !anotherPackagesCopy
1375-
// [#34248] …or, at a bare doc read the environment's own entry
1376-
// answers beside two holders, a package's copy
1380+
// [#34248, #34452] …or, at a bare doc read the environment's own
1381+
// entry answers beside one or more holders, a package's copy
13771382
// ({@link bareDocServiceCopyDisplacesEntry}): step 3 serves the entry.
13781383
&& !bareDocServiceCopyDisplacesEntry(bareDocEnvironmentEntry, fromService.data)) {
13791384
// [#22877] …when it is the member this read addresses. The

‎packages/metadata-protocol/src/protocol-meta-layered-reads.ts‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -316,19 +316,19 @@ async function getGenericMetaItemLayered(host: LayeredReadHost, request: {
316316
? await judgeBareActionRead(host, request.name)
317317
: undefined;
318318
const exactAddress = await admitExactQualifier(host, { type: request.type, name: request.name, packageId: request.packageId, member });
319-
// [#34248, ruling 6893582352] …and a bare doc read of a name two enabled
320-
// packages hold, beside the environment's own entry, reads that entry as
319+
// [#34248, #34452, ruling 6893582352] …and a bare doc read of a name one
320+
// or more enabled packages hold, beside the environment's own entry, reads that entry as
321321
// {@link getMetaItem} serves it ({@link refuseAmbiguousBareDocRead}): as
322-
// its code layer, never the package copy the service kept. Its refusal
323-
// without such an entry stays the door's, as before.
324-
let bareDocEnvironmentEntry: unknown;
325-
if (!request.packageId && request.type === 'doc') {
326-
try {
327-
bareDocEnvironmentEntry = refuseAmbiguousBareDocRead(host, request.name, member);
328-
} catch (error) {
329-
if (packageScopedRefusalOf(error) === undefined) throw error;
330-
}
331-
}
322+
// its code layer, never the package copy the service kept.
323+
// [#34190, ADR-0150 D3/D5] Without such an entry, a name two or more
324+
// enabled packages hold is refused here as the plain read refuses it
325+
// (`409 RESOURCE_CONFLICT` naming each holder), before any layer is read.
326+
// The refusal was dropped and left to the doors, so an in-process caller
327+
// (`getMetaItemLayered` naming no package) read the layers of the holder
328+
// the metadata service registered last while `getMetaItem` refused.
329+
const bareDocEnvironmentEntry: unknown = !request.packageId && request.type === 'doc'
330+
? refuseAmbiguousBareDocRead(host, request.name, member)
331+
: undefined;
332332
// [ADR-0150 D3, #32914] …and, naming no package, a type addressed by
333333
// package is judged by the registry's package-scoped resolver, as the
334334
// plain read judges it ({@link getMetaItem}, its `packagelessScopedRead`):
@@ -903,7 +903,7 @@ async function getGenericMetaItemLayered(host: LayeredReadHost, request: {
903903
// [#28409] …and an orphaned row (above) is a shadowed layer of the
904904
// same kind: `effective` is the code layer the by-name read serves.
905905
// [#34248, ruling 6893582352] …but not the package-less row behind a bare
906-
// doc read's environment entry, beside two enabled holders: the entry the
906+
// doc read's environment entry, beside one or more enabled holders: the entry the
907907
// hydrator lays for it is tenant-authored, so it is no code layer (#21059,
908908
// above), and the row it came from is the environment's own item, which
909909
// answers first. Declined, `effective` was the empty code layer while the

0 commit comments

Comments
 (0)