Repository navigation
fix(integrations): align tracing-header capture across frameworks - #1061
dustinbyrne wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Not approved — this change needs a human reviewer.
Re-adding the stamphog label gives the same result unless the changed files change.
stamphog won't auto-review this pull request because two gates refused it. The deny-list gate flagged it for touching public_api, which here is the references/public_api_snapshot.txt update and the new capture_tracing_headers and POSTHOG_MW_CAPTURE_TRACING_HEADERS options. The tier gate classified it as T2-never because it is a cross-cutting fix (623 lines across 12 files, touching the ASGI, Django and Flask integrations together). The size gate passed, so the refusal is about the public API surface and the cross-cutting scope, not the line count.
Please ask a human reviewer to look at it, since the PR description already notes that human review is required. If you want it to be easier to review, you could split the shared _tracing_headers.py helper and the per-framework changes into separate pull requests, and keep the public API and default-behavior change on its own.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✗ | matches: public_api |
| size | ✓ | 262L, 4F substantive, 623L/12F incl. docs/generated/snapshots — within ceiling |
| tier | ✗ | classified as T2-never: T2-never (623L, 12F, cross-cutting, fix) |
| stamphog 2.5.1 | .stamphog/policy.yml @ unknown · reviewed head 1432df6 |
posthog-python Compliance ReportDate: 2026-10-14T18:27:44.065459+00:00 ✅ All Tests Passed!121/121 tests passed Capture_V1 Tests✅ 95/95 tests passed View Details
Capture_Ai Tests✅ 5/5 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
Feature_Flags_Local_Evaluation Tests✅ 4/4 tests passed View Details
|
💡 Motivation and Context
Restore browser-to-backend attribution without requiring a second opt-in after installing a request integration, and align Python's configuration with server SDK peers.
capture_tracing_headersfor ASGI/Flask andPOSTHOG_MW_CAPTURE_TRACING_HEADERSfor Django, enabled by default once installed.$session_idproperties authoritative. Preserve Django's existing authenticated-user fallback and request-context lifecycle/privacy behavior.Compared current Node, Ruby/Rails, PHP, Go, Java, .NET, Elixir and Rust implementations against the tracing-header specification. The spec permits default-on server extraction after middleware installation and does not prescribe one server option name. Peer authentication policies differ, so this change preserves Python's existing identity precedence rather than changing it incidentally. Tracing IDs remain analytics context, never authentication or authorization evidence.
Compatibility/release: The effective default becomes enabled for all three integrations; applications that omit the options will now consume attribution headers. Explicit
Falseremains an opt-out. Includes a minor Sampo changeset, configuration docs and public API snapshot updates. The generatedposthoganalyticsmirror receives the same behavior.💚 How did you test it?
posthogmodule.distinct_id,$session_idand personless properties; no wire-format changes.📝 Checklist
If releasing new changes
sampo addto generate a changeset file.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented using Pi with read-only scout/reviewer subagents, uv, pytest, Ruff, mypy and GitHub CLI. Peer comparison and simplification preceded the independent pre-PR review. The integration layer handles sanitized request attribution; the existing capture pipeline remains responsible for explicit-value precedence. Human review is required before merging.