Skip to content

Commit 54bd49b

Browse files
committed
feat(runtime)!: retire POST /packages/:id/adopt-orphans and its console entries (#38150 PR-B1)
The all-at-once adoption of every loose item retires with every surface that reached it: the route and its ledger row, the protocol method `reassignOrphanedMetadata` (and `releaseAdoptedObjectOwner`, which only it used), the client's `packages.adoptOrphans`, the spec's `ReassignOrphanedMetadataResponseSchema` (registered as a retired def), the `packages_orphan_adoption_unsupported` message, and the console's "Adopt loose items" button and Studio menu item with their i18n keys. The move door (`POST /packages/:id/move-in`) takes its place in every route table pin, and the old door's own tests go with it. Claude-Session: https://claude.ai/code/session_01L9qibyHmxFV4bTFZ5BKnUz Co-authored-by: Claude <noreply@anthropic.com>
1 parent c091d28 commit 54bd49b

72 files changed

Lines changed: 343 additions & 2756 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
'@objectstack/spec': major
3+
'@objectstack/metadata-protocol': patch
4+
'@objectstack/runtime': patch
5+
'@objectstack/client': patch
6+
'@object-ui/app-shell': patch
7+
'@object-ui/i18n': patch
8+
---
9+
10+
feat(runtime)!: `POST /api/v1/packages/:id/adopt-orphans` is retired; loose items move by an explicit selection through `POST /api/v1/packages/:id/move-in`
11+
12+
Clause-②: no (narrowing)
13+
Metadata-protocol: narrowed
14+
15+
<!-- adr-0087: registered packages-adopt-orphans-door-retired -->
16+
17+
**BREAKING.** The all-at-once adoption of every loose (package-less) item into one package is gone, with every surface that reached it. It rebound rows with a bare storage update and asked none of the save door's questions, so it could adopt into a package nothing installed, adopt an object its target's namespace prefix refuses, and leave the runtime serving the old address until a restart (#37468). ADR-0084's amendment of 2026-11-26 replaces it with one door that moves a selection, each item through the save door: `POST /api/v1/packages/:id/move-in`, shipped in the same release.
18+
19+
What is removed:
20+
21+
- the route `POST /api/v1/packages/:id/adopt-orphans` (it answers `404` now), and its route-ledger row;
22+
- the client method `packages.adoptOrphans(id)` of `@objectstack/client`;
23+
- the protocol method `reassignOrphanedMetadata` of `@objectstack/metadata-protocol`'s `ObjectStackProtocolImplementation`;
24+
- `ReassignOrphanedMetadataResponseSchema` and its `ReassignOrphanedMetadataResponse` / `ReassignOrphanedMetadataResponseParsed` types from `@objectstack/spec/api`, and the published JSON schema `api/ReassignOrphanedMetadataResponse.json`;
25+
- the operation-message key `packages_orphan_adoption_unsupported` (four locales);
26+
- in the console, the Packages page's "Adopt loose items" button and its dialog, and the matching item of Studio's 「⋯」 package menu, with the `engine.packages.detail.adopt*` keys of `@object-ui/i18n`'s studio namespace (`adoptOrphans`, `adopting`, `adoptTitle`, `adoptDescription`, `adoptedOne`, `adoptedOther`). The console's door to move loose items is the move-in confirm step of the next change in this release.
27+
28+
How to move:
29+
30+
| before | after |
31+
|:--|:--|
32+
| `POST /api/v1/packages/:id/adopt-orphans` | `POST /api/v1/packages/:id/move-in` with `{ "items": [{ "type": "flow", "name": "…" }, …] }` |
33+
| `client.packages.adoptOrphans(id)` | `client.packages.moveIn(id, { items })` |
34+
| `protocol.reassignOrphanedMetadata({ targetPackageId })` | `protocol.moveIntoPackage({ targetPackageId, items })` |
35+
| `ReassignOrphanedMetadataResponseSchema` | `MoveIntoPackageResponseSchema` |
36+
37+
The fix in one line: name the loose items to move; to move them all, list them and pass every one. The move is whole or nothing, and `dryRun: true` answers what it would do without writing.

‎content/docs/api/metadata-api.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Under a `group` or `isolated` tenancy posture every `/packages` write is the
174174
platform operator's (ADR-0131 D12 items 7–8, D11): install (`POST /packages`),
175175
the manifest `PATCH`, enable, disable, publish, `publish-drafts`,
176176
`discard-drafts`, `revert`, `rollback`, `commits/:commitId/revert`, `duplicate`,
177-
`adopt-orphans` and this delete. Any other caller, a `manage_metadata` holder
177+
`move-in` and this delete. Any other caller, a `manage_metadata` holder
178178
inside one organization included, is refused `403 PERMISSION_DENIED` naming the
179179
posture, before anything is read or written, whatever the package carries.
180180
Reads are unchanged. Under `single` every `manage_metadata` holder writes as

‎content/docs/permissions/system-context.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ One of the largest consumers of the flag;
213213
| 54 | Package REST route capability gate bypassed | rest | Get: a marketplace publish over REST (`POST /packages/publish`, the one route the REST registrar mounts since #14503) without `manage_metadata`; the package read cohort (`studio.access` / `setup.access`) is enforced by the dispatcher `/packages` domain's own read gate, where the reads are served | `refusePackageRequest` |
214214
| 55 | Package domain capability gates bypassed | runtime | Get: package management and package-inventory reads without the capability; and a write to a package that holds a knowledge source (the twelve doors that write an existing package) without `manage_knowledge_sources` beside it (ADR-0161 K4); and, on the move-in door, a selected `datasource` or `knowledge_source` moved without the capability its `/meta` write asks (`manage_platform_settings`, `manage_knowledge_sources`) | `requireManageMetadata`, `requireReadCapability`, `refuseKnowledgeSourcePackageWrite`, `handlePackagesRequest` |
215215
| 56 | Activation write / authoring refusals do not fire | runtime | Get: activation artifacts writable and authorable without the activation-authoring capability | `refuseUngrantedActivationWrite`, `refuseUngrantedActivationAuthoring` |
216-
| 55b | Walled environment-metadata refusal does not fire | metadata-core, rest, runtime | Get: under `isolated` / `group`, a write of the environment's metadata, of any type, at the `/meta` write doors (save, reset, publish, rollback) and `POST /meta/_migrate-stored` on both transports, at every `/packages` write door (create, the manifest `PATCH`, enable, disable, publish, `publish-drafts`, `discard-drafts`, `revert`, `rollback`, `commits/:commitId/revert`, `duplicate`, `adopt-orphans`, delete), at the `/automation` definition writes (create, update, delete, clone), at the permission-set clone door, at the import of a remote table as an object (the REST import route and the MCP `import_object` tool), at the open MCP server's draft save and discard (`save_metadata_draft`, `delete_metadata_draft`), and at the refresh of a federated datasource's cached catalog. Every other caller below the platform-operator rung is refused `403` there (ADR-0131 D3, D12 items 7–8, D11), because one organization's write would change what every organization resolves. The seeders, the package door and migrations write the environment's metadata this way. Under `single` the refusal is inert for every caller | `walledCatalogWriteVerdict`, `walledCatalogRefusal`, `refuseWalledCatalogPackageWrite`, `refuseWalledFlowDefinitionWrite`, `registerExternalDatasourceRoutes`, `federationService`, `openWriter` |
216+
| 55b | Walled environment-metadata refusal does not fire | metadata-core, rest, runtime | Get: under `isolated` / `group`, a write of the environment's metadata, of any type, at the `/meta` write doors (save, reset, publish, rollback) and `POST /meta/_migrate-stored` on both transports, at every `/packages` write door (create, the manifest `PATCH`, enable, disable, publish, `publish-drafts`, `discard-drafts`, `revert`, `rollback`, `commits/:commitId/revert`, `duplicate`, `move-in`, delete), at the `/automation` definition writes (create, update, delete, clone), at the permission-set clone door, at the import of a remote table as an object (the REST import route and the MCP `import_object` tool), at the open MCP server's draft save and discard (`save_metadata_draft`, `delete_metadata_draft`), and at the refresh of a federated datasource's cached catalog. Every other caller below the platform-operator rung is refused `403` there (ADR-0131 D3, D12 items 7–8, D11), because one organization's write would change what every organization resolves. The seeders, the package door and migrations write the environment's metadata this way. Under `single` the refusal is inert for every caller | `walledCatalogWriteVerdict`, `walledCatalogRefusal`, `refuseWalledCatalogPackageWrite`, `refuseWalledFlowDefinitionWrite`, `registerExternalDatasourceRoutes`, `federationService`, `openWriter` |
217217
| 57 | Automation run-state read, flow-authoring write, the paused-run caller gate (screen read and resume), the two operator run-lifecycle writes, and the elevated self-triggered start, the AI-service-account elevated start and the start-record check at every door that starts a flow by name all pass | runtime | Get: run state, flow writes, a paused run's screen and its resume with no grant and without being the run's starter — and cancelling or restoring a suspension without the platform-operator rung. The screen read and the resume ask one predicate, so this is one bypass for both. The lifecycle bypass is the in-process owner's door: plugin-approvals' revise-window recall (ADR-0044) cancels on behalf of a decision it already authorized and recorded. And starting a flow declared `runAs: 'system'` whose type is self-triggered (`autolaunched`, `record_change`, `schedule`) through any door that starts a flow by name — the trigger route, an action of `type: 'flow'` (REST `/actions` and the MCP `run_action` bridge) and a declared endpoint of `type: 'flow'` — which every other caller, the guest principal included, is refused `403 PERMISSION_DENIED` (the maintainer's rulings, letters B and A) — and starting, through the same doors, a flow whose `requiredPermissions` the caller does not hold (ruling record 6377848497, letter A) — and starting, through the same doors, a flow declared `runAs: 'system'` as an AI service account (an agent acting for itself, with no `onBehalfOf`) where the action's `ai.exposed: true` opt-in is not in hand, which that account is refused `403 PERMISSION_DENIED` (ADR-0151 Non-goals, ruling record 6812617393, letter C; a trigger route and a declared endpoint carry no opt-in, so there it is always refused, and the refusal names the action door that admits it). And starting, through the same doors, a flow on a record key the caller's own scope does not deliver, which every other caller is refused with the action door's `404 RECORD_NOT_FOUND` before the run exists (and `400 VALIDATION_FAILED` for a key that is not one id, or for an elevated start that names no object). The three doors ask one check, so this is one bypass for all of them, and it is the in-process caller's, such as a job: inbound HTTP never carries the flag | `mayReadRunState`, `refuseUngrantedFlowWrite`, `isRunStarterOrRunStateReader`, `refuseUngrantedRunLifecycleWrite`, `flowStartRefusal`, `refuseUnreadableFlowStartRecords` |
218218
| 57b | Connector credential door's capability and posture gates pass | runtime | Get: listing, setting and clearing the environment's stored connector credentials (`/automation/connectors/credential-refs`) without `manage_metadata`, and under the `group` / `isolated` postures, where the door refuses every other caller `403 PERMISSION_DENIED` naming the posture, the platform operator included, because the store is environment-level. The bypass is the in-process caller's: inbound HTTP never carries the flag. Get nothing more about the value: no answer of this door carries it | `refuseUngrantedConnectorCredentialAccess`, `refuseWalledConnectorCredentialAccess` |
219219
| 57c | Connector connection door's capability gate passes | runtime | Get: reading, beginning, completing (the OAuth callback) and revoking an organization's connection of an `oauth2` `authorization_code` connector instance (`/automation/connectors/:name/connection`, `/automation/connectors/oauth/callback`, ADR-0143 D5) without `manage_metadata`. No posture refuses it: a connection belongs to its organization. The bypass is the in-process caller's: inbound HTTP never carries the flag. Get nothing more: no answer of this door carries a token, and the callback's `state` is still bound to the user and organization that began the connect | `refuseUngrantedConnectorConnectionAccess` |

‎content/docs/protocol/knowledge.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ and the MCP draft door:
225225
imply it. Over MCP it is the human's own grant that is read, never the
226226
agent's. The package doors ask it too: every write to an existing package
227227
that holds a knowledge source (enable, disable, publish, publish-drafts,
228-
discard-drafts, the commit revert, rollback, revert, adopt-orphans,
228+
discard-drafts, the commit revert, rollback, revert, move-in,
229229
duplicate, the manifest update and delete) needs the capability, and is
230230
refused `403` naming it otherwise. A package that holds none is written as
231231
before. Two doors are not asked. Installing a package is one: a packaged

‎content/docs/references/api/package-lifecycle.mdx‎

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ authored after that retirement per the ruling's sequencing (3A).
5050
## TypeScript Usage
5151

5252
```typescript
53-
import { DiscardPackageDraftsResponseSchema, DuplicatePackageResponseSchema, EnsureCustomizationPackageRequestSchema, EnsureCustomizationPackageResponseSchema, GetPackageCustomizationsRequestSchema, GetPackageCustomizationsResponseSchema, ImportUnmanagedPackageRequestSchema, ImportUnmanagedPackageResponseSchema, ListPackageCommitsResponseSchema, MoveIntoPackageItemSchema, MoveIntoPackageMovedItemSchema, MoveIntoPackageRefusedItemSchema, MoveIntoPackageRequestSchema, MoveIntoPackageResponseSchema, PackageExportBundleSchema, PackageExportManifestSchema, PackagePublishResultSchema, ReassignOrphanedMetadataResponseSchema, RevertPackageCommitResponseSchema, RollbackToPackageCommitResponseSchema } from '@objectstack/spec/api';
54-
import type { DiscardPackageDraftsResponse, DuplicatePackageResponse, EnsureCustomizationPackageRequest, EnsureCustomizationPackageResponse, GetPackageCustomizationsRequest, GetPackageCustomizationsResponse, ImportUnmanagedPackageRequest, ImportUnmanagedPackageResponse, ListPackageCommitsResponse, MoveIntoPackageItem, MoveIntoPackageMovedItem, MoveIntoPackageRefusedItem, MoveIntoPackageRequest, MoveIntoPackageResponse, PackageExportBundle, PackageExportManifest, PackagePublishResult, ReassignOrphanedMetadataResponse, RevertPackageCommitResponse, RollbackToPackageCommitResponse } from '@objectstack/spec/api';
53+
import { DiscardPackageDraftsResponseSchema, DuplicatePackageResponseSchema, EnsureCustomizationPackageRequestSchema, EnsureCustomizationPackageResponseSchema, GetPackageCustomizationsRequestSchema, GetPackageCustomizationsResponseSchema, ImportUnmanagedPackageRequestSchema, ImportUnmanagedPackageResponseSchema, ListPackageCommitsResponseSchema, MoveIntoPackageItemSchema, MoveIntoPackageMovedItemSchema, MoveIntoPackageRefusedItemSchema, MoveIntoPackageRequestSchema, MoveIntoPackageResponseSchema, PackageExportBundleSchema, PackageExportManifestSchema, PackagePublishResultSchema, RevertPackageCommitResponseSchema, RollbackToPackageCommitResponseSchema } from '@objectstack/spec/api';
54+
import type { DiscardPackageDraftsResponse, DuplicatePackageResponse, EnsureCustomizationPackageRequest, EnsureCustomizationPackageResponse, GetPackageCustomizationsRequest, GetPackageCustomizationsResponse, ImportUnmanagedPackageRequest, ImportUnmanagedPackageResponse, ListPackageCommitsResponse, MoveIntoPackageItem, MoveIntoPackageMovedItem, MoveIntoPackageRefusedItem, MoveIntoPackageRequest, MoveIntoPackageResponse, PackageExportBundle, PackageExportManifest, PackagePublishResult, RevertPackageCommitResponse, RollbackToPackageCommitResponse } from '@objectstack/spec/api';
5555

5656
// Validate data
5757
const result = DiscardPackageDraftsResponseSchema.parse(data);
@@ -513,27 +513,6 @@ Whole-deployment export, the answer of `GET /packages/export` (`os package expor
513513
| **message** | `string` | ✅ | Validation error message |
514514

515515

516-
---
517-
518-
## ReassignOrphanedMetadataResponse
519-
520-
### Properties
521-
522-
| Property | Type | Required | Description |
523-
| :--- | :--- | :--- | :--- |
524-
| **success** | `boolean` | ✅ | Whether the reassignment ran. |
525-
| **reassignedCount** | `number` | ✅ | How many orphaned items were adopted. |
526-
| **reassigned** | `{ type: string; name: string }[]` | ✅ | Every item that was adopted. |
527-
| **targetPackageId** | `string` | ✅ | The package the items were adopted into. |
528-
529-
### Nested Shape: `ReassignOrphanedMetadataResponse.reassigned[number]`
530-
531-
| Property | Type | Required | Description |
532-
| :--- | :--- | :--- | :--- |
533-
| **type** | `string` | ✅ | Metadata type of the adopted item. |
534-
| **name** | `string` | ✅ | Name of the adopted item. |
535-
536-
537516
---
538517

539518
## RevertPackageCommitResponse

0 commit comments

Comments
 (0)