Depot Sim Testing Requirements¶
Purpose¶
This document is essentially a context dump for an AI to understand the current testing methodology, and expected testing surfaces for a Capacity Provider simulator to be natively provided by Depot Sim. A simple simulated capacity provider server exists currently, however it is rudimentary and must be replaced with an appropriate, feature-full alternative in Depot Sim.
The document outlines all of the potential failures that need to be easily testable in an end-to-end environment. For example, in order to validate that the OSCP connection is appropriately culled when an offline condition is detected, the prospective simulator must be able to replicate that situation (manual process just kills the simple sim server which results in heartbeats no longer being sent).
Scope¶
Focused on the current and next confirmed Vector OSCP testing surfaces:
- handshakes and acknowledgement
- heartbeats and offline detection
- fallback-mode activation and recovery
- forecast gaps with and without matching fallback coverage
- intentional disconnect handover back to the non-OSCP path
Key Outcomes¶
- All
Behavioural outcome: *should be actionable. - All
Failure mode: *can be triggered through the sim. - All
Failure risk: *can be tested for and expected behaviours validated.
Reference for Manual Testing Approach¶
This is a reference to how manual testing was conducted prior to the creation of the proper Depot Sim Capacity Provider.
This is while using the single-file simulator.
Due to Event Bridge not being able to communicate directly with the dev server, those events were triggered using Postman and the appropriate event_id.
BetterFleet Initiated Handshake Timeout¶
- Use the UI to connect FP to CP
- Option 1
- Kill CP process
- Wait for timeout handling to reset the connection
- Option 2
- Let CP return
204 - Kill CP process
- Wait for timeout handling to reset the connection
- Let CP return
- Verify that connection state is reset to offline
Capacity Provider Initiated Handshake Timeout¶
- Use Postman to send
Handshaketo BetterFleet - BetterFleet returns
204 - Kill CP process
- Wait for BetterFleet's outbound
HandshakeAcknowledgerequest to fail or time out - Verify that connection state is reset to offline
BetterFleet Stops Sending Heartbeats¶
- Establish the connection first
- Stop BetterFleet from sending heartbeats (cease using Postman)
- Wait for CP offline detection to occur
- Verify that connection state is reset to offline
Capacity Provider Stops Sending Heartbeats¶
- Establish the connection first
- Stop CP from sending heartbeats to BetterFleet (kill CP process)
- Wait for BetterFleet offline detection to occur
- Verify that connection state is reset to offline
Future Goals¶
- Trigger specific OSCP messages such as
UpdateGroupCapacityForecast - Send malformed payloads for those messages
- Could be similar to the interoperability testing sys admin page.
- Exercise fallback and gap-policy scenarios from the Depot Sim UI without external scripts or Postman-only flows.
Current Testing Expectations¶
Timeouts¶
Behavioural outcome: sim needs to be able to imitate timeouts.
BetterFleet Initiated Handshake¶
sequenceDiagram
participant CP as Capacity Provider
participant BF as BetterFleet
BF->>CP: Send Handshake
CP-->>BF: Respond 204
Note over CP,BF: Failure mode: we may never receive this
CP-->>BF: Send HandshakeAcknowledge
Note over CP,BF: Failure mode: we may never receive this
Capacity Provider Initiated Handshake¶
sequenceDiagram
participant CP as Capacity Provider
participant BF as BetterFleet
CP->>BF: Send Handshake
BF->>CP: Respond 204
BF->>CP: Send HandshakeAcknowledge
CP-->>BF: Respond 204
Note over CP,BF: Failure mode: we may never receive this
BetterFleet Sending Heartbeats¶
sequenceDiagram
participant CP as Capacity Provider
participant BF as BetterFleet
loop
BF->>CP: Send Heartbeat
CP-->>BF: Respond 204
Note over CP,BF: Failure mode: we may never receive this
end
Offline Handling¶
Behavioural outcome: sim needs to be able to be turned offline (i.e., stop sending heartbeats).
Note: when determining offline detection, it is strictly based on the expiry time in the heartbeats, but for simplicity, these charts assume that offline detection occurs immediately.
Capacity Provider Stops Sending Heartbeats¶
sequenceDiagram
participant CP as Capacity Provider
participant BF as BetterFleet
CP->>BF: Send Heartbeat
BF-->>CP: Respond 204
Note over CP: Server dies
Note over CP,BF: Failure risk: connection should now be offline
Capacity Provider Stops Accepting Heartbeats¶
sequenceDiagram
participant CP as Capacity Provider
participant BF as BetterFleet
Note over CP,BF: Both services are considered online
Note over CP,BF: Network outage
BF->>CP: Send Heartbeat
Note over BF: Heartbeat times out
Note over CP,BF: Failure risk: connection should now be offline
Fallback and Gap Handling¶
Behavioural outcome: sim needs to be able to drive BetterFleet into yellow fallback mode and allow the resulting constraint path to be validated end-to-end.
Offline Detection With Matching Fallback Forecast¶
- Establish the connection first.
- Send a forecast set that includes active primary coverage plus valid fallback coverage for the same managed scope.
- Stop CP heartbeats or otherwise force BetterFleet offline detection.
- Verify that BetterFleet enters yellow fallback mode and continues operating against the fallback-derived constraint.
- Verify that notification and incident context is created for the fallback transition.
Forecast Gap With Matching Fallback Block¶
- Send a forecast set where the primary forecast has no active block for
now, but a matching fallback block exists. - Verify that BetterFleet enters yellow fallback mode.
- Verify that the effective constraint uses the fallback-derived value for the uncovered period.
Forecast Gap Without Matching Fallback Block¶
- Send a forecast set where neither the primary forecast nor fallback forecast covers
now. - Verify that BetterFleet enters yellow fallback mode.
- Verify that BetterFleet applies the configured gap policy. The current expected selectable option is the existing circuit safe default or non-OSCP path.
- Verify that notification and incident context is created for the gap-driven fallback transition.
Recovery From Fallback Mode¶
- Restore normal online state and send valid primary forecast coverage for
now. - Verify that BetterFleet exits fallback mode deterministically and returns to the restored normal path.
Intentional Disconnect Handling¶
Behavioural outcome: BetterFleet can hand control back to the operator immediately without waiting for OSCP-derived constraints to expire naturally.
Disconnect While OSCP Forecast Is Active¶
- Establish the connection and send an active forecast.
- Use Manage UI to disconnect the OSCP connection.
- Verify that BetterFleet clears active OSCP-derived forecast and fallback envelopes immediately.
- Verify that the managed scope returns to the non-OSCP path and the operator sees explicit handover messaging.
Disconnect While Fallback Mode Is Active¶
- Establish the connection, send fallback-capable forecast coverage, and force offline detection so BetterFleet enters yellow fallback mode.
- Use Manage UI to disconnect the OSCP connection.
- Verify that fallback mode exits as part of the disconnect flow and control returns to the non-OSCP path.
Network Outage is Resolved While Still Connected¶
sequenceDiagram
participant CP as Capacity Provider
participant BF as BetterFleet
Note over CP,BF: Both services are considered online
Note over CP,BF: Network outage
BF->>CP: Send Heartbeat
Note over BF: Heartbeat fails
Note over CP,BF: Network outage resolved
BF->>CP: Send Heartbeat
CP-->>BF: Respond 204
Note over CP,BF: Failure risk: connection should remain online
Network Outage is Resolved After Offline Detection¶
sequenceDiagram
participant CP as Capacity Provider
participant BF as BetterFleet
Note over CP,BF: Both services are considered online
Note over CP,BF: Network outage
BF->>CP: Send Heartbeat
Note over BF: Heartbeat fails
Note over CP,BF: Offline detection occurs
Note over CP,BF: Network outage is resolved
Note over CP,BF: Failure risk: connection should now be offline
Error Cases¶
Behavioural outcome: sim state needs to be manually editable to create connection mismatches.
Note: this is necessary to imitate conditions such as the CP thinking the connection has died, while BetterFleet continues to send heartbeats. Same goes for setting the CP to think it's in the connected state, and then receiving a handshake from BetterFleet. BetterFleet needs to handle these 403 cases gracefully.
BetterFleet Sends Heartbeat While Capacity Provider is NOT in Online State¶
sequenceDiagram
participant CP as Capacity Provider
participant BF as BetterFleet
Note over CP: Offline
Note over BF: Online
BF->>CP: Send Heartbeat
CP-->>BF: Respond 403
Note over CP,BF: Failure risk: connection should now be offline
Capacity Provider Sends Heartbeat While BetterFleet is NOT in Online State¶
sequenceDiagram
participant CP as Capacity Provider
participant BF as BetterFleet
Note over CP: Online
Note over BF: Offline
CP->>BF: Send Heartbeat
BF-->>CP: Respond 403
Note over CP,BF: Failure risk: connection should remain offline
BetterFleet Sends Handshake/Acknowledge While Capacity Provider is NOT in Offline State¶
sequenceDiagram
participant CP as Capacity Provider
participant BF as BetterFleet
Note over CP: Online
Note over BF: Offline
BF->>CP: Send Handshake
CP-->>BF: Respond 403
Note over CP,BF: Failure risk: should not proceed with connection
Capacity Provider Sends Handshake/Acknowledge While BetterFleet is NOT in Offline State¶
sequenceDiagram
participant CP as Capacity Provider
participant BF as BetterFleet
Note over CP: Offline
Note over BF: Online
CP->>BF: Send Handshake
BF-->>CP: Respond 403
Note over CP,BF: Failure risk: should now become offline