|
55 | 55 | - OpenCode's --format json outputs NDJSON with types: step_start, text, step_finish — content in `part.text` |
56 | 56 | - Use ANTHROPIC_BASE_URL env var to redirect OpenCode API calls to mock server — no opencode.json config needed |
57 | 57 | - Use XDG_DATA_HOME + unique dir to isolate OpenCode's SQLite database per test run |
| 58 | +- Claude Code headless tests use direct spawn (nodeSpawn) — same pattern as OpenCode headless, not sandbox bridge |
| 59 | +- Claude Code exits 0 on 401 auth errors — check output text for error signals, not just exit code |
58 | 60 |
|
59 | 61 | # Ralph Progress Log |
60 | 62 | Started: Sat Mar 21 02:49:43 AM PDT 2026 |
@@ -705,3 +707,43 @@ Started: Sat Mar 21 02:49:43 AM PDT 2026 |
705 | 707 | - Use XDG_DATA_HOME to isolate OpenCode's database across test runs (avoids shared state) |
706 | 708 | - NO_COLOR=1 strips ANSI codes from default format output |
707 | 709 | --- |
| 710 | + |
| 711 | +## 2026-03-21 08:47 - US-026 |
| 712 | +- Updated opencode-interactive.test.ts imports from deleted package paths (kernel/, os/browser/, runtime/node/) to consolidated paths (secure-exec-core/, secure-exec-browser/, secure-exec-nodejs/) |
| 713 | +- Added PTY resize test: verifies OpenCode TUI re-renders after SIGWINCH from terminal resize |
| 714 | +- Tests skip gracefully when OpenCode binary is unavailable or child_process bridge can't spawn |
| 715 | +- Files changed: |
| 716 | + - packages/secure-exec/tests/cli-tools/opencode-interactive.test.ts |
| 717 | +- **Learnings for future iterations:** |
| 718 | + - OpenCode interactive tests use `script -qefc` wrapper to give the binary a host-side PTY (needed for TUI rendering) |
| 719 | + - OpenCode uses kitty keyboard protocol — raw `\r` won't work as Enter, use `\x1b[13u` (CSI u-encoded Enter) |
| 720 | + - HostBinaryDriver is a minimal RuntimeDriver that routes child_process.spawn to real host binaries |
| 721 | + - These tests skip via 3-phase probing (node probe, spawn probe, stdin probe) — each probe tests a different layer of the bridge |
| 722 | +--- |
| 723 | + |
| 724 | +## 2026-03-21 09:06 - US-027 |
| 725 | +- Rewrote claude-headless.test.ts to use direct spawn (nodeSpawn) instead of sandbox bridge |
| 726 | +- Added --continue session continuation test (was missing from original skeleton) |
| 727 | +- Changed bad API key test to check for error signals in output (Claude may exit 0 on auth errors) |
| 728 | +- All 11 tests pass: boot, text output, JSON output, stream-json, file read, file write, bash tool, continue session, SIGINT, bad API key, good prompt |
| 729 | +- Files changed: |
| 730 | + - packages/secure-exec/tests/cli-tools/claude-headless.test.ts |
| 731 | +- **Learnings for future iterations:** |
| 732 | + - Claude Code headless tests must use direct spawn (nodeSpawn) for reliable stdout capture — sandbox bridge stdout round-trip is unreliable for native CLI binaries (same pattern as OpenCode) |
| 733 | + - Claude Code exits 0 on 401 auth errors — check stderr/stdout for error text rather than relying on non-zero exit code |
| 734 | + - Claude Code's --continue flag works with default session persistence (omit --no-session-persistence for the first run) |
| 735 | + - Claude Code --verbose flag is required for stream-json output format |
| 736 | + - Claude Code natively supports ANTHROPIC_BASE_URL — no config file or fetch interceptor needed |
| 737 | +--- |
| 738 | + |
| 739 | +## 2026-03-21 09:15 - US-028 |
| 740 | +- Updated claude-interactive.test.ts imports from deleted package paths (kernel/, os/browser/, runtime/node/) to consolidated paths (secure-exec-core/, secure-exec-browser/, secure-exec-nodejs/) |
| 741 | +- Added 3 new tests: tool use UI (tool_use mock response + Bash tool rendering), PTY resize (SIGWINCH + Ink re-render), /help command (slash command help text) |
| 742 | +- Total: 9 tests (6 existing + 3 new) — all skip gracefully when sandbox can't spawn Claude |
| 743 | +- Files changed: |
| 744 | + - packages/secure-exec/tests/cli-tools/claude-interactive.test.ts |
| 745 | +- **Learnings for future iterations:** |
| 746 | + - Claude Code with --dangerously-skip-permissions auto-executes tools without approval UI — tool use tests verify tool name/output appears on screen rather than approval dialog |
| 747 | + - Claude interactive tests use same pattern as OpenCode: script -qefc wrapper, HostBinaryDriver, 3-phase probing (node, spawn, stdin) |
| 748 | + - Pre-creating .claude/settings.json and .terms-accepted in HOME skips Claude's first-run onboarding dialogs |
| 749 | +--- |
0 commit comments