Skip to content

Commit ea6f9be

Browse files
committed
docs: the ADR-0146 promise pages say what a .custom customization delivers
Claude-Session: https://claude.ai/code/session_01J8VVAjSK8WEK7Uja5NRpTo Co-authored-by: Claude <noreply@anthropic.com>
1 parent 14208f2 commit ea6f9be

8 files changed

Lines changed: 88 additions & 17 deletions

File tree

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ unaffected. See [unrecognised type spelling](/docs/api/error-catalog#invalid_req
9696
in the error catalog for the envelope — the same code and status cover both this
9797
refusal and the misspelling one above; the message text tells them apart.
9898

99+
**An item an installed package ships is customized in that package's pair**
100+
([ADR-0146](https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md)
101+
D2, D11). A `PUT` naming no package onto an item one installed read-only package
102+
`hotcrm` ships is refused `403 NOT_OVERRIDABLE`; for a type an override applies to,
103+
the sentence names the route: save it with `?package=hotcrm.custom`, the body
104+
declaring `overrides: { package: 'hotcrm', basedOn: '3.2.0' }` (`basedOn` is the
105+
`manifest.version` of `hotcrm` it was taken from, recorded and never judged). Only the pair declares an override: an item of any other
106+
package that depends on `hotcrm` and bears a `hotcrm` item's name is refused at save
107+
and publish, and its fix is a new name. A permission set, position or capability is
108+
never overridden; it is copied under a new name. What the reads then serve is in
109+
[Metadata lifecycle](/docs/concepts/metadata-lifecycle#customizing-an-installed-package-the-paired-custom-override-adr-0146).
110+
`POST /packages/hotcrm/ensure-customization` creates the pair when absent (Studio calls
111+
it on the first change), and `GET /packages/hotcrm/customizations` lists its overrides,
112+
extensions and switched-off items in one read.
113+
99114
**Body**: `{ type: "object", name: "account", item: { ... } }`
100115
**Response**: `{ success: true }`
101116

‎content/docs/build-without-code.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Two properties make Studio safe to hand to non-developers:
3535

3636
## Setup — where the platform is administered
3737

38-
The **System Settings** app covers platform administration: user management and invitations, permission assignment, datasources (including federated external databases), diagnostics and audit logs, and the **Marketplace** — template apps such as HotCRM install with one click and appear alongside your own apps. What "customize" means depends on the piece: views and dashboards are yours to edit directly; a packaged object grows through your own fields via an extension package, never by reshaping what shipped; a packaged flow stays locked, but a dedicated **packaged automation** page here lets you switch it off and clone your own — the clone is an ordinary flow, yours to edit in Studio.
38+
The **System Settings** app covers platform administration: user management and invitations, permission assignment, datasources (including federated external databases), diagnostics and audit logs, and the **Marketplace** — template apps such as HotCRM install with one click and appear alongside your own apps. Setup holds no metadata editor: its metadata pages open Studio, and an installed app is customized there. Open the app in Studio and every change lands in its paired customization package (`hotcrm.custom` for HotCRM), created on your first change and exported and deployed like any package, while what shipped stays the vendor's. **Customize** on a view, dashboard, report or flow saves your version as an override of the shipped one, marked with the app it overrides, and **Restore package original** removes it. **Add field** on a shipped object adds your own field, named with a `__c` suffix, and a shipped field's label, description, help text, placeholder and option labels can be changed, nothing else. A shipped flow's switch turns it off for this deployment, and **New similar** copies a flow or a permission set under a new name; a flow's copy starts switched off.
3939

4040
## When to reach for code instead
4141

‎content/docs/capabilities/integrations.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A business system earns its keep by fitting into the systems — and habits —
1515
- **Triggers in** — external systems start platform [flows](/docs/capabilities/automation).
1616
- **Connectors** — ready-made Slack and generic REST connectors drop into flows; an HTTP API, OpenAPI document, or MCP server can be [declared as metadata](/docs/automation/connectors) and goes live at boot, no plugin code.
1717
- **Federated external databases** — point at an existing database and query it in place: no migration, visible in views, usable in flows.
18-
- **Marketplace templates** — install complete apps (HotCRM among them) with one click: objects, views, flows, dashboards, and seed data included. Views and dashboards are yours to edit directly; a packaged flow stays locked, but [Setup](/docs/build-without-code) lets you switch it off and clone your own to edit in Studio; a packaged object grows through your own fields via an extension package, not by editing what shipped.
18+
- **Marketplace templates** — install complete apps (HotCRM among them) with one click: objects, views, flows, dashboards, and seed data included. What shipped stays the vendor's: you customize an installed app in [Studio](/docs/build-without-code), and every change lands in the app's own customization package (`hotcrm.custom` for HotCRM), which exports and deploys to another environment like any package. A view, dashboard, report or flow is customized by overriding it there; a shipped object gains your own fields, named with a `__c` suffix; a shipped flow can be switched off for your deployment, or copied under a new name with **New similar**.
1919
- **Deploy anywhere** — cloud or fully self-hosted; your data and your app definition stay yours.
2020

2121
## Everyday collaboration

‎content/docs/concepts/metadata-lifecycle.mdx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,15 @@ document **whole** for every read that serves the base's name
166166

167167
> **ADR-0131 D6 — the per-organization overlay axis is retired.** The `/meta` doors (REST and the runtime dispatcher) carry no organization into a metadata write or read: a Studio or `PUT /api/v1/meta/...` write of the five ✅ types below lands **environment-wide** (since ADR-0131 D7 the `sys_metadata` family declares no organization column) and is served to every organization, and an organization admin holding only the retired `manage_org_presentation` capability is refused (`403`). The protocol itself refuses every organization-scoped write, and every read — item, list, layers, cached, history, diff, audit, drafts and the commit timeline — is environment → code, whatever organization a caller names. An overlay row an earlier release stored under an organization — under the `single` posture, every Studio save of these types, filed under the Default Organization — is served by no read, and on a SQL database (SQLite, PostgreSQL, MySQL) still holding one a v18 `os serve` refuses to start until the v18 migration ceremony (ADR-0131 C7: `os migrate organization-ownership --out PLAN`, then `--apply --plan-file PLAN`) has carried such a row to the environment layer and dropped the column; nothing deletes or rewrites it before then. The anonymous form doors read the environment alone too: the ceremony carries every organization-layer public-form withdrawal onto the environment, fail-closed. The table still records which types take an overlay of a shipped item.
168168

169+
> **ADR-0146 D11 — the tier no longer opens a write door onto a packaged item.** A write naming no package — a save, a publish, a reset (`DELETE`) or a rollback — onto a ✅-type item that one installed read-only package ships is refused `403 NOT_OVERRIDABLE`, and the sentence names the base's pair: save it into `?package=<base>.custom`, declaring `overrides` ([above](#customizing-an-installed-package-the-paired-custom-override-adr-0146)). A package-less row stored before the close is still served until `os migrate packageless-overlays` moves it into the pair as a declared override; the ✅ row is now the set that ceremony moves and the read path honours for an unmoved row. A package-less write of a name no package ships is environment metadata, and stays open.
170+
169171
| Type | `allowEnvironmentOverlay` | Rationale |
170172
| :--- | :---: | :--- |
171173
| `view`, `dashboard`, `report`, `email_template`, `translation` | ✅ | Pure rendering / render-time content. Customizing it in an environment is safe. |
172174
| `flow` | ❌ | Flows carry execution side-effects (events, jobs, audit), and the `flow` entry declares `supportsOverlay: false` — the loader cannot merge a per-org flow overlay, so the write permission granted a write nothing could read back: an org-scoped flow overlay wrote successfully and **lost its binding on the next cold start**. Rolled back (#6283) so the silent phantom is a loud `403 not_overridable` at the moment of the write. **`allowRuntimeCreate` stays `true`** — a tenant may still author a *brand-new* flow through the runtime API (ADR-0070 package-first authoring); what is closed is overlaying a *packaged* flow. |
173175
| `agent` | ❌ | Agents are platform-owned and closed to third parties (ADR-0063 §2) — no environment fork of a packaged agent. |
174176
| `permission`, `position` | ❌ | Authorization correctness — an overlay of a packaged permission set *is* silent privilege drift (ADR-0005's security row). Rolled back from an unratified `true` by the 2026-08-08 maintainer ruling (#6483); `position` takes the amendment's `false` default for new types. **`allowRuntimeCreate` stays `true`**: runtime-created sets (including package-bound rows materialized through the metadata door) keep working, while an admin-door edit of a *code-declared* set refuses with `403 not_overridable`, naming the sanctioned path: clone the set under a new name and edit the clone ([ADR-0126](#packaged-flows-actions-and-permission-sets-adr-0126)). The package's own author still changes the declaration in the package and re-publishes (ADR-0086 two-doors). |
175-
| `object` | ❌ | Defines the table schema. Overriding a packaged object would break existing data — but `allowRuntimeCreate: true`, so tenants *can* author brand-new objects, **and this is also how a new field is added** (write the object with the field in `fields`). |
177+
| `object` | ❌ | Defines the table schema. Overriding a packaged object would break existing data — but `allowRuntimeCreate: true`, so tenants *can* author brand-new objects, **and this is also how a new field is added** (write the object with the field in `fields`). On an object an installed package ships, a field is added as an object extension in the base's paired `.custom` package, named `<name>__c` ([Object extensions](/docs/data-modeling/object-extensions#customizing-an-installed-packages-object)). |
176178
| `field` | ❌ | **Also `allowRuntimeCreate: false` since protocol 17** (#7893). A field is not a standalone artifact — fields are authored inside their object (`ObjectSchema.fields`), so a `field` write minted a *separate* `sys_metadata` row keyed `('field','<object>.<name>')` that nothing ever composed into the parent: `PUT /meta/field/showcase_task.zz_probe` answered 200 `state=active`, the row read back `_diagnostics.valid: true`, and `GET /meta/object/showcase_task` never listed the field. The door is closed rather than bridged: add a field by writing its **object** (`PUT /meta/object/:name`, or `**/*.object.ts` and redeploy), which both persists and composes. Existing rows are untouched — they were inert before the change too — and remain deletable. |
177179
| `datasource` | ❌ | Connection strings; multi-tenant isolation is enforced at a higher layer. (`allowRuntimeCreate: true` — the datasource wizard persists `origin: 'runtime'` rows.) |
178180
| `job` | ❌ | **Also `allowRuntimeCreate: false` since protocol 17** (#4509). `JobSchema.handler` names a function in the compiled bundle's function table, which a runtime writer has no way to reach — so a job created in Studio or through `PUT /meta` parsed, saved, reported success and was never scheduled. The door is closed rather than bridged: `job` stays first-class through `*.job.ts` / `defineStack({ jobs, functions })`, where every schedule shape, `retryPolicy` and `timeout` does reach the scheduler. Existing rows are untouched — they were never scheduled — and `migrateStoredMetadata` reports them `skipped`. |
@@ -184,7 +186,7 @@ There is no `workflow` metadata type (per [ADR-0020](https://github.com/objectst
184186

185187
The gate is **two-tier** — `allowEnvironmentOverlay: false` is not the same as "no runtime writes":
186188

187-
- Overwriting an item that ships from a code package requires `allowEnvironmentOverlay`. Denied → `403 not_overridable`.
189+
- Overwriting an item that ships from a code package is refused → `403 not_overridable`. The change is a declared override saved into the base's paired `.custom` package ([above](#customizing-an-installed-package-the-paired-custom-override-adr-0146)); for a ✅ type, a package-less row stored before ADR-0146 D11 is still served until it is moved.
188190
- Creating a brand-new item that has no artifact backing requires `allowRuntimeCreate` (or `allowEnvironmentOverlay`). Denied → `403 not_creatable`.
189191

190192
See [ADR-0005](https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0005-metadata-customization-overlay.md) for the full design and amendments.
@@ -195,7 +197,7 @@ See [ADR-0005](https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/
195197

196198
| Type | Sanctioned path the refusal names |
197199
| :--- | :--- |
198-
| `flow` | Clone it under a new name (`POST /api/v1/automation/:name/clone`, body `{name, label}`), or switch it off (`POST /api/v1/automation/:name/toggle`, body `{enabled: false}`). A flow that holds a credential (an inbound hook's `secret`, an `http` node's `signingSecret`) is not cloned in one step: the clone door refuses it with `409`, because a copy would share the secret, and the copy is authored as a new flow with its own. The copy is written switched off, into the source package's paired customization package `<base>.custom` (created on first use), or into the writable package the body's optional `package` names; a flow no read-only package ships has no pair, so its clone names `package`. The answer's `packageId` says where the copy landed ([ADR-0146](https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md) D3, D4). |
200+
| `flow` | Declare an override from the base's paired `<base>.custom`, or rename it (a write from any other package is told to rename: only the pair declares an override), or switch it off (`POST /api/v1/automation/:name/toggle`, body `{enabled: false}`). The declared override is armed in the base flow's place, keeps its one activation switch, and a run suspended on the base finishes on the version it started on (ADR-0146 D9). A copy under a new name is "New similar", the clone door `POST /api/v1/automation/:name/clone` (body `{name, label}`), which the removal refusal still names. A flow that holds a credential (an inbound hook's `secret`, an `http` node's `signingSecret`) is not cloned in one step: the clone door refuses it with `409`, because a copy would share the secret, and the copy is authored as a new flow with its own. The copy is written switched off, into the source package's paired customization package `<base>.custom` (created on first use), or into the writable package the body's optional `package` names; a flow no read-only package ships has no pair, so its clone names `package`. The answer's `packageId` says where the copy landed ([ADR-0146](https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md) D3, D4). |
199201
| `action` | Switch it off (`POST /api/v1/actions/_activation/:object/:action`, body `{enabled: false}`; `:object` is `global` for an object-less action). No clone is offered. |
200202
| `permission` | Clone it under a new name: the "Clone" action on the permission set, or the clone door `POST /api/v1/security/permission-sets/:name/clone` (body `{name, label, package?}`) with a new name. The clone door copies the whole definition from the security catalog; a copy of a packaged set lands in the package's paired `<X>.custom` (ADR-0146 D3/D6). |
201203

‎content/docs/data-modeling/object-extensions.mdx‎

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ DDL, the same forms and list views, the same API.
1919
|:---|:---|
2020
| You need extra data on an object another package ships (`sys_user`, a CRM package's `account`) | **Object extension** |
2121
| You need a new business entity of your own | Define your own [object](/docs/data-modeling/objects) |
22-
| A single tenant needs a field only they use | Tenant customization, not a package extension — an extension ships in code with the package |
22+
| Your deployment needs a field on an object an installed package ships | An object extension in that package's paired `.custom` package, the field named `<name>__c` — [below](#customizing-an-installed-packages-object) |
2323
| You need an action, hook, view or page on someone else's object | Declare that artifact at the top level and bind it to the target object — [see below](#what-an-extension-may-not-contribute) |
2424

2525
---
@@ -62,7 +62,7 @@ check that spelling first.
6262

6363
| Key | Merge behaviour |
6464
|:---|:---|
65-
| `fields` | **Additive.** Merged into the target's field map. A name the target already has is **replaced**, not merged. |
65+
| `fields` | **Additive.** Merged into the target's field map. A name the target already has is **replaced**, not merged — never in a `.custom` package, whose added fields all end in `__c`. |
6666
| `fieldPatches` | **Applied, field by field.** Changes the *display* of one of the target's own fields — never one an extension adds — without replacing it — [below](#relabelling-a-vendor-field). |
6767
| `validations` | **Concatenated.** Your rules run alongside the owner's; neither replaces the other. |
6868
| `indexes` | **Concatenated**, same as validations. |
@@ -165,6 +165,55 @@ with every package that declares it and the one whose definition is served. Name
165165
defensively — prefix added fields with something specific to your package when the
166166
name is at all generic.
167167

168+
**The `__c` suffix is reserved to the customer.** A field named `<name>__c` may be
169+
declared only by a base package's paired `.custom` package, below; in any other package,
170+
on its own objects or in its extensions, it is refused, so a vendor's next version can
171+
never take a customer's field name. The save, publish and restore doors, the install
172+
door, `os validate` and `os build` all refuse it, naming the field.
173+
174+
---
175+
176+
## Customizing an installed package's object
177+
178+
A customer adds to an object an installed package ships — HotCRM's `crm_account` — from
179+
the base's paired customization package `hotcrm.custom`
180+
([ADR-0146](https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md)
181+
D10). The object is extended, never replaced:
182+
183+
- **Every field the pair adds to a base object ends in `__c`** (`region__c`); an unsuffixed field in a
184+
`.custom` extension is refused with the suffixed name to use. A field the base
185+
declares is changed only through `fieldPatches`, [above](#relabelling-a-vendor-field).
186+
- **The extension is an item of the pair.** In code it is an `objectExtensions` entry of
187+
the `hotcrm.custom` stack; at runtime it is an `object_extension` item saved into the
188+
pair (`PUT /api/v1/meta/object_extension/crm_account?package=hotcrm.custom`, the body
189+
`ObjectExtensionSchema` with `extend`), drafted, published and exported like any item.
190+
Studio's **Add field** on a read-only base object writes exactly that, creating the
191+
pair on first use.
192+
- **An object takes no `overrides` declaration.** Declaring one on an object is refused,
193+
naming the extension as the route.
194+
195+
{/* os:check */}
196+
```typescript
197+
import { defineObjectExtension, Field } from '@objectstack/spec/data';
198+
199+
export const AccountRegionExtension = defineObjectExtension({
200+
extend: 'crm_account',
201+
fields: { region__c: Field.text({ label: 'Region' }) },
202+
});
203+
```
204+
205+
```typescript
206+
export default defineStack({
207+
manifest: {
208+
id: 'hotcrm.custom', // the base's id + '.custom'
209+
namespace: 'crm_custom', // the base's namespace + '_custom'
210+
dependencies: { hotcrm: '^3' }, // the base, at its installed major
211+
/* … */
212+
},
213+
objectExtensions: [AccountRegionExtension],
214+
});
215+
```
216+
168217
---
169218

170219
## Merge order and conflicts

0 commit comments

Comments
 (0)