Skip to content

Commit 8f23746

Browse files
os-zhuangclaude
andauthored
fix(platform-objects): sys_sso_provider resultDialog paths address the inner data payload (#2842)
* fix(platform-objects): sys_sso_provider resultDialog paths address the inner data payload The console action runtime unwraps the `{ success, data }` response envelope before resolving `resultDialog` field paths (matching create_user, two-factor and OAuth). sys_sso_provider's domain-verification dialog was the only spec written with a `data.` prefix — it compensated for a runtime bug where apiHandler leaked the whole envelope. Once apiHandler unwraps correctly (objectstack-ai/objectui), that prefix double-nests and blanks the DNS-record dialog. Drop the prefix (`data.dnsRecordType` → `dnsRecordType`, …) so the paths are relative to the inner data like every other object. Adds a regression assertion. Release-coupled with the objectui apiHandler fix — ship together. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * chore: add changeset Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 4d9dd7b commit 8f23746

3 files changed

Lines changed: 37 additions & 6 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@objectstack/platform-objects': patch
3+
---
4+
5+
`sys_sso_provider` domain-verification `resultDialog` paths now address the
6+
inner `data` payload (`dnsRecordType`, not `data.dnsRecordType`), matching every
7+
other object. Pairs with the objectui `apiHandler` envelope-unwrap fix
8+
(objectui#2396) — the old `data.` prefix compensated for a runtime bug and would
9+
blank the dialog once the runtime unwraps correctly.

packages/platform-objects/src/identity/sys-sso-provider.object.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,13 @@ export const SysSsoProvider = ObjectSchema.create({
132132
// for a one-time DNS-TXT challenge and reveals the ready-to-paste record
133133
// ONCE via `resultDialog`. Routed through the env bridge (plugin-auth /
134134
// cloud AuthProxyPlugin) which reshapes the `{domainVerificationToken}`
135-
// response into the `{ data: { dnsRecordName, dnsRecordValue } }` envelope
136-
// the dialog reads. When the feature is OFF the bridge returns a clear
137-
// "not enabled for this environment" error instead of a bare 404.
135+
// response into a `{ success, data: { dnsRecordName, dnsRecordValue } }`
136+
// envelope. The console action runtime unwraps that envelope, so the
137+
// `resultDialog` field paths are relative to the inner `data` payload
138+
// (`dnsRecordName`, not `data.dnsRecordName`) — consistent with every
139+
// other object's resultDialog (create_user, two-factor, OAuth). When the
140+
// feature is OFF the bridge returns a clear "not enabled for this
141+
// environment" error instead of a bare 404.
138142
target: '/api/v1/auth/admin/sso/request-domain-verification',
139143
params: [
140144
{ name: 'providerId', field: 'provider_id', defaultFromRow: true, required: true },
@@ -146,9 +150,9 @@ export const SysSsoProvider = ObjectSchema.create({
146150
'Add the DNS TXT record below at your domain’s DNS provider, then run “Verify Domain”. The token is shown once.',
147151
acknowledge: 'Done',
148152
fields: [
149-
{ path: 'data.dnsRecordType', label: 'Record type', format: 'text' },
150-
{ path: 'data.dnsRecordName', label: 'Name / Host', format: 'secret' },
151-
{ path: 'data.dnsRecordValue', label: 'Value', format: 'secret' },
153+
{ path: 'dnsRecordType', label: 'Record type', format: 'text' },
154+
{ path: 'dnsRecordName', label: 'Name / Host', format: 'secret' },
155+
{ path: 'dnsRecordValue', label: 'Value', format: 'secret' },
152156
],
153157
},
154158
},

packages/platform-objects/src/platform-objects.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
SysOrganization,
1515
SysScimProvider,
1616
SysSession,
17+
SysSsoProvider,
1718
SysTeam,
1819
SysTeamMember,
1920
SysTwoFactor,
@@ -172,6 +173,23 @@ describe('@objectstack/platform-objects', () => {
172173
expect(SysOauthApplication.enable?.apiMethods).not.toContain('update');
173174
expect(SysOauthApplication.enable?.apiMethods).not.toContain('create');
174175
});
176+
177+
it('SysSsoProvider request_domain_verification resultDialog paths address the inner data payload (no `data.` prefix)', () => {
178+
// The console action runtime unwraps the `{ success, data }` envelope
179+
// before resolving resultDialog field paths (same as create_user,
180+
// two-factor and OAuth). These paths must therefore be relative to the
181+
// INNER data — a `data.` prefix double-nests and blanks the dialog.
182+
// Regression guard for the "temporary password / DNS record shows empty"
183+
// class of bug.
184+
const action = (SysSsoProvider.actions ?? []).find(
185+
(a) => a.target === '/api/v1/auth/admin/sso/request-domain-verification',
186+
);
187+
expect(action?.resultDialog?.fields?.map((f) => f.path)).toEqual([
188+
'dnsRecordType',
189+
'dnsRecordName',
190+
'dnsRecordValue',
191+
]);
192+
});
175193
});
176194

177195
describe('SETUP_APP (ADR-0029 D7 shell)', () => {

0 commit comments

Comments
 (0)