Commit Graph

21 Commits

Author SHA1 Message Date
mcfn.feng 7a1cc2207a [packages/cli-v2]fix: misc fixes from cookies, logs, wait, and CDP session
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:35:46 +08:00
mcfn.feng 21dc96056e [packages/cli-v2]fix: address code review findings in E2E test harness
- SoloEnv::Drop: wait for daemon exit + clean up daemon.sock/ready/pid
  files (SIGKILL prevents daemon's own cleanup)
- cloud_crash_recovery_endpoint_gone: add real assertions to all branches
  (was a no-op test that could never fail)
- Restore cloud_crash_recovery_reconnect test (was deleted in refactor)
- Add SessionGuard to lifecycle_close_s1t2 and lifecycle_double_close
  tests (prevent session leak on panic)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 11:45:01 +08:00
mcfn.feng c18c65c280 [packages/cli-v2]refactor: improve E2E test harness for reliability and maintainability
- Extract common helpers to harness.rs (assert_meta, assert_error_envelope,
  assert_tab_id, start_session, close_session, new_tab_json, etc.)
- Add local HTTP server to eliminate external network dependency
- Introduce SoloEnv for tests needing isolated ACTIONBOOK_HOME
- Replace fixed sleep(500ms) with per-test session isolation
- Fix TempDir leak in cloud_mode (ChromeGuard now owns TempDir)
- Add PID to unique_session IDs to prevent cross-run collisions
- HTTP server: thread-per-connection + Connection: close header
- Restore all cloud_mode tests (groups 5b-15) that were missing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 11:45:01 +08:00
mcfn.feng a5f3e0b212 [packages/cli-v2]fix: update e2e test for profile_name rename
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 18:47:33 +08:00
mcfn 0c7960e13a [packages/cli-v2]fix: add session starting hint 2026-03-28 15:13:41 +08:00
mcfn 30e047d8fe [packages/cli-v2]fix: use session starting error 2026-03-28 15:10:20 +08:00
mcfn 4a665838ed [packages/cli-v2]feat: add start placeholders 2026-03-28 15:07:46 +08:00
mcfn 594e5d3f24 [packages/cli-v2]fix: align default profile naming 2026-03-28 14:25:18 +08:00
mcfn bbbcc41f57 [packages/cli-v2]fix: unblock lint after rebase 2026-03-28 13:12:06 +08:00
mcfn 128db46a0e [packages/cli-v2]fix: finalize env precedence contract 2026-03-28 13:06:02 +08:00
mcfn 01eb586b70 [packages/cli-v2]fix: align config module contract 2026-03-28 13:06:02 +08:00
mcfn 46836033a0 [packages/cli-v2]feat: resolve browser start config 2026-03-28 13:06:02 +08:00
mcfn.feng 532d0be351 [packages/cli-v2]refactor: use native Chrome target ID as tab_id
- tab_id value is now Chrome's native CDP target ID (opaque string),
  no longer computed t1/t2/t3 counter
- Remove native_tab_id field from all API responses
- Remove next_tab_id counter from SessionEntry
- list-tabs fetches url/title real-time from Chrome /json/list
- TabEntry keeps url/title fields for extensibility
- All E2E tests use dynamic tab_ids from command responses

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 12:07:34 +08:00
mcfn.feng 636b3993ec [packages/cli-v2]fix: resolve all clippy warnings (collapsible_if, too_many_args, etc.)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 02:03:55 +08:00
mcfn.feng 86be497225 [packages/cli-v2]chore: cargo fmt
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 02:00:10 +08:00
mcfn.feng 4c731562d4 [packages/cli-v2]fix: populate native_tab_id from Chrome CDP target ID
native_tab_id was always null. Now populated from Chrome's CDP target
list (e.g. "4662D2C5D55C1F240EF210C569428A86"). Also added E2E test
for reuse + open-url navigation scenario.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 01:43:02 +08:00
mcfn.feng 67047fd80b [packages/cli-v2]feat: reuse existing session for same profile in Local mode
Local mode: 1 profile = max 1 active session (Chrome user-data-dir limit).
Second `browser start` with same profile returns existing session with
reused=true instead of failing with CDP timeout.

Added 2 E2E tests (JSON + text) verifying:
- First start: reused=false
- Second start: reused=true, same session_id
- list-sessions shows exactly 1 session

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 01:35:18 +08:00
mcfn.feng 6a34875cf2 [packages/cli-v2]feat: implement lifecycle commands (GREEN phase)
All 20 lifecycle E2E tests passing:
- Domain types: SessionId, TabId, WindowId, Mode
- Action/ActionResult protocol with serde tagged enums
- Wire protocol: UDS + 4-byte LE length prefix + JSON framing
- CLI layer: clap derive with --session/--tab long flags per PRD
- Daemon server: UDS listener with PID file lock, auto-start from CLI
- Session registry: in-memory HashMap with auto ID generation
- Router: handles start/list-sessions/status/close/restart/goto/new-tab/eval/snapshot
- Browser backend: Chrome launch with CDP, WebSocket for eval/navigate/snapshot
- Output formatting: JSON envelope (§2.4) + text protocol (§2.5)
- Test harness: daemon kill + Chrome cleanup between tests for isolation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 00:18:38 +08:00
mcfn.feng 48df4f16d4 [packages/cli-v2]fix: address re-review findings (B, C, D)
- native_tab_id: assert key presence explicitly, not just value type
- search pagination: add meta.pagination.total assertion (§2.4)
- get nonexistent: add error.details assertion (§3.1)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 23:55:45 +08:00
mcfn.feng b583080911 [packages/cli-v2]fix: complete JSON+text coverage per review findings
- close: add context.session_id assertions (§4)
- start text: add title: assertion (§7.1)
- list-sessions: add tabs: text + meta JSON assertions (§7.2)
- restart text: assert tab_id in header [SID t1] (§7.5)
- start JSON: add native_tab_id assertion (§7.1)
- error JSON: add details field assertion (§3.1)
- Add error-path tests for status --session nonexistent (JSON+text)
- help/version JSON: add command, error, meta assertions (§2.4)
- get JSON: add xpath assertion (§6.2)
- get/search text: verify format structure not just presence
- search pagination: verify meta.pagination fields (§2.4)
- 31 tests total (30 RED + 1 pass)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 23:53:57 +08:00
mcfn.feng c3d6fd157a [packages/cli-v2]feat: init project + lifecycle E2E tests (RED phase)
- Initialize independent Rust crate (binary: actionbook)
- Source structure: commands/{browser,daemon}, utils/{wire,client}
- E2E test harness: IsolatedEnv, SessionGuard, headless/headless_json runners
- 17 lifecycle tests covering JSON + text for start/status/list/close/restart
- 11 API tests for search/get/help/version (§6)
- 2 concurrent session tests with profile isolation
- All 28 tests RED (binary is stub only)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 23:31:48 +08:00