fix: respect opts.debug in installV3ShadowPiercer (fixes #1996)#2069
Open
kagura-agent wants to merge 1 commit intobrowserbase:mainfrom
Open
fix: respect opts.debug in installV3ShadowPiercer (fixes #1996)#2069kagura-agent wants to merge 1 commit intobrowserbase:mainfrom
kagura-agent wants to merge 1 commit intobrowserbase:mainfrom
Conversation
…1996) Replace hardcoded `const DEBUG = true` with `const DEBUG = opts.debug ?? false` so callers can control debug logging via V3ShadowPatchOptions.
🦋 Changeset detectedLatest commit: 5c2f895 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant Caller as Calling Service/Script
participant Piercer as installV3ShadowPiercer
participant DOM as Element.prototype
participant Console as Browser Console
Note over Caller,DOM: Initialization Phase
Caller->>Piercer: installV3ShadowPiercer(opts)
Piercer->>Piercer: CHANGED: Evaluate DEBUG via opts.debug ?? false
Piercer->>DOM: Patch attachShadow() logic
DOM-->>Piercer: Done
Piercer-->>Caller: Void
Note over Caller,DOM: Runtime Execution Phase
participant App as Web Application
App->>DOM: element.attachShadow(init)
alt DEBUG is true
DOM->>Console: NEW: Log "[v3-piercer] attachShadow"
else DEBUG is false
Note over DOM,Console: No logging output
end
DOM->>DOM: Execute original attachShadow
DOM->>DOM: Track shadow root in window.__v3ShadowRoots
DOM-->>App: shadowRoot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
installV3ShadowPiercerdeclares adebug?: booleanoption inV3ShadowPatchOptions, but ignores it —DEBUGis hardcoded totrue:This means
console.info("[v3-piercer] attachShadow", ...)fires on everyattachShadowcall regardless of what the caller passes, and thedebugfield inV3ShadowPatchOptionsis effectively dead API.Fix
One-line change. Defaults to
false(no debug noise) and respects the caller's choice when explicitly set.Closes #1996.
Summary by cubic
Respect
opts.debugininstallV3ShadowPiercerby replacing the hardcodedDEBUG = truewithconst DEBUG = opts.debug ?? false. This removes noisy logs by default and lets callers enable debugging when needed (fixes #1996).Written for commit 5c2f895. Summary will update on new commits. Review in cubic