Skip to content

chore: (breaking) migrating to hookified v2#122

Merged
jaredwray merged 1 commit intomainfrom
chore-(breaking)-migrating-to-hookified-v2
Mar 4, 2026
Merged

chore: (breaking) migrating to hookified v2#122
jaredwray merged 1 commit intomainfrom
chore-(breaking)-migrating-to-hookified-v2

Conversation

@jaredwray
Copy link
Contributor

@jaredwray jaredwray commented Mar 4, 2026

Please check if the PR fulfills these requirements

  • Followed the Contributing guidelines and Code of Conduct
  • Tests for the changes have been added (for bug fixes/features) with 100% code coverage.

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
chore: (breaking) migrating to hookified v2

@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 focuses on a significant internal refactor by upgrading the core event system to hookified v2. This upgrade necessitates several breaking changes, primarily in how errors are handled and propagated throughout the SDK, leading to a major version bump to v3. The changes aim to align the SDK with the new hookified error management paradigm, requiring consumers to adapt their error listening strategies.

Highlights

  • Breaking Change: Hookified v2 Upgrade: The SDK has been upgraded to use hookified v2, introducing significant breaking changes to error handling mechanisms. This includes a major version bump to 3.0.0 for the SDK.
  • Error Handling Default Behavior Change: The throwOnEmptyListeners option in hookified now defaults to true. This means that emitting an 'error' event without any registered listeners will now throw an error by default, whereas previously it was silently ignored. Consumers must now register error listeners or explicitly set throwOnEmptyListeners: false.
  • Removal of throwErrors Option: The throwErrors option, along with its getter and setter, has been removed from BaseServiceOptions, HyphenOptions, and all service classes. Error throwing is now managed natively by hookified v2. The equivalent behavior can be achieved by using throwOnEmitError: true.
  • Migration Guide Added: A new 'Migrating to v3' section has been added to the README.md to guide users through the breaking changes and necessary updates when upgrading to the new SDK version.

🧠 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
  • README.md
    • Added 'Migrating to v3' section to the table of contents.
    • Included detailed instructions and examples for migrating to v3, specifically addressing changes in error handling with throwOnEmptyListeners and the removal of throwErrors.
  • package.json
    • Updated the package version from 2.2.1 to 3.0.0.
    • Upgraded the hookified dependency from ^1.15.1 to ^2.0.1.
  • pnpm-lock.yaml
    • Updated the hookified dependency version to 2.0.1.
    • Added the new integrity hash for hookified@2.0.1.
  • src/base-service.ts
    • Removed the throwErrors property from BaseServiceOptions.
    • Removed the private _throwErrors property and its corresponding getter and setter from the BaseService class.
    • Adjusted the error method to remove the conditional error throwing based on _throwErrors.
  • src/hyphen.ts
    • Removed the throwErrors property from HyphenOptions.
    • Updated Omit types for toggle, netInfo, and link options to no longer exclude throwErrors.
  • test/base-service.test.ts
    • Removed the test case verifying the default value of throwErrors.
    • Removed the test case for setting and getting throwErrors.
    • Modified the error emission test to register an error listener (service.on("error", () => {});) instead of expecting a direct throw.
  • test/hyphen.test.ts
    • Added hyphen.on("error", () => {}); to link error event tests to handle the new default error throwing behavior.
    • Added hyphen.on("error", () => {}); to netInfo error event tests.
    • Added hyphen.on("error", () => {}); to toggle error event tests.
  • test/net-info.test.ts
    • Removed the test case verifying the default value of throwErrors.
    • Replaced throwErrors: true with throwOnEmitError: true in NetInfo instantiation for API key validation tests.
    • Added netInfo.on("error", () => {}); to tests involving invalid IP addresses and empty IP arrays to prevent unhandled error throws.
  • test/toggle-evals.test.ts
    • Added toggle.on("error", () => {}); to multiple toggle evaluation tests to handle the new default error throwing behavior when no listeners are present.
  • test/toggle.test.ts
    • Added toggle.on("error", () => {}); to a test case involving horizon URLs to prevent unhandled error throws.
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.

@jaredwray jaredwray merged commit a313d9c into main Mar 4, 2026
7 checks passed
@jaredwray jaredwray deleted the chore-(breaking)-migrating-to-hookified-v2 branch March 4, 2026 19:18
Copy link

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

Choose a reason for hiding this comment

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

Code Review

This pull request correctly migrates the SDK to hookified v2, which is a significant breaking change. The removal of the custom throwErrors implementation and the adaptation to hookified's new error handling model are well-executed throughout the codebase. The test suite has been updated appropriately to reflect the new behaviors, such as throwOnEmptyListeners defaulting to true. Additionally, the README.md provides a clear and helpful migration guide for users moving to v3 of the SDK. My review includes a few suggestions to improve the clarity of the JSDoc comments in src/hyphen.ts for the service options, where the explanation for using Omit was removed during the refactoring.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14af5b5216

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"@faker-js/faker": "^10.3.0",
"cacheable": "^2.3.3",
"hookified": "^1.15.1",
"hookified": "^2.0.1",

Choose a reason for hiding this comment

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

P1 Badge Propagate Hookified options into Toggle constructor

Upgrading to hookified v2 changes unhandled emit behavior, but Toggle still does not accept or forward Hookified options (ToggleOptions lacks HookifiedOptions and the constructor uses super()), so new Toggle({ throwOnEmptyListeners: false }) has no effect. In error paths like Toggle.get() (which emits error before returning defaultValue), callers now get thrown exceptions unless they add listeners, which breaks the documented migration behavior for standalone Toggle instances.

Useful? React with 👍 / 👎.

@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (cb44bef) to head (14af5b5).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #122   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          486       477    -9     
  Branches       101        99    -2     
=========================================
- Hits           486       477    -9     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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