fix(debug): route JES web debug responses on the actual _debug value … - #900
Draft
YuryShkoda wants to merge 1 commit into
Draft
fix(debug): route JES web debug responses on the actual _debug value …#900YuryShkoda wants to merge 1 commit into
YuryShkoda wants to merge 1 commit into
Conversation
…sent Parser selection was keyed off useComputeApi === null, but WebJobExecutor is only ever reached once useComputeApi is already null/undefined, so a caller passing it explicitly as undefined fell through to the parser built for the old iframe-URL format and crashed. Route on the _debug value getRequestParams actually produced instead, and fall back to blob extraction in the old parser too, so neither format can end up unhandled again.
Coverage reportTotal coverage
Show new covered files 🌑Coverage of new files
Show files with reduced coverage 🔻Reduced coverage
Report generated by 🧪jest coverage report action from 715978f |
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.
Issue
Closes #898
Intent
request()calls fail outright on SAS Viya whendebug: trueis combined with the JES web app execution path (useComputeApileftnull/undefined) andrunAsTask: true— even though the underlying SAS service completes successfully. The adapter picks the wrong debug-response parser for this configuration, so a valid webout response either throws (Unable to find webout file URL.) or crashes outright, and callers see a failure where there wasn't one.Fix this so
debug: trueworks correctly for this configuration, and make the fix resilient to the underlying cause changing shape in the future (the_debug=128value in use today is a workaround for a SAS platform bug that's expected to be reverted once fixed upstream).Implementation
WebJobExecutor.execute()selected a parser based onconfig.useComputeApi === null && config.runAsTask === true. ButWebJobExecutoris only ever reached (viaSASjs.request()) onceuseComputeApiis already known to benull/undefined— that routing decision happens one layer up. So a caller passinguseComputeApi: undefinedexplicitly failed the strict=== nullcheck and fell through to the parser built for the older_debug=131iframe-URL response format, which doesn't understand the current_debug=128HTML/Blob format and fails._debugvalue produced bygetRequestParams(config)(the single source of truth for which format the server will send back) and route parsing on that value directly, instead of re-deriving it fromrunAsTask. This avoids the two staying in sync only by convention — if the_debug=128workaround is reverted to131in the future whilerunAsTaskstaystrue, parsing still follows the actual value sent._debug=131parser (parseSasViyaDebugResponse) now falls back to the same blob/weboutBEGINextraction used by the newer parser if its iframe-URL pattern isn't found, instead of hard-failing. Extracted the shared blob-matching logic into a newextractWeboutBlobhelper used by both parsers.WebJobExecutor.debug.spec.ts(previously no test file existed for this class's response parsing at all) reproducing the exact failing configuration, a guard test confirming the non-runAsTaskpath is untouched, and a regression test that mocksgetRequestParamsto return_debug: 131whilerunAsTask: true— simulating the future-revert scenario — verified to fail under therunAsTask-keyed version of the fix before being treated as a real guard. ExtendedparseViyaDebugResponse.spec.tswith the new fallback-extraction cases.npm run buildandnpm run lintpass.Checks
No PR (that involves a non-trivial code change) should be merged, unless all items below are confirmed! If an urgent fix is needed - use a tar file.
sasjs-cliunit tests are passing (npm test).sasjs-testsare passing. If you want to run it manually (instructions available here).