Skip to content

[Jamie] Update Stakwork payload unit tests for wrapped project envelope - #5226

Closed
gonzaloaune wants to merge 3 commits into
masterfrom
swarm/swarm-change-381a8d6a
Closed

[Jamie] Update Stakwork payload unit tests for wrapped project envelope#5226
gonzaloaune wants to merge 3 commits into
masterfrom
swarm/swarm-change-381a8d6a

Conversation

@gonzaloaune

Copy link
Copy Markdown
Collaborator

Why

PR #5224 changed the outbound Stakwork /projects request body from a flat object to { project: stakworkPayload }. 156 unit tests across 7 files still assert against the old flat shape (body.workflow_id, body.workflow_params.set_var.attributes.vars, body.webhook_url, etc.), so they now read undefined and fail. Build, lint, integration, and Playwright all pass — only these payload-shape assertions need updating.

Change

Update the assertions/mocks in the affected test files to read the payload from the nested project envelope (e.g. body.project.workflow_id, body.project.workflow_params.set_var.attributes.vars, body.project.webhook_url, body.project.webhook_full_output). No production code changes — this only realigns tests with the new wrapped request shape.

…lope

## Why

PR #5224 changed the outbound Stakwork `/projects` request body from a flat object to `{ project: stakworkPayload }`. 156 unit tests across 7 files still assert against the old flat shape (`body.workflow_id`, `body.workflow_params.set_var.attributes.vars`, `body.webhook_url`, etc.), so they now read `undefined` and fail. Build, lint, integration, and Playwright all pass — only these payload-shape assertions need updating.

## Change

Update the assertions/mocks in the affected test files to read the payload from the nested `project` envelope (e.g. `body.project.workflow_id`, `body.project.workflow_params.set_var.attributes.vars`, `body.project.webhook_url`, `body.project.webhook_full_output`). No production code changes — this only realigns tests with the new wrapped request shape.
@gonzaloaune gonzaloaune added the jamie Automated PR opened by Jamie label Sep 2, 2026 — with Hive Chat PM
@gonzaloaune
gonzaloaune enabled auto-merge (squash) September 2, 2026 13:41
…k_full_output survives

## Problem

For plan_mode / workflow_editor runs, `callStakworkAPI` sets `webhook_full_output: false` as a top-level key in the Stakwork `/projects` request body. But Stakwork stores `webhook_full_output: true` anyway.

## Root cause

Hive sends a **flat** JSON body (no `{ project: ... }` envelope). Stakwork's `ProjectsController` relies on Rails `wrap_parameters` (`format: [:json]`, no explicit `include`), which wraps **only real `Project` DB columns** into `params[:project]`. `webhook_full_output` (like `stop_on_errors` and `debug_mode`) is NOT a column — it lives inside the `project_configs` JSON blob — so the wrapper drops it. Strong params then see `nil`, and `create_project` defaults it back to `true`.

If the body is sent pre-nested under `project`, Rails uses the explicit nested key as-is and the drop does not happen.

## Fix

Wrap the outbound payload as `{ project: stakworkPayload }` in `callStakworkAPI` so `webhook_full_output` (and the other non-column config keys) are correctly nested. Sending a body that already has a `project` root key is safe: `wrap_parameters` only *adds* a synthetic copy, it never alters an already-present `project` key.
@gonzaloaune gonzaloaune closed this Sep 2, 2026
auto-merge was automatically disabled September 2, 2026 13:59

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jamie Automated PR opened by Jamie

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants