diff --git a/.changeset/remove-allowUnknownExtensionConfig-app-api.md b/.changeset/remove-allowUnknownExtensionConfig-app-api.md new file mode 100644 index 0000000000..a105eece46 --- /dev/null +++ b/.changeset/remove-allowUnknownExtensionConfig-app-api.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-app-api': minor +--- + +**BREAKING**: Removed the `allowUnknownExtensionConfig` option from `createSpecializedApp`. Unknown extension configuration is now always reported as an `INVALID_EXTENSION_CONFIG_KEY` error in the returned `errors` array instead. diff --git a/.changeset/remove-allowUnknownExtensionConfig-defaults.md b/.changeset/remove-allowUnknownExtensionConfig-defaults.md new file mode 100644 index 0000000000..c76b955828 --- /dev/null +++ b/.changeset/remove-allowUnknownExtensionConfig-defaults.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-defaults': minor +--- + +**BREAKING**: Removed the `allowUnknownExtensionConfig` option from `createApp`. Unknown extension configuration now always produces a console warning instead. diff --git a/packages/frontend-app-api/report.api.md b/packages/frontend-app-api/report.api.md index e8fc019007..47677b8916 100644 --- a/packages/frontend-app-api/report.api.md +++ b/packages/frontend-app-api/report.api.md @@ -169,7 +169,6 @@ export type CreateSpecializedAppOptions = { bindRoutes?(context: { bind: CreateAppRouteBinder }): void; advanced?: { apis?: ApiHolder; - allowUnknownExtensionConfig?: boolean; extensionFactoryMiddleware?: | ExtensionFactoryMiddleware | ExtensionFactoryMiddleware[]; diff --git a/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx b/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx index d56a609bb9..a5195d853c 100644 --- a/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx +++ b/packages/frontend-app-api/src/wiring/createSpecializedApp.tsx @@ -255,17 +255,6 @@ export type CreateSpecializedAppOptions = { */ apis?: ApiHolder; - /** - * If set to true, the system will silently accept and move on if - * encountering config for extensions that do not exist. The default is to - * reject such config to help catch simple mistakes. - * - * This flag can be useful in some scenarios where you have a dynamic set of - * extensions enabled at different times, but also increases the risk of - * accidentally missing e.g. simple typos in your config. - */ - allowUnknownExtensionConfig?: boolean; - /** * Applies one or more middleware on every extension, as they are added to * the application. diff --git a/packages/frontend-defaults/report.api.md b/packages/frontend-defaults/report.api.md index 75392d2dc1..6457ddb7f7 100644 --- a/packages/frontend-defaults/report.api.md +++ b/packages/frontend-defaults/report.api.md @@ -23,7 +23,6 @@ export function createApp(options?: CreateAppOptions): { // @public export interface CreateAppOptions { advanced?: { - allowUnknownExtensionConfig?: boolean; configLoader?: () => Promise<{ config: ConfigApi; }>; diff --git a/packages/frontend-defaults/src/createApp.test.tsx b/packages/frontend-defaults/src/createApp.test.tsx index 55ca0b3772..1d1c5ebf53 100644 --- a/packages/frontend-defaults/src/createApp.test.tsx +++ b/packages/frontend-defaults/src/createApp.test.tsx @@ -283,7 +283,9 @@ describe('createApp', () => { ).resolves.toBeInTheDocument(); }); - it('should allow unknown extension config if the flag is set', async () => { + it('should warn about unknown extension config', async () => { + const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {}); + const app = createApp({ features: [ appPlugin, @@ -300,7 +302,6 @@ describe('createApp', () => { }), ], advanced: { - allowUnknownExtensionConfig: true, configLoader: async () => ({ config: mockApis.config({ data: { @@ -316,6 +317,12 @@ describe('createApp', () => { await renderWithEffects(app.createRoot()); await expect(screen.findByText('Derp')).resolves.toBeInTheDocument(); + expect(warnSpy).toHaveBeenCalledWith('App startup encountered warnings:'); + expect(warnSpy).toHaveBeenCalledWith( + 'INVALID_EXTENSION_CONFIG_KEY: Extension unknown:lols/wut does not exist', + ); + + warnSpy.mockRestore(); }); it('should make the app structure available through the AppTreeApi', async () => { let appTreeApi: AppTreeApi | undefined = undefined; diff --git a/packages/frontend-defaults/src/createApp.tsx b/packages/frontend-defaults/src/createApp.tsx index 4ff67f6d5a..fe96b50e31 100644 --- a/packages/frontend-defaults/src/createApp.tsx +++ b/packages/frontend-defaults/src/createApp.tsx @@ -58,17 +58,6 @@ export interface CreateAppOptions { * Advanced, more rarely used options. */ advanced?: { - /** - * If set to true, the system will silently accept and move on if - * encountering config for extensions that do not exist. The default is to - * reject such config to help catch simple mistakes. - * - * This flag can be useful in some scenarios where you have a dynamic set of - * extensions enabled at different times, but also increases the risk of - * accidentally missing e.g. simple typos in your config. - */ - allowUnknownExtensionConfig?: boolean; - /** * Sets a custom config loader, replacing the builtin one. *