fix: concurrency bugs, license, docs, and CI#1
Merged
Conversation
Code review fixes: - Fix routeInjecting race condition: use atomic.Bool.CompareAndSwap instead of bare bool read-check-write - Fix pipeTransport.Close() race: replace manual channel-close check with sync.Once (consistent with rest of codebase) - Fix global logger mutation: driver.log() now reads d.options.Logger instead of mutating package-level var. Default logger writes to options.Stderr via slog.TextHandler - Fix transformRunOptions mutating caller's *RunOptions: clone before applying defaults so concurrent callers sharing one RunOptions don't race - Fix Verbose default being lost when caller passes any RunOptions - Add isolatedContext: true to EvalOnSelector and element_handle eval methods for consistency with all other evaluate methods - Reuse safeJoin in downloadPatchrightCore instead of duplicating traversal guard - Remove dead code in installInjectRoute (both if/else branches were identical) Other changes: - LICENSE: change from MIT to Apache-2.0 (matching Patchright upstream) - Add docs/llm-guide.md: concise LLM-friendly reference with anti-detection best practices - Add .github/workflows/ci.yml: build, vet, unit + integration tests on Go 1.22 and 1.23
desperatee
added a commit
that referenced
this pull request
Jul 1, 2026
Anti-bot solutions can still detect headless browsers via deep fingerprinting (WebGL, navigator.plugins, screen dimensions) even with Patchright patches. Verified: headful passes Walmart PerimeterX on product pages while headless gets blocked. - README: add headless vs headful section, update quick start to headful - LLM guide: headful as rule #1, add troubleshooting section - Example: default to headful
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.
Summary
Test plan
go build ./...andgo vet ./...cleannavigator.webdriverreturnsfalseReview findings addressed
routeInjectingrace on concurrent AddInitScript/ExposeBindingatomic.Bool.CompareAndSwaploggermutation across concurrent driversd.options.Logger; package-level logger never mutatedtransformRunOptionsmutates caller's*RunOptionsVerbose: truedefault lost when caller passes optionspipeTransport.Close()race on channel closesync.Once(consistent with rest of codebase)downloadPatchrightCoreduplicatessafeJointraversal guardsafeJoinEvalOnSelectormissingisolatedContext