Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .changeset/38150-adopt-orphans-door-retired.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
'@objectstack/spec': major
'@objectstack/metadata-protocol': patch
'@objectstack/runtime': patch
'@objectstack/client': patch
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

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`

Clause-②: no (narrowing)
Metadata-protocol: narrowed

<!-- adr-0087: registered packages-adopt-orphans-door-retired -->

**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.

What is removed:

- the route `POST /api/v1/packages/:id/adopt-orphans` (it answers `404` now), and its route-ledger row;
- the client method `packages.adoptOrphans(id)` of `@objectstack/client`;
- the protocol method `reassignOrphanedMetadata` of `@objectstack/metadata-protocol`'s `ObjectStackProtocolImplementation`;
- `ReassignOrphanedMetadataResponseSchema` and its `ReassignOrphanedMetadataResponse` / `ReassignOrphanedMetadataResponseParsed` types from `@objectstack/spec/api`, and the published JSON schema `api/ReassignOrphanedMetadataResponse.json`;
- the operation-message key `packages_orphan_adoption_unsupported` (four locales);
- 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.

How to move:

| before | after |
|:--|:--|
| `POST /api/v1/packages/:id/adopt-orphans` | `POST /api/v1/packages/:id/move-in` with `{ "items": [{ "type": "flow", "name": "…" }, …] }` |
| `client.packages.adoptOrphans(id)` | `client.packages.moveIn(id, { items })` |
| `protocol.reassignOrphanedMetadata({ targetPackageId })` | `protocol.moveIntoPackage({ targetPackageId, items })` |
| `ReassignOrphanedMetadataResponseSchema` | `MoveIntoPackageResponseSchema` |

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.
2 changes: 1 addition & 1 deletion content/docs/api/metadata-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Under a `group` or `isolated` tenancy posture every `/packages` write is the
platform operator's (ADR-0131 D12 items 7–8, D11): install (`POST /packages`),
the manifest `PATCH`, enable, disable, publish, `publish-drafts`,
`discard-drafts`, `revert`, `rollback`, `commits/:commitId/revert`, `duplicate`,
`adopt-orphans` and this delete. Any other caller, a `manage_metadata` holder
`move-in` and this delete. Any other caller, a `manage_metadata` holder
inside one organization included, is refused `403 PERMISSION_DENIED` naming the
posture, before anything is read or written, whatever the package carries.
Reads are unchanged. Under `single` every `manage_metadata` holder writes as
Expand Down
2 changes: 1 addition & 1 deletion content/docs/permissions/system-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ One of the largest consumers of the flag;
| 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` |
| 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` |
| 56 | Activation write / authoring refusals do not fire | runtime | Get: activation artifacts writable and authorable without the activation-authoring capability | `refuseUngrantedActivationWrite`, `refuseUngrantedActivationAuthoring` |
| 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` |
| 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` |
| 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` |
| 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` |
| 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` |
Expand Down
2 changes: 1 addition & 1 deletion content/docs/protocol/knowledge.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ and the MCP draft door:
imply it. Over MCP it is the human's own grant that is read, never the
agent's. The package doors ask it too: every write to an existing package
that holds a knowledge source (enable, disable, publish, publish-drafts,
discard-drafts, the commit revert, rollback, revert, adopt-orphans,
discard-drafts, the commit revert, rollback, revert, move-in,
duplicate, the manifest update and delete) needs the capability, and is
refused `403` naming it otherwise. A package that holds none is written as
before. Two doors are not asked. Installing a package is one: a packaged
Expand Down
25 changes: 2 additions & 23 deletions content/docs/references/api/package-lifecycle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ authored after that retirement per the ruling's sequencing (3A).
## TypeScript Usage

```typescript
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';
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';
import { DiscardPackageDraftsResponseSchema, DuplicatePackageResponseSchema, EnsureCustomizationPackageRequestSchema, EnsureCustomizationPackageResponseSchema, GetPackageCustomizationsRequestSchema, GetPackageCustomizationsResponseSchema, ImportUnmanagedPackageRequestSchema, ImportUnmanagedPackageResponseSchema, ListPackageCommitsResponseSchema, MoveIntoPackageItemSchema, MoveIntoPackageMovedItemSchema, MoveIntoPackageRefusedItemSchema, MoveIntoPackageRequestSchema, MoveIntoPackageResponseSchema, PackageExportBundleSchema, PackageExportManifestSchema, PackagePublishResultSchema, RevertPackageCommitResponseSchema, RollbackToPackageCommitResponseSchema } from '@objectstack/spec/api';
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';

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


---

## ReassignOrphanedMetadataResponse

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **success** | `boolean` | ✅ | Whether the reassignment ran. |
| **reassignedCount** | `number` | ✅ | How many orphaned items were adopted. |
| **reassigned** | `{ type: string; name: string }[]` | ✅ | Every item that was adopted. |
| **targetPackageId** | `string` | ✅ | The package the items were adopted into. |

### Nested Shape: `ReassignOrphanedMetadataResponse.reassigned[number]`

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **type** | `string` | ✅ | Metadata type of the adopted item. |
| **name** | `string` | ✅ | Name of the adopted item. |


---

## RevertPackageCommitResponse
Expand Down
Loading
Loading