Using Gostly

Time Chamber

Time Chamber lets you repeat a mocked API workflow from a prepared starting point. Take a snapshot, run the case in an isolated episode, move API time forward when needed, then reset and compare another run.

Use it to investigate a deadline, a rate-limit window or a sequence of resource changes. Gostly controls the modeled dependency; your application or test harness decides whether the customer-facing result is correct.

  1. 1. Snapshot

    Capture the prepared default API state.

  2. 2. Run

    Send selected requests inside a named episode.

  3. 3. Advance API time

    Move the episode clock explicitly when needed.

  4. 4. Save and reset

    Keep the run’s outcomes, then restore the baseline.

The episode clock changes modeled API behavior. Application timers and assertions remain in your test harness.

Before you begin

  • Use a running Gostly installation and a client configured to send selected API calls through its proxy.
  • Prepare the response library and any resource lifecycles or fault rules the case needs.
  • Set the Default mode on the dashboard's Services page (the proxy's global mode) and every routed service to MOCK. A snapshot needs the Default mode in MOCK too, even when every service is already in MOCK. Allow the intended routing table to reach the proxy before taking a snapshot.
  • If chaos can apply in MOCK, configure a fixed unsigned 64-bit CHAOS_SEED before preparing the baseline.

The standard installation enables episodes with GOSTLY_EPISODES=1. Time Chamber runs in the proxy and does not require a response model. An operator can disable episodes or configure their limits.

Proxy control requests use the service key. Shared API and MCP snapshot, fork and reset operations also need GOSTLY_SHARED_EPISODE_MUTATIONS_ENABLED, which is on by default; set it to 0 in .env to refuse them. Direct proxy controls do not depend on it. See the API time & episodes reference for exact requests, authentication and refusal codes.

Prepare a baseline

Take a named snapshot after services, routes, mocks, statecharts and chaos are ready. It captures the default namespace's eligible resource state, clock, random-stream position, bounded environment overlay and rate-limit windows. Routed services and the global resource scope determine which resources are included.

The snapshot identifies the serving configuration it is compatible with. It does not retain old copies of every route, mock or statechart so it can roll the installation back. Take a new snapshot when those inputs change. A baseline comes from the default namespace, not an arbitrary checkpoint of a progressed episode.

Run and repeat the case

  1. Reset a named episode from the snapshot. This creates the episode or restores an existing one and starts a new journal generation.
  2. Send the application's selected requests with the episode identifier and meaningful run and action identifiers.
  3. Advance the episode clock if the case needs a deadline or window to pass. The next request or retry remains a separate client action.
  4. Inspect API responses and the application result. Retain the journal generation alongside your application's checks.
  5. Reset before the next attempt. Repeat the same action order and clock advances when comparing seeded behavior.

An episode supplies isolated run state. Application data, background jobs and other dependencies need their own reset or controls when the test depends on them.

Understand API time

The episode clock is frozen until you advance it. Its default starting point is 2020-01-01T00:00:00Z. Eligible statechart timers can run during an advance. Supported episode-created resource lifetimes, recorded rate-limit windows and seeded Markov chaos also use this API clock.

An advance does not move the host clock, browser timers, SDK sleeps, workers or a database clock. Configure application time separately in your harness when needed; injected latency still takes real elapsed time.

Resource expiry needs the supported configuration. Sending a recorded token during a run does not make it an episode-created token. The expiring-resource guide explains the relevant boundary checks.

Run and inspect it in the dashboard

An owner or administrator can take snapshots, fork and reset episodes, and inspect runs on the dashboard's Time Chamber page. Advancing API time uses the proxy control interface; see advance the clock. Scripts and CI can use the proxy control interfaces for every step.

  1. Open Time Chamber in the local Gostly dashboard. Use Refresh to read the bounded inventory. Check the selected agent instance and boot before choosing an episode.
  2. Under Snapshot this boot, enter a snapshot name and choose Snapshot.
  3. Under Fork an episode, enter a new episode id, choose the snapshot and choose Fork.
  4. Select an episode and inspect its Journal. Keep the reset generation with the run and action identifiers.
  5. To repeat the run, keep the episode selected, choose Restore from a snapshot and the snapshot, then choose Reset. Wipe clears the episode's state instead.
  6. When finalization has been recorded for that generation, inspect Evidence. Before finalization, that view is unavailable.

A journal records operations and outcomes. Evidence integrity checks concern that record; they do not establish that an application assertion passed or a model answer was correct. Save your harness's result alongside the selected evidence.

Example: a payment deadline

For an illustrative case, configure an order lifecycle that starts unpaid and expires unless payment arrives before its deadline. Prepare its HTTP fixtures and snapshot the starting state.

First, send payment before expiry and inspect the order response and application confirmation. Reset to the baseline. Next, advance API time past the deadline before payment and check the application's expired-order and recovery behavior. Your team authors the lifecycle and assertions; Time Chamber does not infer the business policy.

For a complete sequence with saved HTTP outcomes, use the rate-limit recovery guide. It keeps the API clock advance and the client's retry separate.

Recover a blocked run

What you seeWhat to do next
Episodes disabledCheck the proxy episode setting. A shared API mutation refusal can instead mean GOSTLY_SHARED_EPISODE_MUTATIONS_ENABLED is set to 0.
Baseline refusedCheck routing readiness, the Default mode and each service's mode, journal health and the chaos seed before snapshotting again.
Snapshot, fork or reset refused with episode_conflictThe proxy refused the request. Check that the Default mode on the Services page and every routed service are in MOCK, that CHAOS_SEED is set when chaos can apply, that the proxy can write its episode journal, and that the routing table has reached the proxy. Then choose the control again.
Snapshot no longer matchesPrepare the intended configuration and take a new snapshot. Reset does not undo the configuration change.
Agent restarted or selection changedRefresh inventory and select the current boot and reset generation. Create a baseline for a new boot.
Operation outcome uncertainInspect the recorded outcome and journal state. A failure can require reset; it does not promise that the clock stayed unchanged.

Lifetime and storage

Episodes and usable snapshots belong to one proxy boot. Restarting that proxy ends them. Default idle limits are one hour for an episode and 24 hours since a snapshot was last used by reset. Operators can configure these limits, and live episode and snapshot quotas are bounded.

Journals and snapshot artifacts written to the data volume have a separate lifetime from live state; they do not make a past episode resumable after restart. Review retained artifacts before sharing them, just as you would other captured test data.