From 8ace9cd9f18564a3f3d7c70c46f9621f369332ee Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Tue, 17 Mar 2026 15:32:09 -0700 Subject: [PATCH] docs: update PRD and progress for US-036 Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/ralph/prd.json | 4 ++-- scripts/ralph/progress.txt | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/ralph/prd.json b/scripts/ralph/prd.json index 25ccbb4..685c0ee 100644 --- a/scripts/ralph/prd.json +++ b/scripts/ralph/prd.json @@ -589,8 +589,8 @@ "Tests pass" ], "priority": 36, - "passes": false, - "notes": "Console and network monitoring have real complexity (background tasks, ring buffers, event correlation) but zero test coverage currently." + "passes": true, + "notes": "Console test uses HTML page with console.log/error/warn calls, verifies messages captured and level filtering works. Network test verifies navigation generates captured network requests. CDP reports console.warn level as 'warn' not 'warning'. Both tests use 1s sleep for async CDP event capture." }, { "id": "US-037", diff --git a/scripts/ralph/progress.txt b/scripts/ralph/progress.txt index 531276e..34ddbc0 100644 --- a/scripts/ralph/progress.txt +++ b/scripts/ralph/progress.txt @@ -28,6 +28,7 @@ - Test helper `write_test_file()` uses `PUT /v1/fs/file?path=...` to write HTML test fixtures into the container - `docker/test-agent/Dockerfile` must include chromium + deps (libnss3, libatk-bridge2.0-0, libdrm2, libxcomposite1, libxdamage1, libxrandr2, libgbm1, libasound2, libpangocairo-1.0-0, libgtk-3-0) for browser integration tests - `get_page_info_via_cdp()` is a helper fn in router.rs for getting current URL and title via Runtime.evaluate +- CDP event-based features (console, network monitoring) are captured asynchronously by background tasks; integration tests need ~1s sleep after triggering events before asserting on endpoint results - CDP `Page.getNavigationHistory` returns `{currentIndex, entries: [{id, url, title}]}` for back/forward navigation - CDP `Page.navigateToHistoryEntry` takes `{entryId}` (the id from history entries, not the index) - CDP `Target.getTargets` returns `{targetInfos: [{targetId, url, title, type, ...}]}`; filter `type == "page"` for browser tabs @@ -639,3 +640,13 @@ Started: Tue Mar 17 04:32:06 AM PDT 2026 - CDP console event `type` field uses "warning" (not "warn") — always normalize to "warn" for consistency with standard log levels - When adding new error variants, check existing tests in the module's `#[cfg(test)] mod tests` to ensure they still pass --- + +## 2026-03-17 - US-036 +- Added `v1_browser_console_monitoring` test: writes HTML page with console.log/error/warn calls, navigates to it, verifies messages captured in ring buffer, verifies level filtering via `?level=error` query param +- Added `v1_browser_network_monitoring` test: navigates to a file:// page, verifies network requests are captured with url, method, and timestamp fields +- Files changed: server/packages/sandbox-agent/tests/browser_api.rs +- **Learnings for future iterations:** + - CDP console events are captured asynchronously by background tokio tasks; tests need a ~1s sleep after navigation before checking console/network endpoints + - CDP reports `console.warn` level as `"warn"` (after US-035 normalization), not `"warning"` — test assertions must match + - `file://` URL navigations DO generate `Network.requestWillBeSent` events in Chromium, so network monitoring tests work with local files +---