Skip to content

Lock in LabelEntity caches JSON serialization contract#272

Merged
em3s merged 1 commit intomainfrom
test/label-entity-caches-contract
Apr 24, 2026
Merged

Lock in LabelEntity caches JSON serialization contract#272
em3s merged 1 commit intomainfrom
test/label-entity-caches-contract

Conversation

@em3s
Copy link
Copy Markdown
Contributor

@em3s em3s commented Apr 24, 2026

Summary

Add a regression test in LabelEntitySpec that locks in the JSON serialization contract for LabelEntity.caches:

  • Asserts that jacksonObjectMapper().writeValueAsString(LabelEntity(...)) emits a "caches" field.
  • Round-trips the JSON back to LabelEntity and asserts the caches list survives.

This guards the wire format that codec-java 0.0.1+ clients depend on. GET /graph/v2/service/{service}/label/{label} returns LabelEntity directly, and its JSON response must include the caches field so clients that deserialize into a DTO with a caches property do not fail (e.g., when FAIL_ON_NULL_CREATOR_PROPERTIES=true is configured on the consumer side).

No production change — LabelEntity already declares caches: List<Cache> = emptyList() and Jackson serializes it by default. This PR only prevents accidental future regressions (e.g., an @JsonIgnore slip, a field rename, or a custom serializer that omits it).

Test plan

  • ./gradlew :engine:test --tests "*LabelEntitySpec*" — all 4 cases pass (materialize LabelEntity, two backward-compatibility cases, and the new LabelEntity JSON serializes caches field).

Context

This enables the codec-java 0.0.1 release (paired with Actionbase 0.3.x) to land PR #249's BulkEdgeEncoder cache-encoding changes safely — the contract guarded here is precisely the server-side half of the "new client ↔ server" compatibility story.

Add a regression test asserting that LabelEntity serializes and
deserializes its caches field via Jackson. The test guards the
wire format that codec-java 0.0.1+ clients depend on: the
GET /graph/v2/service/{service}/label/{label} response must include
the caches field so clients constructing LabelDTO with a required
caches property (via @JsonProperty with required=false defaults)
deserialize cleanly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. maintenance Maintenance work. labels Apr 24, 2026
@em3s em3s merged commit 361a8fe into main Apr 24, 2026
8 checks passed
@em3s em3s self-assigned this Apr 24, 2026
@em3s em3s deleted the test/label-entity-caches-contract branch April 24, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Maintenance work. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant