Skip to content

Commit 6a06a42

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-l0j2zg
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzGExkj8nxREmV7FjX
2 parents 0a88f92 + 91a423e commit 6a06a42

56 files changed

Lines changed: 2657 additions & 691 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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/core': patch
3+
'@objectstack/plugin-auth': patch
4+
---
5+
6+
fix(core, plugin-auth): a failed organization probe says `readFailed` too, and an auth mail no longer reads a failed settings read as "no default currency" (#27733, #27710)
7+
8+
Clause-②: no — `resolveLocalizationContext`'s result keeps its shape; the existing `readFailed?: true` member gains one more trigger. Nothing new is exported from a package entry.
9+
Metadata-protocol: none
10+
11+
- **Before.** For a caller that names no organization where no wall stands, `resolveLocalizationContext` first asks `sys_organization` which organization's rows it may read. A store fault on that probe answered the built-ins with no `readFailed`, so messaging graded a mail whose `{{ amount | currency }}` hole then had no default as permanent (`TEMPLATE_INVALID`) and dead-lettered it. And the auth mails (verification, password reset, invitations, magic link, notices) read every failed settings read as "the organization has no default currency": such a mail failed with `TEMPLATE_INVALID` and its "set localization.currency" remedy during a transient fault.
12+
- **Now.** A probe that throws `AuthzStoreUnavailableError` answers `readFailed: true`, the same as a failed `sys_setting` read, so messaging retries the delivery. That answer is cached in neither memo, since no value was read: the next request asks again. A posture that cannot be read is not a store fault and still answers no `readFailed`. The auth mail's currency read rejects on `readFailed`; when the render then refuses for want of a default, the mail is rendered once more without sending with the no-currency code `XXX`: if that renders, the mail fails with an error that names the failed read and carries no `TEMPLATE_*` code, so sending it again once the read succeeds works; if it still refuses, that refusal stands.
13+
- **Unchanged.** A read that succeeds and finds no default keeps today's refusal and remedy, on both paths. A template with no no-argument `currency` hole is sent during a read fault. The failure memo for a failed `sys_setting` read is unchanged.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/platform-objects': patch
3+
'@objectstack/plugin-audit': patch
4+
---
5+
6+
fix(platform-objects): the Setup sidebar names each settings page the way the settings hub does, and lists every page the hub lists; Notification Events and the audit action read in words
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
- **One name per settings page.** The Setup sidebar's Configuration entries now carry the hub card's title in every shipped locale. In English, "Email" becomes "Mail Delivery". In zh-CN, ja-JP and es-ES the mail, company, file storage and feature flags entries take the hub's wording (for example 邮件 becomes 邮件投递, 公司信息 becomes 公司).
12+
- **The same set of pages.** SMS Delivery (`nav_settings_sms`) and Data Lifecycle (`nav_settings_lifecycle`) gain sidebar entries; until now they were reachable only through "All Settings". Both require `manage_platform_settings`, as their settings namespaces do.
13+
- **Notification Events.** Severity options read Info / Warning / Critical, and Source Object is drawn as the object's label (the `object-ref` widget the sharing rules use) instead of its api name. The stored values are unchanged: severity keeps `info` / `warning` / `critical`, and the field still stores the object name.
14+
- **Audit action.** Each `sys_audit_log.action` option carries a label ("Config Change" for `config_change`, "Login Failed" for `login_failed`, …), so the English list, detail and System Overview's "Audit Events by Action" chart no longer show the codes. The stored values are unchanged.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/plugin-auth': patch
3+
'@objectstack/platform-objects': patch
4+
---
5+
6+
fix(plugin-auth): a role change that grants an org-admin permission set says which set it granted (#27862)
7+
8+
Clause-②: yes (widening: update-member-role's success answer gains outcome 'permission_set_granted' and grantedPermissionSet; the two sys_member actions gain outcomeMessages)
9+
Metadata-protocol: none
10+
11+
Raising a member to `admin` or `owner` grants an org-admin permission set as a side effect (`organization_admin`, or `organization_admin_no_bypass` on a wall-less posture). The role change used to answer the member row alone, so the console toasted "Member role updated" and the administrator later found a set on the user that nobody visibly assigned.
12+
13+
- **Now.** When the role change left the member holding an org-admin set they did not hold before it, `POST /api/v1/auth/organization/update-member-role` answers two more members beside the member row: `outcome: 'permission_set_granted'` and `grantedPermissionSet: { name, label }`, the label read from the security catalog. The `sys_member` actions Change Role and Make Owner show it: "Member role updated. The new role also granted the permission set Organization Administrator (no record bypass)."
14+
- **Unchanged.** A role change that grants nothing (admin to owner keeps the set already held, a demotion revokes it) and a refusal answer exactly as before. The member row's own columns are untouched. What is granted does not change: the grant is still written by `plugin-security`'s reconciler alone, and the new hooks only read.
15+
- **Fails toward silence.** A grant read that fails leaves the answer as the route wrote it, without the line.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/runtime': patch
3+
'@objectstack/cli': patch
4+
---
5+
6+
fix(cli): `os plugin publish` decodes the artifact's compiled manifest once, through `readCompiledPluginManifest` (#27914)
7+
8+
Clause-②: yes (widening: the `ok` arm of `@objectstack/runtime`'s exported `CompiledPluginManifestRead` gains `document`, the manifest entry as decoded before the `ManifestSchema` parse; every existing key keeps its value)
9+
Metadata-protocol: none
10+
11+
- **Before.** `os plugin publish` validated the compiled manifest through `readCompiledPluginManifest`, then decoded the same archive entry a second time to build the verbatim `plugin_manifest` upload, finding it by the CLI's own spelling of the filename. That lookup held only while the CLI's `MANIFEST_FILENAME` and the runtime's `COMPILED_PLUGIN_MANIFEST_FILE` spelled the same string.
12+
- **Now.** `readCompiledPluginManifest` answers the decoded `document` beside the parsed `manifest`, and publish uploads that document. The upload is unchanged: the artifact's own manifest, key for key, without the defaults the parse stamps (`scope`, `defaultDatasource`).
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/objectql': patch
3+
---
4+
5+
fix(objectql): a flow a composed stack declares only on its top level, beside package bodies that do not declare it, registers with the automation engine at boot
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: none
9+
10+
The engine's `manifest` service registers a multi-package stack's residual (top-level items no package body declares, ADR-0130 D4) objects and connectors under the stack's own `manifest.id`; it now registers the residual's flows the same way. The automation plugin's boot pull reads flows from the ObjectQL registry only, so a residual flow used to be listed by the metadata service and never registered with the engine: `getFlow` answered `null`, a run answered "not found", and its trigger never armed. Such a flow now registers and runs at boot. A flow a package body declares is still registered once, under that body; stacks whose top level repeats their bodies, and single-package stacks, are unchanged.

‎packages/cli/src/commands/plugin/publish.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,9 @@ export default class PluginPublish extends Command {
137137
// What is uploaded is the manifest the artifact carries, as it carries
138138
// it: the parse above stamps the schema's defaults (`scope`,
139139
// `defaultDatasource`), which would make the declared manifest differ
140-
// from the signed bytes' own. The entry is there and is a JSON object:
141-
// the read above answered `ok`.
142-
const declaredManifest = JSON.parse(
143-
Buffer.from(archiveFiles.find((f) => f.path === MANIFEST_FILENAME)!.data).toString('utf8'),
144-
) as Record<string, unknown>;
140+
// from the signed bytes' own. The read hands back the document it
141+
// decoded, so the entry is decoded once and looked up by one spelling.
142+
const declaredManifest = read.document;
145143
const id = String(flags['manifest-id'] ?? manifest.id).trim();
146144
const version = manifest.version;
147145
const displayName = String(flags['display-name'] ?? manifest.name ?? id).trim();

‎packages/cli/test/connect-agent-both-halves-wire.pin.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,14 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', (
254254
.toContain('nav_connect_agent');
255255
// The Setup tree the platform admin is served BY THIS COMPOSITION: 9
256256
// authored groups less `group_approvals`, which nothing contributes
257-
// into and the filter collapses, plus the 23 entries
257+
// into and the filter collapses, plus the 25 entries
258258
// `SETUP_NAV_CONTRIBUTIONS` carries, plus the MCP one.
259259
// `nav_settings_branding` is not among them, and not because of a
260260
// tenancy wall (this harness boots none): since #24766 it is
261261
// contributed by `@objectstack/service-settings` together with the
262262
// `branding` namespace, offered only where no organization wall stands,
263263
// and this harness composes platform-objects and the MCP bundle alone.
264-
expect(allowedIds).toHaveLength(32);
264+
expect(allowedIds).toHaveLength(34);
265265
expect(allowedIds).not.toContain('nav_settings_branding');
266266
// The two per-user stores are reached from the User record page, not
267267
// from Setup's menu (#23803).
@@ -284,8 +284,8 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', (
284284
expect(withAccountHalf.statusCode).toBe(200);
285285
expect(withoutAccountHalf.statusCode).toBe(200);
286286
expect(navIds(withAccountHalf.body?.item)).toEqual(navIds(withoutAccountHalf.body?.item));
287-
// 32: the composition the count in the test above states.
288-
expect(navIds(withAccountHalf.body?.item)).toHaveLength(32);
287+
// 34: the composition the count in the test above states.
288+
expect(navIds(withAccountHalf.body?.item)).toHaveLength(34);
289289

290290
// The mechanism behind the invariance, asserted rather than assumed:
291291
// the bundle aims exactly one contribution at `setup` and one at
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* `os plugin publish` uploads the compiled manifest from the one decode
5+
* `readCompiledPluginManifest` makes (#27914): the `plugin_manifest` payload
6+
* is the archive entry's own document, key for key, and the door does not
7+
* depend on the CLI's `MANIFEST_FILENAME` spelling the runtime's
8+
* `COMPILED_PLUGIN_MANIFEST_FILE`.
9+
*/
10+
11+
import { describe, it, expect, afterEach, vi } from 'vitest';
12+
import { mkdtemp, rm, writeFile } from 'node:fs/promises';
13+
import { tmpdir } from 'node:os';
14+
import { join } from 'node:path';
15+
16+
// The CLI's constant spelled differently from the runtime's, as a drift
17+
// between the two packages would leave it.
18+
vi.mock('../src/utils/osplugin.js', async (importOriginal) => ({
19+
...(await importOriginal<typeof import('../src/utils/osplugin.js')>()),
20+
MANIFEST_FILENAME: 'objectstack.plugin.drifted.json',
21+
}));
22+
23+
import { createTarGz, type ArchiveFile } from '../src/utils/osplugin.js';
24+
import PluginPublish from '../src/commands/plugin/publish.js';
25+
26+
// The runtime's spelling (`COMPILED_PLUGIN_MANIFEST_FILE`), which the artifact uses.
27+
const RUNTIME_MANIFEST_FILE = 'objectstack.plugin.json';
28+
29+
// No `integrity` map: the preflight's exemption list is spelled with the
30+
// CLI constant, and this file is about the manifest read only.
31+
const manifest = {
32+
version: '1.2.0', id: 'com.acme.demo', name: 'Demo', type: 'plugin',
33+
main: 'dist/index.mjs', packaging: 'bundled', runtime: 'sandbox',
34+
permissions: { services: ['object'] },
35+
};
36+
const manifestText = JSON.stringify(manifest, null, 4);
37+
38+
describe('os plugin publish: the uploaded manifest is the entry it decoded once', () => {
39+
let dir: string | undefined;
40+
const prevEnv = { url: process.env.OS_CLOUD_URL, key: process.env.OS_CLOUD_API_KEY };
41+
afterEach(async () => {
42+
vi.unstubAllGlobals();
43+
process.env.OS_CLOUD_URL = prevEnv.url;
44+
process.env.OS_CLOUD_API_KEY = prevEnv.key;
45+
if (dir) await rm(dir, { recursive: true, force: true });
46+
});
47+
48+
it("publishes when the CLI's filename constant and the runtime's differ, and uploads the entry's document key for key", async () => {
49+
const files: ArchiveFile[] = [
50+
{ path: 'dist/index.mjs', data: new Uint8Array(Buffer.from('export const x=1;\n')) },
51+
{ path: RUNTIME_MANIFEST_FILE, data: new Uint8Array(Buffer.from(manifestText)) },
52+
];
53+
dir = await mkdtemp(join(tmpdir(), 'plugin-publish-entry-'));
54+
const artifactPath = join(dir, 'com.acme.demo-1.2.0.osplugin');
55+
await writeFile(artifactPath, new Uint8Array(createTarGz(files)));
56+
process.env.OS_CLOUD_URL = 'http://cloud.test';
57+
process.env.OS_CLOUD_API_KEY = 'tok_123';
58+
const bodies: any[] = [];
59+
vi.stubGlobal('fetch', vi.fn(async (url: string, init: any) => {
60+
bodies.push(JSON.parse(init.body));
61+
const data = url.endsWith('/versions') ? { version: '1.2.0' } : { id: 'pkg_1', created: true };
62+
return { ok: true, status: 200, json: async () => ({ success: true, data }), statusText: 'OK' } as any;
63+
}));
64+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
65+
try {
66+
await PluginPublish.run([artifactPath]);
67+
} finally {
68+
logSpy.mockRestore();
69+
}
70+
expect(bodies).toHaveLength(2);
71+
expect(JSON.stringify(bodies[1].plugin_manifest)).toBe(JSON.stringify(JSON.parse(manifestText)));
72+
});
73+
});

‎packages/cli/test/plugin-publish.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ describe('os plugin publish (end-to-end, mocked cloud)', () => {
135135
// Exactly the artifact's own manifest: `ManifestSchema` would stamp
136136
// `scope` and `defaultDatasource`, and neither is uploaded.
137137
expect(bodies[1].plugin_manifest).toEqual(manifest);
138+
// Key for key, in the archive entry's own order (#27914).
139+
const entry = readTarGz(blob).find((f) => f.path === MANIFEST_FILENAME)!;
140+
expect(JSON.stringify(bodies[1].plugin_manifest)).toBe(JSON.stringify(JSON.parse(Buffer.from(entry.data).toString('utf8'))));
138141
expect(bodies[1].plugin_manifest).not.toHaveProperty('scope');
139142
expect(bodies[1].plugin_manifest).not.toHaveProperty('defaultDatasource');
140143
});

0 commit comments

Comments
 (0)