Repository navigation
feat(ui): support typed micro frontend placements and ESM remotes - #21921
craig-rueda wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
13 issues found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx:79">
P2: Custom agent: **Enforce Strict Maintainability Standards**
`validateMFEConfig` carries an `entityTab` mode through placement, required-field, path, flag, and icon validation. Split entity-tab validation from page validation, then share only the common checks.</violation>
<violation number="2" location="datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx:196">
P2: The duplicate-route check ignores `slot`, so an app placement and a settings placement with the same path are treated as duplicates. App routes mount under `/mfe`, so these two entries do not collide, and the second one is silently dropped. Include the slot in the dedupe key.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/contract.ts">
<violation number="1" location="datahub-web-react/src/app/mfeframework/contract.ts:3">
P2: `PresentationTheme` exposes the host's entire `colors` and `styles` objects, so v1 remotes depend on internal theme shapes. Define an explicit token subset in this contract so host theme refactors do not silently change the v1 surface.</violation>
</file>
<file name="datahub-web-react/devtools/mfe-fixture/build.mjs">
<violation number="1" location="datahub-web-react/devtools/mfe-fixture/build.mjs:23">
P2: The host build writes to `build/` with `emptyOutDir: true`, which also wipes `build/remote`. The no-argument run works only because host runs first. Running the host target alone deletes the remote bundle, so give the host its own subdirectory or document that the target order is required.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/_tests_/mfeConfigLoader.test.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/_tests_/mfeConfigLoader.test.tsx:160">
P3: These new tests log expected errors to stderr without mocking them, unlike the other error-path tests in this file. Wrap them with `vi.spyOn(console, 'error').mockImplementation(() => {})` and call `mockRestore()`, and assert the logged reason in the rejection cases.</violation>
</file>
<file name=".github/workflows/mfe-runtime.yml">
<violation number="1" location=".github/workflows/mfe-runtime.yml:6">
P2: This job does not exercise `src/app/mfeframework`, even though the path filter runs it on changes there. The fixture's mount props are hand-written, so changes to the host contract can pass here. Either drive the real loader/container in this check or drop the path filter entry to avoid implying coverage.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/README-MFE.md">
<violation number="1" location="datahub-web-react/src/app/mfeframework/README-MFE.md:190">
P3: The copied contract block uses `PresentationTheme` without defining it. Add the `PresentationTheme` type from contract.ts above `HostServices`, or the snippet will not compile.</violation>
<violation number="2" location="datahub-web-react/src/app/mfeframework/README-MFE.md:228">
P2: The entity-tab example omits `flags`, but the loader requires `flags: { enabled: true }` on every entry, including tab entries. Add it to the entry or the copied config is rejected.</violation>
</file>
<file name="datahub-web-react/src/app/settingsV2/SettingsPage.tsx">
<violation number="1" location="datahub-web-react/src/app/settingsV2/SettingsPage.tsx:132">
P2: Custom agent: **Enforce i18n for User-Facing Strings**
Settings MFE menu titles are passed through as raw `mfe.label` values, so the new sidebar entries bypass the required translation lookup. Resolve these user-visible labels through the translation mechanism before adding them to the menu.</violation>
<violation number="2" location="datahub-web-react/src/app/settingsV2/SettingsPage.tsx:157">
P2: Custom agent: **Enforce Pragmatic Test Coverage**
The settings MFE wiring has no page-level coverage: existing tests check the menu helper, but never verify that a settings item navigates to a rendered placement. Add a SettingsPage integration test for the settings menu and route.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx:167">
P2: A mount that returns no cleanup bypasses this guard, is recorded as successful, and cannot be torn down on unmount. Reject `undefined` here to enforce the required cleanup contract.</violation>
<violation number="2" location="datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx:169">
P2: An async mount that fulfills with a cleanup function is rejected, but this handler discards the function, leaving any remote resources created during the mount alive. Handle fulfillment by invoking its cleanup while still reporting the async mount as invalid.</violation>
<violation number="3" location="datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx:186">
P2: An async cleanup is still accepted because it is a function, and this call discards its Promise, so teardown is not synchronous and rejection can go unhandled. Inspect the return value and handle thenables as contract violations.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| .filter(({ path, slot }) => { | ||
| const basePath = slot === 'settings' ? path : `/mfe${path}`; | ||
| const route = basePath.replace(/\/$/, '').toLowerCase(); | ||
| if (routes.has(route)) { |
There was a problem hiding this comment.
P2: The duplicate-route check ignores slot, so an app placement and a settings placement with the same path are treated as duplicates. App routes mount under /mfe, so these two entries do not collide, and the second one is silently dropped. Include the slot in the dedupe key.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx, line 196:
<comment>The duplicate-route check ignores `slot`, so an app placement and a settings placement with the same path are treated as duplicates. App routes mount under `/mfe`, so these two entries do not collide, and the second one is silently dropped. Include the slot in the dedupe key.</comment>
<file context>
@@ -111,9 +181,25 @@ export function loadMFEConfigFromYAML(yamlString: string): MFESchema {
+ .filter((config): config is MFEConfig => config !== null && 'path' in config)
+ .filter(({ path }) => {
+ const route = path.replace(/\/$/, '').toLowerCase();
+ if (routes.has(route)) {
+ console.error('[MFE Loader] Duplicate route:', path);
+ return false;
</file context>
| @@ -0,0 +1,17 @@ | |||
| import type { Theme } from '@conf/theme/types'; | |||
|
|
|||
| export type PresentationTheme = Pick<Theme, 'id' | 'colors' | 'styles'> & { brandSeed?: string }; | |||
There was a problem hiding this comment.
P2: PresentationTheme exposes the host's entire colors and styles objects, so v1 remotes depend on internal theme shapes. Define an explicit token subset in this contract so host theme refactors do not silently change the v1 surface.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/contract.ts, line 3:
<comment>`PresentationTheme` exposes the host's entire `colors` and `styles` objects, so v1 remotes depend on internal theme shapes. Define an explicit token subset in this contract so host theme refactors do not silently change the v1 surface.</comment>
<file context>
@@ -0,0 +1,17 @@
+import type { Theme } from '@conf/theme/types';
+
+export type PresentationTheme = Pick<Theme, 'id' | 'colors' | 'styles'> & { brandSeed?: string };
+
+export interface HostServices {
</file context>
| base: name === 'host' ? '/' : `/${name}/`, | ||
| build: { | ||
| target: 'esnext', | ||
| outDir: path.join(fixture, 'build', name === 'host' ? '.' : name), |
There was a problem hiding this comment.
P2: The host build writes to build/ with emptyOutDir: true, which also wipes build/remote. The no-argument run works only because host runs first. Running the host target alone deletes the remote bundle, so give the host its own subdirectory or document that the target order is required.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/devtools/mfe-fixture/build.mjs, line 23:
<comment>The host build writes to `build/` with `emptyOutDir: true`, which also wipes `build/remote`. The no-argument run works only because host runs first. Running the host target alone deletes the remote bundle, so give the host its own subdirectory or document that the target order is required.</comment>
<file context>
@@ -0,0 +1,34 @@
+ base: name === 'host' ? '/' : `/${name}/`,
+ build: {
+ target: 'esnext',
+ outDir: path.join(fixture, 'build', name === 'host' ? '.' : name),
+ emptyOutDir: true,
+ rollupOptions: { input: path.join(root, 'index.html') },
</file context>
| outDir: path.join(fixture, 'build', name === 'host' ? '.' : name), | |
| outDir: path.join(fixture, 'build', name), |
| pull_request: | ||
| paths: | ||
| - "datahub-web-react/devtools/mfe-fixture/**" | ||
| - "datahub-web-react/src/app/mfeframework/**" |
There was a problem hiding this comment.
P2: This job does not exercise src/app/mfeframework, even though the path filter runs it on changes there. The fixture's mount props are hand-written, so changes to the host contract can pass here. Either drive the real loader/container in this check or drop the path filter entry to avoid implying coverage.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/mfe-runtime.yml, line 6:
<comment>This job does not exercise `src/app/mfeframework`, even though the path filter runs it on changes there. The fixture's mount props are hand-written, so changes to the host contract can pass here. Either drive the real loader/container in this check or drop the path filter entry to avoid implying coverage.</comment>
<file context>
@@ -0,0 +1,28 @@
+ pull_request:
+ paths:
+ - "datahub-web-react/devtools/mfe-fixture/**"
+ - "datahub-web-react/src/app/mfeframework/**"
+ - "datahub-web-react/vite.config.ts"
+ - "datahub-web-react/package.json"
</file context>
|
|
||
| const mfeConfig = useMFEConfigFromBackend(); | ||
| const extensionRoutes = getPlacementRoutes(mfeConfig, 'settings'); | ||
| const extensionItems = mfeConfig ? getMfeMenuItems(mfeConfig, 'settings') : []; |
There was a problem hiding this comment.
P2: Custom agent: Enforce i18n for User-Facing Strings
Settings MFE menu titles are passed through as raw mfe.label values, so the new sidebar entries bypass the required translation lookup. Resolve these user-visible labels through the translation mechanism before adding them to the menu.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/settingsV2/SettingsPage.tsx, line 132:
<comment>Settings MFE menu titles are passed through as raw `mfe.label` values, so the new sidebar entries bypass the required translation lookup. Resolve these user-visible labels through the translation mechanism before adding them to the menu.</comment>
<file context>
@@ -125,6 +127,9 @@ const SettingsPageContent = () => {
+ const mfeConfig = useMFEConfigFromBackend();
+ const extensionRoutes = getPlacementRoutes(mfeConfig, 'settings');
+ const extensionItems = mfeConfig ? getMfeMenuItems(mfeConfig, 'settings') : [];
const subRoutes = PATHS.map((p) => p.path.replace('/', ''));
const currPathName = pathname.replace(path, '');
</file context>
| // Menu Items based on PATHS | ||
| const menuItems: NavBarMenuItems = { | ||
| items: [ | ||
| ...extensionItems, |
There was a problem hiding this comment.
P2: Custom agent: Enforce Pragmatic Test Coverage
The settings MFE wiring has no page-level coverage: existing tests check the menu helper, but never verify that a settings item navigates to a rendered placement. Add a SettingsPage integration test for the settings menu and route.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/settingsV2/SettingsPage.tsx, line 157:
<comment>The settings MFE wiring has no page-level coverage: existing tests check the menu helper, but never verify that a settings item navigates to a rendered placement. Add a SettingsPage integration test for the settings menu and route.</comment>
<file context>
@@ -149,6 +154,7 @@ const SettingsPageContent = () => {
// Menu Items based on PATHS
const menuItems: NavBarMenuItems = {
items: [
+ ...extensionItems,
// Personal Section
{
</file context>
| `blob:${window.location.origin}/remote`, | ||
| '', | ||
| 'https://[', | ||
| ])('rejects ESM entry %s', async (remoteEntry) => { |
There was a problem hiding this comment.
P3: These new tests log expected errors to stderr without mocking them, unlike the other error-path tests in this file. Wrap them with vi.spyOn(console, 'error').mockImplementation(() => {}) and call mockRestore(), and assert the logged reason in the rejection cases.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/_tests_/mfeConfigLoader.test.tsx, line 160:
<comment>These new tests log expected errors to stderr without mocking them, unlike the other error-path tests in this file. Wrap them with `vi.spyOn(console, 'error').mockImplementation(() => {})` and call `mockRestore()`, and assert the logged reason in the rejection cases.</comment>
<file context>
@@ -118,6 +118,53 @@ describe('mfeConfigLoader', () => {
+ `blob:${window.location.origin}/remote`,
+ '',
+ 'https://[',
+ ])('rejects ESM entry %s', async (remoteEntry) => {
+ mockYamlLoad({
+ microFrontends: [{ ...validParsedYaml.microFrontends[0], format: 'esm', from: 'vite', remoteEntry }],
</file context>
| the v1 interface from [contract.ts](./contract.ts) into the remote: | ||
|
|
||
| ```ts | ||
| export interface HostServices { |
There was a problem hiding this comment.
P3: The copied contract block uses PresentationTheme without defining it. Add the PresentationTheme type from contract.ts above HostServices, or the snippet will not compile.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/README-MFE.md, line 190:
<comment>The copied contract block uses `PresentationTheme` without defining it. Add the `PresentationTheme` type from contract.ts above `HostServices`, or the snippet will not compile.</comment>
<file context>
@@ -175,3 +175,61 @@ volumes:
+the v1 interface from [contract.ts](./contract.ts) into the remote:
+
+```ts
+export interface HostServices {
+ theme: PresentationTheme;
+ subscribeTheme: (listener: (theme: PresentationTheme) => void) => () => void;
</file context>
There was a problem hiding this comment.
13 issues found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx:102">
P2: Custom agent: **Flag Security Vulnerabilities**
The ESM path accepts same-origin `http:` entries and executes them without TLS on an HTTP-served production host. Require HTTPS for production entries, allowing HTTP only for local development.</violation>
<violation number="2" location="datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx:271">
P3: Subscribing the same callback twice collapses both registrations in this `Map`, so the first disposer removes theme updates for the second. Track registrations separately or reference-count callbacks so each disposer removes only its own subscription.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx:108">
P2: Custom agent: **Enforce Pragmatic Test Coverage**
The new sync-cleanup contract is enforced (`throw new TypeError('MFE mount must return a synchronous cleanup function or undefined')` when a remote mount returns a Promise or non-function), but none of the new tests cover that rejection path. Every new test mocks a mount that returns a valid synchronous cleanup, so the async/missing-cleanup failure branch is untested. Add a test where mount returns a Promise (or a non-function) and assert the host surfaces the error (TypeError / error tracking).</violation>
<violation number="2" location="datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx:110">
P3: Assertions inside the `mount` mock are swallowed by `mountMFE`'s catch block, which turns them into a `load_error`. A failure then shows up as a misleading later assertion. Capture `props` in the mock and assert on it after `waitFor`, and replace the `props.slot === 'nav.page' && props.basePath` expression with a direct check.</violation>
<violation number="3" location="datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx:151">
P2: This test never checks listener isolation: no theme change happens after the replacement, and the same `fail` mock stands in for both the old listener and the old cleanup. Use distinct `oldListener`/`newListener` mocks, rerender with a changed theme after the replacement, and assert that only the new listener runs.</violation>
<violation number="4" location="datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx:276">
P2: Custom agent: **Enforce Pragmatic Test Coverage**
The Settings page placement is a newly claimed feature (PR description: 'Page placements can target the app or Settings') but no test mounts a Settings placement. `MFEBaseConfigurablePage` derives `area: config.slot ?? 'app'` and `basePath: config.slot === 'settings' ? config.path : "/mfe${config.path}"`, and the only mount-props assertion added here hard-codes `slot: 'nav.page'`, so the settings branch (area='settings', basePath without the /mfe prefix) is entirely uncovered. Add a test that renders a settings config (e.g. `{ ...entry, slot: 'settings', path: '/settings/example' }`) and asserts mount receives `contractVersion: 1, slot: 'nav.page', area: 'settings', basePath: '/settings/example'`.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx:247">
P2: Custom agent: **Enforce Pragmatic Test Coverage**
Add a test for a `slot: 'settings'` placement that verifies `getPlacementRoutes` emits the configured `/settings/...` path; the current route tests cover only app routes.</violation>
</file>
<file name="datahub-web-react/src/app/settingsV2/SettingsPage.tsx">
<violation number="1" location="datahub-web-react/src/app/settingsV2/SettingsPage.tsx:130">
P3: This adds a second `/mfe/config` request on every settings page mount, because `NavSidebar` already fetches the same config. Lift the config into a shared context or cached hook, and have both components read from it.</violation>
<violation number="2" location="datahub-web-react/src/app/settingsV2/SettingsPage.tsx:375">
P2: Settings extensions under an existing settings prefix, such as `/settings/ai/custom`, are shadowed by the earlier non-exact built-in route. Render extension routes before `PATHS` routes so these placements can match.</violation>
</file>
<file name=".github/workflows/mfe-runtime.yml">
<violation number="1" location=".github/workflows/mfe-runtime.yml:15">
P3: Add `timeout-minutes` to the `browser` job so a hung install or build cannot run to the 6-hour default.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/_tests_/mfeConfigLoader.test.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/_tests_/mfeConfigLoader.test.tsx:148">
P2: This test is named as normalizing page placement, but it only checks `path`. Also assert the normalized `slot`, `navIcon`, and `flags.showInNav` so a regression in the placement mapping fails the test.</violation>
</file>
<file name="datahub-web-react/.eslintrc.js">
<violation number="1" location="datahub-web-react/.eslintrc.js:337">
P3: This override never takes effect in CI: `yarn lint` runs `eslint . --ext .ts,.tsx`, which skips `.js` files, and devtools is type-checked with `tsc` instead. Either drop the override or add a lint step that actually covers `devtools/mfe-fixture/host/main.js`. Also note that replacing the `import/no-unresolved` options drops airbnb's `commonjs: true` and `caseSensitive: true` for this file.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/README-MFE.md">
<violation number="1" location="datahub-web-react/src/app/mfeframework/README-MFE.md:230">
P2: "Flat-slot mount props" is not defined anywhere in this doc or in `contract.ts`. Describe the props shape a remote must accept during rollout, or drop the phrase.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| url: remoteEntry, | ||
| format: 'var' as const, | ||
| from: 'webpack' as const, | ||
| format: config.format ?? ('var' as const), |
There was a problem hiding this comment.
P2: Custom agent: Flag Security Vulnerabilities
The ESM path accepts same-origin http: entries and executes them without TLS on an HTTP-served production host. Require HTTPS for production entries, allowing HTTP only for local development.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx, line 102:
<comment>The ESM path accepts same-origin `http:` entries and executes them without TLS on an HTTP-served production host. Require HTTPS for production entries, allowing HTTP only for local development.</comment>
<file context>
@@ -90,8 +99,8 @@ async function mountMFE({
url: remoteEntry,
- format: 'var' as const,
- from: 'webpack' as const,
+ format: config.format ?? ('var' as const),
+ from: config.from ?? ('webpack' as const),
};
</file context>
| expect(mountFn).toHaveBeenCalledWith(mountTarget, {}); | ||
| expect(mountFn).toHaveBeenCalledWith( | ||
| mountTarget, | ||
| expect.objectContaining({ contractVersion: 1, slot: 'nav.page' }), |
There was a problem hiding this comment.
P2: Custom agent: Enforce Pragmatic Test Coverage
The Settings page placement is a newly claimed feature (PR description: 'Page placements can target the app or Settings') but no test mounts a Settings placement. MFEBaseConfigurablePage derives area: config.slot ?? 'app' and basePath: config.slot === 'settings' ? config.path : "/mfe${config.path}", and the only mount-props assertion added here hard-codes slot: 'nav.page', so the settings branch (area='settings', basePath without the /mfe prefix) is entirely uncovered. Add a test that renders a settings config (e.g. { ...entry, slot: 'settings', path: '/settings/example' }) and asserts mount receives contractVersion: 1, slot: 'nav.page', area: 'settings', basePath: '/settings/example'.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx, line 276:
<comment>The Settings page placement is a newly claimed feature (PR description: 'Page placements can target the app or Settings') but no test mounts a Settings placement. `MFEBaseConfigurablePage` derives `area: config.slot ?? 'app'` and `basePath: config.slot === 'settings' ? config.path : "/mfe${config.path}"`, and the only mount-props assertion added here hard-codes `slot: 'nav.page'`, so the settings branch (area='settings', basePath without the /mfe prefix) is entirely uncovered. Add a test that renders a settings config (e.g. `{ ...entry, slot: 'settings', path: '/settings/example' }`) and asserts mount receives `contractVersion: 1, slot: 'nav.page', area: 'settings', basePath: '/settings/example'`.</comment>
<file context>
@@ -133,7 +271,10 @@ describe('MFEBaseConfigurablePage', () => {
- expect(mountFn).toHaveBeenCalledWith(mountTarget, {});
+ expect(mountFn).toHaveBeenCalledWith(
+ mountTarget,
+ expect.objectContaining({ contractVersion: 1, slot: 'nav.page' }),
+ );
});
</file context>
| it('delivers resolved theme changes until unsubscribe without remounting', async () => { | ||
| const listener = vi.fn(); | ||
| let unsubscribe: () => void; | ||
| const cleanup = vi.fn(); |
There was a problem hiding this comment.
P2: Custom agent: Enforce Pragmatic Test Coverage
The new sync-cleanup contract is enforced (throw new TypeError('MFE mount must return a synchronous cleanup function or undefined') when a remote mount returns a Promise or non-function), but none of the new tests cover that rejection path. Every new test mocks a mount that returns a valid synchronous cleanup, so the async/missing-cleanup failure branch is untested. Add a test where mount returns a Promise (or a non-function) and assert the host surfaces the error (TypeError / error tracking).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx, line 108:
<comment>The new sync-cleanup contract is enforced (`throw new TypeError('MFE mount must return a synchronous cleanup function or undefined')` when a remote mount returns a Promise or non-function), but none of the new tests cover that rejection path. Every new test mocks a mount that returns a valid synchronous cleanup, so the async/missing-cleanup failure branch is untested. Add a test where mount returns a Promise (or a non-function) and assert the host surfaces the error (TypeError / error tracking).</comment>
<file context>
@@ -94,6 +102,136 @@ describe('MFEBaseConfigurablePage', () => {
+ it('delivers resolved theme changes until unsubscribe without remounting', async () => {
+ const listener = vi.fn();
+ let unsubscribe: () => void;
+ const cleanup = vi.fn();
+ const mount = vi.fn((_element: HTMLElement, props: MountProps) => {
+ expect(props.theme).toEqual({
</file context>
| .map((mfe) => ( | ||
| <Route | ||
| key={mfe.path} | ||
| path={area === 'settings' ? mfe.path : `/mfe${mfe.path}`} |
There was a problem hiding this comment.
P2: Custom agent: Enforce Pragmatic Test Coverage
Add a test for a slot: 'settings' placement that verifies getPlacementRoutes emits the configured /settings/... path; the current route tests cover only app routes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx, line 247:
<comment>Add a test for a `slot: 'settings'` placement that verifies `getPlacementRoutes` emits the configured `/settings/...` path; the current route tests cover only app routes.</comment>
<file context>
@@ -148,23 +235,28 @@ export function useMFEConfigFromBackend(): MFESchema | null {
+ .map((mfe) => (
+ <Route
+ key={mfe.path}
+ path={area === 'settings' ? mfe.path : `/mfe${mfe.path}`}
+ render={() => (
+ <MFEBaseConfigurablePage
</file context>
| }); | ||
| const { loadMFEConfigFromYAML } = await import('../mfeConfigLoader'); | ||
| const parsed = loadMFEConfigFromYAML(''); | ||
| expect(parsed.microFrontends.map((entry) => entry.path)).toEqual(['/one']); |
There was a problem hiding this comment.
P2: This test is named as normalizing page placement, but it only checks path. Also assert the normalized slot, navIcon, and flags.showInNav so a regression in the placement mapping fails the test.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/_tests_/mfeConfigLoader.test.tsx, line 148:
<comment>This test is named as normalizing page placement, but it only checks `path`. Also assert the normalized `slot`, `navIcon`, and `flags.showInNav` so a regression in the placement mapping fails the test.</comment>
<file context>
@@ -118,6 +118,53 @@ describe('mfeConfigLoader', () => {
+ });
+ const { loadMFEConfigFromYAML } = await import('../mfeConfigLoader');
+ const parsed = loadMFEConfigFromYAML('');
+ expect(parsed.microFrontends.map((entry) => entry.path)).toEqual(['/one']);
+ expect(parsed.entityTabs?.map((entry) => entry.id)).toEqual(['tab']);
+ });
</file context>
| expect(parsed.microFrontends.map((entry) => entry.path)).toEqual(['/one']); | |
| expect(parsed.microFrontends).toEqual([ | |
| expect.objectContaining({ | |
| path: '/one', | |
| slot: 'app', | |
| navIcon: 'Gear', | |
| flags: { enabled: true, showInNav: true }, | |
| }), | |
| ]); |
| const isShowNavBarRedesign = useShowNavBarRedesign(); | ||
| const { config } = useAppConfig(); | ||
|
|
||
| const mfeConfig = useMFEConfigFromBackend(); |
There was a problem hiding this comment.
P3: This adds a second /mfe/config request on every settings page mount, because NavSidebar already fetches the same config. Lift the config into a shared context or cached hook, and have both components read from it.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/settingsV2/SettingsPage.tsx, line 130:
<comment>This adds a second `/mfe/config` request on every settings page mount, because `NavSidebar` already fetches the same config. Lift the config into a shared context or cached hook, and have both components read from it.</comment>
<file context>
@@ -125,6 +127,9 @@ const SettingsPageContent = () => {
const isShowNavBarRedesign = useShowNavBarRedesign();
const { config } = useAppConfig();
+ const mfeConfig = useMFEConfigFromBackend();
+ const extensionRoutes = getPlacementRoutes(mfeConfig, 'settings');
+ const extensionItems = mfeConfig ? getMfeMenuItems(mfeConfig, 'settings') : [];
</file context>
| contents: read | ||
| jobs: | ||
| browser: | ||
| runs-on: ubuntu-24.04 |
There was a problem hiding this comment.
P3: Add timeout-minutes to the browser job so a hung install or build cannot run to the 6-hour default.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/mfe-runtime.yml, line 15:
<comment>Add `timeout-minutes` to the `browser` job so a hung install or build cannot run to the 6-hour default.</comment>
<file context>
@@ -0,0 +1,28 @@
+ contents: read
+jobs:
+ browser:
+ runs-on: ubuntu-24.04
+ defaults:
+ run:
</file context>
| runs-on: ubuntu-24.04 | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 |
| }, | ||
| overrides: [ | ||
| { | ||
| files: ['devtools/mfe-fixture/host/main.js'], |
There was a problem hiding this comment.
P3: This override never takes effect in CI: yarn lint runs eslint . --ext .ts,.tsx, which skips .js files, and devtools is type-checked with tsc instead. Either drop the override or add a lint step that actually covers devtools/mfe-fixture/host/main.js. Also note that replacing the import/no-unresolved options drops airbnb's commonjs: true and caseSensitive: true for this file.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/.eslintrc.js, line 337:
<comment>This override never takes effect in CI: `yarn lint` runs `eslint . --ext .ts,.tsx`, which skips `.js` files, and devtools is type-checked with `tsc` instead. Either drop the override or add a lint step that actually covers `devtools/mfe-fixture/host/main.js`. Also note that replacing the `import/no-unresolved` options drops airbnb's `commonjs: true` and `caseSensitive: true` for this file.</comment>
<file context>
@@ -333,6 +333,11 @@ module.exports = {
},
overrides: [
+ {
+ files: ['devtools/mfe-fixture/host/main.js'],
+ env: { browser: true },
+ rules: { 'import/no-unresolved': ['error', { ignore: ['^virtual:__federation__$'] }] },
</file context>
| let unsubscribe: () => void; | ||
| const cleanup = vi.fn(); | ||
| const mount = vi.fn((_element: HTMLElement, props: MountProps) => { | ||
| expect(props.theme).toEqual({ |
There was a problem hiding this comment.
P3: Assertions inside the mount mock are swallowed by mountMFE's catch block, which turns them into a load_error. A failure then shows up as a misleading later assertion. Capture props in the mock and assert on it after waitFor, and replace the props.slot === 'nav.page' && props.basePath expression with a direct check.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx, line 110:
<comment>Assertions inside the `mount` mock are swallowed by `mountMFE`'s catch block, which turns them into a `load_error`. A failure then shows up as a misleading later assertion. Capture `props` in the mock and assert on it after `waitFor`, and replace the `props.slot === 'nav.page' && props.basePath` expression with a direct check.</comment>
<file context>
@@ -94,6 +102,136 @@ describe('MFEBaseConfigurablePage', () => {
+ let unsubscribe: () => void;
+ const cleanup = vi.fn();
+ const mount = vi.fn((_element: HTMLElement, props: MountProps) => {
+ expect(props.theme).toEqual({
+ id: themeV2.id,
+ colors: themeV2.colors,
</file context>
| theme: snapshot.current, | ||
| navigate: (path) => history.push(path), | ||
| subscribeTheme: (listener) => { | ||
| if (aliveRef.current) subscriptions.set(listener, config); |
There was a problem hiding this comment.
P3: Subscribing the same callback twice collapses both registrations in this Map, so the first disposer removes theme updates for the second. Track registrations separately or reference-count callbacks so each disposer removes only its own subscription.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx, line 271:
<comment>Subscribing the same callback twice collapses both registrations in this `Map`, so the first disposer removes theme updates for the second. Track registrations separately or reference-count callbacks so each disposer removes only its own subscription.</comment>
<file context>
@@ -195,40 +209,81 @@ interface MFEBaseConfigurablePageProps {
+ theme: snapshot.current,
+ navigate: (path) => history.push(path),
+ subscribeTheme: (listener) => {
+ if (aliveRef.current) subscriptions.set(listener, config);
+ return () => subscriptions.delete(listener);
+ },
</file context>
There was a problem hiding this comment.
10 issues found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="datahub-web-react/devtools/mfe-fixture/host/main.js">
<violation number="1" location="datahub-web-react/devtools/mfe-fixture/host/main.js:27">
P2: Custom agent: **Enforce Pragmatic Test Coverage**
This fixture passes a no-op `navigate` and never observes `datahub:mfe-location`, leaving the new host location-event contract untested. Add a test that changes host history and asserts the event payload.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/_tests_/mfeConfigLoader.test.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/_tests_/mfeConfigLoader.test.tsx:138">
P2: Custom agent: **Enforce Pragmatic Test Coverage**
The new placement tests never exercise Settings-targeted placements, though `mfeConfigLoader.tsx` now validates them (`slot === 'settings'` entries must have a path under `/settings/`, otherwise they are filtered with 'Settings placement requires a path under /settings/'). Add success and failure cases — e.g. a `placement: { area: 'settings', path: '/settings/example' }` entry that must survive parsing, and a settings entry with a non-`/settings/` path that must be filtered.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/README-MFE.md">
<violation number="1" location="datahub-web-react/src/app/mfeframework/README-MFE.md:181">
P3: The top of this README still says every MFE must expose a Module Federation `remoteEntry.js`. That no longer holds once Vite ESM remotes are supported, so add a pointer to the new section there.</violation>
<violation number="2" location="datahub-web-react/src/app/mfeframework/README-MFE.md:230">
P3: The existing host passes `{}` as mount props, not flat-slot props, so this instruction names a compatibility contract that does not exist. Tell remote authors to handle the old empty object and the new v1 props.</violation>
</file>
<file name=".github/workflows/mfe-runtime.yml">
<violation number="1" location=".github/workflows/mfe-runtime.yml:14">
P3: The `browser` job has no `timeout-minutes`, so a stalled install or headless Chrome run holds the runner for the 6-hour default. Add a job-level timeout, matching other workflows in this repo.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/mfeNavBarMenuUtils.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/mfeNavBarMenuUtils.tsx:13">
P3: The JSDoc above `getMfeMenuItems` still says only `showInNav=true` entries are included. The filter now also requires the matching `area` and `flags.enabled`, so update the comment to describe all three.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx:110">
P3: Assertions inside the mock `mount` are swallowed by `mountMFE`'s try/catch, so a failure shows up as an unrelated `pushMock` mismatch. Capture the props in a variable and assert them in the test body instead.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx:137">
P2: A Vite entry with `from: vite` but no `format` passes validation and is loaded as `var` by the container. Reject Vite entries unless `format` is `esm`.</violation>
<violation number="2" location="datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx:247">
P2: A settings placement nested under a built-in settings route is unreachable because `SettingsPage` checks non-exact `PATHS` routes before `extensionRoutes`. Reject these reserved prefixes or prioritize extension routes.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx:260">
P2: Entity-tab mounts emit `MfePageViewEvent` with the current entity URL as `mfePath`, although no `/mfe/<path>` route rendered. Emit this event only for `nav.page` contexts.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| listener = undefined; | ||
| }; | ||
| }, | ||
| navigate() {}, |
There was a problem hiding this comment.
P2: Custom agent: Enforce Pragmatic Test Coverage
This fixture passes a no-op navigate and never observes datahub:mfe-location, leaving the new host location-event contract untested. Add a test that changes host history and asserts the event payload.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/devtools/mfe-fixture/host/main.js, line 27:
<comment>This fixture passes a no-op `navigate` and never observes `datahub:mfe-location`, leaving the new host location-event contract untested. Add a test that changes host history and asserts the event payload.</comment>
<file context>
@@ -0,0 +1,45 @@
+ listener = undefined;
+ };
+ },
+ navigate() {},
+ });
+ const label = element.firstElementChild;
</file context>
| module: 'example/mount', | ||
| flags: { enabled: true }, | ||
| }; | ||
| const placement = { slot: 'entity.detail.tab', entityTypes: ['dataset'], tabName: 'Details' }; |
There was a problem hiding this comment.
P2: Custom agent: Enforce Pragmatic Test Coverage
The new placement tests never exercise Settings-targeted placements, though mfeConfigLoader.tsx now validates them (slot === 'settings' entries must have a path under /settings/, otherwise they are filtered with 'Settings placement requires a path under /settings/'). Add success and failure cases — e.g. a placement: { area: 'settings', path: '/settings/example' } entry that must survive parsing, and a settings entry with a non-/settings/ path that must be filtered.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/_tests_/mfeConfigLoader.test.tsx, line 138:
<comment>The new placement tests never exercise Settings-targeted placements, though `mfeConfigLoader.tsx` now validates them (`slot === 'settings'` entries must have a path under `/settings/`, otherwise they are filtered with 'Settings placement requires a path under /settings/'). Add success and failure cases — e.g. a `placement: { area: 'settings', path: '/settings/example' }` entry that must survive parsing, and a settings entry with a non-`/settings/` path that must be filtered.</comment>
<file context>
@@ -118,6 +118,53 @@ describe('mfeConfigLoader', () => {
+ module: 'example/mount',
+ flags: { enabled: true },
+ };
+ const placement = { slot: 'entity.detail.tab', entityTypes: ['dataset'], tabName: 'Details' };
+ mockYamlLoad({
+ microFrontends: [
</file context>
| .map((mfe) => ( | ||
| <Route | ||
| key={mfe.path} | ||
| path={area === 'settings' ? mfe.path : `/mfe${mfe.path}`} |
There was a problem hiding this comment.
P2: A settings placement nested under a built-in settings route is unreachable because SettingsPage checks non-exact PATHS routes before extensionRoutes. Reject these reserved prefixes or prioritize extension routes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx, line 246:
<comment>A settings placement nested under a built-in settings route is unreachable because `SettingsPage` checks non-exact `PATHS` routes before `extensionRoutes`. Reject these reserved prefixes or prioritize extension routes.</comment>
<file context>
@@ -148,23 +234,28 @@ export function useMFEConfigFromBackend(): MFESchema | null {
+ .map((mfe) => (
+ <Route
+ key={mfe.path}
+ path={area === 'settings' ? mfe.path : `/mfe${mfe.path}`}
+ render={() => (
+ <MFEBaseConfigurablePage
</file context>
| } | ||
|
|
||
| if (config.format !== undefined && !['var', 'esm'].includes(config.format)) errors.push('Invalid remote format'); | ||
| if (config.from !== undefined && !['webpack', 'vite'].includes(config.from)) errors.push('Invalid remote source'); |
There was a problem hiding this comment.
P2: A Vite entry with from: vite but no format passes validation and is loaded as var by the container. Reject Vite entries unless format is esm.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx, line 137:
<comment>A Vite entry with `from: vite` but no `format` passes validation and is loaded as `var` by the container. Reject Vite entries unless `format` is `esm`.</comment>
<file context>
@@ -61,37 +70,98 @@ function parseLoadTimeoutMs(value: unknown, context: string): number | undefined
}
+ if (config.format !== undefined && !['var', 'esm'].includes(config.format)) errors.push('Invalid remote format');
+ if (config.from !== undefined && !['webpack', 'vite'].includes(config.from)) errors.push('Invalid remote source');
+ let { remoteEntry } = config;
+ if (config.format === 'esm') {
</file context>
| if (config.from !== undefined && !['webpack', 'vite'].includes(config.from)) errors.push('Invalid remote source'); | |
| if (config.from !== undefined && !['webpack', 'vite'].includes(config.from)) errors.push('Invalid remote source'); | |
| if (config.from === 'vite' && config.format !== 'esm') errors.push('Vite remotes require format: esm'); |
| mfeId: config.id, | ||
| mfeLabel: config.label, | ||
| mfePath: config.path, | ||
| mfePath: 'path' in config ? config.path : window.location.pathname, |
There was a problem hiding this comment.
P2: Entity-tab mounts emit MfePageViewEvent with the current entity URL as mfePath, although no /mfe/<path> route rendered. Emit this event only for nav.page contexts.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/MFEConfigurableContainer.tsx, line 260:
<comment>Entity-tab mounts emit `MfePageViewEvent` with the current entity URL as `mfePath`, although no `/mfe/<path>` route rendered. Emit this event only for `nav.page` contexts.</comment>
<file context>
@@ -195,40 +209,81 @@ interface MFEBaseConfigurablePageProps {
mfeId: config.id,
mfeLabel: config.label,
- mfePath: config.path,
+ mfePath: 'path' in config ? config.path : window.location.pathname,
});
</file context>
|
|
||
| ## Vite remotes and mount contract v1 | ||
|
|
||
| Set `format: esm` and `from: vite` on the YAML entry for a Vite remote. Its |
There was a problem hiding this comment.
P3: The top of this README still says every MFE must expose a Module Federation remoteEntry.js. That no longer holds once Vite ESM remotes are supported, so add a pointer to the new section there.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/README-MFE.md, line 181:
<comment>The top of this README still says every MFE must expose a Module Federation `remoteEntry.js`. That no longer holds once Vite ESM remotes are supported, so add a pointer to the new section there.</comment>
<file context>
@@ -175,3 +175,61 @@ volumes:
+
+## Vite remotes and mount contract v1
+
+Set `format: esm` and `from: vite` on the YAML entry for a Vite remote. Its
+Path-relative entries resolve from the deployment base, including on trailing-slash routes. The
+remoteEntry must resolve to a same-origin HTTP(S) URL. Existing entries default
</file context>
| permissions: | ||
| contents: read | ||
| jobs: | ||
| browser: |
There was a problem hiding this comment.
P3: The browser job has no timeout-minutes, so a stalled install or headless Chrome run holds the runner for the 6-hour default. Add a job-level timeout, matching other workflows in this repo.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/mfe-runtime.yml, line 14:
<comment>The `browser` job has no `timeout-minutes`, so a stalled install or headless Chrome run holds the runner for the 6-hour default. Add a job-level timeout, matching other workflows in this repo.</comment>
<file context>
@@ -0,0 +1,28 @@
+permissions:
+ contents: read
+jobs:
+ browser:
+ runs-on: ubuntu-24.04
+ defaults:
</file context>
| browser: | |
| browser: | |
| timeout-minutes: 30 |
| * Only MFEs with showInNav=true are included. | ||
| */ | ||
| export function getMfeMenuItems(mfeConfig: MFESchema): NavBarMenuLinkItem[] { | ||
| export function getMfeMenuItems(mfeConfig: MFESchema, area: 'app' | 'settings' = 'app'): NavBarMenuLinkItem[] { |
There was a problem hiding this comment.
P3: The JSDoc above getMfeMenuItems still says only showInNav=true entries are included. The filter now also requires the matching area and flags.enabled, so update the comment to describe all three.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/mfeNavBarMenuUtils.tsx, line 13:
<comment>The JSDoc above `getMfeMenuItems` still says only `showInNav=true` entries are included. The filter now also requires the matching `area` and `flags.enabled`, so update the comment to describe all three.</comment>
<file context>
@@ -10,17 +10,17 @@ import { MFESchema } from '@app/mfeframework/mfeConfigLoader';
* Only MFEs with showInNav=true are included.
*/
-export function getMfeMenuItems(mfeConfig: MFESchema): NavBarMenuLinkItem[] {
+export function getMfeMenuItems(mfeConfig: MFESchema, area: 'app' | 'settings' = 'app'): NavBarMenuLinkItem[] {
if (!mfeConfig?.microFrontends) return [];
</file context>
| let unsubscribe: () => void; | ||
| const cleanup = vi.fn(); | ||
| const mount = vi.fn((_element: HTMLElement, props: MountProps) => { | ||
| expect(props.theme).toEqual({ |
There was a problem hiding this comment.
P3: Assertions inside the mock mount are swallowed by mountMFE's try/catch, so a failure shows up as an unrelated pushMock mismatch. Capture the props in a variable and assert them in the test body instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx, line 106:
<comment>Assertions inside the mock `mount` are swallowed by `mountMFE`'s try/catch, so a failure shows up as an unrelated `pushMock` mismatch. Capture the props in a variable and assert them in the test body instead.</comment>
<file context>
@@ -94,6 +98,132 @@ describe('MFEBaseConfigurablePage', () => {
+ let unsubscribe: () => void;
+ const cleanup = vi.fn();
+ const mount = vi.fn((_element: HTMLElement, props: MountProps) => {
+ expect(props.theme).toEqual({
+ id: themeV2.id,
+ colors: themeV2.colors,
</file context>
|
|
||
| Keep id, label, remoteEntry and module on the entry. Flat YAML remains accepted. A placement without a slot defaults to nav.page. For a component use `placement: { slot: entity.detail.tab, entityTypes: [dataset], tabName: Extra details }`. The entity URN and type come from the host at mount time. Registry parsing discovers these entries separately from routes. The entity detail page does not register tabs yet. | ||
|
|
||
| Roll out a remote that accepts both flat-slot mount props and named-slot mount props before switching the host. |
There was a problem hiding this comment.
P3: The existing host passes {} as mount props, not flat-slot props, so this instruction names a compatibility contract that does not exist. Tell remote authors to handle the old empty object and the new v1 props.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/README-MFE.md, line 230:
<comment>The existing host passes `{}` as mount props, not flat-slot props, so this instruction names a compatibility contract that does not exist. Tell remote authors to handle the old empty object and the new v1 props.</comment>
<file context>
@@ -175,3 +175,61 @@ volumes:
+
+Keep id, label, remoteEntry and module on the entry. Flat YAML remains accepted. A placement without a slot defaults to nav.page. For a component use `placement: { slot: entity.detail.tab, entityTypes: [dataset], tabName: Extra details }`. The entity URN and type come from the host at mount time. Registry parsing discovers these entries separately from routes. The entity detail page does not register tabs yet.
+
+Roll out a remote that accepts both flat-slot mount props and named-slot mount props before switching the host.
+
+Return cleanup synchronously. During cleanup, unsubscribe from theme changes,
</file context>
| Roll out a remote that accepts both flat-slot mount props and named-slot mount props before switching the host. | |
| Roll out a remote that accepts both the previous host's empty props object and the new v1 named-slot props before switching the host. |
There was a problem hiding this comment.
3 issues found across 7 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx:139">
P2: This assertion can't tell a live location read from a stale one: `historyMock.location` never changes, so the listener could dispatch a snapshot taken at subscribe time and the test would still pass. Change `historyMock.location` to a new pathname/search/hash before invoking the listener, then assert the event detail equals the new values.</violation>
</file>
<file name="datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx">
<violation number="1" location="datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx:195">
P2: Custom agent: **Enforce Pragmatic Test Coverage**
The route dedup now uses separate keys for Settings and app placements, but loader tests cover only duplicate app paths. Add tests for duplicate Settings paths and identical paths across the two areas.</violation>
</file>
<file name="datahub-web-react/src/app/settingsV2/SettingsPage.tsx">
<violation number="1" location="datahub-web-react/src/app/settingsV2/SettingsPage.tsx:352">
P2: Custom agent: **Enforce Pragmatic Test Coverage**
The Settings extension route's active-menu selection is user-visible, but no test asserts the extension match or built-in-route fallback; add a SettingsPage test covering both paths.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| const onLocation = vi.fn(); | ||
| window.addEventListener('datahub:mfe-location', onLocation, { once: true }); | ||
| historyMock.listen.mock.lastCall?.[0](); | ||
| expect(onLocation).toHaveBeenCalledWith(expect.objectContaining({ detail: historyMock.location })); |
There was a problem hiding this comment.
P2: This assertion can't tell a live location read from a stale one: historyMock.location never changes, so the listener could dispatch a snapshot taken at subscribe time and the test would still pass. Change historyMock.location to a new pathname/search/hash before invoking the listener, then assert the event detail equals the new values.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/_tests_/MFEConfigurableContainer.test.tsx, line 139:
<comment>This assertion can't tell a live location read from a stale one: `historyMock.location` never changes, so the listener could dispatch a snapshot taken at subscribe time and the test would still pass. Change `historyMock.location` to a new pathname/search/hash before invoking the listener, then assert the event detail equals the new values.</comment>
<file context>
@@ -129,6 +133,10 @@ describe('MFEBaseConfigurablePage', () => {
+ const onLocation = vi.fn();
+ window.addEventListener('datahub:mfe-location', onLocation, { once: true });
+ historyMock.listen.mock.lastCall?.[0]();
+ expect(onLocation).toHaveBeenCalledWith(expect.objectContaining({ detail: historyMock.location }));
view.rerender(page({ ...themeV2, brandSeed: '#888888' }));
expect(listener).toHaveBeenCalledWith(expect.objectContaining({ brandSeed: '#888888' }));
</file context>
| expect(onLocation).toHaveBeenCalledWith(expect.objectContaining({ detail: historyMock.location })); | |
| historyMock.location = { pathname: '/mfe/example/next', search: '?q=2', hash: '' }; | |
| historyMock.listen.mock.lastCall?.[0](); | |
| expect(onLocation).toHaveBeenCalledWith( | |
| expect.objectContaining({ detail: { pathname: '/mfe/example/next', search: '?q=2', hash: '' } }), | |
| ); |
| parsed.microFrontends = entries | ||
| .filter((config): config is MFEConfig => config !== null && 'path' in config) | ||
| .filter(({ path, slot }) => { | ||
| const basePath = slot === 'settings' ? path : `/mfe${path}`; |
There was a problem hiding this comment.
P2: Custom agent: Enforce Pragmatic Test Coverage
The route dedup now uses separate keys for Settings and app placements, but loader tests cover only duplicate app paths. Add tests for duplicate Settings paths and identical paths across the two areas.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/mfeframework/mfeConfigLoader.tsx, line 195:
<comment>The route dedup now uses separate keys for Settings and app placements, but loader tests cover only duplicate app paths. Add tests for duplicate Settings paths and identical paths across the two areas.</comment>
<file context>
@@ -191,8 +191,9 @@ export function loadMFEConfigFromYAML(yamlString: string): MFESchema {
- .filter(({ path }) => {
- const route = path.replace(/\/$/, '').toLowerCase();
+ .filter(({ path, slot }) => {
+ const basePath = slot === 'settings' ? path : `/mfe${path}`;
+ const route = basePath.replace(/\/$/, '').toLowerCase();
if (routes.has(route)) {
</file context>
| <NavBarMenu isCollapsed={isCollapsed} selectedKey={activePath} menu={menuItems} iconSize={16} /> | ||
| <NavBarMenu | ||
| isCollapsed={isCollapsed} | ||
| selectedKey={ |
There was a problem hiding this comment.
P2: Custom agent: Enforce Pragmatic Test Coverage
The Settings extension route's active-menu selection is user-visible, but no test asserts the extension match or built-in-route fallback; add a SettingsPage test covering both paths.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At datahub-web-react/src/app/settingsV2/SettingsPage.tsx, line 352:
<comment>The Settings extension route's active-menu selection is user-visible, but no test asserts the extension match or built-in-route fallback; add a SettingsPage test covering both paths.</comment>
<file context>
@@ -347,7 +347,16 @@ const SettingsPageContent = () => {
- <NavBarMenu isCollapsed={isCollapsed} selectedKey={activePath} menu={menuItems} iconSize={16} />
+ <NavBarMenu
+ isCollapsed={isCollapsed}
+ selectedKey={
+ extensionItems.find(
+ (item) => item.link && (pathname === item.link || pathname.startsWith(`${item.link}/`)),
</file context>
Bundle ReportChanges will increase total bundle size by 112.41kB (0.36%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: datahub-react-web-esmAssets Changed:
Files in
Files in
Files in
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
The MFE registry accepts same-origin Vite ESM entries and preserves the existing webpack defaults. A typed mount contract supplies presentation tokens, live theme subscriptions, navigation and synchronous cleanup. Page placements can target the app or Settings. Entity-tab placements receive entity context when mounted by a consumer.
Existing flat entries continue to work. The registry ships without any default remote. README-MFE includes placement examples and the remote lifecycle contract.
Verification
🤖 Opened with cclaude on behalf of @craig-rueda
Summary by cubic
The MFE registry now accepts same-origin Vite ESM remotes alongside the existing webpack defaults, and remotes receive a typed v1 mount contract instead of an empty props object. The contract delivers presentation tokens, live theme subscriptions, navigation, and requires synchronous cleanup; page placements can target the app or Settings, and entity-tab placements receive entity context at mount time.
Behavior
/mfe/with thevar/webpackdefaults./settings/area with separate menu items, and the active one is highlighted in the nav; entity tabs are discovered independently from page routes.datahub:mfe-locationevents on history changes so page remotes can track navigation.format: esmentries must resolve to a same-origin HTTP(S) URL from the deployment base.Migration
contract.tsand return a synchronous cleanup function; async or missing cleanup is rejected.Written for commit 291734a. Summary will update on new commits.
There is no visible UI change by default: placements are opt-in through configuration, and the remote mount lifecycle was verified with the Chromium fixture.