feat(Segment Membership): Seed identities on Beta opt-in#7899
Draft
khvn26 wants to merge 11 commits into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Run seed tests against live ClickHouse with a mocked Dynamo source, inline the pending-task check, assert the whole skip event, use the ClickHouseIdentityRow type, and replace the management command with a Django admin re-seed action that clears the seed marker. beep boop Claude-Session: https://claude.ai/code/session_01EgZ5iHpDASZzCapiHRxHLB
for more information, see https://pre-commit.ci
khvn26
commented
Jun 27, 2026
khvn26
commented
Jun 27, 2026
khvn26
commented
Jun 27, 2026
…t-in Replace the daily all-org backfill with an on-demand seed_organisation_identities(organisation_id) task and a lightweight reconcile_segment_membership_seeds tick that fires it once per opted-in org, tracked by a SegmentMembershipSeed marker. Seeded rows are versioned at scan start so a CDC write landing mid-scan wins ReplacingMergeTree dedup. Keep a count-refresh safety-net as a separate recurring refresh_all_segment_counts task (cadence via SEGMENT_MEMBERSHIP_REFRESH_INTERVAL_HOURS, default 6) so cached counts track CDC identity churn between segment edits. All refresh enqueues - edit-triggered, seed fan-out, and the recurring sweep - route through enqueue_membership_refresh, the single flag and debounce gate, so a project never has duplicate refreshes queued. Add a Django admin action to force a re-seed by clearing the marker. beep boop Claude-Session: https://claude.ai/code/session_01EgZ5iHpDASZzCapiHRxHLB
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7899 +/- ##
========================================
Coverage 98.62% 98.62%
========================================
Files 1487 1490 +3
Lines 58493 58637 +144
========================================
+ Hits 57687 57831 +144
Misses 806 806 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… lines beep boop Claude-Session: https://claude.ai/code/session_01EgZ5iHpDASZzCapiHRxHLB
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.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Closes #7471.
In this PR, we convert
backfill_identities_to_clickhouseto a seed backfill expected to run once per org.seed_organisation_identities(org_id)— on-demand one-shot seed for one org. Stampsinserted_atat scan start so a CDC write landing mid-scan wins ReplacingMergeTree dedup.reconcile_segment_membership_seeds(hourly) — fires the seed once per allowed org, tracked bySegmentMembershipSeedmodel.refresh_all_segment_countsevery 6 hours.SegmentMembershipSeedfor a given org).All tasks that run the expensive ClickHouse queries are debounced.
Review complexity: 2/5.
How did you test this code?
Added new tests and modified existing where needed; will test extensively in staging.