Skip to content

test: cover capture invariants on both lanes - #1029

Merged
eli-r-ph merged 2 commits into
v1from
v1-capture-invariant-tests
Oct 14, 2026
Merged

eli-r-ph merged 2 commits into
v1from
v1-capture-invariant-tests

Conversation

@eli-r-ph

@eli-r-ph eli-r-ph commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Stacked on #1028. posthog-go and posthog-rs hit several capture bugs that tests did not catch, such as a race between enqueue and shutdown. This PR checks the Python stack for each of them and adds tests only where no existing test catches the bug.

Changes

Tests only:

  • A before_send that changes nothing leaves the request body unchanged, on both clients and both lanes.
  • Enqueue racing shutdown delivers the event and leaves no workers running, on both lanes.
  • An AI event at the endpoint's size limit is sent on every send path.
  • A failed batch logs one line that names the lane's endpoint and no response text, for all four capture methods.

💚 How did you test it?

  • One deliberate bug per check; each fails its new test.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Written with Cursor (Claude Opus) under the direction of the assignee.

🤖 Generated with Claude Code

@eli-r-ph eli-r-ph self-assigned this Oct 7, 2026
@eli-r-ph
eli-r-ph force-pushed the v1-capture-async-ai-lane branch from d5eb0bc to ae647de Compare October 7, 2026 03:56
@eli-r-ph
eli-r-ph force-pushed the v1-capture-invariant-tests branch 6 times, most recently from 44df57f to 2011a51 Compare October 7, 2026 17:43
@eli-r-ph
eli-r-ph force-pushed the v1-capture-async-ai-lane branch from 42c1d07 to 691c8bd Compare October 7, 2026 17:43
@eli-r-ph

eli-r-ph commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@eli-r-ph
eli-r-ph marked this pull request as ready for review October 7, 2026 20:44
@eli-r-ph
eli-r-ph requested a review from a team as a code owner October 7, 2026 20:44

@dustinbyrne dustinbyrne 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.

The test-only hardening looks sound, and existing CI passes for this snapshot. One non-blocking suggestion inline: assert exactly one aggregate loss record in the newly named single-loss-line test.

AI-assisted review.

Comment thread posthog/test/test_async_client.py Outdated
@eli-r-ph
eli-r-ph force-pushed the v1-capture-invariant-tests branch from aac8735 to fd36bd2 Compare October 8, 2026 16:25
@eli-r-ph
eli-r-ph force-pushed the v1-capture-async-ai-lane branch from 691c8bd to 1f784bb Compare October 8, 2026 16:25
@eli-r-ph
eli-r-ph force-pushed the v1-capture-invariant-tests branch from fd36bd2 to d969e0f Compare October 8, 2026 18:13
@eli-r-ph
eli-r-ph force-pushed the v1-capture-async-ai-lane branch from 1f784bb to 04507c0 Compare October 8, 2026 18:13
@eli-r-ph
eli-r-ph force-pushed the v1-capture-invariant-tests branch from d969e0f to 84e195d Compare October 8, 2026 21:12
@eli-r-ph
eli-r-ph force-pushed the v1-capture-async-ai-lane branch from 04507c0 to adf5b16 Compare October 8, 2026 21:12
@eli-r-ph
eli-r-ph force-pushed the v1-capture-invariant-tests branch from 84e195d to e542984 Compare October 8, 2026 22:54
@eli-r-ph
eli-r-ph force-pushed the v1-capture-async-ai-lane branch from adf5b16 to 0cfa23c Compare October 8, 2026 22:54
@eli-r-ph
eli-r-ph force-pushed the v1-capture-invariant-tests branch from e542984 to e34c122 Compare October 8, 2026 23:40
@eli-r-ph
eli-r-ph force-pushed the v1-capture-async-ai-lane branch from 252b30d to 6e1a501 Compare October 10, 2026 23:35
@eli-r-ph
eli-r-ph force-pushed the v1-capture-invariant-tests branch from e34c122 to 5a36573 Compare October 10, 2026 23:35
@eli-r-ph
eli-r-ph force-pushed the v1-capture-async-ai-lane branch from 6e1a501 to 2765967 Compare October 11, 2026 20:17
@eli-r-ph
eli-r-ph force-pushed the v1-capture-invariant-tests branch from 5a36573 to 2663fd0 Compare October 11, 2026 20:17
@eli-r-ph eli-r-ph changed the title test: capture invariant hardening test: cover capture invariants on both lanes Oct 13, 2026
@eli-r-ph
eli-r-ph force-pushed the v1-capture-invariant-tests branch from 2663fd0 to 87217bb Compare October 14, 2026 03:11
@eli-r-ph
eli-r-ph force-pushed the v1-capture-async-ai-lane branch 2 times, most recently from 4cd3a28 to 66b1e17 Compare October 14, 2026 03:47
Base automatically changed from v1-capture-async-ai-lane to v1 October 14, 2026 03:47
@eli-r-ph
eli-r-ph force-pushed the v1-capture-invariant-tests branch from 87217bb to 87ff592 Compare October 14, 2026 03:47
@eli-r-ph
eli-r-ph merged commit 5ec93d0 into v1 Oct 14, 2026
39 checks passed
@eli-r-ph
eli-r-ph deleted the v1-capture-invariant-tests branch October 14, 2026 03:47
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