fix(tapis): skip optional inputs without bindings in ExecutionCreation#119
Merged
Conversation
processInputFiles unconditionally pushed every model input id into the list passed to cartProd, even when an optional input had no user binding and no fixed value. cartProd then read `undefined.length` and the POST to /executionEngines/tapis crashed before the stage-2 skip in TapisJobService could run. Skip optional inputs (is_optional=true) that have neither a binding nor a fixed value: omit the id from inputIds and do not seed an undefined binding. Required inputs and optional inputs with bindings are unchanged. Downstream Tapis/localex adapters already tolerate the missing key.
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
POST /executionEngines/tapiscrashes withTypeError: Cannot read properties of undefined (reading 'length')whenever a model has an optional input (is_optional: true) that the user did not bind to a dataset.ExecutionCreation.processInputFilesunconditionally pushed every model input id into the list passed tocartProd. The optional input had no entry inthreadModel.bindings, so the corresponding slot in the cart-product list wasundefined, andcartProdthen readundefined.length. The crash happens before the stage-2 skip added in phase 12-04 (TapisJobService.createJobFileInputsFromSeed) ever runs.The fix skips optional inputs that have neither a user binding nor a fixed value — they contribute nothing to the cartesian product and downstream Tapis/localex adapters already tolerate the missing key.
Changes
src/classes/common/ExecutionCreation.ts: inprocessInputFiles, early-return foris_optional=true && !value && !bindings[id]. Required inputs and optional inputs with a binding are unchanged.src/classes/common/__tests__/ExecutionCreationStatic.test.ts: three new tests covering the optional-skip, optional-with-binding, and required-no-binding branches.Test plan
npx jest— 80/80 passnpm run build— webpack compiles