Skip to content

Add SSE stream node with two-phase ready/complete handles - #66

Merged
Kaysharp42 merged 3 commits into
mainfrom
feat/sse-test-node
Sep 8, 2026
Merged

Kaysharp42 merged 3 commits into
mainfrom
feat/sse-test-node

Conversation

@Kaysharp42

Copy link
Copy Markdown
Owner

Problem

APIWeave couldn't test streaming APIs: there was no way to open an SSE connection, wait for it to be ready, trigger an action, and then assert on the events it emitted. Assertions and diagnosis logic were also hardcoded to only understand http-request as a response source.

Solution

Adds a new sse node type: a bounded test listener (not a permanent subscription) that connects with Accept: text/event-stream, exposes a ready handle (fires after the handshake, so a downstream trigger request can run without racing the subscription) and a complete handle (fires once the bounded capture ends via event limit, a finish-condition rule match, or timeout). Captured events are structured (event, id, data) and addressable by assertions/extractors the same way an HTTP response body is.

Details:

  • New app/core/runner/sse.ts parses the SSE wire format (multi-line data:, id:, retry:, fragmented chunks) with a 1 MiB capture cap.
  • executor.ts runs SSE nodes as a background listener so the ready path can continue immediately; safe_http.ts gained an opt-in zero-timeout mode for finish-condition-only waits.
  • Assertion source resolution, workflow graph analyzer diagnostics, and the assertion authoring service now treat http-request and sse interchangeably as "response-producing" nodes.
  • New SseNodeData/SseFinishCondition shared types and zod schemas, canvas node (SseNode.tsx), node modal config panel (SseConfigPanel.tsx), palette entry, and JSON editor/docs updates.
  • MCP: tightened workflows_patch to reject unknown keys via full-object schemas (previously stripped silently), and documented a safe insert-and-rewire pattern in the authoring guide.

Testing

  • Added app/core/runner/__tests__/executor_sse.test.ts covering fragmented multi-line events, non-matching event types, non-SSE content-type rejection, downstream assertion consumption, and the ready/trigger/finish-condition race.
  • Added HTML reporter test for SSE event/termination metrics.
  • Added workflow-schema and graph-analyzer tests for SSE config validation and assertion-source resolution.
  • Added MCP test for unknown patch key rejection.

- bridge.ts passed reg.input.shape to the SDK instead of the strict
  ZodObject, which let unknown keys slip past the router before
  rejection; pass the object itself
- add tests covering unknown patch keys on addNodes/addEdges
- guide.ts and tools.ts now walk through inserting a node and rewiring
  edges in one patch, since splitting it across calls can leave a
  branch disconnected
- ignore app/tools
Copilot AI lite review requested due to automatic review settings September 8, 2026 15:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

- Removed duplicated URL query-parameter assembly.
- Added scoped, documented fallow suppressions for intentional SSE state-machine, traversal, and registry complexity/duplication.
- Reused the SSE numeric input rendering helper.
@Kaysharp42
Kaysharp42 merged commit 3b75c5c into main Sep 8, 2026
5 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.

2 participants