Skip to content

Require event hints for remote protocol errors - #202

Merged
Kriechi merged 4 commits into
python-hyper:mainfrom
Mirochill:fix-178-require-event-hint
May 23, 2026
Merged

Kriechi merged 4 commits into
python-hyper:mainfrom
Mirochill:fix-178-require-event-hint

Conversation

@Mirochill

@Mirochill Mirochill commented May 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • make RemoteProtocolError.event_hint a required constructor argument
  • update the public documentation to match the guarantee already provided by all internal call sites

Why

Issue #178 notes that every wsproto call site already supplies an event_hint, while the public signature still allows callers to construct a RemoteProtocolError without one. Requiring the argument makes the API describe the behavior the implementation already depends on and gives consumers a stable hint to react to.

This is intentionally an API-breaking change, matching the maintainer note that the issue is a candidate for a future minor API-breaking release.

Validation

  • Not run locally
  • Verified statically that all in-repo RemoteProtocolError(...) call sites already provide event_hint=.
  • Relying on the repository's remote CI for execution feedback.
@Mirochill
Mirochill marked this pull request as ready for review May 18, 2026 17:35
@Kriechi

Kriechi commented May 18, 2026

Copy link
Copy Markdown
Member

Please add a changelog entry to document the API breaking change as minor. Also add the corresponding source-code comment annotation.

Comment thread src/wsproto/utilities.py Outdated

"""

# API-breaking change for the next minor release: event_hint is required.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was thinking about https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-versionchanged

example:

    .. versionchanged:: 2.3.0
       Changed the type of ``headers`` to :class:`HeaderTuple
       <hpack:hpack.HeaderTuple>`. This has no effect on current users.
@Mirochill

Mirochill commented May 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks, this is addressed in the follow-up commits: b1dc8d5 adds the 1.4.0 changelog entry, and f40f1b3 replaces the source note with a .. versionchanged:: 1.4.0 directive on RemoteProtocolError.

Remote checks now show the published tox jobs and codecov/patch green; codecov/project is still red, which looks like project coverage rather than this patch. Not run locally.

@Kriechi
Kriechi merged commit 5e0685d into python-hyper:main May 23, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants