Skip to content

Commit b6afae2

Browse files
committed
chore(spec): regenerate references and strictness counts; docs, changeset, producer type narrowing
The package-lifecycle reference page and the api strictness count follow the per-kind contributions entry. The metadata API page names the contributions list and says the nav kind is not yet served. The runtime producer's local entry type excludes the nav arm so it keeps compiling; it lists the same field and flow entries as before. Claude-Session: https://claude.ai/code/session_01ADHkmQ28WWiNo3u94yGTPb Co-authored-by: Claude <noreply@anthropic.com>
1 parent c73f76b commit b6afae2

5 files changed

Lines changed: 40 additions & 6 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/spec': minor
3+
---
4+
5+
feat(spec): the customizations read's `contributions` declares a `nav` kind, with an entry shape per kind
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: added
9+
10+
`GET /packages/:id/customizations` names the package behind each item another installed package contributes to a base (ADR-0029 D7 as amended by ADR-0146 D3). `GetPackageCustomizationsResponseSchema.contributions` now declares a third kind: the navigation items another package's `navigationContributions` add to an app the base owns.
11+
12+
- **The entry shape is per kind.** A `field` or `flow` entry is `{ kind, object, name, packageId }` and accepts exactly what it accepted before. A `nav` entry is `{ kind: 'nav', app, group?, name, packageId }`: the base-owned app, the group the contribution targets when it targets one, the nav item's id, and the contributing package. Each shape is strict, so a `nav` entry carrying `object`, or a `field` entry carrying `app`, is refused.
13+
- **Order.** The `field` and `flow` entries come first, in the order they had before. The `nav` entries follow, by app, group (an entry with no group first), name and package. `counts.contributions` still counts items.
14+
- **Not served yet.** The runtime lists no `nav` entry yet. The kind is declared ahead of its producer, and its describe opens `[PLANNED — not yet served]`. No nav item gains a key: the served app's `navigation` stays as declared.
15+
16+
TypeScript code that reads `object` from a `contributions` entry now narrows on `kind` first (`entry.kind !== 'nav'`), because a `nav` entry has no `object`.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ never overridden; it is copied under a new name. What the reads then serve is in
109109
[Metadata lifecycle](/docs/concepts/metadata-lifecycle#customizing-an-installed-package-the-paired-custom-override-adr-0146).
110110
`POST /packages/hotcrm/ensure-customization` creates the pair when absent (Studio calls
111111
it on the first change), and `GET /packages/hotcrm/customizations` lists its overrides,
112-
extensions and switched-off items in one read.
112+
extensions and switched-off items in one read, beside `contributions`: the fields and flows
113+
other installed packages contribute to `hotcrm`, each entry naming its package. Its `nav` kind
114+
(a navigation item another package contributes to a `hotcrm` app) is declared and not yet served.
113115

114116
**Body**: `{ type: "object", name: "account", item: { ... } }`
115117
**Response**: `{ success: true }`

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Per-package customization read request: the base package id, no query parameters
163163

164164
## GetPackageCustomizationsResponse
165165

166-
Per-package customization read: overrides, extensions and switched-off items of one installed base, and the fields and flows other packages contribute to it.
166+
Per-package customization read: overrides, extensions and switched-off items of one installed base, and the fields, flows and (not yet served) navigation items other packages contribute to it.
167167

168168
### Properties
169169

@@ -173,7 +173,7 @@ Per-package customization read: overrides, extensions and switched-off items of
173173
| **overrides** | `{ type: string; name: string; member?: string; basedOn?: string; … }[]` | ✅ | Every ACTIVE item of the base's paired `<base>.custom` package that declares `overrides.package` = the base and that the effective read serves over the base's item of the same name: the rows the served-override predicate admits (a declaration from any other package, and an undeclared pair item, are not listed), minus the stored rows every read declines (a shipped flow name). Ordered by type, name and member. |
174174
| **extensions** | `{ object: string; kind: Enum<'field' \| 'validation' \| 'index'>; name?: string; fields?: string[] }[]` | ✅ | Every field, validation rule and index the paired `<base>.custom` package declares in an object extension (`objectExtensions`) of an object the base owns, one entry per member, as the extension declares it. Ordered by object, kind and name. |
175175
| **switchedOff** | `{ type: string; name: string }[]` | ✅ | Every activation-ledger row (`sys_metadata_activation`) that records the base as its package and `active: false`: the base's items this deployment switched off. Ordered by type and name. |
176-
| **contributions** | `{ kind: Enum<'field' \| 'flow'>; object: string; name: string; packageId: string }[]` | ✅ | Every field and flow another installed package contributes to the base's objects, one entry per item and contributing package: the fields of every object extension of an object the base owns, from any package but the base and its pair, and every flow registered under such a package whose trigger object the base owns (a flow of a disabled package is not served, so not listed). Ordered by object, kind, name and package. |
176+
| **contributions** | `({ kind: Enum<'field' \| 'flow'>; object: string; name: string; packageId: string } \| { kind: 'nav'; app: string; group?: string; name: string; … })[]` | ✅ | Every field, flow and navigation item another installed package contributes to the base, one entry per item and contributing package: the fields of every object extension of an object the base owns, from any package but the base and its pair; every flow registered under such a package whose trigger object the base owns (a flow of a disabled package is not served, so not listed); and, declared ahead of its producer and not yet served, every navigation item such a package contributes to an app the base owns. The entry shape is per `kind`: `object` for `field` and `flow`, `app` and an optional `group` for `nav`. Ordered: the `field` and `flow` entries first, by object, kind, name and package; then the `nav` entries, by app, group (an entry with no group first), name and package. |
177177
| **counts** | `{ overrides: integer; extensions: integer; switchedOff: integer; contributions: integer }` | ✅ | Each list's length, derived from the lists in this same answer. |
178178

179179
### Nested Shape: `GetPackageCustomizationsResponse.overrides[number]`
@@ -202,7 +202,9 @@ Per-package customization read: overrides, extensions and switched-off items of
202202
| **type** | `string` | ✅ | The ledger row's metadata type (`flow`, `action`, `position`, …). |
203203
| **name** | `string` | ✅ | The switched-off item's name. |
204204

205-
### Nested Shape: `GetPackageCustomizationsResponse.contributions[number]`
205+
### Nested Shape: `GetPackageCustomizationsResponse.contributions[number][option 1]`
206+
207+
A field or flow another package contributes to one of the base's objects.
206208

207209
| Property | Type | Required | Description |
208210
| :--- | :--- | :--- | :--- |
@@ -211,6 +213,18 @@ Per-package customization read: overrides, extensions and switched-off items of
211213
| **name** | `string` | ✅ | The item's name: the field name as the extension declares it, or the flow's name. |
212214
| **packageId** | `string` | ✅ | The package that contributes the item: the extension's package, or the package the flow is registered under. Never the base and never its `<base>.custom` pair. |
213215

216+
### Nested Shape: `GetPackageCustomizationsResponse.contributions[number][option 2]`
217+
218+
[PLANNED — not yet served] Declared ahead of its producer (ADR-0049): the read lists no `nav` entry yet. A navigation item another installed package contributes to an app the base owns, one entry per item of the contribution's `items` (a contributed group's children ride inside it and are not entries of their own), read from the same contribution registry the served app's navigation fold reads (ADR-0029 D7). A disabled package's contributions are not listed, as the fold drops them.
219+
220+
| Property | Type | Required | Description |
221+
| :--- | :--- | :--- | :--- |
222+
| **kind** | `'nav'` | ✅ | What is contributed: `nav`, a navigation item another package's `navigationContributions` entry adds to the navigation of an app the base owns. |
223+
| **app** | `string` | ✅ | The base-owned app the item is contributed to: the contribution's `app`. |
224+
| **group** | `string` | optional | The group nav item the contribution targets: its `group`, as the contribution declares it. Absent when the contribution targets the app's top level. A group the app does not declare is still named here, though the served navigation appends those items at the app's top level. |
225+
| **name** | `string` | ✅ | The nav item's id, as the contribution's `items` declare it. |
226+
| **packageId** | `string` | ✅ | The package that contributes the item: the package whose `navigationContributions` declares it. Never the base and never its `<base>.custom` pair. |
227+
214228
### Nested Shape: `GetPackageCustomizationsResponse.counts`
215229

216230
| Property | Type | Required | Description |

‎docs/audits/2026-07-unknown-key-strictness-ledger.counts/api.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ hand-patch a number here** — fix the code or the verdict and regenerate.
1919

2020
| Dir | Sites |
2121
|---|---|
22-
| `api/` | 486 |
22+
| `api/` | 487 |

‎packages/runtime/src/domains/packages.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3245,7 +3245,9 @@ function readBaseContributions(
32453245
pairId: string | undefined,
32463246
registry: any,
32473247
): GetPackageCustomizationsResponse['contributions'] {
3248-
type Contribution = GetPackageCustomizationsResponse['contributions'][number];
3248+
// The `field` and `flow` entries: the `nav` kind is declared in the spec
3249+
// ahead of this producer (#27928) and is not listed here yet (#28722).
3250+
type Contribution = Exclude<GetPackageCustomizationsResponse['contributions'][number], { kind: 'nav' }>;
32493251
const contributions: Contribution[] = [];
32503252
if (typeof registry?.getAllObjects !== 'function') return contributions;
32513253
// The one stamp reading both kinds share: the package `packageId` names

0 commit comments

Comments
 (0)