Skip to content

fix: bunch of selectivity fixes - #1348

Open
KuznetsovRoman wants to merge 13 commits into
masterfrom
selectivity_fixes
Open

KuznetsovRoman wants to merge 13 commits into
masterfrom
selectivity_fixes

Conversation

@KuznetsovRoman

Copy link
Copy Markdown
Member

01. fix: count unique sources in full-span bundle wrappers

  • Problem: the transitions beta.jsx → shared.jsx → beta.jsx were incorrectly counted as three files, causing the full-span wrapper to be discarded.
  • Solution: count unique nonempty sources across the entire source map. Wrappers with two files are retained, while those with more than two are still skipped.

02. fix: collect dependencies from Vue and Svelte sources

  • Problem: .vue and .svelte sources were filtered out even when they appeared in source maps for executed JavaScript.
  • Solution: add both extensions to the list of allowed JavaScript source files.

03. fix: preserve logical and physical CSS source roots

  • Problem: a real absolute CSS path was prefixed with the root again, while a logical /src/... path could be mistaken for a physical absolute path.
  • Solution: retain both an existing absolute file and an existing file under the configured root. Include both when ambiguous, and do not hide missing-file errors.

04. fix: key source-map caches by all inputs with bounded memory

  • Problem: the cache could return offsets or paths from different inputs, while serializing all inputs into a single JSON string consumed excessive memory.
  • Solution: compute a compact, versioned SHA-256 digest incrementally from the resource text, source map, and root, preserving exact UTF-16 code units.

05. fix: resolve mapped CSS URIs and decode file URLs once

  • Problem: CSS URI roots were corrupted, percent escapes in file: URLs were decoded twice, and unsupported URIs were discarded before the user's mapper ran.
  • Solution: resolve URIs correctly, decode file: URLs once, and allow the mapper to turn a URI into an existing local file. URIs that remain unmapped are still discarded with a warning.

06. fix: protect reused script IDs from stale asset callbacks

  • Problem: a new script reusing a scriptId inherited stale assets, and a delayed callback could overwrite the new source or source-map URL.
  • Solution: invalidate assets when an unhashed script's URL changes, and allow asynchronous writes only for the script's current state.

07. fix: validate HTTP assets and release rejected response bodies

  • Problem: an unsuccessful HTTP response was accepted as an asset, a browser fetch exception could be lost, and an unread response body kept a connection occupied.
  • Solution: check HTTP status in Node and the browser, release rejected response bodies, and reject CDP exceptions instead of saving partial dependencies.

08. fix: reject failed browser asset evaluations

  • Problem: Runtime.evaluate could return a missing or non-string value that was accepted as asset text.
  • Solution: check the result type and fail asset retrieval if the result is not a string.

09. fix: preserve script assets while resolving coverage snapshots

  • Problem: while a coverage snapshot waited for assets to load, reuse of a scriptId could replace its source and map with another script's data.
  • Solution: capture references to the source, map, and their URLs before waiting, then resolve the snapshot using those captured assets.

10. fix: safely encode asset URLs in browser evaluations

  • Problem: quotes, backslashes, and line breaks in URLs corrupted the browser fetch expression or changed the request URL.
  • Solution: insert the URL into the expression using JSON.stringify instead of manually escaping only quotes.

11. fix: recover source maps from late parsed metadata

  • Problem: a settled Promise<null> left by a missing source-map comment blocked later valid metadata.
  • Solution: replace that settled state with null only if it is still current, allowing a late source map to load.

12. fix: reject empty declared source maps

  • Problem: a declared but empty source map was silently skipped, allowing a successful test to save incomplete dependencies.
  • Solution: distinguish an absent map (null/undefined) from empty text, and pass an empty map to the parser so dependency collection fails explicitly.

13. fix: resume only the current selectivity pause

  • Problem: a handler for an earlier pause could resume a newly paused page before coverage was collected and reset, losing startup-script dependencies.
  • Solution: use a generation counter to allow only the handler for the latest accepted pause to call Debugger.resume.

@github-actions

Copy link
Copy Markdown

✅ Testplane E2E run succeed

Report

@pkg-pr-new

pkg-pr-new Bot commented Oct 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/gemini-testing/testplane@1348

commit: 8c1bdfa

@github-actions

Copy link
Copy Markdown

✅ Testplane browser-env run succeed

Report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant