You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(ssf): add token processing and remote discovery - #132006
This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.
✅ Duplication (Python) — clean
New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.
✅ Duplication (TypeScript) — clean
New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.
We've analyzed your migrations for potential risks.
Summary: 2 Safe | 0 Needs Review | 1 Blocked
❌ Blocked
Causes locks or breaks compatibility
posthog.1412_ssf_connections
│ └─ #1 ⚠️ AddField
│ Adding NOT NULL field with callable default (list) - verify it's stable
│ model: ssfstream, field: audiences, default: list
│ └─ #2 ✅ AddField
│ Adding NOT NULL field with constant default (safe in PG11+)
│ model: ssfstream, field: endpoint_url
│ └─ #3 ⚠️ AddField
│ Adding NOT NULL field with callable default (list) - verify it's stable
│ model: ssfstream, field: events_delivered, default: list
│ └─ #4 ✅ AddField
│ Adding NOT NULL field with constant default (safe in PG11+)
│ model: ssfstream, field: last_error
│ └─ #5 ✅ AddField
│ Adding nullable field requires brief lock
│ model: ssfstream, field: last_verified_at
│ └─ #6 ✅ AddField
│ Adding nullable field requires brief lock
│ model: ssfstream, field: operation_until
│ └─ #7 ✅ AddField
│ Adding nullable field requires brief lock
│ model: ssfstream, field: receiver_token
│ └─ #8 ✅ AddField
│ Adding NOT NULL field with constant default (safe in PG11+)
│ model: ssfstream, field: receiver_token_hash
│ └─ #9 ✅ AddField
│ Adding NOT NULL field with constant default (safe in PG11+)
│ model: ssfstream, field: remote_stream_id
│ └─ #10 ✅ AddField
│ Adding nullable field requires brief lock
│ model: ssfstream, field: retry_at
│ └─ #11 ✅ AddField
│ Adding nullable field requires brief lock
│ model: ssfstream, field: verification_requested_at
│ └─ #12 ✅ AddField
│ Adding nullable field requires brief lock
│ model: ssfstream, field: verification_state
│ └─ #13 ⚠️ AlterField
│ Field alteration may cause table locks or data loss (check if changing type or constraints)
│ model: ssfevent, field: stream, field_type: ForeignKey
│ └─ #14 ⚠️ AlterField
│ Field alteration may cause table locks or data loss (check if changing type or constraints)
│ model: ssfstream, field: status, field_type: CharField
│ └─ #15 ✅ CreateModel
│ Creating new table is safe
│ model: SSFConnection
│ └─ #16 ✅ AddField
│ Adding nullable field requires brief lock
│ model: ssfstream, field: connection
│ └─ #17 ⚠️ AddConstraint
│ Adding constraint may lock table (use NOT VALID pattern)
│ model: ssfstream
│ └─ #18 ⚠️ RunPython: RunPython data migration needs review for performance
│
└──> ℹ️ INFO:
ℹ️ Skipped operations on newly created tables (empty tables
don't cause lock contention).
│
└──> �[91m⚠️ COMBINATION RISKS:�[0m
❌ BLOCKED: #18 RunPython + #1 AddField, #2 AddField, #3 AddField,
#4 AddField, #5 AddField, #6 AddField, #7 AddField, #8 AddField,
#9 AddField, #10 AddField, #11 AddField, #12 AddField, #13
AlterField, #14 AlterField, #15 CreateModel, #16 AddField, #17
AddConstraint RunPython data migration combined with schema
changes. Data migrations can hold locks during execution,
especially on large tables. Split into separate migrations: 1)
schema changes, 2) data migration.
✅ Safe
Brief or no lock, backwards compatible
posthog.1411_ssf
└─ #1 ✅ CreateModel
Creating new table is safe
model: SSFConfiguration
└─ #2 ✅ CreateModel
Creating new table is safe
model: SSFStream
└─ #3 ✅ CreateModel
Creating new table is safe
model: SSFEvent
│
└──> ℹ️ INFO:
ℹ️ Skipped operations on newly created tables (empty tables
don't cause lock contention).
posthog.1413_ssf_connection_transmitter_url
└─ #1 ✅ AddField
Adding NOT NULL field with constant default (safe in PG11+)
model: ssfconnection, field: transmitter_url
📚 How to Deploy These Changes Safely
AddConstraint:
Add constraints in 2 phases without locking, using the PostHog helpers:
AddConstraintNotValid (instant, validates new rows only, no table scan)
ValidateConstraint in a separate migration (scans table with non-blocking lock)
from posthog.migration_helpers import AddConstraintNotValid, ValidateConstraint
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the stale label – otherwise this will be closed in another week. If you want to permanently keep it open, use the waiting label.
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
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.
Problem
Reviewers need smaller diffs to assess the SSF implementation in #123731.
Changes
Add security event token signing and validation, polling, subject matching, remote discovery and serializers. Routes arrive in subsequent layers.
Part 2 of seven. Previous: #132005. Next: #132007. Parts 1–4 form the backend stack; parts 5–7 form a second stack based on #132008.
How did you test this code?
The combined tree exactly matches #123731 at
98c422d. Commit hooks and whitespace checks passed. Runtime tests and visual verification remain pending.Test rationale: Preserve the original tests and assertions; no new coverage accompanies this mechanical split.
Release status
Docs update
No documentation behavior changed during this split.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Codex, GPT-6. Original implementation by ReeceJones; the agent redistributed unchanged files.
Skills: /stacking-prs, /writing-pr-descriptions, /improving-drf-endpoints, /routing-outbound-api-calls, /writing-code-comments, /writing-user-facing-copy, /verifying-changes.
The original base is retained. Rebase conflicts with current master and full validation remain outstanding before review readiness.