Skip to content

fix(tapis): skip optional inputs without bindings in ExecutionCreation#119

Merged
mosoriob merged 1 commit into
masterfrom
fix/optional-input-cartprod-crash
May 4, 2026
Merged

fix(tapis): skip optional inputs without bindings in ExecutionCreation#119
mosoriob merged 1 commit into
masterfrom
fix/optional-input-cartprod-crash

Conversation

@mosoriob
Copy link
Copy Markdown
Contributor

@mosoriob mosoriob commented May 4, 2026

Summary

POST /executionEngines/tapis crashes with TypeError: 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.processInputFiles unconditionally pushed every model input id into the list passed to cartProd. The optional input had no entry in threadModel.bindings, so the corresponding slot in the cart-product list was undefined, and cartProd then read undefined.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: in processInputFiles, early-return for is_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 pass
  • npm run build — webpack compiles
  • Manual: submit a thread with an optional input left unbound to /executionEngines/tapis and confirm no crash + Tapis job submitted

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.
@mosoriob mosoriob merged commit 9cf3607 into master May 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant