Designing reliable segmentation with reconciliation
A fictional architecture case: computing the segment is easy; guaranteeing exactly one per eligible account, explicit exits and safe reruns is the design.
Independently created. Contains no employer or client implementation detail, internal names or figures.
01The outcome
Every eligible account has exactly one current segment, every exit is written explicitly, reruns are idempotent, and each run ends with a reconciliation whose differences have owners.
Accounts end up with two segments or none, and campaigns keep targeting accounts that have already recovered.
How does every eligible account get exactly one current segment—and every rerun stay safe?
Publish the full population per period with explicit removals, apply it as an idempotent diff, and reconcile expected against actual membership after every run.
Customers are classified monthly into On Track, Underperforming, At Risk and No Sale from their performance to target. The segment drives recovery tasks in the CRM and campaign membership. The pipeline writes new segments, but never removes old ones, and a rerun after a failure writes some accounts twice.
02The reality · current state
What the data does today.
- Some accounts carry two segments after a rerun
- Accounts with no sales and no target get no segment at all
- Accounts that left the population keep their last segment for months
- Campaigns keep enrolling accounts that already recovered
- Nobody can say which accounts the last run missed
03Target flow
Where the data comes from, where it goes—and how.
Every hand-over is named with its mode. The mode follows the business tolerance for waiting, inconsistency and loss.
- 01 · Data platformEligible populationHands over by Batch
Active accounts with a target or sales history.
- 02 · Data platformSegment computationHands over by Batch
Exactly one segment per eligible account and period.
- 03 · Data platformDiff vs currentHands over by Batch
Entries, changes and removals—keyed by account and period.
- 04 · CRMCRM membershipHands over by Event
Current segment, read-only, with version.
- 05 · Campaign platform · CRMCampaigns & tasks
Enrol, exit and create tasks from membership changes.
04Contracts
What one row or message means.
Meaning, grain, key, freshness and owner—written down before anything is mapped.
Segment membership
The current segment of one eligible account for one period.
- Grain
- Account × period
- Key
Account + period + run version- Freshness
- Monthly, rerunnable
- Owner
- Sales operations
Membership change
An entry, change or removal to apply downstream.
- Grain
- Account × change
- Key
Account + period + change type- Freshness
- Within a day of the run
- Owner
- Data platform team
05Key dimension · Population, removals & idempotent reruns
Expected membership against actual membership
After every run, the published population is compared with what the CRM and campaigns actually hold. Each class of difference has an owner and a repair.
Eligible accounts for the period, as published
| Key | Published | In CRM & campaigns | Outcome |
|---|---|---|---|
ACC-A12 | On Track | On Track | MatchBoth sides agree. |
ACC-B07 | At Risk | Underperforming | DifferenceA rerun applied an older version after the newer one. |
ACC-C33 | Underperforming | — | MissingThe writeback batch stopped half-way. |
ACC-D19 | Not eligible | No Sale | UnexpectedThe account left the population; its removal was never written. |
ACC-E02 | At Risk | At Risk + No Sale | DifferenceTwo memberships: the old one was never closed. |
ACC-F58 | No Sale | No Sale | MatchBoth sides agree. |
- Match
Same account, same segment, same version.
- Owner
- Nobody
- Action
- Record the check.
- Difference
Same account, different segment or version.
- Owner
- Data platform team
- Action
- Re-apply the current version; the upsert by key is idempotent.
- Missing
Published, not present downstream.
- Owner
- Integration operations
- Action
- Replay the missing keys from the run.
- Unexpected
Present downstream, not in the published population.
- Owner
- Data platform team
- Action
- Write the removal; exit campaigns and close tasks.
A zero-segment account and a stale membership are the same failure seen from two sides. Only a full-population comparison sees both.
07Failure & recovery
Design the failure path before the happy path.
- Activation partially succeedsReconciliation: missingReplay the missing keys; nothing else is touchedIntegration operations
- A rerun after a failureSame period, new run versionApply by version; older versions are ignoredData platform team
- An account leaves the populationReconciliation: unexpectedExplicit removal; campaigns exit and tasks closeData platform team
- An eligible account gets no segmentPopulation count vs segmented countFail the run before publishingSales operations
08Candidate architectures
Credible options, judged against these premises.
Recompute and overwrite in the CRM
Small populations that never shrink
Cost: Removals and zero-segment accounts are invisibleKeep segments only in analytics
Segments that inform, not act
Cost: Cannot drive tasks or campaignsFull population, explicit removals, idempotent diff, reconcile
Segments that drive actions
Cost: Needs a run version and a reconciliation step09The second layer
Questions that change the design.
Population
- What is the eligible population?
- How is an account with no segment detected?
- How are removals represented?
Activation
- What happens if activation partially succeeds?
- How are downstream campaigns and tasks kept aligned?
- Which system is authoritative for the current segment?
Reruns & history
- How is rerun idempotency guaranteed?
- How is historical membership retained?
- Who owns each class of difference?
10Decisions & outputs
What the work produces.
- 01Segmentation contract
- 02Eligibility model
- 03Removal semantics
- 04Run versioning & rerun rule
- 05Reconciliation design
- 06Activation state model