chore: Expose app layout error-boundary catches for canary detection#4699
Draft
gethinwebster wants to merge 5 commits into
Draft
chore: Expose app layout error-boundary catches for canary detection#4699gethinwebster wants to merge 5 commits into
gethinwebster wants to merge 5 commits into
Conversation
Enables integration/canary tests to detect ONLY errors caught by App Layout error boundaries, instead of failing on any unexpected console error behind a hand-maintained allowlist. - AppLayoutBuiltInErrorBoundary now records each caught error (appLayoutPart + message) into a module registry, exposed via a new getErrors accessor on the App Layout root element's __awsui__ (attachAppLayoutErrorBoundaryTestHooks). - Adds a test-only throwInAppLayoutPart hook that forces a genuine boundary catch, so a production canary can verify detection survives minification. - Switches the boundary metric from metrics.sendOpsMetricObject (deduped one-time per page) to metrics.sendPanoramaMetric (per-event), making it usable for dashboards/alarms and no longer dropping repeat fires.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4699 +/- ##
=======================================
Coverage 97.57% 97.57%
=======================================
Files 948 949 +1
Lines 30507 30556 +49
Branches 11164 11178 +14
=======================================
+ Hits 29767 29815 +48
- Misses 693 694 +1
Partials 47 47 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Panorama and Clog are both the legacy console-platform logging path; switching between them is not the TangerineBox migration. TangerineBox metrics live in the internal @amzn/awsui-component-toolkit-internal override, not in OSS components. Revert the metric change and keep the existing sendOpsMetricObject call; the TangerineBox migration will be handled separately on the internal layer.
- Fan-out forced-throw setters (Map<part, Set>) with identity-safe cleanup so multiple app layouts on one page no longer clobber each other's positive-control hook. - Bound the shared error registry (cap 50). - Add integration tests that go through the real skeleton-wired app layout root element: a genuine boundary catch is recorded and readable via getAppLayoutErrors, and throwInAppLayoutPart drives a real catch into the registry. - Trim inline comments to the non-obvious ones.
…controller - Move the error registry out of a per-realm module global into an ErrorBoundaryController installed on the plugin API. Same-origin frames resolve to the one instance on the top window via findUpApi, so a canary reads getErrors() once at the top document instead of traversing iframes. - Keep the forced-throw test hook local per window so a positive-control throw never reaches boundaries in other frames. - Add a direct controller unit test and an api reuse test covering cross-frame aggregation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lets our integration/canary tests detect errors that an App Layout error boundary caught.
What changed
AppLayoutBuiltInErrorBoundaryrecords each caught error ({ appLayoutPart, message }) into a bounded module registry. A newgetAppLayoutErrors()/clearAppLayoutErrors()accessor is exposed on the App Layout root element's__awsui__(viaattachAppLayoutErrorBoundaryTestHooks, wired through the skeleton root ref). No console logging — teams that wrap App Layout in their own<ErrorBoundary>keep errors handled quietly, and the signal is a passive DOM query invisible to users.throwInAppLayoutPart(part)that forces a genuine boundary catch, so a canary can verify — against the real minified prod bundle — that detection still works and hasn't been broken by a build change. It fans out to every mounted boundary for the part, so multiple App Layouts on one page do not clobber each other.Testing
error-boundary.test.tsx: records + exposes errors,throwInAppLayoutParttriggers a real recorded catch,clearAppLayoutErrors,attachno-ops on null and merges (does not clobber) an existing__awsui__, a non-app-layout boundary catch is not recorded, and multi-instance fan-out.widget-areas-error-boundaries.test.tsxthat go through the real skeleton-wired App Layout root element: a genuine boundary catch is readable viagetAppLayoutErrors(), andthrowInAppLayoutPartdrives a real catch into the registry.