Fix null export (#69) and stale export after clear-retrace (#106)#108
Open
kellenmurphy wants to merge 1 commit into
Open
Fix null export (#69) and stale export after clear-retrace (#106)#108kellenmurphy wants to merge 1 commit into
kellenmurphy wants to merge 1 commit into
Conversation
Adds Jest test suite and CI workflow. Guards enrichWithResponse against null/undefined from getResponse() (simplesamlphp#69), and filters undefined parsed entries from the export request list (simplesamlphp#106).
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.
This fixes two bugs that both cause the export to silently fail.
The first (related to #69) happens when a request is blocked, cancelled, or interrupted before a response arrives.
getResponse()returnsundefined, which gets passed tocreateFromJSON. Inside there,JSON.stringify(undefined)doesn't produce a string — it returns the JS valueundefined— soJSON.parsethrows a SyntaxError. The exception goes uncaught,ui.exportResultis never updated, and the downloaded file contains justnull. The fix is a one-line null guard inenrichWithResponseinSAMLTraceIO.js.The second (related to #106) happens when a request entry has
isVisibleset butparsedwas never populated — this can occur whenonHeadersReceivedfires beforeonBeforeSendHeadersin a clear-and-retrace scenario. The export filter mapsreq.parsedacross all entries, producingundefinedin the array, which crashescreateFromJSONand leavesui.exportResultstale. The fix is.filter(Boolean)after the.mapcall inexportDialog.js.Both fixes are covered by Jest unit tests and Playwright end-to-end tests. The Playwright suite lives on the
playwright-testingbranch at https://github.com/kellenmurphy/SAML-tracer/tree/playwright-testing — see E2E_TESTS.md there for context and instructions on running the tests. Each bug test was confirmed to fail on unfixed code and pass with the fix applied.