-
Notifications
You must be signed in to change notification settings - Fork 96
fix(iframe-app): Parse IDENTITY_PROVIDERS as JSON string instead of object #8724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🤖 AI PR Validation ReportPR Review ResultsThank you for your submission! Here's detailed feedback on your PR title and body compliance:✅ PR Title
✅ Commit Type
|
| Section | Status | Recommendation |
|---|---|---|
| Title | ✅ | Good. Optionally call out breaking change in title/body. |
| Commit Type | ✅ | fix is appropriate. |
| Risk Level | Upgrade to risk:medium (breaking change for consumers of window.IDENTITY_PROVIDERS). |
|
| What & Why | ✅ | Add an explicit "BREAKING CHANGE" note and a migration example. |
| Impact of Change | ✅ | Add a short migration checklist for devs and ops. |
| Test Plan | ✅ | Tests exist and were updated. Verify downstream consumers are covered. |
| Contributors | Good, but consider adding credited reviewers/PMs if applicable. | |
| Screenshots/Videos | ✅ | N/A — acceptable. |
Final message:
Please update the PR to reflect the increased risk (change label to risk:medium) and add a brief explicit BREAKING CHANGE section in the PR body that:
- Explains that the expected type of window.IDENTITY_PROVIDERS changed from a JS object to a JSON string.
- Provides a one-line migration example (server-side templating example and a snippet showing how to stringify an object for injection).
- Mentions that deployments or templates that previously injected an object must be updated.
Other than the risk/compatibility note, the PR title, tests, and body otherwise follow the template and the tests in the diff align with the claimed Test Plan. Thank you — once you update the risk label and add the small BREAKING CHANGE/migration note I recommend merging.
Last updated: Fri, 23 Jan 2026 15:38:01 GMT
|
📊 Coverage check completed. See workflow run for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR changes how identity providers configuration is injected into the iframe application, moving from a JavaScript object format to a JSON string format to support server-side HTML injection.
Changes:
- Modified
window.IDENTITY_PROVIDERStype fromRecord<string, IdentityProvider>tostringto support server-side string replacement in HTML - Added
parseIdentityProviders()function to parse the JSON string at runtime with error handling - Updated all unit tests and E2E tests to use JSON string format instead of JavaScript object literals
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/iframe-app/src/lib/utils/config-parser.ts | Changed Window.IDENTITY_PROVIDERS type to string and added parseIdentityProviders() function to parse JSON string with fallback to defaults |
| apps/iframe-app/src/lib/utils/tests/config-parser.test.ts | Updated test to use JSON string format for IDENTITY_PROVIDERS |
| e2e/chatClient/tests/features/authentication/login-prompt.spec.ts | Updated all E2E tests to inject IDENTITY_PROVIDERS as JSON strings in both addInitScript and HTML replacement scenarios |
Comments suppressed due to low confidence (1)
apps/iframe-app/src/lib/utils/tests/config-parser.test.ts:250
- The test suite is missing coverage for error cases in the new parseIdentityProviders function. Following the pattern established for metadata parsing (see line 178-186), add tests for:
- Invalid JSON string - should fall back to DEFAULT_IDENTITY_PROVIDERS and log an error
- Valid JSON but not an object (e.g., array, string, number) - should fall back to DEFAULT_IDENTITY_PROVIDERS
- Empty string "" - should fall back to DEFAULT_IDENTITY_PROVIDERS
These tests would ensure the error handling in the parseIdentityProviders function works correctly and is consistent with the existing error handling patterns in this file.
it('uses window.IDENTITY_PROVIDERS when set', () => {
document.documentElement.dataset.agentCard = 'http://test.agent/agent-card.json';
(window as any).IDENTITY_PROVIDERS = '{"custom":{"signInEndpoint":"/.auth/login/custom","name":"Custom Provider"}}';
const config = parseIframeConfig();
expect(config.props.identityProviders).toEqual({
custom: {
signInEndpoint: '/.auth/login/custom',
name: 'Custom Provider',
},
});
// Clean up
delete (window as any).IDENTITY_PROVIDERS;
});
|
📊 Coverage check completed. See workflow run for details. |
|
📊 Coverage check completed. See workflow run for details. |
1 similar comment
|
📊 Coverage check completed. See workflow run for details. |
|
📊 Coverage check completed. See workflow run for details. |
2 similar comments
|
📊 Coverage check completed. See workflow run for details. |
|
📊 Coverage check completed. See workflow run for details. |
|
📊 Coverage check completed. See workflow run for details. |
|
📊 Coverage check completed. See workflow run for details. |
Commit Type
Risk Level
What & Why
This PR changes how
window.IDENTITY_PROVIDERSis handled in the iframe chat app configuration parser. Previously,IDENTITY_PROVIDERSwas expected to be a JavaScript object directly assigned to the window. This change updates it to expect a JSON string that gets parsed at runtime.Why this change?
try/catchwhen parsing failsImpact of Change
window.IDENTITY_PROVIDERS, it must now be a JSON string (e.g.,'{"aad":{"signInEndpoint":"/.auth/login/aad","name":"Microsoft"}}') instead of a JavaScript objectTest Plan
Contributors
@ccastrotrejo
Screenshots/Videos
N/A - No visual changes