Skip to content

Commit f595e7f

Browse files
committed
docs: add single e2e test isolation guide with trace integration
- Add 'Running a single e2e test in isolation' subsection documenting required E2E_PROFILE/USE_REAL_CLI env vars and --config flag when bypassing pnpm scripts - Show -t flag usage for filtering by test name - Include BEAMCODE_TRACE patterns (smart + full) combined with vitest file/name filters for targeted debugging - Fix stale session-manager-* references → session-coordinator-* in debugging walkthrough steps 1 and 3, and key files table
1 parent 9b17b98 commit f595e7f

File tree

1 file changed

+50
-4
lines changed

1 file changed

+50
-4
lines changed

DEVELOPMENT.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,49 @@ Tests are auto-skipped when prerequisites are not met. Detection logic is in `sr
740740
- PR: `E2E Real CLI Smoke` runs when `ANTHROPIC_API_KEY` secret is configured
741741
- Nightly: full deterministic + full real CLI (secret-gated)
742742

743+
### Running a single e2e test in isolation
744+
745+
**This is the primary workflow when debugging a failing real backend test.**
746+
747+
The real backend scripts set required env vars (`E2E_PROFILE`, `USE_REAL_CLI`) and point vitest at the real config. To run a single test you must preserve those vars:
748+
749+
```bash
750+
# Run one test file (e.g. claude) — smoke lane
751+
E2E_PROFILE=real-smoke USE_REAL_CLI=true \
752+
pnpm vitest run src/e2e/real/session-coordinator-claude.e2e.test.ts \
753+
--config vitest.e2e.real.config.ts
754+
755+
# Filter further by test name using -t
756+
E2E_PROFILE=real-smoke USE_REAL_CLI=true \
757+
pnpm vitest run src/e2e/real/session-coordinator-claude.e2e.test.ts \
758+
--config vitest.e2e.real.config.ts \
759+
-t "launch emits process spawn"
760+
```
761+
762+
**With message tracing** (recommended when the trace dump alone is not enough):
763+
764+
```bash
765+
# Smart tracing — bodies included, sensitive keys redacted (safe default)
766+
BEAMCODE_TRACE=1 E2E_PROFILE=real-smoke USE_REAL_CLI=true \
767+
pnpm vitest run src/e2e/real/session-coordinator-claude.e2e.test.ts \
768+
--config vitest.e2e.real.config.ts \
769+
-t "launch emits process spawn" 2>trace.ndjson
770+
771+
# Full tracing — every payload as-is, no redaction
772+
BEAMCODE_TRACE=1 BEAMCODE_TRACE_LEVEL=full BEAMCODE_TRACE_ALLOW_SENSITIVE=1 \
773+
E2E_PROFILE=real-smoke USE_REAL_CLI=true \
774+
pnpm vitest run src/e2e/real/session-coordinator-claude.e2e.test.ts \
775+
--config vitest.e2e.real.config.ts \
776+
-t "launch emits process spawn" 2>trace.ndjson
777+
778+
# Then inspect the trace
779+
pnpm trace:inspect dropped-backend-types trace.ndjson
780+
```
781+
782+
Replace `session-coordinator-claude` with `session-coordinator-gemini`, `session-coordinator-codex`, or `session-coordinator-opencode` for other backends. Use `real-full` profile to enable full-coverage tests (`it.runIf(runFull)`).
783+
784+
> **Note:** The `-t` flag matches a substring of the test name. Wrap in quotes if the name contains spaces.
785+
743786
### Architecture Boundary Checks
744787

745788
Run architecture checks locally with:
@@ -803,8 +846,9 @@ Trace levels:
803846
1. **Run the failing test in isolation** with verbose output:
804847

805848
```bash
806-
pnpm vitest run src/e2e/real/session-manager-gemini.e2e.test.ts \
807-
--reporter=verbose 2>&1 | tee test-output.log
849+
E2E_PROFILE=real-smoke USE_REAL_CLI=true \
850+
pnpm vitest run src/e2e/real/session-coordinator-gemini.e2e.test.ts \
851+
--config vitest.e2e.real.config.ts --reporter=verbose 2>&1 | tee test-output.log
808852
```
809853

810854
Look for the `[gemini-e2e-debug]` (or `[claude-e2e-debug]`, etc.) prefix in the output — that's the trace dump.
@@ -824,7 +868,9 @@ Trace levels:
824868

825869
```bash
826870
BEAMCODE_TRACE=1 BEAMCODE_TRACE_LEVEL=smart \
827-
pnpm vitest run src/e2e/real/session-manager-gemini.e2e.test.ts 2>trace.ndjson
871+
E2E_PROFILE=real-smoke USE_REAL_CLI=true \
872+
pnpm vitest run src/e2e/real/session-coordinator-gemini.e2e.test.ts \
873+
--config vitest.e2e.real.config.ts 2>trace.ndjson
828874

829875
# Show translation events with drops
830876
grep '"boundary"' trace.ndjson | python3 -c "
@@ -852,7 +898,7 @@ Trace levels:
852898
| File | Purpose |
853899
|------|---------|
854900
| `src/e2e/real/helpers.ts` | `attachTrace()`, `dumpTraceOnFailure()`, `getTrace()` |
855-
| `src/e2e/real/session-manager-setup.ts` | `setupRealSession()` — creates manager with trace attached |
901+
| `src/e2e/real/session-coordinator-setup.ts` | `setupRealSession()` — creates coordinator with trace attached |
856902
| `src/e2e/real/prereqs.ts` | Binary/auth detection, auto-skip logic |
857903
| `src/core/message-tracer.ts` | `MessageTracerImpl` for T1–T4 boundary tracing |
858904

0 commit comments

Comments
 (0)