Skip to content

feat: migrate GoBatch API to generics#60

Merged
MasterOfBinary merged 2 commits into
masterfrom
feature/generics-v0.5-hard-switch
Feb 15, 2026
Merged

feat: migrate GoBatch API to generics#60
MasterOfBinary merged 2 commits into
masterfrom
feature/generics-v0.5-hard-switch

Conversation

@MasterOfBinary

@MasterOfBinary MasterOfBinary commented Feb 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • migrate batch, source, and processor public APIs to generics (Batch[T], Item[T], Source[T], Processor[T])
  • update built-in sources/processors and helper APIs (RunBatchAndWait[T], BatchConfig[T], ExecuteBatches[T])
  • migrate tests/examples/docs to typed usage and normalize any style
  • add v0.5.0 changelog entry with explicit migration notes, including homogeneous ExecuteBatches[T] behavior and type-changing pipeline guidance

Validation

  • /Users/vaughn/go/bin/goimports -w $(rg --files --glob '*.go')
  • go test -race -coverprofile=coverage.txt -covermode=atomic ./...
  • go vet ./...
  • /Users/vaughn/go/bin/golangci-lint run --timeout=3m

Note

High Risk
Wide-reaching breaking changes to all public interfaces and built-in implementations; downstream users must update type parameters and any custom Source/Processor implementations to compile.

Overview
Hard-breaking API migration to generics across the library. Core types and interfaces are now parameterized (Batch[T], Item[T], Source[T], Processor[T]), with Source.Read returning <-chan T and processors operating on []*Item[T].

All built-in sources/processors and helper utilities were updated to the typed API (RunBatchAndWait[T], BatchConfig[T], ExecuteBatches[T]), and the full docs/README/examples/tests were rewritten to use explicit type parameters (often any) with new v0.5.0 changelog + migration notes (including ExecuteBatches now requiring a single shared T per call).

Written by Cursor Bugbot for commit b625e7b. This will update automatically on new commits. Configure here.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @MasterOfBinary, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the GoBatch library by introducing Go generics across its public API. This change aims to provide compile-time type safety for batch processing, eliminating the need for runtime type assertions and making the API more robust and easier to use. The migration impacts core data structures and interfaces, requiring users to specify types when creating batches, sources, and processors. This update also ensures that built-in components and helper functions are fully compatible with the new generic paradigm, streamlining the development of type-safe batch processing pipelines.

Highlights

  • Generics Migration: The core Batch, Item, Source, and Processor APIs have been migrated to use Go generics, enhancing type safety and reducing the need for interface{} type assertions.
  • Breaking Changes: This migration introduces breaking changes, requiring explicit type parameters for Batch[T], Item[T], Source[T], and Processor[T], as well as updates to method signatures like Source.Read and Processor.Process.
  • Helper API Updates: Helper functions such as RunBatchAndWait, BatchConfig, and ExecuteBatches have been updated to support the new generic types.
  • Built-in Component Adaptation: All built-in sources and processors (e.g., source.Channel, processor.Transform) now require explicit type parameters, and examples/tests have been updated accordingly.
  • Changelog and Documentation: A new v0.5.0 changelog entry has been added, providing detailed migration notes, including guidance on homogeneous batch behavior and handling type-changing pipelines.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • CHANGELOG.md
    • Added new version 0.5.0 entry detailing breaking changes and migration steps for generics.
    • Updated Batch, Item, Source, and Processor to be generic types (Batch[T], Item[T], Source[T], Processor[T]).
    • Updated Source.Read to use typed output channels (<-chan T).
    • Updated Processor.Process to use typed items ([]*Item[T]).
    • Noted that built-in sources and processors now require explicit type parameters (e.g., source.Channel[int]).
    • Updated helper APIs RunBatchAndWait[T], BatchConfig[T], and ExecuteBatches[T] to generics.
    • Provided migration guidance for instantiating typed batches, sources, and processors.
    • Clarified requirements for ExecuteBatches[T] regarding shared T types.
    • Advised on using Batch[any] for pipelines that change data types between processor stages.
    • Instructed custom source and processor implementations to update their type signatures.
Activity
  • No specific activity (comments, reviews, etc.) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov

codecov Bot commented Feb 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.79%. Comparing base (4d5378d) to head (b625e7b).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #60   +/-   ##
=======================================
  Coverage   96.79%   96.79%           
=======================================
  Files          12       12           
  Lines         374      374           
=======================================
  Hits          362      362           
  Misses          9        9           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This is an excellent and thorough pull request that successfully migrates the entire library to use Go generics. The changes are extensive, consistent, and well-executed across the core API, tests, examples, and documentation. This migration significantly improves type safety and the overall developer experience. The code quality is high, demonstrating a strong understanding of generics and concurrent programming in Go. The updated documentation, especially the changelog with migration notes, is clear and will be very helpful for users transitioning to this new version. I have no suggestions for improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant