Skip to content

Commit c363084

Browse files
fix(metadata-protocol)!: the adopt-orphans door asks the __c judge against the target package; the promotion's suffix block is seal-gated (#28768)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XUSbzmMRfCQ13hL4Jffkmqp)_ Fixes #28735 Clause-②: no (narrowing) Metadata-protocol: narrowed Skills-docs: none — no file under `skills/**` teaches the adopt-orphans door or a field spelled `__c` (0 hits for `adopt-orphans`, `reassignOrphanedMetadata` and `[a-z0-9]__c`). ## 维护者速读 - **改了什么**:「收养孤儿元数据」(`POST /api/v1/packages/:id/adopt-orphans`) 现在也问 `__c` 判官:要把一个不属于任何包、带 `x__c` 字段的对象收进普通包(不是 `.custom` 配对包)时,整次收养被拒,一行都不动;收进基础包的 `.custom` 配对包照常放行。另外,草稿发布时的 `__c` 检查对「代码包自带的受封对象」不再先开口,让存储层的 `NOT_OVERRIDABLE` 作为唯一答复,和上面两道检查一致。 - **为什么改**:#28564 让保存、恢复、发布、复制、`os validate`、市场安装都拒绝普通包里的 `__c` 字段,唯独收养这道门不问,等于留了一条把 `x__c` 塞进普通包的后路(#28724 合同审查的两条 should-fix)。 - **风险与回滚**:收窄只拦今天没人用的情形:在本 PR 基点实测 `examples/**`、`packages/*/src`(不含测试)里 `[a-z0-9]__c` 字段 0 个(文本命中全在文档注释里)。沿用保存门的 `VALIDATION_ERROR` / 400 信封,不新增错误码,不动 spec。回滚即 revert,无数据迁移。 - **先看**:`packages/metadata-protocol/src/protocol.ts` 的 `reassignOrphanedMetadata`(第一次 `update` 之前新加的判官块);同文件 `promoteDraftForPublish` 里 `__c` 块的条件;`packages/metadata-protocol/src/protocol.extension-field-suffix.test.ts` 新增的 4b 节和受封用例。 - **两分钟验证**:`pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.extension-field-suffix.test.ts`,预期 `Tests 24 passed (24)`(main 上新增的 3 条红)。 - **需要你做的**:无,席位落地(合同审查后)。 ## What changes - **The adopt door asks the `__c` judge** (`reassignOrphanedMetadata`, REST `POST /api/v1/packages/:id/adopt-orphans`). After the orphan list is read and before the first storage `update`, every ACTIVE `object` row the adoption would rebind is handed to `judgeExtensionFieldSuffix` as the TARGET package's own object (`{ packageId: targetPackageId, objects }`), the same call `duplicatePackage` makes. Any refused field throws `extensionFieldSuffixRefusalError`: `400 VALIDATION_ERROR`, the message case (a)'s sentence, `issues[]` locating each field at `objects.OBJECT.fields.FIELD`. The adoption is refused whole: no row moves and `applyRegistryWriteThrough` never runs. An adoption into the base's `.custom` pair is admitted (a pair's own objects are not judged). An unparseable row body is left to the loop, as `duplicatePackage` leaves it. The type folds through `canonicalMetaType`, as the loop's own registry limb does. - **Drafts.** Ruling 1 names active rows. An adopted package-less draft is rebound in storage only (unchanged), and when it is promoted the promotion asks the same judge against its binding, so `x__c` still cannot go live in a plain package. - **The promotion's suffix block is seal-gated** (`promoteDraftForPublish`): `if (draftForGate && singularType === 'object' && !this.isSealedManagedItem(singularType, request.name))`, exactly like the D9.9 block and the namespace-prefix block above it. A sealed draft carrying `x__c` now reaches the store's one `NOT_OVERRIDABLE` / 403 (`repo.promoteDraft` → `assertAllowed`) instead of "rename the field". For a non-object type the judge answered `undefined` already, so adding `singularType === 'object'` to the condition changes nothing else. - **No new error code, no `packages/spec/**` change, no ui change, no new gate.** Not touched: `protocol-packaged-base-refusal.ts`, `stored-row-binding.ts`, `withRowBinding`, the automation boot pull. - **Changeset** `.changeset/28735-adopt-orphans-extension-field-suffix.md`: `minor` on `@objectstack/metadata-protocol` (kind `narrowed`), with the BREAKING banner, both declaration lines, the migration paragraph and the ADR-0087 `not-required (no-migration-prescription)` disposition. **Why `Metadata-protocol: narrowed`.** An adoption into a plain package that admitted an object row carrying `x__c` is now refused: one more write door applies the requirement #28564 declared `narrowed` at its doors. Nothing an author could save before is refused at the save door (the package-less save is unchanged); what narrows is the set of package contents the adopt door can produce. ## Tests New in `packages/metadata-protocol/src/protocol.extension-field-suffix.test.ts` (the #28564 file, its stub engine and helpers): - **§4b, adopt-orphans.** (1) A package-less active `probe_env` with `x__c`, saved through the real save door (not judged: no package), adopted into the plain `app.probe-bound`: refused with case (a)'s envelope and sentence, `issues` path `objects.probe_env.fields.x__c`; `engine.update` never called, `applyRegistryWriteThrough` never called; the store reads back the row still package-less and active. (2) Mixed: a clean `probe_clean` beside `probe_env` (`x__c`) into the plain package: refused whole; both rows stay package-less; no write-through. (3) CONTROL: the same `x__c` row adopted into `app.probe-bound.custom` is admitted (`success: true`, `reassignedCount: 1`) and the row reads back bound to the pair; a clean row into the plain package moves too. - **§3b, the seal gate.** The stub registry ships `probe_sealed` (`getArtifactItem` answers `_packageId: com.acme.shipper`, `_provenance: package`), so `isSealedManagedItem('object','probe_sealed')` holds. A draft of it carrying `x__c`, bound to the plain package, is staged as a row stored before the gate (the save door refuses that draft first, `refusePackagedBaseOverride`). `publishMetaItem` answers `NOT_OVERRIDABLE` / 403, and the draft is still a draft. The gate is reachable this way only (a pre-gate stored row); no public save produces that draft today. <details><summary>Red on base, green on head</summary> - **Base** (`protocol.ts` from `db357f6d`, the new tests at head): `Tests 3 failed | 21 passed (24)`. The seal pin: `expected { code: 'VALIDATION_ERROR', …(1) } to deeply equal { Object (code, status) }`. The two adopt refusals: `expected null to be an instance of Error` (the adoption succeeded). The `.custom` CONTROL is green on base and head, as a control should be. Restore: `git checkout HEAD -- protocol.ts`, `git diff HEAD` empty. - **Head**: `Tests 24 passed (24)`. </details> <details><summary>Ablations (one-off, from committed HEAD, `node scripts/ablation-replace.mjs`)</summary> The suite imports `./protocol.js` from source, so no build sits between mutation and run. - **Adopt call removed.** `if (suffixRefusals.length > 0) throw extensionFieldSuffixRefusalError(suffixRefusals);` in `reassignOrphanedMetadata` replaced with `void suffixRefusals; /* ABLATE_28735_ADOPT */`: anchor 1 → 0, blob `065792a3d3d0` → `618118ae6818`. `Tests 2 failed | 22 passed (24)`: the two adopt refusals. Restored: blob equals HEAD `065792a3d3d0`, `git diff HEAD` empty. - **Seal gate removed.** The promotion's suffix-block condition replaced with `if (draftForGate /* ABLATE_28735_SEAL */)`: anchor 1 → 0, blob `065792a3d3d0` → `7a4b2a52267f`. `Tests 1 failed | 23 passed (24)`: the seal pin. Restored: blob equals HEAD, `git diff HEAD` empty. </details> ## Acceptance notes - **The other two judges (ruling 2).** Not added. The namespace-prefix judge (`objectNamespacePrefixViolation`) and the owner judge (`permissionSetOwnerBindingRefusal`) are skipped at this door too. See the report's `open_questions` for whether they should ride this call and what that costs. - **The judge module's door list.** `protocol-extension-field-suffix.ts`'s header lists the doors that call the judge and does not yet name the adopt door. That file is outside the claim's file surface, so it is left; the call site's comment and `reassignOrphanedMetadata`'s header carry the reference. - **Narrowing count.** 0 fields spelled `[a-z0-9]__c` in `examples/**` and `packages/*/src` outside tests (`git grep -nE '[a-z0-9]__c\b'`, 10 textual hits, all doc comments, including the two this PR adds), so no package-less `object` row in the tree carries one. ## Verification All readings at head `8bdde034` (the fix `67c08437` + changeset `6f6d2f35`, merged once with `origin/main` `7a48bf73`, which carries #28734's `protocol.ts` edit; clean merge, both kept), after `pnpm install --frozen-lockfile` and a full `pnpm turbo run build --concurrency=2` (118/118 tasks). <details><summary>Package tests, typecheck, lint</summary> - `pnpm --filter @objectstack/metadata-protocol test`: `Test Files 294 passed | 4 skipped (298)`, `Tests 22012 passed | 26 skipped (22038)` (lock VERDICT command-exit 0). - `pnpm --filter @objectstack/metadata-protocol typecheck`: exit 0 (the package type-checks its own tests: `check:type-check-debt` reports 0 packages hiding tests from tsc). - `pnpm exec eslint --no-inline-config` on the two touched files: exit 0. - REST door and the adopt pins downstream: `@objectstack/runtime` `src/domains/packages-adopt-orphans-readonly.test.ts` + `src/package-duplicate-adopt-org-scope.integration.test.ts` 13/13; `@objectstack/objectql` (reads metadata-protocol from `dist`, rebuilt) `protocol-adopt-orphans-object-registry`, `protocol-adopt-orphans-draft-view-registry`, `protocol-package-lifecycle`, `protocol-packageless-overlay-migration`, `protocol-sentinel-owner-package-save-refusal` 44/44 (pre-merge head `6f6d2f35`). The REST door relays the protocol's throw through `deps.errorFromThrown`, as `duplicate` does, so the code, status and `issues` reach the wire unchanged; no route code moved. </details> <details><summary>Full dogfood battery (the `(narrowing)` arm)</summary> - Head `8bdde034`: `pnpm --filter @objectstack/dogfood test` under the lock, VERDICT command-exit 0, `Test Files 374 passed | 3 skipped (377)`, `Tests 3034 passed | 28 skipped (3062)`. No failure. - Also green at the pre-merge head `6f6d2f35` (same counts). </details> <details><summary>Derived gates (`dispatch-gates.mjs --commands`, 61 families)</summary> - All 61 exit 0 at `8bdde034`; `dispatch-gates --ran`: `61 derived, 61 run, 0 NOT-MEASURED, 0 UNRUN`. - `check:type-check-debt` (under the lock): `check-type-check-coverage: OK — 126/129 workspace packages type-checked`, `--re-measure: OK`. - First pass at `6f6d2f35` had three PREREQUISITE reds (no full build yet: `check:dts-closure`, `check:dual-build-cjs-loads`; shallow clone: `check-plugin-teardown-shape --self-test`) and one queue-timeout (`check:type-check-debt`, behind the dogfood run). None measured anything; all four are green in the `8bdde034` pass after the full build and `git fetch --depth=1` of the fixture commit. - `pnpm lint` (repo-wide) and the CI-only families are CI's; see the PR's check-runs. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5mTYb1BTJNRqf3bdJ8)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8afaf12 commit c363084

3 files changed

Lines changed: 142 additions & 3 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@objectstack/metadata-protocol': minor
3+
---
4+
5+
**BREAKING** fix(metadata-protocol): the adopt-orphans door refuses to rebind a package-less object carrying a `__c` field into a plain package (ADR-0146 D10, #28735)
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: narrowed
9+
Skills-docs: none — no file under `skills/**` teaches the adopt-orphans door or a field spelled `__c` (0 hits for `adopt-orphans`, `reassignOrphanedMetadata` and `[a-z0-9]__c`).
10+
11+
<!-- adr-0087: not-required (no-migration-prescription) The narrowing refuses one more door into the `__c` reservation #28564 declared: an adoption (`POST /api/v1/packages/:id/adopt-orphans`) that would rebind a package-less active object row carrying a field spelled `__c` into a package that is not a base's paired `.custom`. No metadata key, accepted value of a key, export or error code is removed or renamed, and no stored shape changes. The remedy is a rename of the field, or adopting into the base's `.custom` pair, an authoring choice a person makes; there is no mechanical conversion between two metadata versions for `objectstack migrate meta` to apply. Measured at the PR's base: 0 fields spelled `[a-z0-9]__c` in `examples/**` and `packages/*/src` outside tests (every textual hit is a doc comment). The other categories are closed on facts: the package publishes (not unpublished); no ADR-0087 id is named or touched (not registered or already-registered); no `packages/spec/**` file is touched, so no schema, type or runtime interface moves (not type-surface-only, not runtime-interface-only); and no export is retired (not runtime-export-retired). -->
12+
13+
`reassignOrphanedMetadata` (REST `POST /api/v1/packages/:id/adopt-orphans`) rebinds every active package-unbound row into the target package. The save door does not judge a package-unbound object against the `__c` reservation (a row bound to no package is the environment's own), so an object carrying `x__c` is stored package-less; adopted into a plain package, `x__c` became that package's own field, the case (a) every other door refuses.
14+
15+
The door now asks the save door's judge (`judgeExtensionFieldSuffix`) for every active `object` row it would rebind, judged against the TARGET package id, before the first storage update. Any refused field refuses the adoption whole: `400 VALIDATION_ERROR`, the message case (a)'s sentence ("the `__c` suffix is reserved to a base's paired `.custom` package (ADR-0146 D10); rename the field."), `issues[]` locating each field at `objects.OBJECT.fields.FIELD`. No row moves and nothing is written through to the registry. An adoption into the base's `.custom` pair is admitted, since its objects are the pair's own. An adopted draft is judged when it is promoted, by the promotion's own call to the same judge. No new error code.
16+
17+
Also, the draft promotion's suffix block is no longer asked of sealed managed content (an object a code package ships), like the two promotion blocks above it: such a draft gets the store's one `NOT_OVERRIDABLE` / 403 refusal instead of "rename the field".
18+
19+
**Migration.** None needed for this repository: 0 fields affected (measured above). An environment holding a package-less object with a `__c` field renames the field before adopting into a plain package, or adopts into the base's `.custom` pair.

‎packages/metadata-protocol/src/protocol.extension-field-suffix.test.ts‎

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* [ADR-0146 D10, #28564] The `__c` extension-field reservation at every door
55
* of this package — one judge (`protocol-extension-field-suffix.ts`), asked by
66
* the save door, the restore doors, the draft promotion (`publishMetaItem` and
7-
* the `publishPackageDrafts` batch that shares it) and `duplicatePackage`; and
7+
* the `publishPackageDrafts` batch that shares it), `duplicatePackage` and
8+
* ([#28735]) `reassignOrphanedMetadata`, the adopt-orphans door; and
89
* `installPackage`, which its closed manifest already covers.
910
*
1011
* Maintainer, verbatim: 「扩展字段用 __c 后缀,只有 .custom 包能用。」
@@ -532,6 +533,34 @@ describe('[ADR-0146 D10] the draft promotion refuses an object draft carrying a
532533
});
533534
});
534535

536+
describe('[#28735] the promotion\'s suffix block is not asked of sealed managed content', () => {
537+
/** A code package's shipped object, as `SchemaRegistry.getArtifactItem` stamps it. */
538+
const SHIPPED = 'probe_sealed';
539+
const sealedHarness = () => {
540+
const h = makeProtocol();
541+
h.engine.registry.getArtifactItem = (type: string, name: string) => (type === 'object' && name === SHIPPED
542+
? { name, label: 'Sealed', _packageId: 'com.acme.shipper', _provenance: 'package' }
543+
: undefined);
544+
return h;
545+
};
546+
547+
it('a draft of a shipped object carrying `x__c`, stored before the rule, answers the store\'s NOT_OVERRIDABLE, not "rename the field"', async () => {
548+
const h = sealedHarness();
549+
// The save door refuses this draft (`refusePackagedBaseOverride`), so it is staged as a row stored before the gate.
550+
const row: Row = {
551+
id: 'r_sealed', type: 'object', name: SHIPPED, organization_id: null, package_id: BOUND, state: 'draft',
552+
metadata: JSON.stringify(obj(SHIPPED, 'Sealed', 'x__c')),
553+
};
554+
h.rows.set(keyOf(row as unknown as Record<string, unknown>), row);
555+
556+
const { error } = await attempt(() => h.protocol.publishMetaItem({ type: 'object', name: SHIPPED, packageId: BOUND }));
557+
558+
expect(error).toBeInstanceOf(Error);
559+
expect({ code: error.code, status: error.status }).toEqual({ code: 'NOT_OVERRIDABLE', status: 403 });
560+
expect(storedObjects(h)).toEqual([{ row: SHIPPED, state: 'draft', binding: BOUND, fields: ['title', 'x__c'] }]);
561+
});
562+
});
563+
535564
// ═══════════════════════════════════════════════════════════════════════════
536565
// 4. duplicatePackage, judged against the target id
537566
// ═══════════════════════════════════════════════════════════════════════════
@@ -567,6 +596,56 @@ describe('[ADR-0146 D10] duplicatePackage from a `.custom` pair into a plain id
567596
});
568597
});
569598

599+
// ═══════════════════════════════════════════════════════════════════════════
600+
// 4b. reassignOrphanedMetadata (the adopt-orphans door), judged against the target id
601+
// ═══════════════════════════════════════════════════════════════════════════
602+
603+
describe('[ADR-0146 D10, #28735] the adopt-orphans door judges each object row it rebinds against the target', () => {
604+
/** Package-less active objects through the real save door (not judged: no package), then the write-through spied. */
605+
async function orphans(h: Harness, ...bodies: Array<ReturnType<typeof obj>>) {
606+
for (const item of bodies) await h.protocol.saveMetaItem({ type: 'object', name: item.name, item });
607+
h.saveDoor.mockClear();
608+
return vi.spyOn(h.protocol, 'applyRegistryWriteThrough');
609+
}
610+
611+
it('a package-less object with `x__c` adopted into a plain package is refused with case (a); nothing moves, nothing registers', async () => {
612+
const h = makeProtocol();
613+
const writeThrough = await orphans(h, obj('probe_env', 'Env', 'x__c'));
614+
const update = vi.spyOn(h.engine, 'update');
615+
616+
const { error } = await attempt(() => h.protocol.reassignOrphanedMetadata({ targetPackageId: BOUND }));
617+
618+
expectReservedRefusal(error, 'x__c', 'probe_env', BOUND, 'objects.probe_env.fields.x__c');
619+
expect(update).not.toHaveBeenCalled();
620+
expect(writeThrough).not.toHaveBeenCalled();
621+
expect(storedObjects(h)).toEqual([{ row: 'probe_env', state: 'active', binding: null, fields: ['title', 'x__c'] }]);
622+
});
623+
624+
it('a mixed adoption (one clean row, one `x__c` row) into a plain package is refused whole: the clean row does not move either', async () => {
625+
const h = makeProtocol();
626+
const writeThrough = await orphans(h, obj('probe_clean', 'Clean'), obj('probe_env', 'Env', 'x__c'));
627+
628+
const { error } = await attempt(() => h.protocol.reassignOrphanedMetadata({ targetPackageId: BOUND }));
629+
630+
expectReservedRefusal(error, 'x__c', 'probe_env', BOUND, 'objects.probe_env.fields.x__c');
631+
expect(writeThrough).not.toHaveBeenCalled();
632+
expect(storedObjects(h).map((r) => [r.row, r.binding])).toEqual([['probe_clean', null], ['probe_env', null]]);
633+
});
634+
635+
it('CONTROL: the same `x__c` row adopted into the base\'s `.custom` pair is admitted and moves; a clean row into the plain package too', async () => {
636+
const pairH = makeProtocol();
637+
await orphans(pairH, obj('probe_env', 'Env', 'x__c'));
638+
const res = await pairH.protocol.reassignOrphanedMetadata({ targetPackageId: PAIR });
639+
expect(res).toMatchObject({ success: true, reassignedCount: 1, targetPackageId: PAIR });
640+
expect(storedObjects(pairH)).toEqual([{ row: 'probe_env', state: 'active', binding: PAIR, fields: ['title', 'x__c'] }]);
641+
642+
const plainH = makeProtocol();
643+
await orphans(plainH, obj('probe_clean', 'Clean', 'region'));
644+
expect((await plainH.protocol.reassignOrphanedMetadata({ targetPackageId: BOUND })).reassignedCount).toBe(1);
645+
expect(storedObjects(plainH)).toEqual([{ row: 'probe_clean', state: 'active', binding: BOUND, fields: ['title', 'region'] }]);
646+
});
647+
});
648+
570649
// ═══════════════════════════════════════════════════════════════════════════
571650
// 5. installPackage — covered by its closed manifest
572651
// ═══════════════════════════════════════════════════════════════════════════

‎packages/metadata-protocol/src/protocol.ts‎

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23957,8 +23957,10 @@ export class ObjectStackProtocolImplementation implements
2395723957
// [ADR-0146 D10, #28564] …and an object draft's fields against the
2395823958
// `__c` reservation, judged against the package promoted into, with the
2395923959
// save door's judge and envelope, before `repo.promoteDraft` writes. See
23960-
// {@link objectBodyExtensionFieldSuffixRefusal}.
23961-
if (draftForGate) {
23960+
// {@link objectBodyExtensionFieldSuffixRefusal}. [#28735] ⛔ Not asked
23961+
// of SEALED managed content, for the D9.9 block's reason: the store's
23962+
// `NOT_OVERRIDABLE` is that row's one answer, not "rename the field".
23963+
if (draftForGate && singularType === 'object' && !this.isSealedManagedItem(singularType, request.name)) {
2396223964
const suffixRefusal = objectBodyExtensionFieldSuffixRefusal(
2396323965
singularType, draftForGate.body, request.name, promoteInto,
2396423966
);
@@ -26833,6 +26835,21 @@ export class ObjectStackProtocolImplementation implements
2683326835
* new binding) until the next boot dropped it again, against the
2683426836
* write-through's own rule that a draft never leaks into the runtime
2683526837
* (ADR-0048). One gate before both limbs now admits active rows only.
26838+
*
26839+
* ## [ADR-0146 D10, #28735] The `__c` reservation, judged against the target
26840+
*
26841+
* A package-unbound row is not judged by the reservation (it is the
26842+
* environment's own), so the save door admits an object carrying `x__c`
26843+
* into no package. Rebinding that row makes `x__c` a field the TARGET
26844+
* package declares on its own object, which case (a) refuses outside a
26845+
* `.custom` pair. So every active `object` row this adoption would rebind
26846+
* is judged against the target id with the save door's judge
26847+
* ({@link judgeExtensionFieldSuffix}) before the first storage update, and
26848+
* any refused field refuses the adoption whole, with the save door's
26849+
* envelope ({@link extensionFieldSuffixRefusalError}, `VALIDATION_ERROR` /
26850+
* 400, `issues[]` locating each field): no row moves and nothing is
26851+
* written through to the registry. An adopted draft is judged when it is
26852+
* promoted (the promotion asks the same judge against its binding).
2683626853
*/
2683726854
async reassignOrphanedMetadata(request: {
2683826855
targetPackageId: string;
@@ -26865,6 +26882,30 @@ export class ObjectStackProtocolImplementation implements
2686526882
&& !this.isArtifactBacked(PLURAL_TO_SINGULAR[r.type] ?? r.type, String(r.name)),
2686626883
);
2686726884

26885+
// [ADR-0146 D10, #28735] ⭐ THE `__c` RESERVATION, JUDGED AGAINST THE
26886+
// TARGET, before the first update below: each active object row this
26887+
// adoption rebinds becomes the target's own object. Refused whole, with
26888+
// the save door's judge and envelope; see the header. An unparseable
26889+
// row is left to the loop, as `duplicatePackage` leaves it.
26890+
{
26891+
const adoptedObjects: Record<string, unknown> = {};
26892+
for (const row of orphans) {
26893+
if (canonicalMetaType(String(row?.type)) !== 'object' || row.state !== 'active') continue;
26894+
if (typeof row.name !== 'string') continue;
26895+
let body: unknown;
26896+
try {
26897+
body = typeof row.metadata === 'string' ? JSON.parse(row.metadata) : row.metadata;
26898+
} catch {
26899+
continue;
26900+
}
26901+
if (body && typeof body === 'object' && !Array.isArray(body)) {
26902+
adoptedObjects[row.name] = { ...(body as Record<string, unknown>), name: row.name };
26903+
}
26904+
}
26905+
const suffixRefusals = judgeExtensionFieldSuffix({ packageId: request.targetPackageId, objects: adoptedObjects });
26906+
if (suffixRefusals.length > 0) throw extensionFieldSuffixRefusalError(suffixRefusals);
26907+
}
26908+
2686826909
const reassigned: Array<{ type: string; name: string }> = [];
2686926910
// [#12981] The refusal channel this loop used to lack entirely.
2687026911
//

0 commit comments

Comments
 (0)