[Jamie] Update Stakwork payload unit tests for wrapped project envelope - #5226
Closed
gonzaloaune wants to merge 3 commits into
Closed
[Jamie] Update Stakwork payload unit tests for wrapped project envelope#5226gonzaloaune wants to merge 3 commits into
project envelope#5226gonzaloaune wants to merge 3 commits into
Conversation
…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
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.
auto-merge was automatically disabled
September 2, 2026 13:59
Pull request was closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
PR #5224 changed the outbound Stakwork
/projectsrequest 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 readundefinedand 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
projectenvelope (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.