System Design Atlas

Shift planning with qualifications and time tracking

10 / 10Worked example

Final design

The end-to-end test includes deviations from the plan. Which conditions ensure a valid result?

Testing only times that match the plan hides offline risks.

Starting point A new correction references the original entry and the reason.

Assumptions for the example case

A fictional maintenance operation with a defined qualification for each shift. The example requires 11 hours of rest between planned shifts; this is an exercise assumption and does not replace an employment-law review. All quantities, thresholds and operational objectives are illustrative assumptions.

Shift-planning architecture with test markers

Planning API and synchronization

Scheduling interfaceShifts
Offline applocal buffers
Scheduling APIEligibility + commands
Relational datastorePlan · Time records · Inbox
Synchronization workerAssigning device events
Qualification registerVersioned Q-47
Scheduling interface → Scheduling APIShift command
Offline app → Scheduling APIAuthenticated submission
Scheduling API → Relational datastorePlan + event inbox
Relational data store → synchronization workeraccepted device events
Synchronisation worker → Relational datastoreAssign time records
Scheduling API → Qualification registerVersioned Q-47
Qualification register → Scheduling APIValidity end

The interface and offline app use the authenticated API endpoint; planning and time records remain separate modules sharing a datastore.

Reuse the topology from step 6: Mark the 11 h rule at eligibility checks, contention at the datastore and replay at synchronisation; link back to steps 2, 4 and 5.

Test plan with expected outcomes

Input and initial stateExpected resultReturn to an earlier step
P-47 available → confirm two overlapping shifts in orders A/B and B/AExactly one confirmed; other conflict.Step 5
B-47 saved → Identical, then occurredAt changeOne time entry remains; changing it causes a conflict. A correction is a separate operation.Step 4
Previous shift ends 16:00 → Next start 02:59:59 /03:00:00 /03:00:01 Next dayOnly the first violates the 11 h rest period; qualification valid until 15:59:59 is insufficient, until 16:00 is sufficient.Step 2
Shift cancelled, real work reported → Import offline booking and checkWork remains preserved and in clarification; cancellation does not erase any actual time.Step 5/9

P-47 available → confirm two overlapping shifts in orders A/B and B/A

Expected result
Exactly one confirmed; other conflict.
Return to an earlier step
Step 5

B-47 saved → Identical, then occurredAt change

Expected result
One time entry remains; changing it causes a conflict. A correction is a separate operation.
Return to an earlier step
Step 4

Previous shift ends 16:00 → Next start 02:59:59 /03:00:00 /03:00:01 Next day

Expected result
Only the first violates the 11 h rest period; qualification valid until 15:59:59 is insufficient, until 16:00 is sufficient.
Return to an earlier step
Step 2

Shift cancelled, real work reported → Import offline booking and check

Expected result
Work remains preserved and in clarification; cancellation does not erase any actual time.
Return to an earlier step
Step 5/9

End-to-end test and unresolved agreements

First end-to-end path
Confirm a shift with its qualification, test concurrency and the rest-period boundary, import offline times twice and resolve deviations from the plan through domain review.
Clarify before real use
Review actual working-time, privacy, collective-agreement and employee-participation rules, as well as time-zone handling, with operational and legal specialists.

The end-to-end test includes deviations from the plan.

The end-to-end test includes deviations from the plan.

Test a cancelled shift with work actually performed.

Testing only times that match the plan hides offline risks.

The eligibility check accepts exactly 11 h; revisit step 2. Synchronisation preserves one time entry; revisit steps 4 and 7.

Alternative considered
Happy Path does not provide proof.
Trade-off
Test needs separate plan and actual events.
Reassess
Further rules follow after proof.

Try it yourself

Identify the steps to revisit for rest-period and replay failures.

A hint for your attempt

Testing only times that match the plan hides offline risks.

Compare with a possible solution
Rest period
The eligibility check accepts exactly 11 h; revisit step 2.
Replay
Synchronisation preserves one time entry; revisit steps 4 and 7.

Apply to your project

How does this principle apply in your own project: The end-to-end test includes deviations from the plan.

Transfer the decisions and their counterexamples to the editable design template.

Start your own design

Choose a small case from your project. The template collects the ten design tasks and leaves space for your sketches, decisions, and open assumptions. You can edit it in your text editor or note-taking app.

Download design template (.md)
Compare the ten tasks with the example case
  1. Purpose and boundary

    How does this principle apply in your own project: Planned and actual work answer different questions.

    In the example: Actual working times are preserved independently.

  2. Requirements

    How does this principle apply in your own project: Qualifications must cover the entire shift.

    In the example: Validity through and including 16:00 is required.

  3. Scale estimates

    How does this principle apply in your own project: Check rest periods as time differences.

    In the example: UTC instants make the time difference unambiguous.

  4. Interfaces

    How does this principle apply in your own project: Offline identifiers preserve the time entry.

    In the example: Device and event identifiers form the deduplication key.

  5. Data and states

    How does this principle apply in your own project: Cancellation does not erase work performed.

    In the example: The time account remains independent.

  6. Overall architecture

    How does this principle apply in your own project: One datastore supports two domain modules.

    In the example: The modules remain separate within the relational datastore.

  7. Critical flow

    How does this principle apply in your own project: Resolve concurrency when confirming.

    In the example: Commit interval and rest-period checks together with the allocation.

  8. Bottlenecks and trade-offs

    How does this principle apply in your own project: A synchronisation backlog does not establish that no work was done.

    In the example: Measure device data age and event gaps.

  9. Operations and security

    How does this principle apply in your own project: Corrections remain auditable.

    In the example: A new correction references the original entry and the reason.

  10. Final design

    How does this principle apply in your own project: The end-to-end test includes deviations from the plan.

    In the example: Test a cancelled shift with work actually performed.