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
2 changes: 2 additions & 0 deletions docs/adr/0010-metadata-protection-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ Every artifact carries a `_provenance` field:

> **Amendment note (2026-11-24, #37013 — PR #37021).** The enum gained a fourth value, `platform`: a record the platform's own code registers at boot (a built-in skill, agent or tool). It is read at the item's own top-level `_provenance` key only. The metadata service sets it on that registration only; every other write the service and the metadata protocol make (a write without the option, the in-memory seeding, the loader save, the protocol's save door, a rollback, and the protocol's restore doors) stores the body without it; a rollback whose row is the platform's own record is refused (`409`), and an undo that puts a row back as the same operation found it (a refused batch publish's, a failed batch row write's) restores the row's own stored bytes. A served body carries the value on its top level only when the stored item does: a body served from a loader other than the stored rows' and a published snapshot are served without it. The artifact door refuses an item that carries it (`VALIDATION_ERROR` at `_provenance`). A stored row re-registered at boot keeps it only when the row held it. It is a store-slot marker only (ADR-0150 D4's note of the same date).

> **Amendment note (2026-11-28, #37130 — PR #37423; #37604 — PR #37640; carried by #37245).** On the note above, "a rollback whose row is the platform's own record is refused (`409`)". The refusal covers every restore door, not the metadata service's `rollback` alone. A restore whose row is the platform's own record is refused `409 RESOURCE_CONFLICT`, before anything is written, at the metadata service's `rollback` and at the metadata protocol's `rollbackMetaItem` and the restore limb of `revertCommit`. The three doors ask one rule (`packages/metadata/src/loaders/database-loader.ts#refusePlatformRecordRestore`); the protocol's two reach it through the overlay store's version restore, which they ask to refuse the platform's record. In `revertCommit` the refused item is reported in `failed[]` with that code, nothing is written for it, and the commit's other items still revert. The same rule also refuses, with the same code, a restore that would write a version the platform registered into a package's row (#37604). An undo that puts a row back as the same operation found it is not asked the rule, as the note above says of it. Pinned in `packages/metadata-protocol/src/protocol.platform-mark-rollback.test.ts` and `packages/metadata/src/loaders/database-loader.test.ts`.

Rules:

- Overlay rows targeting a `package` artifact respect L3 + L4.
Expand Down
28 changes: 28 additions & 0 deletions docs/adr/0048-cross-package-metadata-collision.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,34 @@ as future work, not part of this decision.
> seed data (the import copies none), and the hosted-cloud default namespace
> (objectstack-ai/cloud#3624).

> **Note (2026-11-28, [#37245](https://github.com/objectstack-ai/objectstack/issues/37245); from
> #36166 — PR #37065, following #35823 — PR #36138).** On the amendment's rename sentence, "a name
> that lacks the package's prefix takes it in front". On the unmanaged rename path that sentence has
> three bounds.
>
> 1. **A package that declares no `namespace`** is refused, not renamed, when no object name carries
> the namespace derived from its id and two or more object names share a first segment. Each
> object of each such group is refused (`400 INVALID_REQUEST`), whether every object shares
> the segment (#36138) or a stray object stands beside the group (#36166); the stray is not named
> and does not lift the refusal. So two-word short names the package repeats (`purchase_order`
> beside `purchase_item`) are refused too, and declaring `namespace` lifts the refusal
> (`packages/metadata-protocol/src/package-unmanaged-install.ts#derivedNamespaceContradiction`).
> 2. **A package that declares a `namespace`** is refused for each object name the namespace-prefix
> judge refuses under it
> (`packages/spec/src/kernel/namespace-prefix.ts#validateObjectNamespacePrefix`, asked by
> `packages/metadata-protocol/src/package-unmanaged-install.ts#declaredNamespaceContradiction`).
> The rename has no declared prefix in such a name to replace, and every authoring door already
> refuses that name.
> 3. **Decided to stay as written:** a namespace-less package's single object, foreign prefix or not
> (`demoasset_asset` alone copies as `TARGET_demoasset_asset`), because one name cannot tell a
> two-word short name from a foreign prefix. Namespace-less object names that share no first
> segment (`purchase_order` beside `asset_owner`, bare `asset` beside `site`) also stay as
> written.
>
> A body that writes the id-derived namespace out as `namespace` is judged as declared, so bound 2
> applies to it and the shapes in bound 3 are refused for it. Each refusal is raised before the base
> exists. Pinned in `packages/metadata-protocol/src/package-unmanaged-install.test.ts`.

### 3.6 The package-id URL is transparent; a friendly alias is optional

A reverse-domain URL — `/apps/com.acme.crm/page/home` — is **self-describing**:
Expand Down
2 changes: 2 additions & 0 deletions docs/adr/0066-unified-authorization-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ Captured for the record; **out of scope for Phases 1–4 above**. Each is anchor
> **Note (2026-11-15) — a set's own `readable: false` row wins over that set's own View All vote (#33828, maintainer ruling on the card, letter A).** The ruling, as the card states it: "A, platform. An explicit `readable: false` field-permission row on a permission set must win over that same set's View All (`viewAllRecords`) field vote. This amends ADR-0066 D2 ⑧ as amended by ruling of record 6573563853." In the field-permission merge, a set that holds View All on an object (its own entry for the object if it has one, otherwise its `'*'` wildcard) and does not hold Modify All on it casts **no read vote on a field its own `fields` row declares `readable: false`**. That row is the set's whole say on the field, so a set can grant View All on an object and still hide a field of it from its holders. "Explicit" is literal: an omitted `readable` parses to `true` and is never a mask. The rest of the 2026-11-02 note stands. **Another** set's View All or Modify All on the object still makes the field readable (and, under Modify All, editable) for a caller who holds both sets, which is the platform-admin case ruling 6573563853 fixed. The same set's View All still votes on every field it does not mask itself. View All never granted an edit, so an edit lock beside it binds as before. **Modify All is unchanged, kept until the field-axis split (#34365), by the maintainer's ruling on the card of 2026-11-16 (6909362597, letter A), verbatim 「保持现状,只给警告」 (keep the current behaviour, warn only):** a set that holds `modifyAllRecords` on the object still votes `readable: true` and `editable: true` on every field of it, its own rows included, so its own `readable: false` or edit lock binds none of its holders. This note replaces, **for View All only**, the 2026-11-02 note's sentence "a set can no longer withhold a field from its own View All / Modify All holders"; for Modify All that sentence still holds, and a field is withheld from a Modify All set's holders by granting the object without that bit. One function answers the per-field vote, `superuserFieldVote` (`packages/core/src/security/effective-object-permissions.ts`), asked with the field's name by both field merges, `getFieldPermissions` and the row-blind `/auth/me/permissions` merge (`buildEffectiveFieldPermissions`), so every reader of the merge answers the same. The lint rule `security-superuser-field-mask-inert` reports only a row its own set's Modify All unbinds; a `readable: false` beside the set's own View All is no longer reported. Taking a field away from a caller whom another set serves it to remains the job of the muting/deny layer ⑦ still owes.

> **Note (2026-11-24) — a set may carry `viewAllFields`, a read-only vote on every field of an object ([#36050](https://github.com/objectstack-ai/objectstack/issues/36050), step 2 of the field-axis split [#34365](https://github.com/objectstack-ai/objectstack/issues/34365), ruling of record 6912661484; built by [#36085](https://github.com/objectstack-ai/objectstack/pull/36085)).** `ObjectPermissionSchema` accepts an optional `viewAllFields` beside `viewAllRecords` and `modifyAllRecords`. A set that carries it on an object (its own entry for the object if it has one, otherwise its `'*'` wildcard) casts a read vote, never an edit vote, on every field of that object. The 2026-11-15 rule holds for it: the set's own `readable: false` row on a field beats the set's own bit. The vote is cast inside the one function that calls `holdsViewAllFields` (`packages/core/src/security/effective-object-permissions.ts#holdsViewAllFields`), and both field merges call that function, so both field merges answer the same. The bit grants nothing else: no access to the object, no record (it is not part of `holdsSuperuserBypass`), no admin posture. `admin_full_access` and `organization_admin` carry it on `'*'`. That changes no answer today, because their View All and Modify All already cast the same vote. The `organization_admin` variant granted without the record bypass does not carry it. On `'*'` the bit also votes on the fields of `private`-posture objects while opening none of them; narrowing that reach would be a maintainer ruling. The notes of 2026-11-02 and 2026-11-15 stand: View All and Modify All still vote on fields. The end state of the split, where they stop voting on fields, is [#36055](https://github.com/objectstack-ai/objectstack/issues/36055) and is not built.

> **Note (2026-11-28) — the end state: View All and Modify All cast no field vote ([#36055](https://github.com/objectstack-ai/objectstack/issues/36055), step 3 of the field-axis split [#34365](https://github.com/objectstack-ai/objectstack/issues/34365), ruling of record 6912661484, letter A; built by [#37371](https://github.com/objectstack-ai/objectstack/pull/37371), protocol 19).** The notes of 2026-11-02, 2026-11-15 and 2026-11-24 above describe the vote before this step, and each is superseded where it has View All or Modify All vote on a field. From protocol 19 a set's `viewAllRecords` or `modifyAllRecords` on an object widens the records the set reaches and casts no vote in either field merge. The one object-wide field vote is `viewAllFields`: it votes `readable: true` on every field of the object and never `editable: true`, and a set's own explicit `readable: false` row on a field beats that set's own bit (the 2026-11-15 rule, now carried by `viewAllFields` alone). One function casts it, `packages/core/src/security/effective-object-permissions.ts#viewAllFieldsReadVote`, which replaced `superuserFieldVote`; both field merges ask it, `getFieldPermissions` and the row-blind `/auth/me/permissions` merge (`packages/core/src/security/effective-object-permissions.ts#buildEffectiveFieldPermissions`). **What follows.** A set's own field rows now bind beside its own Modify All, as they already did beside its own View All: its `readable: false` row hides the field from its holders, and a row of its own without `editable: true` locks it. That replaces the 2026-11-15 note's passage "Modify All is unchanged". Another set's View All or Modify All re-opens no field a set hides or locks. Another set's `viewAllFields` still makes a hidden field readable, and another set's field row with `editable: true` still grants the edit, because field grants still union without deny. No object-wide bit casts an edit vote any more, so the built-in admin sets read every field through `viewAllFields` on `'*'` and no longer edit a field another held set locks. **Source is converted, stored sets are not.** The ADR-0087 conversion `permission-view-all-fields-beside-record-bypass` writes `viewAllFields: true` beside either bit in a source migrated with `os migrate meta --from 18`, and nowhere else. It is off the authoring load path, and it is refused by id at the artifact door (`packages/metadata-core/src/artifact-forward-conversion.ts#DEFAULT_FLIPS_NOT_REPLAYED_HERE`) and at every stored-row seam (`packages/spec/src/conversions/stored.ts#STORED_ROWS_NOT_REWRITTEN`). So a permission set stored in `sys_metadata` is read with the protocol 19 meaning and is never rewritten (ruling of record 7177446075, letter A); where its holders should still read every field, the fix is to add `viewAllFields: true` to the entry. The conversion does not keep Modify All's edit vote, and no bit restores it. The error direction is fewer fields read or edited, never a field opened. The lint rule `security-superuser-field-mask-inert` is retired, and `security-cross-set-field-reopen` reports the `viewAllFields` re-open only. The upgrade guidance is the migration entry `permission-view-all-modify-all-cast-no-field-vote`.
- **⑨ Authoring-time validation for capability references** *(recorded 2026-07 pre-launch architecture assessment)*. `systemPermissions` / `requiredPermissions` are free strings today; a typo (`mange_users`) fails closed at runtime — the safe direction — but is undiscoverable: nothing reports that the referenced capability exists nowhere. When D1 lands the `sys_permission` registry, add the authoring/publish-gate lint alongside it: referencing an unregistered capability warns at author time (consistent with ADR-0049 honesty and the contract-first Prime Directive — reject at the producer, don't tolerate at the consumer). **Landed (2026-07):** `validateCapabilityReferences` in `@objectstack/lint` warns (never errors — cross-package capabilities and the fail-closed runtime make a hard gate wrong) when a `requiredPermissions` reference resolves against neither the built-in set (`@objectstack/spec` `PLATFORM_CAPABILITY_NAMES`), nor a capability the stack grants via a permission set's `systemPermissions`, nor a `sys_capability` seed row. Wired into `os validate` and `os lint`. `systemPermissions` (the declaration side) is deliberately not flagged.

> **Note (2026-10-14) — ⑨'s seed-row source is gone.** With `sys_capability` retired by #15204
Expand Down
2 changes: 2 additions & 0 deletions docs/adr/0067-commit-history-and-rollback-for-ai-authoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ All metadata writes in a turn execute inside **one `engine.transaction()`**; any
- `rollbackToPackageCommit(commitId)` — revert the package's HEAD back through every commit after the target, as one transaction. This is the "一层一层回退" the founder described — **commit-granular, not per-artifact** (§Resolved-1). *(Amended 2026-11-14: not one transaction; one `revertCommit` per commit, each step's failures collected — see the Amendment of that date at the end.)*
- Revert restores **metadata** deterministically. Its effect on **data** is governed by §5.

**Note (2026-11-28, #37245; from card #37086, PR #37366, which carried PR #37422).** One kind of item does not revert on its own. The 2026-11-14 Amendment says a revert runs per item, and that stands for every item but a `form`. `revertCommit` walks a commit's plan newest first, with every `form` item after every `view` row the commit edited (`packages/metadata-protocol/src/protocol-package-commits.ts#revertWalkOrder`), and a `form` item is taken back only once each of those rows stands again as it stood before the commit. While one of them is in `failed[]`, the `form` item is put in `failed[]` too, nothing is written for it, and the form stays as published (`packages/metadata-protocol/src/protocol-package-commits.ts#editedViewsNotPutBack`). The scope is the commit, because a plan does not record which form a row carried. The reason is [ADR-0159](./0159-forms-are-their-own-metadata-type-public-forms-are-form-items-view-is-lists-only.md) D5: a `form` publish removes or re-saves the old-shape `view` row that carried the form and records it as an edited row of the same commit, so an undo that took the form back without that row would leave the address with neither. Pinned in `packages/rest/src/public-form-two-type-withdrawal.test.ts` ("a commit revert that cannot put back … its `form` publish edited keeps the form as published and lists it in failed[]").

### D4 — The confirm gate, relocated

ADR-0045 gated *publish* (a human confirms before anything visible changes). This ADR relocates the gate to the only place revert can't save you:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,16 @@ touched in two places, and the rest of it stands. **The amendment declares; the
same day; the same record). Datasources were Setup's already; Studio's menu is to stop drawing a row for them
(ADR-0084).

> **Note (2026-11-28, [#37245](https://github.com/objectstack-ai/objectstack/issues/37245), from
> [#37238](https://github.com/objectstack-ai/objectstack/issues/37238)).** The amendment above reads "All 30 types" as
> every registered type, and counts 32 at one commit. That number is a reading of that commit, and this decision keeps
> no count: the registry has gained types since (`ai_context`, then `form` and `knowledge_source`) and will gain more.
> "Every registered type" is each entry of
> `packages/spec/src/kernel/metadata-plugin.zod.ts#DEFAULT_METADATA_TYPE_REGISTRY`, however many there are.
> [ADR-0084](./0084-application-builder-information-architecture.md)'s type-to-group table lists them by group, and
> the dated notes under that table say at which commit each reading was taken and which registered type has no row
> yet. This note states no new count.

> **Note (2026-11-24, epic [#36359](https://github.com/objectstack-ai/objectstack/issues/36359)).** D1 and the amendment above
> speak of Studio. The running app is an editing surface too, for a workspace administrator. The maintainer's words
> on the epic (2026-11-22), quoted in part: 「我同意先做页面上的「编辑」」 · 「按这个改,重画」 · 「而且不需要 studio
Expand Down
Loading
Loading