Skip to content

fix(tapis): map Hasura output shape in getModelOutputsByModelId#118

Merged
mosoriob merged 1 commit into
masterfrom
fix/match-tapis-output-shape
May 3, 2026
Merged

fix(tapis): map Hasura output shape in getModelOutputsByModelId#118
mosoriob merged 1 commit into
masterfrom
fix/match-tapis-output-shape

Conversation

@mosoriob
Copy link
Copy Markdown
Contributor

@mosoriob mosoriob commented May 3, 2026

Summary

  • matchTapisOutputsToMintOutputs crashed in production with TypeError: Cannot read properties of undefined (reading 'name') when fetching subtask outputs.
  • Root cause: getModelOutputsByModelId returned the raw Hasura response (outputs[].output.{id,label,has_format}) while typed as ModelOutput[] ({position, model_io:{id,name,format,variables}}). The matcher accessed mintOutput.model_io.name on the raw shape and threw. DYNAMO v2.0 migration debt — type lied; test fixture used the typed shape so unit tests passed while prod failed.
  • Fix: extract pure mapHasuraOutputsToModelOutputs and call it inside getModelOutputsByModelId. Return [] instead of null on errors to match the declared return type.

Test plan

  • npx jest src/classes/graphql/graphql_functions.test.ts — 4/4 pass (real Hasura payload, null/undefined input, missing fields, missing label/has_format)
  • npx jest full suite — 77/77 pass (includes existing matchTapisOutputsToMintOutputs test)
  • npm run build — webpack compiles clean
  • Manual: hit GET /v1/problemStatements/.../subtasks/.../outputs against a Tapis-backed execution and confirm 200 with mapped results

matchTapisOutputsToMintOutputs crashed with TypeError reading 'name' on undefined
because getModelOutputsByModelId returned the raw Hasura response
(outputs[].output.{id,label,has_format}) while typed as ModelOutput[]
({position, model_io:{id,name,format,variables}}). The matcher accessed
mintOutput.model_io.name on the raw shape and threw.

Extracted mapHasuraOutputsToModelOutputs and added unit tests covering the
real Hasura payload, null/undefined input, and missing fields. Function now
returns [] instead of null on errors to match its declared return type.
@mosoriob mosoriob merged commit d230a1d into master May 3, 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