| name | ephemeral-testing |
| description | Use when standing up a full local multi-service test stack for cross-service validation, with shared dependencies, deterministic namespaces, and controlled test lifecycle. |
Ephemeral Testing
Use this skill when you need a full local service graph available for end-to-end and integration testing.
Core idea
The test stack is a reusable, deterministic containerized environment that represents the standard local test network for the product:
- one shared infra layer (datastores, caches, queues, shared services),
- one test target service image override per run,
- one reproducible network namespace and service discovery plan,
- one cleanup policy to avoid environment drift.
Before starting
- Confirm the service graph inventory and shared dependency contracts.
- Check repository-local guidance (
AGENTS.md, SPEC.md, ADR.md), then identify required harness variables.
- Ensure test orchestration can consume:
- a generated namespace ID,
- generated stack metadata,
- service image tags,
- readiness checks and test selectors.
Stack configuration
- Define a stable namespace:
STACK_ID (required for stack identity).
- Fall back to a stable runtime identifier only if explicitly allowed.
- Fail fast if no namespace source is available.
- Load shared stack defaults in one stack config source (for example,
.testing/.env-style file).
- Set testing mode explicitly:
- enable ephemeral account APIs for e2e bootstrap (
TESTING_EPHEMERAL_API_ENABLED=true);
- set shared test secret(s) used by API bootstrap and browser/test clients consistently.
- Keep service ports private by default.
- only enable host binding when needed for local manual/browser debugging.
Start flow
- Resolve stack-specific values and expose them via a generated stack metadata file for dependent scripts.
- Start all shared infra and application services from a compose-like manifest in a single namespace.
- Block until explicit readiness checks pass for:
- core infrastructure services (data stores, cache/broker),
- all services required by the current test target.
- Validate that discovery endpoints resolve by internal service DNS/hostnames used by all services.
- Refresh dependency images from registry for non-local services by default.
Image policy
- Default to remote dependency images for deterministic shared-stack behavior.
- Allow exactly one or more explicit image overrides for services under test.
- Do not treat
latest-style mutable tags as test gating truth in normal validation.
Test execution
- Run browser/API/synthetic suites against the same internal network and service routes used by services themselves.
- Keep default e2e scope focused on:
- first-party behavior that is stable locally,
- seams with safe static/test doubles,
- non-mutable flows unless a real provider sandbox contract exists.
- Classify provider-heavy mutable flows as live-only unless they can be safely validated in this stack.
Lifecycle and cleanup
- Default behavior:
- Optional warm-stack path:
- keep stack alive only for explicit debug sessions;
- record the namespace and teardown manually with matching identifiers.
- On stop/shutdown, remove ephemeral storage and mounted test state to prevent cross-run contamination.
Troubleshooting checkpoints
STACK_ID mismatch between test launcher and stack harness.
- Secret mismatch between test bootstrap and API routes (
ephemeral operations fail).
- Missing readiness before test start.
- Service route mismatch between internal discovery and external/base URLs.
Exit criteria
Proceed to test failure analysis only after:
- stack namespace is coherent,
- readiness gates are green,
- ephemeral test endpoints are available, and
- cleanup completes cleanly between runs.