fix: use ty-native ignore syntax for add_cookies#394
Conversation
`# type: ignore[arg-type]` is mypy syntax; ty does not honor it. Newer ty versions (0.0.33+) flag the dict[str, Any] vs SetCookieParam mismatch on `BrowserContext.add_cookies` even with the existing ignore comment, breaking lint-and-check on the pending lockfile maintenance PR (#227). Switch to ty-native `# ty: ignore[invalid-argument-type]` placed on the argument line where ty surfaces the diagnostic. Verified silent on both ty 0.0.20 (current pin) and ty 0.0.33 (incoming via #227).
Greptile SummaryThis PR updates a single type-checker suppression comment in Confidence Score: 5/5Safe to merge — one-line comment change with no runtime impact. The only change is swapping a type-checker suppression comment syntax; no logic, imports, or data flow are affected. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Load cookies from JSON file] --> B{li_at cookie present?}
B -- No --> C[Return False]
B -- Yes --> D["await context.add_cookies(cookies)\n# ty: ignore[invalid-argument-type]"]
D --> E[Log import success]
E --> F[Return True]
Reviews (1): Last reviewed commit: "fix: use ty-native ignore syntax for add..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Updates the type-check suppression in import_cookies() to use ty’s native ignore comment syntax so the existing runtime-safe add_cookies(cookies) call remains accepted under newer ty versions.
Changes:
- Replaced inert mypy-style
# type: ignore[arg-type]with# ty: ignore[invalid-argument-type]. - Adjusted formatting of the
add_cookiescall to attach thetyignore to the argument line.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Summary
Replace
# type: ignore[arg-type](mypy syntax) with# ty: ignore[invalid-argument-type](ty-native syntax) on the single suppression incore/browser.py. The mypy-style comment was inert under ty.Why
The pending lockfile maintenance PR (#227) bumps
tyto 0.0.33, which adds stricter checks. With the mypy-style# type: ignore[arg-type]comment that ty doesn't honor, ty 0.0.33 flags theBrowserContext.add_cookies(cookies)call as adict[str, Any]vsSequence[SetCookieParam]mismatch, breakinglint-and-check.The mismatch is intentional and runtime-safe:
cookiesis a hand-built list of dicts loaded from JSON, and patchright validates the shape at runtime. Only the suppression syntax needs updating.Test plan
uvx --from 'ty==0.0.33' ty check linkedin_mcp_server/core/browser.py→error[invalid-argument-type]before the fix.pre-commit runpasses (ruff, ruff-format, ty all green).