Skip to content

test: use a valid context instead of legacy user format in relay tests#727

Merged
aaron-zeisler merged 2 commits into
v8from
aaronz/use-valid-context-in-relay-test-helper
Jun 30, 2026
Merged

test: use a valid context instead of legacy user format in relay tests#727
aaron-zeisler merged 2 commits into
v8from
aaronz/use-valid-context-in-relay-test-helper

Conversation

@aaron-zeisler

@aaron-zeisler aaron-zeisler commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates two relay test fixtures that still modeled the eval context they send to the SDK endpoints as a legacy LDUser ({"key":"userkey"}, no kind) to use a valid single-kind evaluation context ({"key":"userkey","kind":"user"}):

  1. relay/testutils_test.gosimpleUserJSON / simpleUserBase64 in the assertSDKEndpointsAvailability helper, which feeds the mobile /meval/<base64> and JS /eval/<envID>/<base64> streaming endpoints (plus the REPORT variants) for many relay endpoint tests.
  2. internal/sharedtest/endpoints.go — the shared SimpleUserJSON constant, consumed by the stream/eval request builders in relay/relay_environments_test.go and relay/relay_end_to_end_test.go.

Background

Evaluation contexts (the kind field) have been the canonical format since contexts shipped in 7.0.0 (2022-12-07) and are fully present in production v8. The bare no-kind user shape is the legacy form, accepted today only via the SDK's backward-compatibility path in ldcontext.UnmarshalJSON. These fixtures only need the payload to parse — none assert on its literal value or on evaluation results, and assertSDKEndpointsAvailability checks only HTTP status codes — so behavior is unchanged.

go test ./relay/... and golangci-lint run ./internal/sharedtest/... ./relay/... pass.

… helper

The assertSDKEndpointsAvailability helper used the legacy LDUser shape
({"key":"userkey"}, no kind) for the streaming mobile /meval and JS
/eval endpoints. Replace simpleUserJSON and simpleUserBase64 with a valid
evaluation context ({"key":"userkey","kind":"user"}). The helper
only asserts HTTP status codes, so the 200/401/404 expectations are
unchanged.
@aaron-zeisler aaron-zeisler force-pushed the aaronz/use-valid-context-in-relay-test-helper branch from 2b4066a to a652847 Compare June 29, 2026 21:41
@aaron-zeisler aaron-zeisler marked this pull request as ready for review June 29, 2026 21:46
@aaron-zeisler aaron-zeisler requested a review from a team as a code owner June 29, 2026 21:46
@aaron-zeisler aaron-zeisler marked this pull request as draft June 29, 2026 21:46
@aaron-zeisler aaron-zeisler changed the base branch from v8 to feat/concurrent-keys June 29, 2026 22:18
@aaron-zeisler aaron-zeisler changed the title test: use a valid context instead of legacy user format in relay test helper test: use a valid context instead of legacy user format in relay tests Jun 29, 2026
SimpleUserJSON used the legacy LDUser shape ({"key":"userkey"}, no kind),
which the SDK only still accepts via its backward-compat path. Update it to a
valid single-kind context ({"key":"userkey","kind":"user"}) to match the
format that has been canonical since contexts shipped in 7.0.0. All consumers
encode it for streaming/eval endpoints that don't assert on its literal value,
so behavior is unchanged.
@aaron-zeisler aaron-zeisler changed the base branch from feat/concurrent-keys to v8 June 29, 2026 22:31
@aaron-zeisler aaron-zeisler force-pushed the aaronz/use-valid-context-in-relay-test-helper branch from 02d626b to 72676fd Compare June 29, 2026 22:32
@aaron-zeisler aaron-zeisler marked this pull request as ready for review June 29, 2026 22:48
@aaron-zeisler aaron-zeisler merged commit 8869b88 into v8 Jun 30, 2026
15 checks passed
@aaron-zeisler aaron-zeisler deleted the aaronz/use-valid-context-in-relay-test-helper branch June 30, 2026 16:49
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