Reconcile affiliation dates
What It Does
Date reconciliation settles effects of affiliation and role boundaries that pass without a person opening the record. When Ruth’s future employment begins, current interpretation changes on the workspace day; roles, chosen defaults and organizational assessments may then need persisted work. The flow also covers missed days from its recorded calendar cursor.
Our reading is that classification and settlement must stay distinct. A read can identify a current tie before every pending effect has been processed. Bounded passes, locks and deployment configuration therefore matter to the visible outcome, and a settled compliance window does not prove that all shared-link backlog is empty.
What Starts It
An enabled scheduled date pass runs after a workspace day boundary, or an authorized user requests reconciliation directly.
The system selects eligible work using the workspace calendar and pending or cursor state. Operational lifecycle and deployment conditions described in the hop contract determine whether a scheduled pass reaches it. A scheduled invocation begins an attempt; the observable result comes from the writes it actually commits.
The Flow
The diagram shows the sequence and service seams. Each synchronous stage waits for its result, while captured-event, queue and scheduled stages can run after the originating request has returned. The hop descriptions below identify the write and failure boundary, so the last arrow must not be mistaken for one atomic transaction across every participant.
Hop by Hop
1. Job reconciler (crm_job_reconciler)
The job reconciler invokes date settlement only when its deployment switch enables this path. A scheduled interval is an opportunity to attempt work rather than an unconditional guarantee that every workspace is settled. Other reconciler steps and their failures have their own boundaries.
2. Date reconciliation sweep
The sweep visits operational workspaces and constructs each date window from the timezone and forward-only cursor. A failed workspace pass is logged while later workspaces can still proceed. Identity ordering and the overall time budget mean unvisited workspaces wait for another attempt.
3. Automatic role reconciliation
Automatic-role settlement processes due contacts in bounded batches, with each contact transaction deciding and recording its own assignments. A failed or fully locked contact can remain pending while another contact succeeds. The date pass reports the roles it gives and any responsibilities excluded by type policy.
4. Default link reconciliation
Default-link settlement uses the saved choices from future affiliations now eligible. It fills supported empty destinations rather than replacing the person’s existing independent details. Locks, failures and bounded work can leave mappings pending even though effective interpretation already includes the relationship.
5. Compliance recalculation
The compliance stage scans governed organizations affected by date boundaries and reevaluates them under ordinary notice rules. Successful subjects commit independently. Failed subjects or remaining budget work prevent the compliance window from being declared settled, so the next pass can revisit the incomplete interval.
6. Date reconciliation
The final stage persists the forward date cursor only after the compliance scan reports no failure or remainder. It creates settings only for an operational workspace. This cursor measures that scan’s completion, not every pending role or default-link queue; its apparent progress must not conceal other backlog.
When Something Fails
Hop 1 — Job reconciler (crm_job_reconciler)
The failure boundary is: Log step failure and leave another scheduled pass to try. The remaining work or data is: With the switch disabled, date-only effects require a save, manual pass or another appropriate trigger. Job reconciler logs expose enabled work and failures. A later attempt can be required; the scheduling or publication boundary does not establish an immediate user-visible completion.
Hop 2 — Date reconciliation sweep
The failure boundary is: Log a caught workspace pass failure and continue. The remaining work or data is: The failed workspace retains its unsettled date window. Workspace reconciliation logs show outcomes.
Hop 3 — Automatic role reconciliation
The failure boundary is: Roll back failed contact work and retain its pending marker. The remaining work or data is: Successful contacts are settled while others can remain due. Per-change logs and contact revisions show role assignment.
Hop 4 — Default link reconciliation
The failure boundary is: Roll back failed contact work, retaining pending mappings. The remaining work or data is: Some default links may remain pending because of failures, locks or the batch limit. Contact revisions and change logs show applied links.
Hop 5 — Compliance recalculation
The failure boundary is: Count failed organizations and prevent compliance-window settlement. The remaining work or data is: Completed recalculations remain while failed or unvisited organizations are stale. Result counts and logs expose incomplete compliance scanning.
Hop 6 — Date reconciliation
The failure boundary is: Leave the watermark unchanged if persistence fails. The remaining work or data is: Bounded role or default-link backlog can still remain despite an advanced watermark. The result reports settled or incomplete date-window status.
Repeats and Races
The next window starts after the stored cursor and includes missed calendar boundaries. Role and default-link markers prevent successful settled work from being restored on every pass; unchanged compliance avoids another write. Failed compliance leaves the window open, while bounded contact work can remain pending even after that window advances.
Contact and affiliation locks order settlement against editing, and organization locks order assessments. A manual operation requires contact bulk authority and normally uses twenty seconds. Dry run rolls back database work but still takes real locks and can leave external request objects, so it is not a purely read-only simulation.
What Is Observable
Job reconciler logs expose enabled work and failures. Workspace reconciliation logs show outcomes. Per-change logs and contact revisions show role assignment. Contact revisions and change logs show applied links. Result counts and logs expose incomplete compliance scanning. The result reports settled or incomplete date-window status.
Contact revisions identify successful system changes. Pass results and logs report actual work and failures; a pending marker or an open date window explains why later work remains. Reading effective dates does not establish that a worker reached the record or that every resulting notice was delivered.
Open Design Questions
The watermark’s relationship to bounded pending-link work remains an existing finding. Deployment-switch state and future backlog recovery deadlines are not established by the source alone. Dry-run rollback also does not undo external object storage. The specification preserves those limits instead of describing an exactly-at-midnight guarantee.