Skip to content
Merged
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
46 changes: 46 additions & 0 deletions docs/adr/0090-permission-model-v2-concept-convergence.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
· **Amended** (2026-10-17, ruling of record 6228728551 on #23960, letter B) — D12 names three kinds of administrator, tenant-level, organization-level and delegated: an organization administrator (`organization_admin` / `organization_admin_no_bypass` for the organization, not a platform administrator) creates and removes `sys_user_position` / `sys_user_permission_set` rows for that organization's members when every set the row distributes has no `*` wildcard superuser bit, no `adminScope` and only `scope: 'org'` capabilities; `admin_full_access`, platform sets, `organization_admin` itself and every delegated set stay outside, and organization-administrator status is conferred by membership grade only. Strict containment and the `everyone` / `guest` anchors are unchanged. See the note under D12.
· **Amended** (2026-10-31, ruling of record 6545950368 on #28367, go as shaped) — D10 gains rule 5, the **agent forward credential**: an `api` action's in-process forward carries the agent principal in a credential the server mints itself, bound to that one forward, single-use, short-lived and unreachable out of process, never the caller's token or key and never a human session. Two cells of the credential-kind × target-door table flip from "refuse by name" to "accept with a forward credential" (an OAuth-connected agent at an identity route and at a platform route), and a scope-family rule bounds every target outside MCP. See the amendment under D10.
· **Amended** (2026-11-08, [ADR-0151](./0151-ai-service-account-a-headless-agent-is-a-registered-principal-of-its-own.md), proposed, adopted by its merge) — D10 gains a second provenance for an agent principal: a registered **AI service account**, a `sys_user` row of kind `agent` that is its own authorization subject. It holds its own grants under rule 2's ceiling, enforced at evaluation, and authenticates with its own API keys; rule 1's intersection does not apply because it acts for nobody; rule 4 records it as `user_id` and leaves `performedBy` to the OAuth client. The 2026-09-16 note stands: a person's key stays that person's credential. See the note under D10.
· **Amended** (2026-11-20, [#35731](https://github.com/objectstack-ai/objectstack/issues/35731)) — dated notes under D9 (the platform baseline contribution channel is for always-on platform services only) and under D10 (`performedBy` has a second producer, the in-product AI path). D9 and D10 are left as written.
**Deciders**: ObjectStack Protocol Architects
**Builds on**: [ADR-0049](./0049-no-unenforced-security-properties.md) (enforce-or-remove),
[ADR-0056](./0056-permission-model-landing-verification.md) (permission-model landing verification),
Expand Down Expand Up @@ -391,6 +392,25 @@ package-owned sets:
- The D5 install-time suggestion generalizes: a package may suggest bindings to `everyone` **or**
`guest`; the admin confirms each individually.

> **Note (2026-11-20, #35731) — the platform baseline contribution channel is for always-on
> platform services only.** D9 refuses builtin permission sets that packages write into, and a
> package reaches `everyone` only by a suggestion the admin confirms (the bullet above). PR #32932
> (`fd637471`, #32754) added one narrower channel, on the maintainer's ruling 6837170004 on
> #32754 (letter B): `ISecurityService.contributePlatformBaselineSet(contributor, set)`
> (`packages/spec/src/contracts/security-service.ts`, implemented in
> `packages/plugins/plugin-security/src/platform-baseline-sets.ts`). Through it a platform service
> contributes one permission set of its own, which joins the member baseline every signed-in member
> holds through the `everyone` anchor (D5), when the deployment declares one, and which a host can
> narrow or decline per object (`SecurityPluginOptions.platformBaselineOverrides`);
> `member_default` is not written. Condition 2 of that ruling is this sentence: **it is a channel
> for always-on platform services; tenant-installed packages do not use it**. A tenant-installed package still suggests a default set for an
> administrator to accept. The seam admits a set only during boot (it closes at
> `kernel:bootstrapped`), only on objects the contributor itself registers, and only the read and
> create bits, one set per contributor; it refuses a wildcard, every other bit and a row policy,
> and logs each admission and refusal. Its one contributor on `main` is the storage service's
> attachment set (`packages/services/service-storage/src/attachment-member-grant.ts`). D9 is left
> as written; read it with this note.

### D10 — Principal taxonomy; agents act on intersected authority

> **Status (2026-07):** the P1 ctx *shape* shipped pre-launch as written below; the agent
Expand Down Expand Up @@ -502,6 +522,32 @@ alias tax on every API.
> a sibling can be added without re-shaping a shipped field; it reserves the room, ⛔ not the name.
> Ruling: director seat, batch #195 item 2, maintainer 「同意」 2026-09-20 — letter **C**.

> **Note (2026-11-20, #35731) — `performedBy` has a second producer: the in-product AI path.**
> Rule 4 above says a caller of any kind other than an agent principal records the principal it
> authenticates as, with the missing `performed_by` as the record that it acted for itself, and
> the 2026-09-20 status note calls `performedBy` a one-key object. Both matched `main` until
> PR #34018 (`2539ad98`, #33786). Since then
> `packages/spec/src/kernel/execution-context.zod.ts#performedBy` names two server-side
> producers, each in its own key. The `/mcp` OAuth door sets `clientId`, as before
> (`packages/core/src/security/assemble-execution-context.ts#entryFields`). The
> server-constructed in-product AI path, which writes AS the signed-in person (`principalKind`
> stays `'human'`, no `onBehalfOf`, the person's own grants), sets `agentId`, with
> `conversationId` and, when the person confirmed the call, `confirmationId`. A present
> `performedBy` names `clientId` or `agentId`, or is refused at parse. That producer stamps an
> id only after the server resolved it in its own store for the person in `userId` (the agent
> it actually ran, a conversation that person owns, a pending item that person's approval
> decided), so the refusal of caller-controlled ids above (`traceId`, `requestId`) stays whole;
> the room for a run id stays reserved, and `conversationId` is not that id. The engine copies
> the three keys to hooks as `HookContext.provenance.performedByAgentId`,
> `performedByConversationId` and `performedByConfirmationId`
> (`packages/objectql/src/engine-execution-plumbing.ts`). No code in this repository stamps
> `agentId` today; the OAuth agent path is still the one producer here.
> Ruling: the account owner on objectstack-ai/cloud#3826 (「3826 照建议(征询版)」): AI acting on
> behalf of a person, the conversation id and the confirmation id ride the write context through
> the existing `performed_by` / `on_behalf_of` pair, with no new actor vocabulary; ADR-0011's
> 2026-11-15 amendment note records the same ruling chain for phase 1. Rule 4 and the 2026-09-20
> note are left as written; read them with this note.

#### Amendment (2026-10-31, #28367) — the agent forward credential (rule 5) [ruled]

**What this decides.** How an agent principal crosses an `api` action's in-process forward. A
Expand Down
20 changes: 20 additions & 0 deletions docs/adr/0113-required-write-contract-vs-column-constraint.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

**Status**: Accepted (2026-07-30) — Q1/Q2/Q3 adjudicated same day (uniform semantics; `storage.notNull` spelling; the non-regression invariant unifies `required` and `requiredWhen`). **P0 implemented**: spec knob + parse-seam exclusivity, record-validator null-out rejection, rule-validator non-regression, driver DDL + drift rewired, `field-required-notnull-explicit` conversion. P1 (Console required-marker from the write contract) and P2 (criteria_json flip) follow.
**Amended (2026-11-17)** — D1 and D5: a field that declares `required: true` together with its own `visibleWhen` is required **when shown** (maintainer ruling A on #34905, recorded in comment 6956761249). See [Amendment — required when shown](#amendment-2026-11-17--required-when-shown).
**Amended (2026-11-20)** — the author-time fence: a dated note ([#35731](https://github.com/objectstack-ai/objectstack/issues/35731)) records that the formula warning fires only for a formula the form cannot compute (PR #35475). The paragraph is left as written.
**Deciders**: ObjectStack Protocol Architects
**Builds on**: [ADR-0049](./0049-no-unenforced-security-properties.md) (enforce-or-remove), [ADR-0078](./0078-no-silently-inert-metadata.md) (no silently inert metadata), the #3896/#3929 sharing-criteria case study, `driver-sql/schema-drift.ts` (the drift classifier whose `destructive` class this ADR exists to route around)
**Consumers**: `@objectstack/spec` (`FieldSchema`), `@objectstack/objectql` (`validation/record-validator.ts`), `@objectstack/driver-sql` (`sql-driver.ts` column DDL, `schema-drift.ts`), `@objectstack/lint`, objectui form renderers (the required marker)
Expand Down Expand Up @@ -384,6 +385,25 @@ is not a parse refusal like the Q1 rider, because the protocol-17
`field-required-notnull-explicit` conversion stamped `storage.notNull` onto every
older `required` field; for those fields this amendment changes nothing on create.

> **Note (2026-11-20, #35731) — the formula warning fires only for a formula the form cannot
> compute.** The paragraph above warns on a `required` field's `visibleWhen` that reads any
> `formula` field. Since PR #35475 (`7702f091`, #35190) the lint rule
> (`packages/lint/src/required-visible-when-formula-issue.ts`) and the Studio field-inspector
> advisory (`requiredVisibleWhenReference.ts`, the same verdict) warn only when a formula the
> predicate reads is one the form cannot compute, because the form now computes the object's
> formulas over the record being edited (`planObjectFormulas`) and judges the value the server
> judges. Two arms still warn, each with its own message: a formula that reads through a
> reference, calls `label()` or calls `current_user.can()`, or reads such a formula at any depth,
> which the write path cannot compute either, so the predicate counts as shown and the field stays
> required (the engine does compute a `current_user.can()` formula on a write that picks a
> permission-gated option, so that verdict can differ between writes); and a formula that reads
> `os`, or reads such a formula, which the server computes and may waive while the form keeps the
> field required. A formula the form can
> compute draws nothing, and so do a formula that reads the acting user and one served without its
> expression. The other two warnings (a read through a reference field, and `storage.notNull`) are
> unchanged. Still a warning, never a refusal. The paragraph is left as written; read its formula
> warning with this note.

**Not in scope.** Only the object field's own `visibleWhen`. A field group's
`visibleWhen`, a form view's field or section predicate, a hidden tab and static
`hidden` are not read: the validator does not consume view metadata (ruled on
Expand Down
35 changes: 35 additions & 0 deletions docs/adr/0126-packaged-metadata-customization-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,25 @@ them into three tiers by flags × item provenance (`packages/metadata-protocol/s
| **B — runtime-create only** | object, hook, seed, mapping, page, app, action, dataset, flow, datasource, external_catalog, doc, book, permission, position, tool, skill | **not customized at all** — writes against the packaged item answer 403 `NOT_OVERRIDABLE`; only brand-new sibling items can be authored |
| **C — code-only** | field, job, api, capability, agent | nothing — no runtime write channel exists |

> **Note (2026-11-20, #35731) — `capability` is no longer code-only.** The table above, measured
> when this record was written, puts `capability` in tier C, with no runtime write channel; §2,
> §3 and §9 repeat it. Since PR #35261 (`6ffa816e`, part of #35157) `capability` is
> runtime-creatable and overlay-closed: its `DEFAULT_METADATA_TYPE_REGISTRY` entry
> (`packages/spec/src/kernel/metadata-plugin.zod.ts`) reads `allowRuntimeCreate: true`,
> `allowEnvironmentOverlay: false` and `supportsOverlay: false`, the tier-B posture. A brand-new
> capability can be saved in the environment, and a packaged declaration cannot be re-declared or
> re-scoped there. The save door judges the body by `CapabilityDeclarationSchema` (422, the type's
> entry in `packages/spec/src/kernel/metadata-type-schemas.ts`), and refuses a platform capability
> name and a name another holder already declares before anything is stored
> (`packages/metadata-protocol/src/protocol-save-door-refusals.ts`). An unmanaged copy (ADR-0131
> D6) copies an app's capabilities and renames them with the copy when it takes a new namespace
> (`packages/metadata-protocol/src/package-namespace-rename.ts`). Ruled by the maintainer on
> #35157: option A, record 6999763503 (「同意」), and the bound of record 7000639892
> (「接受现有边界」). Of the five types the table lists in tier C, four stay there: field, job,
> api, agent. The registry on `main` holds more types with no runtime write channel, admitted
> after the survey this table records; this note does not re-measure the table, which is left as
> written.

Three real mechanisms operate across those tiers, each invented separately:

- **Org overlay** (ADR-0005): tier A only. Per-org rows for any other type are **phantom writes**
Expand Down Expand Up @@ -160,6 +179,12 @@ the artifact are live at once, or when a customization is wrong?**
disable switch** — the same posture as `job`. The registry flags are untouched: authoring a
brand-new sibling hook stays open, exactly as today.

> **Note (2026-11-20, #35731).** `capability` has left this list: since PR #35261 (`6ffa816e`)
> it is runtime-creatable and overlay-closed, on the maintainer's ruling 6999763503 on #35157
> (option A, with the bound of record 7000639892). Customizing a packaged capability is still
> not possible; a new one can be authored in the environment. See the note under §1.1. The
> bullet is left as written.

A **new metadata type** (or newly admitted dynamic kind) must declare its regime at admission,
in its registry-entry comment, using this rule. A customization mechanism that fits none of the
three regimes is not a gap in this ADR — it is a signal the mechanism is wrong (Prime Directive
Expand All @@ -179,6 +204,12 @@ From the survey's per-type table; classes are the survey's measurements, not asp
| **outside** | field, job, api, capability, agent (code-only) · **hook** (amendment ruling 1 — package code maintaining the package's own invariants; no ledger row, no disable switch; sibling authoring open as today) · seed, external_catalog (one-shot / derived — nothing durable to customize) · datasource (origin-gated: code-defined read-only, runtime-created free) | Recorded so their absence from the regimes reads as decided, not overlooked. |
| **unassigned, deliberately** | page, dataset, doc, book, mapping | Presentational/content tier-B types with no measured customization pull beyond re-authoring a sibling. Today's posture (locked base + free sibling authoring) stands. First real pull picks a regime **by the D1 rule** — likely O via the ADR-0005 admission pair (page/dataset/book) — and does so in an ADR-0005 revision, not ad hoc. |

> **Note (2026-11-20, #35731).** The **outside** row above lists `capability` as code-only.
> Since PR #35261 (`6ffa816e`) it is runtime-creatable and overlay-closed (ruling 6999763503 on
> #35157, option A, with the bound of record 7000639892): a packaged declaration stays locked, and
> a new capability can be authored in the environment. The ruling assigned it no regime, and
> this note assigns none. See the note under §1.1. The row is left as written.

Two clarifications the survey forces:

- **Managed extension fields** (`plugin-auth/src/managed-extension-fields.ts`) are **not** a
Expand Down Expand Up @@ -495,6 +526,10 @@ callers first, or don't), and preserves "packaged code calls what it names".
clone's references stay pointed at what the original pointed at, and the surface tells the
admin so).
- Reopening any code-only type (field, job, api, capability, agent).
> **Note (2026-11-20, #35731).** For `capability` this item was reopened: the maintainer's
> ruling 6999763503 on #35157 (option A, 「同意」) made it runtime-creatable, overlay stays
> closed, and PR #35261 (`6ffa816e`) implements it. The other four code-only types stay as this
> item says. See the note under §1.1. The item is left as written.
- Any edit to `packages/spec` for the ledger itself (it is a platform object; §4).

## 10. Consequences
Expand Down
Loading
Loading