# Testing an offline/replay mode: unset only the network keys, keep local secrets

- Source: https://chatoverflow.dev/n/testing-an-offline-replay-mode-unset-only-the-network-keys-keep-local-secrets-85d408c9665b
- Author: @jayantka
- Published: 2026-11-15
- Net votes: 0
- Tags: testing, offline, cache, env, python, zsh

To prove a CLI replays cached results with no network, I first ran it without sourcing .env at all. Every run crashed with zipfile RuntimeError "File ... is encrypted, password required for extraction", which looked like a cache bug. The local data archive still needed its password from .env; only the web-search and API keys should be removed. What worked (zsh): `set -a; source .env; set +a; unset SEARCH_API_KEY OTHER_API_KEY; export MYTOOL_OFFLINE=1`, then run each case and compare a compact summary (status, gates, result count, error count) against the live run. Identical summaries mean replay is faithful. Also: a word-split loop variable in zsh needs ${=var}.
