Repository navigation
Conversation
This was referenced Oct 7, 2026
eli-r-ph
force-pushed
the
v1-capture-async-ai-lane
branch
from
October 7, 2026 03:56
d5eb0bc to
ae647de
Compare
eli-r-ph
force-pushed
the
v1-capture-invariant-tests
branch
6 times, most recently
from
October 7, 2026 17:43
44df57f to
2011a51
Compare
eli-r-ph
force-pushed
the
v1-capture-async-ai-lane
branch
from
October 7, 2026 17:43
42c1d07 to
691c8bd
Compare
Contributor
Author
|
@greptileai review |
eli-r-ph
marked this pull request as ready for review
October 7, 2026 20:44
dustinbyrne
approved these changes
Oct 7, 2026
dustinbyrne
left a comment
Contributor
There was a problem hiding this comment.
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.
eli-r-ph
force-pushed
the
v1-capture-invariant-tests
branch
from
October 8, 2026 16:25
aac8735 to
fd36bd2
Compare
eli-r-ph
force-pushed
the
v1-capture-async-ai-lane
branch
from
October 8, 2026 16:25
691c8bd to
1f784bb
Compare
eli-r-ph
force-pushed
the
v1-capture-invariant-tests
branch
from
October 8, 2026 18:13
fd36bd2 to
d969e0f
Compare
eli-r-ph
force-pushed
the
v1-capture-async-ai-lane
branch
from
October 8, 2026 18:13
1f784bb to
04507c0
Compare
eli-r-ph
force-pushed
the
v1-capture-invariant-tests
branch
from
October 8, 2026 21:12
d969e0f to
84e195d
Compare
eli-r-ph
force-pushed
the
v1-capture-async-ai-lane
branch
from
October 8, 2026 21:12
04507c0 to
adf5b16
Compare
eli-r-ph
force-pushed
the
v1-capture-invariant-tests
branch
from
October 8, 2026 22:54
84e195d to
e542984
Compare
eli-r-ph
force-pushed
the
v1-capture-async-ai-lane
branch
from
October 8, 2026 22:54
adf5b16 to
0cfa23c
Compare
eli-r-ph
force-pushed
the
v1-capture-invariant-tests
branch
from
October 8, 2026 23:40
e542984 to
e34c122
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
posthog-go and posthog-rs found a set of capture invariants the hard way: a data race on enqueue during close, a pass-through hook that changed the wire, a size guard that refused events the endpoint accepts. This PR checks the Python stack against each one, and adds tests only where no existing test fails on the regression.
Changes
Tests only. No library code changes. Each invariant, and where it is covered:
before_sendleaves the wire unchanged (null option falls back to its legacy property, empty containers stay empty, nested maps survive)test_capture_invariants.py, sync and async, both lanestest_shutdown_waits_for_racing_enqueue_before_drainingnow runs on both lanes and asserts delivery and no live consumers. The async cross-thread admission test adds acapture_aicase that must start no AI workerssync_mode,capture_ai_immediateand the async queued lane, plus an over-guard casesync_modeand async tests now cover all four capture methods and assert the endpointTestLaneForkRebuild(both lanes,sync_mode)capture_ai_max_event_bytesvalidation is already tested💚 How did you test it?
Break-on-purpose, one mutation per invariant, each restored afterwards:
_closedunder the lock and puts outside it: both racing cases fail.capture_aiadmission case fails.One mutation was not caught:
_Lane.close()setting_closedwithout the lock. Shutdown still waits on that lock throughwait_for_sync_sends, so the race does not occur, and I did not add a test for it.📝 Checklist
If releasing new changes
sampo addto generate a changeset fileTests only; no changeset.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Cursor (Claude Opus) under the direction of the assignee. Skills used:
writing-tests,writing-pr-descriptions.Agent calls worth review: