Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b4986e8
wip(studio): top-bar Save and Cancel for the object page
claude Nov 22, 2026
2dc4f5e
test(studio): pin the object page's top-bar Save and Cancel
claude Nov 22, 2026
7bec409
test(studio): the top bar draws Save where Publish was
claude Nov 22, 2026
3688cdc
fix(studio): Save waits out the expression check; gate pins press Save
claude Nov 22, 2026
7e799ec
test(studio): Data pillar pins press the top bar's Save
claude Nov 22, 2026
17cc57e
test(studio): extension, verdict, switch and toast pins follow Save
claude Nov 22, 2026
4334528
test(studio): top-bar, in-flight, switch and conflict pins follow Save
claude Nov 22, 2026
9dac29f
chore(changeset): Studio object page saves with Cancel and Save
claude Nov 23, 2026
e428611
Merge remote-tracking branch 'origin/main' into claude/issue-36511-st…
claude Nov 23, 2026
b6f217c
test(studio): narrow the verdict double's refused errors
claude Nov 23, 2026
40ddad6
test(studio): the field-groups pins press Save
claude Nov 23, 2026
38d5312
test(studio): pay the linter's first load at collection; the lint deb…
claude Nov 23, 2026
1d6c084
fix(studio): the save bar's registry adds a buffer with enlist, not r…
claude Nov 23, 2026
a184f37
wip(studio): the hooks buffer lifted to the Data pillar, saved by the…
claude Nov 23, 2026
bb08756
wip(studio): the hooks conflict dialog drawn by the pillar
claude Nov 23, 2026
0a019af
fix(studio): drop the unused act imports; the live journey presses Sa…
claude Nov 23, 2026
e24dc99
Merge remote-tracking branch 'origin/claude/issue-36511-studio-save-c…
claude Nov 23, 2026
e31fc76
wip(studio): an installed app's pair actions are buffered by the Data…
claude Nov 23, 2026
143e648
wip(studio): a flow saves with the top bar; its switch and its creati…
claude Nov 23, 2026
4c422b7
wip(studio): a permission set in the Studio saves with the top bar an…
claude Nov 23, 2026
39ff806
Merge remote-tracking branch 'origin/main' into claude/issue-36511-st…
claude Nov 23, 2026
f1eaf8d
Merge remote-tracking branch 'origin/claude/issue-36511-studio-save-c…
claude Nov 23, 2026
1f40ec2
test(studio): hooks, pair actions, flows and permission sets save wit…
claude Nov 23, 2026
aaf407c
test(studio): the hooks, flow and permission suites send with the top…
claude Nov 23, 2026
3a6306c
test(studio): a flow created and switched on, and the first-save pins…
claude Nov 23, 2026
2892cbd
Merge remote-tracking branch 'origin/main' into claude/issue-36511-st…
claude Nov 23, 2026
c496e8b
chore(studio): permission sets move to their own change (the PR line …
claude Nov 23, 2026
bf7dbf0
test(studio): the suites that reach the lint loader pay it at collection
claude Nov 23, 2026
5185e0e
chore(i18n): drop the two stale Studio switch-toast waivers
claude Nov 23, 2026
5501d15
test(i18n): the designer waiver ratchet goes down to 5
claude Nov 23, 2026
3cef83c
Merge remote-tracking branch 'origin/main' into claude/issue-36511-st…
claude Nov 23, 2026
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
13 changes: 13 additions & 0 deletions .changeset/36511-studio-save-cancel-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

feat(studio): hooks, an installed app's added actions and flows save with the top bar, and a Save is live at once

Clause-②: no
Metadata-protocol: none

The Studio's hooks, the actions an installed app's object gains in its `.custom` package and flows no longer autosave a draft 1.5 s after each edit. Edits stay on the page until the author presses Save in the top bar; Cancel puts them back as the server holds them. Save writes each edited item's draft and then publishes that one item at the package it was written to, so the change is live at once. A new hook or an added action is written only by Save, and a removed added action is deleted by Save.

A flow's on/off switch needs no Save: a flip writes the stored flow with the new status and publishes it at once, leaving any unsaved canvas edit on the page for Save. A new flow is published as it is created, switched off, so switching it on makes it live straight away. The inspector footers and the Studio landing say that Save makes a change live; permission sets follow in a separate change.
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ describe('one word per state, the second pass (objectstack#29729)', () => {
'engine.studio.customize.walled',
'engine.studio.customize.noVersion',
'engine.studio.customize.draftFooter',
'engine.studio.customize.saveFooter',
'engine.studio.customize.restoreBody',
'engine.studio.customize.restoreFlowBody',
'engine.edit.resetConfirmBody',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const srv = vi.hoisted(() => ({
saveRefusal: null as null | { status: number; message: string },
saves: [] as Array<{ name: string; body: Record<string, unknown>; opts: Record<string, unknown> }>,
resets: [] as Array<{ name: string; opts: Record<string, unknown> }>,
publishes: [] as Array<{ name: string; opts: Record<string, unknown> }>,
version: 0,
/** Whether the engine's `_status` answer holds a row for the flow. */
statusRow: true,
Expand Down Expand Up @@ -137,6 +138,16 @@ const mockClient = vi.hoisted(() => ({
srv.version += 1;
return { success: true, version: `v${srv.version}`, state: 'draft' };
}),
// objectstack#36511 — a Save publishes the one flow it wrote: the pair's draft
// becomes its published row.
publish: vi.fn(async (_type: string, name: string, opts: Record<string, unknown> = {}) => {
srv.publishes.push({ name, opts: clone(opts) });
if (opts.packageId === PAIR && srv.pairDraft) {
srv.pairActive = srv.pairDraft;
srv.pairDraft = null;
}
return { success: true };
}),
reset: vi.fn(async (_type: string, name: string, opts: Record<string, unknown> = {}) => {
srv.resets.push({ name, opts: clone(opts) });
if (opts.packageId === PAIR) {
Expand All @@ -159,12 +170,15 @@ vi.mock('@object-ui/react', async (importOriginal) => {

vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.fn(), warning: vi.fn() } }));

// The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`).
import '@objectstack/lint';
import { AutomationsPillar, type StudioBaseCustomization } from './StudioDesignSurface';
import { ensureCustomizationPackage } from './packages-io';
import { registerMetadataPreview } from '../metadata-admin/preview-registry';
import { publishRefusal } from './metadataError';
import { t, tFormat } from '../metadata-admin/i18n';
import { createEmptyDataSource } from './__tests__/emptyDataSource';
import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness';

const dataSource = createEmptyDataSource();

Expand Down Expand Up @@ -221,6 +235,7 @@ beforeEach(() => {
srv.saveRefusal = null;
srv.saves.length = 0;
srv.resets.length = 0;
srv.publishes.length = 0;
srv.version = 0;
srv.statusRow = true;
for (const fn of Object.values(mockClient)) (fn as unknown as { mockClear: () => void }).mockClear();
Expand Down Expand Up @@ -262,9 +277,11 @@ function Host({

function mount(props: React.ComponentProps<typeof Host> = {}) {
return render(
<MemoryRouter initialEntries={[`/studio/${BASE}/automations`]}>
<Host {...props} />
</MemoryRouter>,
<StudioSaveHarness>
<MemoryRouter initialEntries={[`/studio/${BASE}/automations`]}>
<Host {...props} />
</MemoryRouter>
</StudioSaveHarness>,
);
}

Expand Down Expand Up @@ -331,7 +348,12 @@ describe('Customize a read-only base’s flow into its pair (objectstack#28570)'
await customize();

patchFlow();
await sleep(1500);
expect(srv.saves, 'nothing is written before Save (objectstack#36511)').toEqual([]);
await pressStudioSave();
await waitFor(() => expect(srv.saves).toHaveLength(1), { timeout: 8000 });
// Then that one flow is published at the pair: the override is live.
await waitFor(() => expect(srv.publishes).toEqual([{ name: FLOW_NAME, opts: { packageId: PAIR } }]));
expect(srv.ensure).toEqual([201]);
const [saved] = srv.saves;
expect(saved!.name).toBe(FLOW_NAME);
Expand All @@ -353,11 +375,13 @@ describe('Customize a read-only base’s flow into its pair (objectstack#28570)'
await waitFor(() => expect(screen.queryByTestId('studio-override-popover')).toBeNull());
await expectLedgerSwitchAlone();

// A later edit asks the door no more, and is pinned to the version it was answered.
// A later edit asks the door no more; its draft was published, so the next
// save asserts no draft again.
patchFlow();
await pressStudioSave();
await waitFor(() => expect(srv.saves).toHaveLength(2), { timeout: 8000 });
expect(srv.ensure).toEqual([201]);
expect(srv.saves[1]!.opts).toMatchObject({ packageId: PAIR, ifMatch: 'v1' });
expect(srv.saves[1]!.opts).toMatchObject({ packageId: PAIR, ifNoneMatch: '*' });
expect(srv.saves[1]!.body.overrides).toEqual(DECLARATION);
expect(calls('/toggle')).toHaveLength(0);
});
Expand Down Expand Up @@ -385,6 +409,7 @@ describe('Customize a read-only base’s flow into its pair (objectstack#28570)'
// Its editors are open: an edit is saved into the pair, keeping the declaration.
fireEvent.keyDown(document.activeElement ?? document.body, { key: 'Escape' });
patchFlow();
await pressStudioSave();
await waitFor(() => expect(srv.saves).toHaveLength(1), { timeout: 8000 });
expect(srv.saves[0]!.opts.packageId).toBe(PAIR);
expect(srv.saves[0]!.body.overrides).toEqual(DECLARATION);
Expand Down Expand Up @@ -436,6 +461,7 @@ describe('Customize a read-only base’s flow into its pair (objectstack#28570)'
await customize();
expect(within(header()).queryByRole('switch')).toBeNull();
patchFlow();
await pressStudioSave();
await waitFor(() => expect(srv.saves).toHaveLength(1), { timeout: 8000 });
await within(header()).findByTestId('studio-override-chip', undefined, { timeout: 8000 });
expect(within(header()).queryByRole('switch')).toBeNull();
Expand Down Expand Up @@ -470,6 +496,7 @@ describe('Customize a read-only base’s flow into its pair (objectstack#28570)'
await openFlow();
await customize();
patchFlow();
await pressStudioSave();
expect(await screen.findByTestId('studio-refusal-message', undefined, { timeout: 8000 })).toHaveTextContent(sentence);
expect(within(header()).queryByTestId('studio-override-chip')).toBeNull();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ vi.mock('@object-ui/react', async (importOriginal) => {

vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } }));

// The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`).
import '@objectstack/lint';
import { AutomationsPillar } from './StudioDesignSurface';
import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness';
import { createEmptyDataSource } from './__tests__/emptyDataSource';
import { registerMetadataPreview } from '../metadata-admin/preview-registry';
import { registerMetadataInspector } from '../metadata-admin/inspector-registry';
Expand Down Expand Up @@ -131,9 +134,11 @@ async function outlastDebounce(): Promise<void> {
/** Open the flow and add a Notify step on its one edge, as an author does. */
async function addNotify(): Promise<string> {
render(
<MemoryRouter initialEntries={[`/studio/${PKG}/automations`]}>
<AutomationsPillar packageId={PKG} />
</MemoryRouter>,
<StudioSaveHarness>
<MemoryRouter initialEntries={[`/studio/${PKG}/automations`]}>
<AutomationsPillar packageId={PKG} />
</MemoryRouter>
</StudioSaveHarness>,
);
fireEvent.click(await screen.findByRole('button', { name: 'Insert node here' }, { timeout: 8000 }));
const option = screen.getAllByRole('option').find((o) => o.textContent?.startsWith('Notify'));
Expand Down Expand Up @@ -168,6 +173,9 @@ describe('Automations page — a new Notify step is held until it is filled in (
fireEvent.change(within(rail).getByPlaceholderText('Your request was approved'), {
target: { value: 'Request approved' },
});
// objectstack#36511 — filled in, the step is no longer held, and Save sends it.
await waitFor(() => expect(screen.queryByTestId('studio-held')).toBeNull());
await pressStudioSave();
await waitFor(() => expect(mockClient.save).toHaveBeenCalledTimes(1), { timeout: 4000 });
const sent = mockClient.saves[0].nodes as Array<Record<string, unknown>>;
expect(sent.find((n) => n.id === id)).toEqual(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ vi.mock('../metadata-admin/previews/useObjectFields', () => ({

import { AutomationsPillar } from './StudioDesignSurface';
import { createEmptyDataSource } from './__tests__/emptyDataSource';
import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness';
import { getMetadataPreview, registerMetadataPreview } from '../metadata-admin/preview-registry';
import { registerMetadataInspector } from '../metadata-admin/inspector-registry';
import { FlowInspector } from '../metadata-admin/inspectors/FlowInspector';
Expand Down Expand Up @@ -173,9 +174,11 @@ afterEach(() => {
/** Open the flow, select Update Records, add the value `id` and switch it to a blank expression. */
async function writeBlankExpression() {
render(
<MemoryRouter initialEntries={[`/studio/${PKG}/automations`]}>
<AutomationsPillar packageId={PKG} />
</MemoryRouter>,
<StudioSaveHarness>
<MemoryRouter initialEntries={[`/studio/${PKG}/automations`]}>
<AutomationsPillar packageId={PKG} />
</MemoryRouter>
</StudioSaveHarness>,
);
fireEvent.click(await screen.findByRole('button', { name: 'select write' }, { timeout: 8000 }));
// The node has two maps (Filter, Field values); the value goes in Field values.
Expand Down Expand Up @@ -209,7 +212,9 @@ describe('Automations page — Problems and the node agree on a blank expression
// The node: business words, not the envelope's wire shape.
expect(within(map).getByRole('alert').textContent).toBe(NEEDED());

// The draft is stored, and its verdict read again …
// Saved (objectstack#36511: by the top bar's Save), and its verdict read
// again. The double keeps serving the stored draft with its verdict.
await pressStudioSave();
await waitFor(() => expect(mockClient.save).toHaveBeenCalled(), { timeout: 6000 });
await waitFor(() => expect(server.draftReads).toBeGreaterThan(readsBefore), { timeout: 6000 });

Expand All @@ -227,6 +232,7 @@ describe('Automations page — Problems and the node agree on a blank expression

it('control: once the expression is written, the cell and the Problems list clear together', async () => {
const { map } = await writeBlankExpression();
await pressStudioSave();
await waitFor(() => expect(mockClient.save).toHaveBeenCalled(), { timeout: 6000 });
fireEvent.click(screen.getByTestId('auto-tab-problems'));
await screen.findByTestId('flow-problem-target', {}, { timeout: 6000 });
Expand All @@ -237,6 +243,7 @@ describe('Automations page — Problems and the node agree on a blank expression
fireEvent.blur(source);

expect(within(map).queryByRole('alert')).toBeNull();
await pressStudioSave();
await waitFor(() => expect(mockClient.save.mock.calls.length).toBeGreaterThan(saves), { timeout: 6000 });
expect(await screen.findByText(EMPTY(), {}, { timeout: 6000 })).toBeInTheDocument();
expect(screen.queryByTestId('flow-problem-target')).toBeNull();
Expand Down
Loading
Loading