Skip to content

Commit bcbb3c1

Browse files
committed
Merge origin/main into claude/project-thread-nye4b2
Claude-Session: https://claude.ai/code/session_01FEkQ5nSMgkteiemkoN31vf Co-authored-by: Claude <noreply@anthropic.com>
2 parents 24c0eec + 9182ff6 commit bcbb3c1

45 files changed

Lines changed: 3154 additions & 75 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
'@objectstack/service-automation': patch
5+
'@objectstack/platform-objects': patch
6+
---
7+
8+
feat(console): Connector connections, a Setup page to connect, reconnect or disconnect each OAuth connector instance and see its status
9+
10+
Clause-②: yes (widening: new Setup entry nav_connector_connections resolving automation:connector-connections; no existing key, route or shape changes)
11+
Metadata-protocol: none
12+
13+
A connector instance declared with `auth: { type: 'oauth2', grant: 'authorization_code' }` needs an administrator to sign in to the vendor once for their organization. The Console now has a page for that (`automation:connector-connections`). `@objectstack/service-automation` contributes its Setup → Integrations entry, **Connector Connections**, gated on `manage_connector_connections`, the organization-scoped capability the connection door asks, so an organization administrator sees it; `@objectstack/platform-objects` carries the entry's label in its four Setup translation packs. The page lists every such instance with the organization's connection status as the server answers it (Not connected, Connected, or Reconnect required with the reason the server recorded), the granted scopes, who connected it and when, and when the access token renews. A `degraded` instance shows the server's reason in the same row as the connection that caused it.
14+
15+
**Connect** and **Reconnect** open the vendor's sign-in in its own window, detached from the page, and send it to the authorization URL the server answered. The page re-reads the status until the connect lands, then closes the window and shows the new status. **Disconnect** removes the connection after a confirmation. No token, code or authorization URL is ever rendered.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(studio): "New similar" on a flow in the Automations pillar, opening the copy where the clone door landed it
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
An admin who wants a second flow like one a package ships, for another rule, gets it without changing the package's flow (ADR-0146 D4). The flow clone door lands the copy switched off in a writable package, by default the source's paired `<base>.custom`, so Studio can offer the gesture where the flow is designed.
12+
13+
- **New similar in the flow's menu.** The open flow's ⋯ menu offers "New similar" on a read-only package's flow and on a writable package's flow. It asks for a new machine name and a label, both mandatory, and posts them to `POST /api/v1/automation/:name/clone`. On a read-only base the request names no package, so the door picks the pair; on a writable package it names the open package.
14+
- **The copy opens where the answer says.** The door's answer names the package the copy landed in. A copy in another package opens on that package's Automations pillar (`/studio/<package>/automations?surface=flow:<copy>`); a copy in the open package opens in place after the rail re-reads. Either way the server's sentence that the copy is switched off is shown as sent. An answer that names no package says so and opens nothing. Nothing records or draws what the copy was made from.
15+
- **Refusals and gates.** A refusal, a `409` for a taken name included, is the server's sentence, shown in the dialog, which stays open. A caller without `manage_metadata` sees the item disabled with the console's sentence for why. A read-only package's flow still offers no Delete, and the package-less scope draws no menu.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(studio): the All metadata area marks a base's customizations, filters to them and counts them
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
In Studio's All metadata area (ADR-0146 D3, "On top, one surface"), an installed base's lists now show its own items and the items of its paired `BASE.custom` package together. Every mark and number comes from the server's customization read, `GET /api/v1/packages/:id/customizations`. Nothing is computed from the documents: there is no diff and no `basedOn` verdict.
12+
13+
- **Marks.** An item the read lists as an override is marked "Customized (BASE)". For a type identified by name and member, such as an email template's locale, only that member is marked. Any other item of the pair is marked "Added". The base's other items carry no mark.
14+
- **Filter.** Each list offers "Only customizations (n)" once the read has answered and the base has a customization.
15+
- **Counts.** Each directory tile shows how many items of its type the read lists as overrides. The object tile also counts the extension members (fields, validation rules, indexes). The directory header shows the base's total, the served overrides plus the served extensions, which is the landing's "customized" figure.
16+
- **Pending or failed read.** While the read is pending, or after it fails, the area draws no mark, no filter and no number, never a "0". A failure shows the server's sentence. A base with no pair is unchanged, and so is Setup, which makes no customization read.
17+
- **Across packages.** In `/studio/~all/metadata`, an item of a `BASE.custom` package is labelled "Customization of BASE".
18+
- **One mark component.** `CustomizationMark` (`views/studio-design/CustomizationMark.tsx`) draws these marks for the whole console, and the pillar rails will reuse it. `fetchPackageCustomizations` returns the read in full, and `fetchPackageCustomizationCounts` (the landing's reader) now uses it.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/cli': patch
3+
---
4+
5+
fix(cli): `os build` runs the override write gate `os validate` runs (ADR-0146 D2, #28643)
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
`os build` now calls `findOverrideDeclarationRefusals` beside the dependency-range check, the same walk over the publish door's own judge (`judgeOverrideWrite`) that `os validate`, the publish doors and the managed install ask. A stack carrying an `overrides` declaration the gate does not admit, or a dependent's item bearing a name a package in its dependency closure ships, is refused at build with the rows `os validate` prints (`NOT_OVERRIDABLE`, exit 1), and no artifact is written. Before, the build emitted that artifact and the managed install or a publish door refused it later with the same judge; what any door accepts is unchanged.
11+
12+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no export or type changes: `os build` now runs the override write gate `os validate`, the publish doors and the managed install already run, with the same judge (`judgeOverrideWrite`) and the same rows. An artifact it now refuses was already refused wherever it landed, so there is nothing for `objectstack migrate meta` to rewrite and no tombstone; the remedy is the judge's own sentence (rename the item, or remove `overrides`). -->

‎content/docs/automation/connectors.mdx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,15 @@ a rotating refresh token is never spent twice.
640640
DELETE /api/v1/automation/connectors/:name/connection → revoke
641641
```
642642

643+
**In the Console**, **Setup → Integrations → Connector Connections** drives
644+
these calls; the entry is shown to holders of `manage_connector_connections`.
645+
It lists each `authorization_code` instance with the organization's status,
646+
the reason the server recorded and, for a `degraded` instance, the server's
647+
reason beside the connection that caused it. **Connect** and **Reconnect**
648+
open the vendor's sign-in in its own window, detached from the page, and the
649+
page shows the new status once the callback has stored it; **Disconnect**
650+
revokes after a confirmation.
651+
643652
`GET …/:name/connection` answers the organization's status
644653
(`not_connected`, `connected`, `reconnect_required`), never a token. The
645654
`state` and the PKCE verifier are bound to the user and organization that

‎packages/cli/src/commands/compile.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ import { findViewContainerNameRefusals } from '../utils/view-container-names.js'
7676
// A field `picklist` that names no picklist the stack declares — the walk
7777
// `os validate` step 2d runs, over the same judge.
7878
import { judgePicklistReferences, picklistRefusalHeading, printPicklistReferenceNotices } from '../utils/picklist-references.js';
79+
// [ADR-0146 D2, #28643] The override write gate — the walk `os validate` step
80+
// 3a-iii runs, over the publish door's own judge (`judgeOverrideWrite`).
81+
import { findOverrideDeclarationRefusals } from '../utils/override-declarations.js';
7982

8083
export default class Compile extends Command {
8184
static override description = 'Compile ObjectStack configuration to JSON artifact';
@@ -768,6 +771,37 @@ export default class Compile extends Command {
768771
);
769772
}
770773

774+
// 3b-iii. [ADR-0146 D2, #28643] The override write gate, at build time —
775+
// the SAME call `os validate` makes at its step 3a-iii, over the
776+
// walk `utils/override-declarations.ts` takes and the publish door's
777+
// own judge (`judgeOverrideWrite`). Only the base's paired
778+
// `<base>.custom` declares an override; a dependent's item bearing a
779+
// name a package in its closure ships, and an `overrides` declaration
780+
// the gate does not admit, are refused. Before this the build emitted
781+
// such an artifact and the managed install or a publish door refused
782+
// it later with the same judge; now the door that ships refuses it
783+
// and writes no artifact.
784+
//
785+
// Beside the dependency-range check below and ahead of every artifact
786+
// write. The `--json` face is this command's failure envelope
787+
// (`errors`, the rows `os validate --json` carries); the text face is
788+
// `os validate`'s. No step line, as on `os validate`.
789+
const overrideRefusals = findOverrideDeclarationRefusals(result.data as Record<string, unknown>);
790+
if (overrideRefusals.length > 0) {
791+
if (flags.json) {
792+
await emitJson({ success: false, errors: overrideRefusals, warnings: warningsSoFar(), conversions: conversionNotices }, 0, { compact: true });
793+
this.exit(1);
794+
}
795+
const n = overrideRefusals.length;
796+
console.log('');
797+
printError(`The publish door would refuse ${n} item${n > 1 ? 's' : ''} under the override write gate (ADR-0146 D2)`);
798+
printBulletList(
799+
overrideRefusals.map((r) => `${r.path} [${r.code}] ${r.message}`),
800+
{ noun: 'override refusal(s)', remedy: JSON_FULL_LIST_REMEDY },
801+
);
802+
this.exit(1);
803+
}
804+
771805
// 3b-quater. ADR-0141 D2, author side — every `manifest.dependencies`
772806
// range of the packages one install act would deliver, judged by the
773807
// install's own predicate (`utils/dependency-range-check.ts`).
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* [ADR-0146 D2, #28643] `os build` asks the override write gate that `os
5+
* validate`, the publish doors and the managed install ask, and refuses the
6+
* build with the rows `os validate` prints: same rows, same exit code, and
7+
* NO artifact written.
8+
*
9+
* ## The defect, measured before the fix
10+
*
11+
* On a dependent package carrying `overrides: { package: 'com.acme.crm', … }`
12+
* (only `com.acme.crm.custom` may declare one), and on a `packages[]` stack
13+
* whose dependent ships a dashboard under the base's name, `os build --json`
14+
* exited 0 and wrote `dist/objectstack.json`, while `os validate --json`
15+
* exited 1 with one `NOT_OVERRIDABLE` row each. The managed install and the
16+
* publish doors refused that artifact later with the same judge.
17+
*
18+
* ## One judge, one walk
19+
*
20+
* `compile.ts` makes the call `validate.ts` makes
21+
* (`findOverrideDeclarationRefusals`, over `judgeOverrideWrite`), so the pins
22+
* below assert EQUALITY with what `os validate` answers for the same config,
23+
* run in the same process, rather than a copy of the judge's words. Both
24+
* commands run in-process (`Command.run`), not as spawned CLIs.
25+
*/
26+
27+
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
28+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
29+
import { tmpdir } from 'node:os';
30+
import { join, resolve } from 'node:path';
31+
import { fileURLToPath } from 'node:url';
32+
import Compile from '../src/commands/compile';
33+
import Validate from '../src/commands/validate';
34+
import { defineStackSource, linkSpec } from './helpers/define-stack-fixture.js';
35+
36+
const CLI_ROOT = resolve(fileURLToPath(import.meta.url), '..', '..');
37+
const BASE = 'com.acme.crm';
38+
39+
interface Run {
40+
/** The exit code `this.exit(n)` threw, or 0 when the command returned. */
41+
code: number;
42+
stdout: string;
43+
}
44+
45+
/** Runs one command in-process; stdout captured ANSI-free, the write callback honoured. */
46+
async function run(command: typeof Compile | typeof Validate, argv: string[]): Promise<Run> {
47+
const chunks: string[] = [];
48+
const spy = vi.spyOn(process.stdout, 'write').mockImplementation(((chunk: unknown, ...rest: unknown[]) => {
49+
chunks.push(String(chunk));
50+
const done = rest.find((a) => typeof a === 'function') as ((e?: Error | null) => void) | undefined;
51+
done?.(null);
52+
return true;
53+
}) as never);
54+
const exitCodeBefore = process.exitCode;
55+
let code = 0;
56+
try {
57+
await command.run(argv, { root: CLI_ROOT });
58+
} catch (error) {
59+
const exit = (error as { oclif?: { exit?: unknown } }).oclif?.exit;
60+
if (typeof exit !== 'number') throw error;
61+
code = exit;
62+
} finally {
63+
spy.mockRestore();
64+
process.exitCode = exitCodeBefore;
65+
}
66+
// eslint-disable-next-line no-control-regex
67+
return { code, stdout: chunks.join('').replace(/\u001b\[[0-9;]*m/g, '') };
68+
}
69+
70+
const json = (r: Run, label: string): Record<string, any> => {
71+
try {
72+
return JSON.parse(r.stdout) as Record<string, any>;
73+
} catch {
74+
throw new Error(`${label}: stdout was not one JSON document (exit ${r.code})\n${r.stdout}`);
75+
}
76+
};
77+
78+
const dashboard = (name: string, extra: Record<string, unknown> = {}) => ({ name, label: 'Board', widgets: [], ...extra });
79+
80+
/** A single-package stack declaring an override of the base's dashboard. */
81+
const declaring = (id: string): Record<string, unknown> => ({
82+
manifest: { id, name: 'ovr', version: '1.0.0', type: 'app', namespace: 'ovr', dependencies: { [BASE]: '^1.0.0' } },
83+
dashboards: [dashboard('crm_board', { overrides: { package: BASE, basedOn: '1.0.0' } })],
84+
});
85+
86+
/** A `packages[]` stack whose dependent ships the base's dashboard name, undeclared. */
87+
const undeclaredSameName = (): Record<string, unknown> => ({
88+
manifest: { id: 'com.acme.bundle', name: 'bundle', version: '1.0.0', type: 'app' },
89+
packages: [
90+
{ manifest: { id: BASE, name: 'crm', version: '1.0.0', type: 'app', dashboards: [dashboard('crm_board')] } },
91+
{
92+
manifest: {
93+
id: 'com.acme.partner', name: 'partner', version: '1.0.0', type: 'app',
94+
dependencies: { [BASE]: '^1.0.0' }, dashboards: [dashboard('crm_board')],
95+
},
96+
},
97+
],
98+
});
99+
100+
let root = '';
101+
const fixtures: Record<string, { config: string; artifact: string }> = {};
102+
103+
beforeAll(() => {
104+
root = mkdtempSync(join(tmpdir(), 'os-build-override-declarations-'));
105+
const make = (label: string, s: Record<string, unknown>) => {
106+
const dir = join(root, label);
107+
mkdirSync(dir, { recursive: true });
108+
// `strict: false`: the content is the door's to judge, not the producer's.
109+
writeFileSync(join(dir, 'objectstack.config.ts'), defineStackSource(s, { strict: false }));
110+
linkSpec(dir);
111+
fixtures[label] = { config: join(dir, 'objectstack.config.ts'), artifact: join(dir, 'dist', 'objectstack.json') };
112+
};
113+
make('partner', declaring('com.acme.partner'));
114+
make('undeclared', undeclaredSameName());
115+
make('pair', declaring('com.acme.crm.custom'));
116+
});
117+
118+
afterAll(() => {
119+
if (root) rmSync(root, { recursive: true, force: true });
120+
});
121+
122+
const build = (label: string, ...flags: string[]) =>
123+
run(Compile, [fixtures[label].config, '--output', fixtures[label].artifact, ...flags]);
124+
const validate = (label: string, ...flags: string[]) => run(Validate, [fixtures[label].config, ...flags]);
125+
126+
describe('#28643 — os build refuses what os validate refuses under the override write gate, and ships nothing', () => {
127+
it.each(['partner', 'undeclared'])('THE PIN (%s): --json exits as validate does, with validate\'s rows, and writes no artifact', async (label) => {
128+
const validated = await validate(label, '--json');
129+
expect(validated.code, validated.stdout).toBe(1);
130+
const expected = json(validated, `validate ${label}`).errors as Array<Record<string, unknown>>;
131+
// Anti-vacuity: the judge refuses this config, under the override gate.
132+
expect(expected.map((e) => e.code)).toEqual(['NOT_OVERRIDABLE']);
133+
134+
const built = await build(label, '--json');
135+
const payload = json(built, `build ${label}`);
136+
expect(built.code).toBe(validated.code);
137+
expect(payload.success).toBe(false);
138+
expect(payload.errors).toEqual(expected);
139+
expect(existsSync(fixtures[label].artifact), 'os build wrote an artifact the publish door refuses').toBe(false);
140+
}, 60_000);
141+
142+
it('the text face exits 1 and prints the refusal block os validate prints', async () => {
143+
const validated = await validate('undeclared');
144+
expect(validated.code).toBe(1);
145+
const block = validated.stdout.slice(validated.stdout.indexOf('✗ The publish door would refuse')).trimEnd();
146+
expect(block).toContain('[NOT_OVERRIDABLE]');
147+
148+
const built = await build('undeclared');
149+
expect(built.code).toBe(1);
150+
expect(built.stdout).toContain(block);
151+
expect(built.stdout).not.toContain('Build complete');
152+
expect(existsSync(fixtures.undeclared.artifact)).toBe(false);
153+
}, 60_000);
154+
155+
it('CONTROL: the base\'s paired .custom declaring the same override builds, and validates clean', async () => {
156+
expect((await validate('pair', '--json')).code).toBe(0);
157+
const built = await build('pair', '--json');
158+
const payload = json(built, 'build pair');
159+
expect(payload.success, JSON.stringify(payload.errors ?? payload.error)).toBe(true);
160+
expect(built.code).toBe(0);
161+
const artifact = JSON.parse(readFileSync(fixtures.pair.artifact, 'utf8')) as Record<string, any>;
162+
expect(artifact.dashboards.map((d: { name: string }) => d.name)).toEqual(['crm_board']);
163+
}, 60_000);
164+
});

‎packages/cli/test/setup-integrations-order.pin.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// Datasources `@objectstack/service-datasource`
1515
// Connect an Agent `@objectstack/mcp`
1616
// Connector Credentials `@objectstack/service-automation`
17+
// Connector Connections `@objectstack/service-automation` (same contribution)
1718
// Cloud Connection `@objectstack/cloud-connection`
1819
//
1920
// Each contributor states the group's other priorities in its own header so
@@ -66,7 +67,8 @@ const GROUP = 'group_integrations';
6667
const EXPECTED_TIERS: readonly (readonly string[])[] = [
6768
['nav_webhooks', 'nav_http_deliveries', 'nav_datasources'],
6869
['nav_connect_agent'],
69-
['nav_connector_credentials'],
70+
// One contribution carries both, in this order (ADR-0143 D5 added the second).
71+
['nav_connector_credentials', 'nav_connector_connections'],
7072
['nav_cloud_connection'],
7173
];
7274

0 commit comments

Comments
 (0)