Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

Merge branch 'dev' into fix/issue-1055-password-admission-dos

Josuéaca5c359a532
diff --cc profile-ui/app/components/__tests__/SettingsContent.test.tsx
index 373fa36a3,4293868c8..d6bf7caf2
--- a/profile-ui/app/components/__tests__/SettingsContent.test.tsx
+++ b/profile-ui/app/components/__tests__/SettingsContent.test.tsx
@@@ -151,46 -159,21 +159,63 @@@ describe('Settings desktop setup handof
expect(mocks.buildDesktopEnvironmentLink).toHaveBeenCalledWith(desktopEnvironment)
expect(mocks.navigateToDesktopApp).toHaveBeenCalledWith(desktopHref)
})
+
+ it('keeps manual REST setup available while automatic handoff is disabled', async () => {
+ vi.stubEnv('NEXT_PUBLIC_PROFILE_DESKTOP_HANDOFF_ENABLED', 'false')
+
+ render(<SettingsContent activeSettingsTab="profile" activeSocialTab="telegram" />)
+
+ fireEvent.click(await screen.findByRole('button', { name: 'Setup desktop app' }))
+
+ const dialog = await screen.findByRole('dialog', { name: 'Setup desktop app' })
+ expect(
+ within(dialog).getByText(/Automatic Desktop handoff is temporarily unavailable/)
+ ).toBeInTheDocument()
+ expect(
+ within(dialog).queryByRole('button', { name: 'Open desktop app and setup' })
+ ).not.toBeInTheDocument()
+ expect(within(dialog).getByRole('button', { name: 'Copy External REST API URL' })).toBeEnabled()
+ })
})
+
+describe('Settings password update recovery messaging', () => {
+ it('shows actionable guidance from the External REST credential-change response', async () => {
+ const publicMessage =
+ 'Your password changed during this request. Sign in again with your new password.'
+ const publicResponse = { status: 409, body: { error: publicMessage } }
+ const actualApi = await vi.importActual<typeof import('@lib/api')>('@lib/api')
+ mocks.updatePassword.mockImplementation(actualApi.updatePassword)
+ const upstreamFetch = vi.spyOn(globalThis, 'fetch').mockResolvedValue(
+ new Response(JSON.stringify(publicResponse.body), {
+ status: publicResponse.status,
+ statusText: 'Conflict',
+ headers: { 'content-type': 'application/json' },
+ })
+ )
+
+ try {
+ render(<SettingsContent activeSettingsTab="profile" activeSocialTab="telegram" />)
+ const openButton = await screen.findByRole('button', { name: 'Update password' })
+ fireEvent.click(openButton)
+
+ const dialog = await screen.findByRole('dialog', { name: 'Update password' })
+ fireEvent.change(within(dialog).getByLabelText('Current password'), {
+ target: { value: 'Synthetic-current-password' },
+ })
+ fireEvent.change(within(dialog).getByLabelText('New password'), {
+ target: { value: 'Synthetic-next-password' },
+ })
+ fireEvent.change(within(dialog).getByLabelText('Confirm new password'), {
+ target: { value: 'Synthetic-next-password' },
+ })
+ fireEvent.click(within(dialog).getByRole('button', { name: 'Update password' }))
+
+ expect(await within(dialog).findByText(`409 Conflict - ${publicMessage}`)).toBeInTheDocument()
+ expect(mocks.logout).not.toHaveBeenCalled()
+ expect(mocks.routerReplace).not.toHaveBeenCalled()
+ expect(mocks.showToast).not.toHaveBeenCalled()
+ } finally {
+ upstreamFetch.mockRestore()
+ }
+ })
+})