Skip to content

Commit cf6a7cc

Browse files
committed
Merge origin/main into claude/project-thread-f4qgcg
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVTq2EZveNYXjHFxWS
2 parents 4c85d2e + 3d5933a commit cf6a7cc

55 files changed

Lines changed: 2462 additions & 183 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
fix(metadata-protocol): the layered read of a form view naming a field its object lacks now carries the form-field-unknown warning
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`GET /api/v1/meta/view/NAME?layers=true` judged its `_diagnostics` with the schema alone, so a published form view whose section names a missing field (or an undeclared field group) read `{ valid: true }` there, while `GET /api/v1/meta/view/NAME` of the same view carried the lint's warning. Studio's item editor reads the layered answer when no draft is pending, so the author of a published form view saw no warning.
11+
12+
The layered read now runs the same form-layout pass on its `effective` body that the single-item read runs, against the object the registry serves for each name the view spells. The warnings land at the same paths, and `valid` stays the schema's answer. A form naming only real fields still reads `{ valid: true }`.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@object-ui/data-objectstack': patch
3+
---
4+
5+
perf(data-objectstack)!: an object route reads that object's saved views (`GET /meta/view?object=`), not every view of every object (#29550)
6+
7+
Clause-②: no (narrowing) — `listViews` and `listViewOverrides` no longer list a stored `view` row that carries no `viewKind` or no top-level `object` (a legacy bare spec, a `{ list }` wrapper, a row bound only through `data.object`). The draft-preview read applies the same rule. Nothing is widened.
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no export, signature or answer shape changes. The adapter's two view readers now apply the rule the server's one-object view read (ADR-0017 section 3.5) and the view write door (#7741) already apply: a row is bound to an object by `object` plus `viewKind`. There is no key for a migration to rewrite; a row stored before the write door refused unbound rows is re-bound by saving the view again. -->
11+
12+
**BREAKING** read narrowing in `@object-ui/data-objectstack` (`ObjectStackAdapter.listViews`, `ObjectStackAdapter.listViewOverrides`), which feed the Console's saved-view tabs and per-view settings.
13+
14+
- **Before.** On every object route, both readers downloaded the whole published view list (`GET /api/v1/meta/view`, every view of every object; 7 KB on app-crm) and kept one object's rows in the browser, matching a row on `data.object` or `object`, with or without `viewKind`.
15+
- **Now.** While nothing on the page has loaded the whole list, they read `GET /api/v1/meta/view?object=OBJECT`, the read ADR-0017 declares for the view switcher, once for both readers. Once something has loaded the whole list, or while its read is on the wire (Studio, the MetadataProvider, a packaged app's object scope), they answer from it with no request of their own. Both paths keep the same rows in the same order: `viewKind` set, `object` naming the object, sorted by `order` and then `name`. The draft-preview read (`listViews` with `previewDrafts`) keeps its own `?preview=draft` request and narrows its rows by the same rule.
16+
- **Order.** Saved-view tabs follow the contract's order (`order`, then `name`). Before, they followed the order of the server's whole list, so tabs with no `order` could appear in a different order.
17+
- **Who sees it.** A deployment holding a `view` row stored before the write door refused rows without `object` and `viewKind` (#7741). That row was a saved-view tab and a per-view setting before, and is neither now. The server's one-object read never served it. Views the Console saves today carry both fields, and none of the rows on a fresh app-crm or showcase deployment were affected.
18+
19+
**The remedy.** Open the view in the Console and save it again: the save writes `object` and `viewKind`, and the view is listed again.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@objectstack/lint': patch
3+
---
4+
5+
Clause-②: no
6+
Metadata-protocol: none
7+
8+
fix(lint): `connector-credential-literal` now also warns when a stdio MCP server's credential goes nowhere, or when a credential is typed into `transport.credentialEnv`
9+
10+
Two new findings on the existing advisory. Both are warnings, so nothing is refused and every save still lands. They reach `os validate`, `os build`, `os lint` and the connector save door (`PUT /meta/connector/:name`), the same doors the rule already runs on.
11+
12+
- **A stdio `auth` that reaches nothing.** Take a `provider: 'mcp'` entry with a stdio transport and a `bearer`, `api-key` or `basic` `auth`, but no `providerConfig.transport.credentialEnv`. Its reference is still resolved, and a missing one still degrades the instance. But the provider hands the credential to a stdio server only in the variable `credentialEnv` names, so the credential was dropped and nothing said so. The finding sits at `auth` and names the fix. Add `credentialEnv`, or drop `auth` if the server takes no credential:
13+
14+
```ts
15+
providerConfig: { transport: { kind: 'stdio', command: 'repo-mcp-server', credentialEnv: 'REPO_MCP_TOKEN' } },
16+
auth: { type: 'bearer', credentialRef: 'REPO_MCP_TOKEN' },
17+
```
18+
19+
- **A credential in `transport.credentialEnv`.** That key holds the name of an environment variable, and it is served on every metadata read. The rule now warns when the value reads as a credential instead of a name. That means it opens with an auth scheme (`Bearer …`), or it has a run of 16 or more letters and digits that switches between the two at least four times, the way a generated token does. A conventional name such as `REPO_MCP_TOKEN`, or a long capital name, never draws. The finding names the key and never echoes the value.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/driver-sql': patch
3+
---
4+
5+
refactor(driver-sql): the comparand bind test reads the list operators from the spec
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The SQL driver bind-tests each member of a `$in`, `$nin` or `$between` list as a comparand in its own right. It now asks `isListComparandOperator` from `@objectstack/spec/data` which operators take a list, instead of keeping its own copy of `$in` / `$nin` / `$between`. The set is the same, so no filter compiles or is refused differently. A later change to the spec's list operators now reaches this driver without a second edit.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/plugin-security': patch
3+
---
4+
5+
refactor(plugin-security): the RLS stored-form check reads the list operators from the spec
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The RLS check puts a value comparand into its column's storage form, and a `$in`, `$nin` or `$between` list member by member. It now asks `isListComparandOperator` from `@objectstack/spec/data` which operators take a list, instead of keeping its own copy of `$in` / `$nin` / `$between`. The set is the same, so no policy filter is judged differently. A later change to the spec's list operators now reaches this check without a second edit.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/runtime': minor
4+
---
5+
6+
feat(spec,runtime): a package export carries its namespace and its dependencies, so a reinstalled `.custom` pair keeps both
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: added
10+
11+
`GET /packages/:id/export` answered a package's items and its `id`, `name`, `version` and `label`, and nothing of the two install-manifest keys an install of the export decides by. A `.custom` pair exported and reinstalled through `POST /api/v1/marketplace/install-local` therefore lost its namespace (the install door derives one from the id, so the pair landed under `custom` instead of, for example, `showcase_custom`) and its edge to its base, which orders the pair's install after the base (ADR-0141 D5) and admits its `overrides` declarations at the managed install (ADR-0146 D2).
12+
13+
- **Spec.** `PackageExportManifestSchema` declares two more optional fixed keys, `namespace` and `dependencies`, each the install manifest's own declaration (`ManifestSchema.shape.namespace` / `.dependencies`), so an export refuses exactly what an install would. The schema stays open for the per-type collections.
14+
- **Runtime.** The export writes both from the package's registry row, as the row's manifest declares them, and writes neither when the row declares none.
15+
16+
Nothing to do for existing exports: an export taken before this change still installs as before. Export the package again to carry both keys. `type` is still not written, and `POST /api/v1/packages` still refuses an export; the install-local door is the one that reinstalls an export.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(app-shell): the Studio field panel can turn on a lookup's or user field's `referenceNameVisible`
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
The object designer's field panel (`ObjectFieldInspector`) now offers a "Show Name When Unreadable" checkbox on `lookup` and `user` fields, the two types `FieldSchema` accepts `referenceNameVisible` on. Checking it saves `referenceNameVisible: true`, so a reader of the record sees the referenced record's name as plain text when they cannot open that record; clearing it removes the key. On a `lookup` it sits after the picker config; a `user` field, whose target is always `sys_user`, shows the checkbox alone. A retype to any other type removes the key, since the spec refuses it there (`false` included); `lookup` to `user` keeps it. The label and help text match the generic `field` metadata form's row for the same key, in the studio namespace's `en` and `zh` tables. Other field types are unchanged.

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ A field or flow another package contributes to one of the base's objects.
323323

324324
| Property | Type | Required | Description |
325325
| :--- | :--- | :--- | :--- |
326-
| **packages** | `({ id: string; name: string; version: string; label?: string; … } & Record<string, any>)[]` | ✅ | Every package whose registry row's `source` is not `code` (the marketplace and authored packages, a `.custom` pair among them), enabled or not, each once and each as `GET /packages/:id/export` answers it, dependencies first: an entry comes after every entry its package's `manifest.dependencies` names, so a `.custom` pair comes after its base. Install the entries in this order; never re-sort them. No entry carries an enabled state, so every entry installs enabled. Empty when every package of the deployment is registered by its own code. |
326+
| **packages** | `({ id: string; name: string; version: string; namespace?: string; … } & Record<string, any>)[]` | ✅ | Every package whose registry row's `source` is not `code` (the marketplace and authored packages, a `.custom` pair among them), enabled or not, each once and each as `GET /packages/:id/export` answers it, dependencies first: an entry comes after every entry its package's `manifest.dependencies` names, so a `.custom` pair comes after its base. Install the entries in this order; never re-sort them. No entry carries an enabled state, so every entry installs enabled. Empty when every package of the deployment is registered by its own code. |
327327

328328
### Nested Shape: `PackageExportBundle.packages[number]`
329329

@@ -332,6 +332,8 @@ A field or flow another package contributes to one of the base's objects.
332332
| **id** | `string` | ✅ | The exported package's id. |
333333
| **name** | `string` | ✅ | The exported package's machine name. |
334334
| **version** | `string` | ✅ | The exported package's version. |
335+
| **namespace** | `string` | optional | The namespace the package was installed with, as its registry row's manifest declares it; absent when the row declares none. An install of the export keeps it instead of deriving one from the id, so a `.custom` pair is reinstalled under its own namespace rather than `custom`. |
336+
| **dependencies** | `Record<string, string>` | optional | The packages this package depends on, each id mapped to its version range, as its registry row's manifest declares them; absent when the row declares none. An install of the export orders it after each of them (ADR-0141 D5), and a `.custom` pair keeps the edge to its base that admits its overrides (ADR-0146 D2). |
335337
| **label** | `string` | optional | Display label, when the package declares one. |
336338
| **withheldMaps** | `{ type: 'connector'; name: string; path: Enum<'providerConfig.headers' \| 'providerConfig.defaultHeaders' \| …> }[]` | optional | [PLANNED — not yet served] Declared ahead of its producer (ADR-0049): no export writes this list yet and no install door reads it yet. Every map the export withheld WHOLE because a served read never carries it: a connector's header and environment-variable maps. The item is written with that map absent, so once served an import reads this list to tell an incomplete map from one the package never had, and names each one for an operator to re-enter. Positions only: no header or variable name is listed. Absence says nothing about what was withheld when the exporter predates this key; from an exporter that writes it, absence means nothing was withheld. |
337339

@@ -347,6 +349,8 @@ A field or flow another package contributes to one of the base's objects.
347349
| **id** | `string` | ✅ | The exported package's id. |
348350
| **name** | `string` | ✅ | The exported package's machine name. |
349351
| **version** | `string` | ✅ | The exported package's version. |
352+
| **namespace** | `string` | optional | The namespace the package was installed with, as its registry row's manifest declares it; absent when the row declares none. An install of the export keeps it instead of deriving one from the id, so a `.custom` pair is reinstalled under its own namespace rather than `custom`. |
353+
| **dependencies** | `Record<string, string>` | optional | The packages this package depends on, each id mapped to its version range, as its registry row's manifest declares them; absent when the row declares none. An install of the export orders it after each of them (ADR-0141 D5), and a `.custom` pair keeps the edge to its base that admits its overrides (ADR-0146 D2). |
350354
| **label** | `string` | optional | Display label, when the package declares one. |
351355
| **withheldMaps** | `{ type: 'connector'; name: string; path: Enum<'providerConfig.headers' \| 'providerConfig.defaultHeaders' \| …> }[]` | optional | [PLANNED — not yet served] Declared ahead of its producer (ADR-0049): no export writes this list yet and no install door reads it yet. Every map the export withheld WHOLE because a served read never carries it: a connector's header and environment-variable maps. The item is written with that map absent, so once served an import reads this list to tell an incomplete map from one the package never had, and names each one for an operator to re-enter. Positions only: no header or variable name is listed. Absence says nothing about what was withheld when the exporter predates this key; from an exporter that writes it, absence means nothing was withheld. |
352356

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* A keyset walk by `id` visits every row once, in the driver's own order
5+
* (#29398 item 1) — the query shape of the organization-membership completion
6+
* read in `@objectstack/core` (`readOrganizationMembersToCompletion`): pages
7+
* of `{ organization_id, id: { $gt: after } }`, `orderBy id asc`, a `limit`,
8+
* the columns `id` and `user_id`, resuming after each full page's last id.
9+
*
10+
* The resolver cannot check the order itself, because the order is the
11+
* driver's (a SQL database's collation, not JavaScript's code points); the
12+
* walk is correct exactly when the cursor and the order share one comparison.
13+
* This pins that for this driver: the pages, joined, are the sequence of one
14+
* unpaged ordered read, holding every row of the organization once and no row
15+
* of another. The ids are mixed-case nanoid-alphabet values, no two equal
16+
* after case folding. The same pin lives in driver-sql (per dialect cell),
17+
* driver-sqlite-wasm, driver-turso and driver-mongodb; the drivers' shared
18+
* conformance cases live in `@objectstack/spec/data`, which this change does
19+
* not edit.
20+
*/
21+
22+
import { describe, it, expect, beforeAll } from 'vitest';
23+
import { InMemoryDriver } from './memory-driver.js';
24+
25+
const TABLE = 'sys_member';
26+
const ORG = 'org_walked';
27+
const OTHER_ORG = 'org_other';
28+
29+
/** The organization walked: sixteen ids, no two equal after case folding. */
30+
const MEMBER_IDS = [
31+
'AC', 'Ab9', 'B-2', 'a-c', 'aB3', 'ab', 'b_1', '0Zz',
32+
'Z0', 'z_9', '_x', '-y', 'Mm', 'mN1', 'n', 'Q-q',
33+
] as const;
34+
/** Another organization's rows, interleaved with the walked ones. */
35+
const OTHER_IDS = ['Aa', 'b', 'zZ'] as const;
36+
37+
/** Page sizes: one row, a mid-run boundary, an exact multiple (16 = 4 x 4), the whole set. */
38+
const PAGE_SIZES = [1, 3, 4, 16] as const;
39+
40+
const userIdOf = (id: string) => `user_${id}`;
41+
42+
describe("InMemoryDriver — a keyset walk by id visits every member once, in the driver's order (#29398)", () => {
43+
let driver: InMemoryDriver;
44+
45+
beforeAll(async () => {
46+
driver = new InMemoryDriver({ persistence: false });
47+
await driver.connect();
48+
const rows = [
49+
...MEMBER_IDS.map((id) => ({ id, organization_id: ORG, user_id: userIdOf(id) })),
50+
...OTHER_IDS.map((id) => ({ id, organization_id: OTHER_ORG, user_id: userIdOf(id) })),
51+
];
52+
for (const row of rows) await driver.create(TABLE, row);
53+
});
54+
55+
/** The completion read's loop: resume after the last id of each full page. */
56+
const walk = async (pageSize: number) => {
57+
const visited: Array<Record<string, unknown>> = [];
58+
let after: unknown;
59+
let reads = 0;
60+
for (;;) {
61+
const where = after === undefined
62+
? { organization_id: ORG }
63+
: { organization_id: ORG, id: { $gt: after } };
64+
const page: Array<Record<string, unknown>> = await driver.find(
65+
TABLE,
66+
{ where, orderBy: [{ field: 'id', order: 'asc' }], limit: pageSize, fields: ['id', 'user_id'] },
67+
);
68+
reads += 1;
69+
// A driver that ignores the cursor would page forever: fail instead of hanging.
70+
expect(reads, 'the walk did not end; the cursor is not narrowing the read').toBeLessThanOrEqual(MEMBER_IDS.length + 1);
71+
visited.push(...page);
72+
if (page.length < pageSize) break;
73+
after = page[page.length - 1]!.id;
74+
}
75+
return { visited, reads };
76+
};
77+
78+
/** The driver's own order, read once without a page boundary to cross. */
79+
const ordered = async () => {
80+
const rows: Array<Record<string, unknown>> = await driver.find(
81+
TABLE,
82+
{ where: { organization_id: ORG }, orderBy: [{ field: 'id', order: 'asc' }], fields: ['id', 'user_id'] },
83+
);
84+
return rows.map((r) => String(r.id));
85+
};
86+
87+
for (const pageSize of PAGE_SIZES) {
88+
it(`pages of ${pageSize}: every member once, no other organization's row, in one ordered read's sequence`, async () => {
89+
const { visited, reads } = await walk(pageSize);
90+
const ids = visited.map((r) => String(r.id));
91+
92+
expect(ids).toEqual(await ordered());
93+
expect([...ids].sort()).toEqual([...MEMBER_IDS].sort());
94+
expect(new Set(ids).size).toBe(MEMBER_IDS.length);
95+
for (const row of visited) expect(row.user_id).toBe(userIdOf(String(row.id)));
96+
expect(reads).toBe(Math.floor(MEMBER_IDS.length / pageSize) + 1);
97+
});
98+
}
99+
});

0 commit comments

Comments
 (0)