Skip to content

fix: preserve expression value types in json bodies#5628

Open
re-pixel wants to merge 2 commits into
superplanehq:mainfrom
re-pixel:fix/numeric-types-json
Open

fix: preserve expression value types in json bodies#5628
re-pixel wants to merge 2 commits into
superplanehq:mainfrom
re-pixel:fix/numeric-types-json

Conversation

@re-pixel

Copy link
Copy Markdown
Collaborator

Resolves #4499

Preserves expression result types inside JSON request bodies for the HTTP action. Whole-value expressions in object/JSON fields now resolve to their native types, so numbers and booleans stay as JSON numbers/booleans, while partial string templates still render as strings.

Signed-off-by: re-pixel <relja.brdar@gmail.com>
@superplanehq-integration

Copy link
Copy Markdown

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

@superplane-gh-integration-9000

Copy link
Copy Markdown

PR Risk Review

Risk: 42/100 (medium)
Review approved: Yes
Check passed: Yes

Summary

This PR fixes type preservation for expression values in JSON bodies by adding type-aware resolution for object, number, and boolean fields, with comprehensive tests covering the key scenarios.

Concerns

  • The refactoring of resolveListItems to delegate to resolveFieldValue changes behavior for existing list resolution paths - could have subtle regressions for list items that aren't objects/numbers/bools
  • The resolveObjectString function attempts JSON decoding on any string that doesn't resolve to a non-string type, which could cause unexpected failures for string fields that happen to look like JSON
  • The unwrapExpressionTemplate function uses a regex match that requires the entire trimmed string to be a single expression - edge cases with whitespace or multiple expressions on one line should be verified
  • No integration tests were added to verify end-to-end behavior with actual pipeline execution

@superplane-gh-integration-9000

Copy link
Copy Markdown

PR Risk Review

Risk: 50/100 (medium)
Review approved: No
Check passed: No

Summary

Could not parse Claude review JSON.

Concerns

  • Based on my detailed review, I've analyzed the diff in:
  • pkg/workers/contexts/node_configuration_builder.go (~200 new lines)
  • pkg/workers/contexts/node_configuration_builder_test.go (2 new unit tests)
  • pkg/components/http/http_test.go (1 new integration test)

Key observations:

  1. Bug fixed: Previously, a template like "{{ previous().weight }}" inside an Object/Number/Bool field would be stringified ("0.1" instead of 0.1), causing wrong JSON serialization in HTTP bodies and ot

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.

HTTP action: expressions in JSON body fields resolve to strings, breaking numeric APIs

1 participant