Lock in LabelEntity caches JSON serialization contract#272
Merged
Conversation
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>
8 tasks
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.
Summary
Add a regression test in
LabelEntitySpecthat locks in the JSON serialization contract forLabelEntity.caches:jacksonObjectMapper().writeValueAsString(LabelEntity(...))emits a"caches"field.LabelEntityand asserts thecacheslist survives.This guards the wire format that codec-java
0.0.1+clients depend on.GET /graph/v2/service/{service}/label/{label}returnsLabelEntitydirectly, and its JSON response must include thecachesfield so clients that deserialize into a DTO with acachesproperty do not fail (e.g., whenFAIL_ON_NULL_CREATOR_PROPERTIES=trueis configured on the consumer side).No production change —
LabelEntityalready declarescaches: List<Cache> = emptyList()and Jackson serializes it by default. This PR only prevents accidental future regressions (e.g., an@JsonIgnoreslip, 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 newLabelEntity JSON serializes caches field).Context
This enables the codec-java
0.0.1release (paired with Actionbase0.3.x) to land PR #249'sBulkEdgeEncodercache-encoding changes safely — the contract guarded here is precisely the server-side half of the "new client ↔ server" compatibility story.