Simulate an offline runner engine
Replay connectivity and job events through an offline queue, returning deterministic job states and execution order.Description
Requirements
Export simulateOfflineRunner from src/App.js.
Keep submitted job IDs queued while connectivity is offline.
Run queued jobs in submission order whenever connectivity becomes online.
Remove a queued job or mark a running job cancelled when its cancel event occurs.
Ignore a second submit event for an existing job ID.
Return an observably equivalent result for equivalent inputs without reading time, randomness, network, storage, or DOM globals.
Do not mutate input objects, arrays, nested records, or values retained in the returned result.
Reconnect
Jobs A and B submit offline, then online occurs
Execution order is A then B
Keep submitted job IDs queued while connectivity is offline.
Queued cancel
A is cancelled before reconnect
A never appears in execution order
Run queued jobs in submission order whenever connectivity becomes online.
Constraints
Implement a pure synchronous function with no external side effectsTreat every input collection and nested record as read-onlyReturn JSON-compatible data except where the declared TypeScript API explicitly uses bigint
Hints
Hint 1
Start with the queues-while-offline behavior and make its observable result deterministic.
Hint 2
Model runs-fifo-online independently before combining it with the remaining states.
Hint 3
Verify the boundary described by deduplicates-job-id without changing caller-owned input.