Skip to content

Give AssembledResult content equality for its ByteArray payload #53

@nficano

Description

@nficano

ResultChunkAssembler.AssembledResult is a public data class containing a ByteArray at lib/src/main/kotlin/dev/arcp/client/ResultChunkAssembler.kt:54. Kotlin data classes compare array properties by reference, so two assembled results with the same resultId, the same bytes, and the same isText value are not equal unless they hold the exact same array instance. The artifact request and body types already override equality for their ByteArray fields, but this public result type does not. Existing tests in lib/src/test/kotlin/dev/arcp/client/ResultChunkAssemblerTest.kt inspect bytes manually and do not catch the equality/hashCode surprise.

Fix prompt: Override equals and hashCode for AssembledResult using bytes.contentEquals and bytes.contentHashCode, or replace the array property with an immutable value type that defines content equality. Add tests that compare two assembled results with distinct but equal byte arrays and verify both equality and hash-based collection behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity:mediumMedium severity issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions