Skip to content

direct: test StateType/RemoteType JSON round-trip; fix found issues - #5681

Merged
denik merged 6 commits into
mainfrom
denik/serialize-this
Jun 22, 2026
Merged

direct: test StateType/RemoteType JSON round-trip; fix found issues#5681
denik merged 6 commits into
mainfrom
denik/serialize-this

Conversation

@denik

@denikdenik commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Direct-engine resources persist their StateType to the state file and emit RemoteType in the plan's remote_state field, both via encoding/json. A wrapper that embeds an SDK type with its own MarshalJSON but omits its own silently drops the wrapper's extra fields. Nothing tested this.

The same bug class was fixed manually in #5672 (role_id); these tests turn it into a guard across every resource.

Adds round-trip tests and fixes two resources that had this bug:

  • VectorSearchEndpointRemote dropped endpoint_uuid
  • MlflowModelRemote dropped model_id

Both fields carry the numeric ID the permissions API needs.

Tests:

  • TestRoundtripFixtureStateType — StateType round-trip on a realistic per-resource fixture
  • TestRoundtripAllFieldsStateType / TestRoundtripAllFieldsRemoteType — synthetic all-fields round-trip, so a dropped field is always observable regardless of fixture coverage
  • plus a concrete-value RemoteType check in the existing testCRUD

InputType is intentionally not covered in this PR - many issues found but it is never serialized via encoding/json (the bundle config layer uses dyn).

This pull request and its description were written by Isaac.

denik added 4 commits June 22, 2026 16:58
…elds
Add round-trip tests ensuring StateType and RemoteType survive
json.Marshal -> json.Unmarshal, the path state and plan remote_state take.
Fixes VectorSearchEndpointRemote (endpoint_uuid) and MlflowModelRemote
(model_id), which embedded an SDK type with its own MarshalJSON but
lacked their own, so the promoted marshaler silently dropped the field.
Co-authored-by: Isaac
The dashboards fixture used []map[string]any for serialized_dashboard, a
shape JSON/dyn decoding never produces (it yields []any). Use []any so the
value round-trips to the same concrete type, letting the round-trip test
assert exact equality instead of filtering JSON-equal differences.
Co-authored-by: Isaac
Adds a dedicated RemoteType round-trip test symmetric with
TestStateTypeRoundTrip. Since there is no per-RemoteType fixture, it fills
every field with a non-zero value via reflection, so a dropped wrapper field
is always observable (non-zero before, zero after) regardless of which fields
a realistic value populates. Complements the concrete-value check in testCRUD.
Co-authored-by: Isaac
Renames to a TestRoundtrip<Mode><Type> convention:
- TestRoundtripFixtureStateType (was TestStateTypeRoundTrip)
- TestRoundtripAllFieldsStateType (new)
- TestRoundtripAllFieldsRemoteType (was TestRoundtripRemoteType)
Factors the synthetic all-fields round-trip into a shared helper driven by
a type accessor. InputType is intentionally omitted: it is never serialized
via encoding/json (the bundle config layer uses dyn), so a json round-trip
would fail by design for resources whose config structs lack a MarshalJSON.
Co-authored-by: Isaac
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: a2b2fca

Run: 27965520921

Env🟨​KNOWN✅​pass🙈​skipTime
🟨​aws linux12169913:06
🟨​aws windows1218972:37
🟨​aws-ucws linux1297183:36
🟨​aws-ucws windows1299163:55
🟨​azure linux1216983:05
🟨​azure windows1218963:18
🟨​azure-ucws linux1299154:02
🟨​azure-ucws windows1301133:52
🟨​gcp linux12151003:04
🟨​gcp windows1217982:47
Test Nameaws linuxaws windowsaws-ucws linuxaws-ucws windowsazure linuxazure windowsazure-ucws linuxazure-ucws windowsgcp linuxgcp windows
🟨​TestAccept🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K
Top 1 slowest tests (at least 2 minutes):
durationenvtestname
12:24aws linuxTestSecretsPutSecretStringValue

@denik
deniktemporarily deployed to test-trigger-is June 22, 2026 15:50 — with GitHub Actions Inactive
@denik
deniktemporarily deployed to test-trigger-is June 22, 2026 15:50 — with GitHub Actions Inactive
@denikdenik changed the title direct: test StateType/RemoteType JSON round-tripdirect: test StateType/RemoteType JSON round-trip; fix found issuesJun 22, 2026
@denik
denik enabled auto-merge June 22, 2026 15:54
@denik
denik added this pull request to the merge queueJun 22, 2026
Merged via the queue into main with commit 5b431f5Jun 22, 2026
25 checks passed
@denik
denik deleted the denik/serialize-this branch June 22, 2026 17:36
Sign up for freeto 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.

3 participants

@denik@eng-dev-ecosystem-bot@pietern