Repository navigation
fix(shifts): persist per-shift assignments and unify effective roster resolution - #216
Draft
theosiemensrhodes wants to merge 4 commits into
Draft
theosiemensrhodes wants to merge 4 commits into
theosiemensrhodes wants to merge 4 commits into
Conversation
theosiemensrhodes
marked this pull request as draft
November 23, 2026 20:18
This was referenced Nov 23, 2026
Signed-off-by: Theo Siemens-Rhodes <112789743+theosiemensrhodes@users.noreply.github.com>
Signed-off-by: Theo Siemens-Rhodes <112789743+theosiemensrhodes@users.noreply.github.com>
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.
Problem
Shift rosters were rebuilt from current schedule membership, so later schedule edits changed historical rosters and hid attendance. Reminder, cancellation, and coverage eligibility queries also disagreed about substitutions.
Change
Persist per-shift volunteer and instructor base assignments. Schedule roster edits update only future, non-canceled shifts, retaining early attendance and slots already transferred to covering volunteers. Shift reads, visibility, reminders, cancellation audiences, and overlapping coverage eligibility share the effective volunteer rule:
base + resolved incoming coverage - resolved outgoing coverage > 0. Open and withdrawn requests do not transfer membership.Decision: choose per-shift snapshots over effective-dated schedule assignments because shifts are already materialized on publication. This preserves existing join-table keys and avoids interval splitting/range joins; resolved coverage remains the substitution source. The shared queries accept database transactions for coverage-transition callers. Hydration reuses loaded coverage records, conflict checks reuse the SQL membership predicate, and schedule removal withdraws obsolete requests in one query. Shift creation persists the shift and its snapshots atomically; early check-in locks the shift and rechecks membership before inserting attendance. Coverage labels describe remaining net incoming slots. Re-adding a released base member preserves the accepted substitute on that occurrence rather than granting a second slot.
Verification
Deployment notes
Apply
0013_add_shift_assignments.sqlbefore deploying the updated services. It creates assignment tables and backfills from current schedules, attendance, and resolved coverage origins. Membership erased before this migration without attendance or coverage evidence cannot be recovered; historical membership inferred from current schedules is necessarily approximate. Legacy data can also leave original base membership indistinguishable from coverage followed by a schedule addition; request creation order is a reconstruction heuristic, not fulfillment chronology.Coverage transition atomicity and the existing unassign operation's transfer-history mutation remain follow-up work. This PR supplies the shared assignment contract for that work.