Skip to content

Add TypedKeyFieldValue and fix Cache.Field in codec-java - #302

Merged
em3s merged 6 commits into
mainfrom
fix/codec-edge-cache
May 7, 2026
Merged

em3s merged 6 commits into
mainfrom
fix/codec-edge-cache

Conversation

@zipdoki

@zipdoki zipdoki commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two fixes to V2 codec edge encoding.

Cache.fields wire shape. Server LabelEntity mixes V2 Index with V3 Cache, so caches[].fields[].* uses the V3 key field, not V2's name. V2's Cache reused Index.Field, so real responses deserialized to null names and broke encoding. New Cache.Field annotated @JsonProperty("field"); Index.Field keeps name.

Row type tag on bulk output. bulkEncodeAll consumers couldn't tell hash from indexed/cache/counter rows without re-decoding keys. TypedKeyFieldValue<T> carries EncodedEdgeType with key/field/value, and bulkEncodeAll now returns List<TypedKeyFieldValue<T>>. Kept separate from KeyFieldValue so engine scan paths (HBaseHashLabel, JdbcHashLabel) stay untouched; overloaded from adapters bridge them.

Closes #

Changes

  • Add Cache.Field with @JsonProperty("field") to match the V3 server wire shape (core.metadata.common.IndexField); Index.Field keeps the legacy name key.
  • Introduce TypedKeyFieldValue<T> carrying EncodedEdgeType alongside key/field/value.
  • Switch BulkEdgeEncoder.bulkEncodeAll to return List<TypedKeyFieldValue<T>>; update AbstractEdgeEncoder signatures accordingly.
  • Add overloaded from adapters between KeyFieldValue and TypedKeyFieldValue; existing engine scan/query paths are unchanged.
  • Expand the wildcard metadata import in BulkEdgeEncoder and apply spotless formatting to the codec-java module.
  • Tests: add LabelDTOTests; update BulkEdgeEncoderTests and MultiEdgeBulkEdgeEncoderTests for the new return type.

How to Test

  • ./gradlew :codec-java:test — covers both fixes via BulkEdgeEncoderTests, MultiEdgeBulkEdgeEncoderTests, and the new LabelDTOTests.
  • ./gradlew test — full suite green; engine integration tests confirm the existing KeyFieldValue scan path is untouched.

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: Claude Code (Opus 4.7, 1M context)

zipdoki and others added 3 commits April 30, 2026 15:05
The server's `LabelEntity` mixes V2 `Index` with V3 `Cache` (from
`core.metadata.common`), so `caches[].fields[].*` is emitted as `field`
(V3 IndexField), not `name` (V2 Index.Field). The V2 client's `Cache`
reused `Index.Field`, so deserializing a real `GET
/graph/v2/service/{service}/label/{label}` response produced null field
names and downstream encoding errors.

Introduce a dedicated `Cache.Field` with `@JsonProperty("field")`,
matching `core.metadata.common.IndexField`. `Index.Field` keeps the
legacy `name` key, since V2 indices are still serialized that way.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Introduce KeyFieldValueV2 carrying EncodedEdgeType alongside the
encoded key/field/value, and switch BulkEdgeEncoder.bulkEncodeAll
to return List<KeyFieldValueV2<T>>. The original KeyFieldValue is
left untouched so existing scan/query call sites in the engine
module are unaffected; fromV1/fromV2 adapters bridge the two.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zipdoki zipdoki self-assigned this May 6, 2026
@zipdoki
zipdoki requested a review from em3s as a code owner May 6, 2026 06:10
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels May 6, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zipdoki zipdoki changed the title Fix V2 Cache.fields wire shape and tag BulkEdgeEncoder output with EncodedEdgeType V2 codec: fix Cache.fields wire shape, tag bulk output rows May 6, 2026

import com.kakao.actionbase.v2.core.metadata.EncodedEdgeType;

public class KeyFieldValueV2<T> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about TypedKeyFieldValue instead of the ambiguous V2 suffix?

zipdoki and others added 2 commits May 6, 2026 16:06
The V2 suffix only meant "the version with EncodedEdgeType", which is
already what the type tag conveys. TypedKeyFieldValue makes the intent
self-evident at call sites and removes the misleading versioning. The
fromV1/fromV2 adapters collapse into a single overloaded `from` for
the same reason.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zipdoki

zipdoki commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

@em3s
Renamed to TypedKeyFieldValue, and folded fromV1 / fromV2 into a single from for the same reason. Thanks!

@em3s

em3s commented May 7, 2026

Copy link
Copy Markdown
Contributor

LGTM 👍
Merging

@em3s em3s changed the title V2 codec: fix Cache.fields wire shape, tag bulk output rows Add TypedKeyFieldValue and fix Cache.Field in codec-java May 7, 2026
@em3s
em3s merged commit 674ddd2 into main May 7, 2026
2 checks passed
@em3s
em3s deleted the fix/codec-edge-cache branch May 7, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants