Skip to content

fix(tapis): tolerate empty-string parameter bindings#115

Merged
mosoriob merged 2 commits into
masterfrom
fix/tapis-empty-binding-crash
May 1, 2026
Merged

fix(tapis): tolerate empty-string parameter bindings#115
mosoriob merged 2 commits into
masterfrom
fix/tapis-empty-binding-crash

Conversation

@mosoriob
Copy link
Copy Markdown
Contributor

@mosoriob mosoriob commented May 1, 2026

Summary

  • POST /executionEngines/tapis crashed with Cannot read properties of undefined (reading 'match') whenever a model input parameter had no default and the user-supplied binding was an empty string. The regex check at helpers.ts:112 ran on undefined.
  • The original error was then masked by a secondary crash in handleSubmissionFailure because this.seeds was never initialized when seedExecutions threw before assignment, so this.seeds.length blew up too. The DB cleanup mutation never ran.

Fix

  • Guard the geojson regex in getInputsParameters with optional chaining (parameters[ip.id]?.match(...)).
  • Initialize this.seeds = [] at the top of submitExecutions so the failure path in handleSubmissionFailure always has a valid array.
  • Add unit tests in tapis/tests/helpers.test.ts covering: empty-string binding without default, populated binding, and ip.value default fallback.

Repro

Input that triggered the original 500:

bindings: {
  '...0d626932...': <Object>,
  '...4103a17f...': ''
}

With this fix the empty parameter is left unset (downstream Tapis layer can decide), the submission either succeeds or fails with a clear error, and the failure cleanup mutation always runs.

Test plan

  • npx jest src/classes/tapis -> 17/17 pass
  • npm run build -> webpack compiled successfully
  • Manual: re-submit the failing ensemble against a deployed image and confirm the 500 is gone (and that any real downstream failure surfaces with its actual message)

mosoriob added 2 commits May 1, 2026 18:29
POST /executionEngines/tapis crashed with "Cannot read properties of
undefined (reading 'match')" when an input parameter had no default value
and the user-supplied binding was an empty string. The empty string is
falsy, so neither branch in getInputsParameters assigned parameters[ip.id],
and the subsequent regex check on the value threw.

The crash propagated into handleSubmissionFailure, which then crashed on
this.seeds.length because seeds was never initialized before
seedExecutions threw. The cleanup mutation never ran and the original
error was masked.

- Guard the geojson regex with optional chaining so undefined values pass
  through unchanged.
- Initialize this.seeds = [] at the start of submitExecutions so the
  failure cleanup path always has a valid array.
- Add unit tests covering empty-string, populated, and default-value
  parameter cases.
@mosoriob mosoriob merged commit 66234d0 into master May 1, 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