Add reachability metadata for io.confluent:kafka-schema-serializer:8.3.0 - #8714
Add reachability metadata for io.confluent:kafka-schema-serializer:8.3.0#8714mvanhorn wants to merge 4 commits into
Conversation
Adds a new-library contribution for io.confluent:kafka-schema-serializer:8.3.0: metadata index and reachability-metadata.json covering the serializer config, subject/context name strategies, and schema-id serdes, a framework-list entry, and a Gradle test harness that exercises the serializers through a mock:// Schema Registry (no live Kafka/Schema Registry service required). Fixes oracle#8564 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QK73cX8EuqqwQEJUbycu6g
|
Hey @mvanhorn, thanks for the contribution! CI fails in |
Removed the `typeReached: AbstractKafkaSchemaSerDeConfig` condition from the seven strategy registrations. They are now active for direct reflective instantiation while all unrelated metadata remains unchanged. ### CODEX STATUS - **PASS:** JSON syntax validation with `jq` - **PASS:** `git diff --check` - **PASS:** Diff scope: one metadata file, 21 deletions - **ENV_BLOCKED:** Gradle validation, lint, and focused tests. The Gradle 9.1 wrapper distribution is not cached and network access cannot resolve `services.gradle.org`. The installed OpenJDK 21 also lacks `native-image`. - **NOTES:** No rebase or upstream-tree materialization attempted. Codex session ID: 019ffb91-e9a6-7211-81e4-1a3f03d3521f
|
Thanks for the precise diagnosis, that was exactly it. Removed the One file, 21 deletions, JSON validated. I could not run the Gradle validation or |
|
Thanks for the quick turnaround, I should have been clearer in my first comment. Every entry in this repository must carry a The condition was correct, the test is what needs to change. Separately, |
The seven subject-, reference-subject- and context-name strategy entries are conditional on AbstractKafkaSchemaSerDeConfig again, as every entry in this repository must be. The test is what changes. strategyTypesAreReflectivelyInstantiable called Class.forName from test code, so it never reached the config class and the condition never fired. Each strategy is now named in configuration and instantiated by the serde config itself, the way Confluent loads them: - subject-name strategies (including AssociatedNameStrategy, whose subject lookup needs a registry the mock does not serve) through KafkaAvroSerializerConfig.key/valueSubjectNameStrategy() - the context-name strategy through contextNameStrategy() - the reference-subject-name strategies through KafkaProtobufSerializerConfig.referenceSubjectNameStrategyInstance(), the public config that defines reference.subject.name.strategy Both config classes extend AbstractKafkaSchemaSerDeConfig, so reaching them satisfies the condition on all seven entries. Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
Generated with generateLibraryStats against the final metadata and test. The library delegates every reflective load to Kafka's ConfigDef, so TrackDynamicAccess reports no dynamic-access call sites inside the artifact itself and dynamicAccess stays empty, as it does for other such libraries. Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
|
@kimeta restored
|
What does this PR do?
This adds GraalVM reachability metadata for
io.confluent:kafka-schema-serializer:8.3.0, resolving the new-library request in #8564. Today, native-image builds that integrate Kafka clients with Confluent Schema Registry fail unless the user hand-maintains reflection config, because the serializer infrastructure loads its configuration, its subject- and context-name strategies, and its schema-id serdes reflectively at runtime. Shipping the metadata here means those applications build natively out of the box.The reporter (jessecoddington) already runs this exact reflection configuration in production and posted it on the issue, so it serves as the verified basis for the entries rather than a guess. The metadata stays deliberately narrow: it registers only the classes that are reflectively reached and exercised by the test, and every entry is gated on
condition.typeReachedso it does not bloat images. Concretely, it covers the abstract serde and config base classes, the subject-name strategies (topic, topic-record, record, associated, and the reference strategies), the null context-name strategy, and the schema-id serializers and deserializers.The contribution mirrors the existing
metadata/org.apache.kafka/kafka-clientslayout: a per-artifact index, the versioned reachability metadata, a registration entry in the framework list (re-sorted by artifact per the contributing guide), a Gradle test harness undertests/src, and the generatedstats/io.confluent/kafka-schema-serializer/8.3.0/stats.json. Following the maintainer (kimeta) human-intervention note on the issue, the harness talks to an in-memorymock://Schema Registry instead of a live Kafka or Schema Registry service, so it needs no external infrastructure.On testing: every new and changed JSON file parses and validates against the repository's own schemas (the library index, reachability metadata, library stats, and framework-list schemas). The harness does an Avro serialize/deserialize round trip through the mock registry, which reaches the abstract serde, the config, and the schema-id serdes, and it serializes once per configured subject-name strategy. Every strategy is loaded the way Confluent loads it, by naming the class in configuration and letting the serde config instantiate it: the subject-name strategies through
KafkaAvroSerializerConfig.key/valueSubjectNameStrategy(), the context-name strategy throughcontextNameStrategy(), and the reference-subject-name strategies throughKafkaProtobufSerializerConfig.referenceSubjectNameStrategyInstance(), which is the public config that definesreference.subject.name.strategy. Both config classes extendAbstractKafkaSchemaSerDeConfig, so reaching them satisfies thetypeReachedcondition on every strategy entry. Verified against GraalVM for JDK 25:nativeTestis green at 11/11, and deleting a single strategy entry from the metadata fails exactly the case that loads it.Contribution requires the Oracle CLA; the signing gate is handled downstream.
Code sections where the PR accesses files, network, docker or some external service
The test resolves the library from the Confluent Maven repository (scoped to the
io.confluentgroup) and otherwise talks only to an in-memorymock://Schema Registry, so there is no live network, Kafka broker, or Docker dependency.build.gradleKafkaSchemaSerializerTest.javaFixes #8564