[PR #6356] [CLOSED] fix(browser): preserve script inventory boundary across async source reads #7303

Closed
opened 2026-11-01 21:46:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6356
Author: @dezzy-music
Created: 10/22/2026
Status: ❌ Closed

Base: main ← Head: fix/cdp-script-inventory-boundary


📝 Commits (1)

  • 6d2c5ec fix(browser): preserve script inventory boundary across async source reads

📊 Changes

2 files changed (+44 additions, -2 deletions)

View changed files

📝 src/browser/CdpPageCaptureScripts.test.ts (+42 -0)
📝 src/browser/CdpPageCaptureScripts.ts (+2 -2)

📄 Description

Summary

Resolves #6231.

When capturing web page scripts via inspect_web_page, captureScripts snapshots admitted script records (const scripts = [...events.scripts.values()]) and subsequently awaits asynchronous source reads (captureScriptSource). If a new scriptParsed event arrives via CDP while source reads are in progress, events.scripts.size was used as the total count and omission count, resulting in scripts.total (e.g. 2) mismatching scripts.items.length (e.g. 1) with no omission reported.

Changes

  • In src/browser/CdpPageCaptureScripts.ts, use scripts.length (the snapshot inventory count) instead of events.scripts.size when reporting unapproved source exclusions and when building the inventory total in keyAndBuildInventory.
  • Added a regression test in src/browser/CdpPageCaptureScripts.test.ts verifying that scripts.total and returned scripts.items preserve a consistent inventory boundary when an additional script is parsed while awaiting a source read.

Verification

  • npx vitest run src/browser/CdpPageCaptureScripts.test.ts passed (5/5 green).
  • node scripts/run-turbo.mjs run typecheck lint passed cleanly with 0 errors.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6356 **Author:** [@dezzy-music](https://github.com/dezzy-music) **Created:** 10/22/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/cdp-script-inventory-boundary` --- ### 📝 Commits (1) - [`6d2c5ec`](https://github.com/morluto/rea/commit/6d2c5ecd2a2521abc672b5d5d7ec7d8af7b628a4) fix(browser): preserve script inventory boundary across async source reads ### 📊 Changes **2 files changed** (+44 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/browser/CdpPageCaptureScripts.test.ts` (+42 -0) 📝 `src/browser/CdpPageCaptureScripts.ts` (+2 -2) </details> ### 📄 Description ### Summary Resolves #6231. When capturing web page scripts via `inspect_web_page`, `captureScripts` snapshots admitted script records (`const scripts = [...events.scripts.values()]`) and subsequently awaits asynchronous source reads (`captureScriptSource`). If a new scriptParsed event arrives via CDP while source reads are in progress, `events.scripts.size` was used as the total count and omission count, resulting in `scripts.total` (e.g. 2) mismatching `scripts.items.length` (e.g. 1) with no omission reported. ### Changes - In `src/browser/CdpPageCaptureScripts.ts`, use `scripts.length` (the snapshot inventory count) instead of `events.scripts.size` when reporting unapproved source exclusions and when building the inventory total in `keyAndBuildInventory`. - Added a regression test in `src/browser/CdpPageCaptureScripts.test.ts` verifying that `scripts.total` and returned `scripts.items` preserve a consistent inventory boundary when an additional script is parsed while awaiting a source read. ### Verification - `npx vitest run src/browser/CdpPageCaptureScripts.test.ts` passed (5/5 green). - `node scripts/run-turbo.mjs run typecheck lint` passed cleanly with 0 errors. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:46:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7303
No description provided.