From b14e301bb6dcbf13aa4d680b7d5fe4da01e18f4f Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 12 Mar 2026 15:49:34 +0100 Subject: [PATCH] frontend-app-api: clean up session boundary initialization Make the bootstrap-visible app slice explicit so APIs and predicate validation follow the same session boundary rules before the full tree is finalized. Signed-off-by: Patrik Oldsberg Made-with: Cursor --- .../src/wiring/createSpecializedApp.test.tsx | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/frontend-app-api/src/wiring/createSpecializedApp.test.tsx b/packages/frontend-app-api/src/wiring/createSpecializedApp.test.tsx index 1695897a14..788fc6bbc2 100644 --- a/packages/frontend-app-api/src/wiring/createSpecializedApp.test.tsx +++ b/packages/frontend-app-api/src/wiring/createSpecializedApp.test.tsx @@ -1800,6 +1800,7 @@ describe('createSpecializedApp', () => { await signIn!.complete; expect(featureFlagsApi.isActive).toHaveBeenCalledWith('test-flag'); + expect(featureFlagsApi.isActive).toHaveBeenCalledTimes(1); const finalizedApp = preparedApp.finalize(); render( @@ -1811,6 +1812,26 @@ describe('createSpecializedApp', () => { expect(screen.getByText('Flagged Layout')).toBeInTheDocument(); }); + it('should reject bootstrap-visible extensions that use if predicates', () => { + expect(() => + prepareSpecializedApp({ + features: [ + appPluginOriginal, + createFrontendModule({ + pluginId: 'app', + extensions: [ + appPluginOriginal.getExtension('sign-in-page:app').override({ + if: { featureFlags: { $contains: 'test-flag' } }, + }), + ], + }), + ], + }), + ).toThrow( + "Extension 'sign-in-page:app' uses 'if' before the session boundary at 'app/root.children'. Move it behind the session boundary or remove the predicate.", + ); + }); + it('should gate finalize behind internal async sign-in finalization', async () => { const identityApi = { getProfileInfo: async () => ({ displayName: 'Test User' }),