Upgrade kafka-javascript; remove wrong typing workarounds#682
Open
James Robinson (jlrobins) wants to merge 1 commit into
Open
Upgrade kafka-javascript; remove wrong typing workarounds#682James Robinson (jlrobins) wants to merge 1 commit into
James Robinson (jlrobins) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades @confluentinc/kafka-javascript to a newer release and removes several local TypeScript/runtime-shape workarounds that were compensating for upstream type mismatches now resolved in the dependency.
Changes:
- Upgraded
@confluentinc/kafka-javascriptto^1.10.0and updated the lockfile accordingly. - Removed the
fetchTopicMetadata()response normalizer and updated call sites/tests to consume the now-correctly-typedITopicMetadata[]directly. - Simplified consumer-group assignment and offset-error handling now that upstream types better match runtime behavior, and updated tests to match the new shapes.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/confluent/tools/handlers/kafka/topic-metadata.ts | Removed the now-unneeded fetchTopicMetadata response normalizer helper. |
| src/confluent/tools/handlers/kafka/topic-metadata.test.ts | Removed tests that exclusively validated the deleted normalizer. |
| src/confluent/tools/handlers/kafka/get-consumer-group-lag-handler.ts | Consumes fetchTopicMetadata() as an array directly; tightens FetchOffsetsPartition.error check to strict null. |
| src/confluent/tools/handlers/kafka/get-consumer-group-lag-handler.test.ts | Updates fixtures/mocks to match the newer fetchTopicMetadata and FetchOffsetsPartition.error shapes. |
| src/confluent/tools/handlers/kafka/describe-consumer-group-handler.ts | Simplifies assignment extraction to member.assignment.topicPartitions.map(...) per updated upstream typing. |
| src/confluent/tools/handlers/kafka/describe-consumer-group-handler.test.ts | Updates member fixtures to use { topicPartitions: [...] } assignment wrapper consistently. |
| src/confluent/tools/handlers/kafka/consume-kafka-messages-handler.ts | Removes fetchTopicMetadata normalization usage; consumes the array return directly. |
| src/confluent/tools/handlers/kafka/consume-kafka-messages-handler.test.ts | Drops casting/workaround in the metadata fixture helper, aligning with the updated return type. |
| package.json | Bumps @confluentinc/kafka-javascript dependency spec to ^1.10.0. |
| pnpm-lock.yaml | Lockfile update reflecting the dependency bump and new transitive versions. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
|
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.




Upgrade @confluentinc/kafka-javascript, drop typing issues workarounds
@confluentinc/kafka-javascriptspecification from1.3.2to1.10.0(in reality, going from1.9.0to1.10.0). The three upstream type/runtime mismatches we'd worked around (fetchTopicMetadata types incorrect confluent-kafka-javascript#367, Document optional Armorer Guard MCP proxy #487,list-consumer-groupstool #489) were all fixed in1.9.1;1.10.0is the current latest and carries no breaking changes over1.3.2per the library's changelog.topic-metadata.ts'snormalizeFetchTopicMetadataResponse()(and its test file) now thatadmin.fetchTopicMetadata()is correctly typed asPromise<Array<ITopicMetadata>>(ThreadconnectionIdthrough tool handlers that depend on connection-specific config #367 fix) — call sites inget-consumer-group-lag-handler.tsandconsume-kafka-messages-handler.tsconsume the array directly.describe-consumer-group-handler.ts'sbuildAssignment()to a singlemember.assignment.topicPartitions.map(...)— the dual-shape defensive branch (flat array vs.{topicPartitions}wrapper) and its "Wacky" fallback log are gone now that the upstreamMemberDescription.assignmenttype honestly declares the wrapper (Document optional Armorer Guard MCP proxy #487 fix; upstream even adopted theMemberAssignmentnamed type andBuffer | nullsuggestion from our issue write-up verbatim).!= null) workaround forFetchOffsetsPartition.erroringet-consumer-group-lag-handler.tsin favor of a strict!== nullcheck — the type is now honestlyLibrdKafkaError | null(list-consumer-groupstool #489 fix), soundefinedis no longer part of its domain.consumer-group-helpers.ts'sGroupDescription.error != nullloose-equality check untouched: that field is still typedLibrdKafkaError | undefinedupstream while runtime populatesnull, a distinct, still-open mismatch not covered by Remove workarounds and tests over workarounds when the next confluent-kafka-javascript release happens #514's tracked issues (367/487/489).tsc --noEmit,pnpm run lint, andpnpm run test:unit(128 files / 2408 tests, all green) plus a diff-line coverage check — every changed line in the four touched handler/helper files is covered.Relationships
Closes #514