Skip to main content
← Back to list
01Issue
BugClosedSwamp CLI
Assigneesstack72

Relationships

#431 dataRepository.getContent() fails in workflow-scope reports with 'type.toDirectoryPath is not a function'

Opened by strawman · 5/24/2026

Summary

In a workflow-scoped report extension, calling context.dataRepository.getContent(step.modelType, step.modelId, h.name, h.version) fails with:

type.toDirectoryPath is not a function

Root Cause

The stepExecutions[].modelType field on WorkflowReportContext is a plain string (e.g. "@strawman/apple-calendar"), but dataRepository.getContent() internally calls type.toDirectoryPath(), which expects a ModelType object, not a string.

The documentation for WorkflowReportContext says:

For workflow-scope reports, use step.modelType, step.modelId, and step.dataHandles from context.stepExecutions.

But doing so causes the above error.

The same problem occurs with findAllForModel() (returns 0 results because modelId from stepExecution is the definition ID, while data is stored under the internal instance ID visible in handle.metadata.ownerDefinition.ownerRef).

Workaround

Read data directly from the filesystem using the storage path:

const ownerRef = h.metadata?.ownerDefinition?.ownerRef;
const contentPath = `${context.repoDir}/.swamp/data/${step.modelType}/${ownerRef}/${h.name}/${h.version}/raw`;
const raw = await Deno.readFile(contentPath).catch(() => null);

Expected Behaviour

context.dataRepository.getContent(step.modelType, step.modelId, h.name, h.version) should work as documented in WorkflowReportContext.

02Bog Flow
OPENTRIAGEDIN PROGRESSCLOSED+ 1 MOREASSIGNED+ 4 MOREREVIEWAPPROVAL

Closed

5/24/2026, 8:49:13 PM

No activity in this phase yet.

03Sludge Pulse
stack72 assigned stack725/24/2026, 8:11:52 PM
Editable. Press Enter to edit.

stack72 commented 5/24/2026, 8:49:12 PM

@strawman Both issues described here are now fixed on main:

  1. type.toDirectoryPath is not a function — fixed in PR #1393 (swamp-club#364). getContent, findByName, and findAllForModel now accept plain strings via ModelTypeInput coercion.

  2. findAllForModel returning 0 results / getContent returning null — fixed in PR #1433 (swamp-club#410). The modelId in stepExecutions was coming from a post-execution name-based definition lookup instead of the authoritative ID used at step execution time. With auto-created definitions, that lookup could return a different definition UUID, silently producing null reads. modelId is now carried from the model_resolved event directly.

Please run swamp update and let us know if you're still seeing either issue.

Sign in to post a ripple.