System Design Atlas

Waste collection routes and disposal records

10 / 10Worked example

Final design

Which tests verify concurrency protection and collection-route completion in the overall architecture?

The final design reuses the full topology from step 6. Inside the system boundary, the interface calls the collection route API, which accesses route assignments, bin-emptying events and handover records. Device synchronisation reads durable work from that store. The receiving facility is external. Processing receives or sends the business messages described in the main flow, and results reach the interface through the collection route API. The test plan covers concurrency, retries, limits and terminal completion for collection route T-38. The table lists expected results; execution evidence is still outstanding.

Starting point Completion requires an accountable chain of evidence.

Assumptions for the example case

Original fictional example design. A municipal collection service for non-hazardous waste uses its own operational records and confirmed handovers. The illustrative load limit is 10000 kg; additional planned loading is allowed only if total mass remains ≤ 10000 kg. All figures and test targets are illustrative assumptions.

Overall architecture with checks and review loops

Runtime topology

  1. 1 · Vehicle with local journal → Device synchronisation
  2. 2 · Device synchronisation → Collection route API
  3. 3 · Collection route API → Relational assignment store
  4. 4 · Relational assignment store → Record completion
  5. 5 · Receiving facility → Record completion
Vehicle with local journalOffline bin-emptying events
Receiving facilityWeighing and handover record

Route and records system

Collection route APIAssignment and evidence
Relational assignment storeRoute and bin
Device synchronisationDurable deduplication
Record completionJoin collection and receiving paths
Route read modelRecommendations create no emptying records
Vehicle with local journal → Device synchronisationSigned event sequence
Device synchronisation → Collection route APIDeduplicated emptying
Collection route API → Relational assignment storeBin outcome
Receiving facility → Record completionWeighing and handover record
Relational assignment store → Record completionCollection evidence chain
Relational assignment store → Route read modelRebuildable recommendation
Replay 4 · State 5 · Flow 7 · Operations 9Load limit ≤ 10,000 kg

Each emptying takes effect once per bin and route. Completion requires a handover record and resolved discrepancies.

Route planning uses the collection route API and its relational assignment store. The vehicle keeps a local event journal during coverage gaps; device synchronisation accepts reports durably and deduplicates them. The receiving facility separately supplies weighing and handover records. Record completion joins the two evidence paths once the mass discrepancy and every bin outcome have been resolved. Route recommendations remain a read model and create no emptying records. Components and arrows match step 6. Test markers link API/commit to concurrency and replay (4/5/7), limit validation to the exact boundary (2), and the domain role/completion to terminal evidence (9).

Test plan for the complete design

ComponentTest and expected resultReturn to an earlier step
Collection route APITwo devices report the same route-and-bin work order: in either order, exactly one emptying is accepted. Conflicting content creates an investigation case instead of a second emptying.Steps 3 and 5
Command journalIdentical retries take effect once; changed content produces a conflict.Steps 4 and 7
Domain boundary checkTest 9999, 10000 and 10001 kg. Expected result: the illustrative load limit is 10000 kg; additional planned loading is allowed only if total mass remains ≤ 10000 kg.Step 2
Route assignments, bin-emptying events and handover recordsAfter abgeschlossen, replay increases neither the count nor the mass. New conflicting evidence opens a linked correction case and leaves the completion record unchanged.Steps 5 and 9
Device synchronisationThe device sends a locally stored bin-emptying record. The collection route API checks the route-and-bin assignment and event identity, then acknowledges only after commit. A second report with a different mass is stored as a discrepancy; the receiving facility later confirms the actual total load.Steps 6 and 7

Collection route API

Test and expected result
Two devices report the same route-and-bin work order: in either order, exactly one emptying is accepted. Conflicting content creates an investigation case instead of a second emptying.
Return to an earlier step
Steps 3 and 5

Command journal

Test and expected result
Identical retries take effect once; changed content produces a conflict.
Return to an earlier step
Steps 4 and 7

Domain boundary check

Test and expected result
Test 9999, 10000 and 10001 kg. Expected result: the illustrative load limit is 10000 kg; additional planned loading is allowed only if total mass remains ≤ 10000 kg.
Return to an earlier step
Step 2

Route assignments, bin-emptying events and handover records

Test and expected result
After abgeschlossen, replay increases neither the count nor the mass. New conflicting evidence opens a linked correction case and leaves the completion record unchanged.
Return to an earlier step
Steps 5 and 9

Device synchronisation

Test and expected result
The device sends a locally stored bin-emptying record. The collection route API checks the route-and-bin assignment and event identity, then acknowledges only after commit. A second report with a different mass is stored as a discrepancy; the receiving facility later confirms the actual total load.
Return to an earlier step
Steps 6 and 7

First end-to-end test and outstanding evidence

End-to-end path
Test duplicate reports and a different accepted mass end to end. The device sends a locally stored bin-emptying record. The collection route API checks the route-and-bin assignment and event identity, then acknowledges only after commit. A second report with a different mass is stored as a discrepancy; the receiving facility later confirms the actual total load.
Clarify before extending the scope
Agree the real contract with the receiving facility, retention periods, recovery targets and assigned roles. Every limit here is a design assumption. The evidence table describes tests to execute; technical integration, browser checks and comprehension checks with readers follow separately.

Test duplicate reports and a different accepted mass end to end

Test duplicate reports and a different accepted mass end to end

Test duplicate reports and a different accepted mass end to end.

A collection vehicle records bin emptying while offline. When it reconnects, reports arrive twice and out of order. Completion requires technical and business evidence.

Two devices report the same route-and-bin work order: in either order, exactly one emptying is accepted. Conflicting content creates an investigation case instead of a second emptying. The exercise specifies the input and expected result.

Alternative considered
An initial end-to-end path limited to lists and forms postpones the critical state checks.
Trade-off
The first end-to-end path needs controlled concurrency and failure points.
Reassess
Passing the counterexample tests and checks with readers provides grounds for extending the case.

Try it yourself

Choose two architectural decisions: concurrency protection and evidence-backed completion. For each, name the test, expected result and step to revisit.

A hint for your attempt

Link the markers of the overall architecture with the associated design steps.

Compare with a possible solution
Concurrency control
Two devices report the same route-and-bin work order: in either order, exactly one emptying is accepted. Conflicting content creates an investigation case instead of a second emptying. The invariant must hold: each confirmed emptying takes effect once for the same bin and route work order, and route completion requires documented handover status and resolved discrepancies. A failure leads back to step 5 and the command contract in step 4.
Test completion and retries
Starting point: a completed route has a confirmed emptying with documented mass and handover evidence. Replay the identical emptying record twice, then submit a new conflicting record for the same route-and-bin work order. Expected result: the completed count and mass remain unchanged; replay returns the same record; the discrepancy creates a linked correction case. The historical completion record is preserved. Failures lead back to step 9 for responsibility and step 7 for the failure sequence.

Apply to your project

Which two counterexample tests will you run first in your own end-to-end implementation?

Transfer the architecture and counterexamples to the editable Markdown 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

    Which evidence for a collection route would originate outside the application in your own project?

    In the example: Emptying and handover have separate records. A fictional municipal collection service for non-hazardous waste, with its own operational records and confirmed handover.

  2. Requirements

    Which rule of your project remains binding even with slow processing?

    In the example: Planned mass and actual accepted mass remain separate. The illustrative load limit is 10000 kg; additional planned loading is allowed only if total mass remains ≤ 10000 kg.

  3. Scale estimates

    Which individual object concentrates more load than the daily average suggests in the collection and handover workflow?

    In the example: Reconnection determines peak processing load. An average of 1.66667 events/s says little about 1000 offline reports from one vehicle after reconnection.

  4. Interfaces

    Which input fields make two change intentions different in your project?

    In the example: A device event identifies its route and bin. The route, bin, device event, action time and reported mass must remain identical on replay.

  5. Data and states

    Which states must remain protected in your model against late replay?

    In the example: Each route-and-bin work order records one effective emptying. After abgeschlossen, replay increases neither the count nor the mass. New conflicting evidence opens a linked correction case and leaves the completion record unchanged.

  6. Overall architecture

    Which planned service boundary would distribute a currently local guarantee across the network?

    In the example: Synchronisation is separate from finalising the evidence. Route assignments, bin-emptying events and handover records must express the same valid state.

  7. Critical flow

    What feedback could be missing even though the underlying action has already taken place?

    In the example: Acknowledgement follows durable acceptance of the emptying record. Each confirmed emptying takes effect once for the same bin and route work order; route completion requires documented handover status and resolved discrepancies.

  8. Bottlenecks and trade-offs

    Which similar display could have two different causes in your project?

    In the example: Mass discrepancies and coverage gaps require different checks. A large synchronisation backlog may indicate a coverage gap or server load. Mass discrepancies concern weighing and allocation records. These causes receive separate investigation lists.

  9. Operations and security

    Which open state in your project needs a domain specialist as well as technical operations?

    In the example: Completion requires an accountable chain of evidence. After abgeschlossen, replay increases neither the count nor the mass. New conflicting evidence opens a linked correction case and leaves the completion record unchanged.

  10. Final design

    Which two counterexample tests will you run first in your own end-to-end implementation?

    In the example: Test duplicate reports and a different accepted mass end to end. Two devices report the same route-and-bin work order: in either order, exactly one emptying is accepted; conflicting content creates an investigation case instead of a second emptying.