Final design
The end-to-end test finishes with renewed availability. Which conditions establish completion?
Issuance alone does not test the return path.
Starting point Block affected copies until reconciliation.
Assumptions for the example case
A fictional library with one licensed copy and reading devices that verify entitlements online. Every new read checks the current entitlement; offline use is outside the scope. All quantities, thresholds and operational targets in this design are illustrative assumptions.
Loan architecture with evidence
Index alongside licence state
The index estimates availability; the API and licence datastore decide allocation; online reads check entitlements through the same API.
Test plan with expected outcomes
| Input and initial state | Expected result | Return to an earlier step |
|---|---|---|
| X-52 available → concurrent allocation attempts by readers A/B and B/A | One winner, the other receives unavailable; exactly one allocation. | Step 5 |
| A-52 allocated → identical replay; a different reader under the same key | The same loan is returned; changed replay content produces a conflict. | Step 4 |
| Expiration=D-52 → now=D-52−1 ms /D-52 /D-52+1 ms | Access at the first instant is allowed while Active; access at the other instants is denied; the copy becomes available once. | Step 2 |
| Return pending → lose the response, attempt another loan, confirm revocation twice | No reallocation before evidence arrives; then available once; duplicate confirmation has no additional effect. | Step 7/9 |
X-52 available → concurrent allocation attempts by readers A/B and B/A
- Expected result
- One winner, the other receives unavailable; exactly one allocation.
- Return to an earlier step
- Step 5
A-52 allocated → identical replay; a different reader under the same key
- Expected result
- The same loan is returned; changed replay content produces a conflict.
- Return to an earlier step
- Step 4
Expiration=D-52 → now=D-52−1 ms /D-52 /D-52+1 ms
- Expected result
- Access at the first instant is allowed while Active; access at the other instants is denied; the copy becomes available once.
- Return to an earlier step
- Step 2
Return pending → lose the response, attempt another loan, confirm revocation twice
- Expected result
- No reallocation before evidence arrives; then available once; duplicate confirmation has no additional effect.
- Return to an earlier step
- Step 7/9
End-to-end test and unresolved agreements
- First end-to-end path
- Compete for the last copy, lose the licensing response, reconcile a return and test the expiry boundary with online reads.
- Clarify before real use
- Real licensing terms, offline rights, ongoing reading sessions and revocation require their own contracts. This model covers only newly authorised online reads.
The end-to-end test finishes with renewed availability.
Test returns and expiry separately.
Issuance alone does not test the return path.
One winner for X-52; revisit step 5 on failure. Release only after evidence arrives; revisit steps 4 and 7 on failure.
- Alternative considered
- Testing only the happy path overlooks copies stuck in allocation.
- Trade-off
- The test requires a controlled clock and service failures.
- Reassess
- Extend to further licence types after these tests pass.
Try it yourself
Map last-copy allocation and returns to the relevant earlier steps.
A hint for your attempt
Issuance alone does not test the return path.
Compare with a possible solution
- Concurrency
- One winner for X-52; revisit step 5 on failure.
- Return
- Release only after evidence arrives; revisit steps 4 and 7 on failure.
Apply to your project
What is the equivalent of testing through to renewed availability in your project?
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
Purpose and boundary
What is the equivalent of the title–copy distinction in your project?
In the example: Allocation binds the specific licensed copy.
Requirements
What is the equivalent of an exclusive expiry instant in your project?
In the example: Online access requires now<D.
Scale estimates
What is the equivalent of search dominating load in your project?
In the example: Size the index and allocation path separately.
Interfaces
What is the equivalent of preserving the same loan on retry in your project?
In the example: commandKey returns the existing A-52.
Data and states
What is the equivalent of retaining allocation while the outcome is unknown in your project?
In the example: Release only after confirmed non-issuance or access revocation.
Overall architecture
What is the equivalent of an index that grants no permissions in your project?
In the example: Online access checks the authoritative entitlement.
Critical flow
What is the equivalent of waiting for revocation before completing a return in your project?
In the example: Reconcile the same command.
Bottlenecks and trade-offs
What is the equivalent of distinguishing stale search results from lost licences in your project?
In the example: Measure search staleness and pending command duration separately.
Operations and security
What is the equivalent of reconciling entitlements before resuming in your project?
In the example: Block affected copies until reconciliation.
Final design
What is the equivalent of testing through to renewed availability in your project?
In the example: Test returns and expiry separately.