Skip to content

fix: add missing return type annotations#640

Open
miachillgood wants to merge 1 commit into
PostHog:mainfrom
miachillgood:codex/posthog-typing-return-annotations
Open

fix: add missing return type annotations#640
miachillgood wants to merge 1 commit into
PostHog:mainfrom
miachillgood:codex/posthog-typing-return-annotations

Conversation

@miachillgood
Copy link
Copy Markdown

@miachillgood miachillgood commented Jun 1, 2026

Summary

Adds explicit return annotations for Client.capture_exception, the client lifecycle helpers (flush, join, shutdown), and the equivalent module-level helpers. capture_exception now also returns None explicitly if its defensive exception handler is reached.

This is a small incremental typing improvement related to #559.

Validation

  • pytest posthog/test/test_client.py::TestClient::test_basic_capture_exception posthog/test/test_client.py::TestClient::test_basic_capture_exception_with_distinct_id posthog/test/test_client.py::TestClient::test_basic_capture_exception_with_correct_host_generation posthog/test/test_client.py::TestClient::test_basic_capture_exception_with_correct_host_generation_for_server_hosts posthog/test/test_client.py::TestClient::test_basic_capture_exception_with_no_exception_given posthog/test/test_client.py::TestClient::test_basic_capture_exception_with_no_exception_happening posthog/test/test_client.py::TestClient::test_capture_exception_logs_when_enabled posthog/test/test_client.py::TestClient::test_flush posthog/test/test_client.py::TestClient::test_shutdown posthog/test/test_module.py::TestModule::test_flush
  • pyright typing_smoke.py with # pyright: strict confirmed the updated helper return types as str | None or None.

@miachillgood miachillgood requested a review from a team as a code owner June 1, 2026 12:10
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 1, 2026

Reviews (1): Last reviewed commit: "Add return annotations for client lifecy..." | Re-trigger Greptile

@miachillgood miachillgood changed the title Add return annotations for exception and lifecycle helpers fix: add return annotations for exception and lifecycle helpers Jun 1, 2026
@miachillgood miachillgood changed the title fix: add return annotations for exception and lifecycle helpers fix: add missing return type annotations Jun 1, 2026
@miachillgood miachillgood force-pushed the codex/posthog-typing-return-annotations branch from b44082e to 3dbb599 Compare June 1, 2026 13:45
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.

2 participants