Skip to main content
← Back to list
01Issue
FeatureOpenSwamp CLI
Assigneeskeeb

Consolidate method execution paths — workflow steps and manual runs build MethodContext divergently

Opened by keeb · 4/9/2026

Method invocations in swamp go through two different code paths depending on whether they are triggered by swamp model method run (manual) or by a workflow step. Both paths construct a MethodContext and call into RawExecutionDriver.execute(), but they construct that context independently. Features added to one path silently miss the other. This is the same problem #947 flagged. The latest example: PR #1145 wired context.queryData into the manual path via libswamp/models/run.ts, but the workflow path at domain/workflows/execution_service.ts:478-533 hand-builds the context literal and never includes queryData or dataQueryService. So the same dedup model that succeeds via swamp model method run errors with context.queryData is not a function when run as a workflow step. Same extension code, same data, same driver, different MethodContext builder. Proposed fix: extract MethodContext construction into a single factory function that both paths call. Common dependencies (data repo, definition repo, vault service, query data, output repo, redactor) flow in once at startup; method-specific overlay flows in per invocation. Adding a new context field then happens in exactly one place and reaches both paths automatically. As long as the two paths build context independently, every refactor that touches MethodContext repeats this pattern: land in one path, forget the other exists, surface as a user-reported regression months later.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED

Open

4/9/2026, 12:07:52 AM

No activity in this phase yet.

03Sludge Pulse
stack72 assigned keeb4/9/2026, 4:20:54 PM

Sign in to post a ripple.