Fix normalizeSelector to validate input type and reject arrays#24
Merged
Fix normalizeSelector to validate input type and reject arrays#24
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #23
Previously, normalizeSelector had a fallback that returned any selector unchanged if it didn't match expected types. This caused issues when arrays were accidentally passed, leading to downstream querySelectorAll errors with invalid selector syntax (trailing comma). Changes: - Add explicit type validation at the start of normalizeSelector - Return null with a warning for arrays and invalid object types - Only accept strings and valid Puppeteer text selector objects - Add tests for array, number, and invalid object rejection - Add test for valid Puppeteer text selector object acceptance Fixes #23 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit 753d7da.
Member
Author
|
konard
added a commit
to konard/hh-job-application-automation
that referenced
this pull request
Jan 13, 2026
…#148 The v0.5.4 release of browser-commander (link-foundation/browser-commander#24) adds input validation to normalizeSelector that rejects arrays and other invalid types, preventing the trailing comma error in querySelectorAll. This is the proper upstream fix for the issue we filed at: link-foundation/browser-commander#23 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
normalizeSelectorto prevent downstreamquerySelectorAllerrorsnullwith a warning for arrays and invalid object typesProblem
When
normalizeSelectorreceived an array input (which should be invalid), it returned the array unchanged instead of throwing an error or returning null. This caused downstreamquerySelectorAllcalls to fail with:Solution
Added explicit type validation at the start of
normalizeSelector:_isPuppeteerTextSelectorobjects are rejectedTest plan
npm run test:unit- all 368 tests passnpm run lint- no new errorsFixes #23
🤖 Generated with Claude Code