fix(auth): define page before use in overview example#338
fix(auth): define page before use in overview example#338dprevoznik wants to merge 4 commits intomainfrom
Conversation
The 'Use the Profile' example called page.goto() without ever defining page, causing a NameError/ReferenceError on copy-paste. Mirror the CDP connection pattern from browsers/create-a-browser so the snippet is runnable as-is.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Matches the dominant pattern across the docs (sync Kernel client with async Playwright). Keeps the Step 3 Playwright block async, since that mirrors browsers/create-a-browser.mdx.
|
Firetiger deploy monitoring skipped This PR didn't match the auto-monitor filter configured on your GitHub connection:
Reason: This PR modifies documentation (auth/overview.mdx) and does not change any API endpoints or Temporal workflows in the kernel repo. To monitor this PR anyway, reply with |
There was a problem hiding this comment.
Risk assessment: Very Low.
I reviewed the diff directly. The PR only updates auth/overview.mdx and fixes the example snippets by creating/deriving page from the Playwright CDP connection before calling page.goto(...) (in both TypeScript and Python examples).
Why this is very low risk:
- Scope is limited to one documentation file.
- No production runtime code, auth logic, permissions, infra, or config changed.
- Blast radius is documentation correctness only.
Approving accordingly.
Sent by Cursor Automation: Assign PR reviewers
There was a problem hiding this comment.
Risk assessment after re-review: Very Low.
I evaluated the current diff directly. The PR only modifies auth/overview.mdx to fix example correctness (initializing SDK/client objects and defining page from the Playwright CDP connection before goto in TypeScript and Python snippets).
Why this remains very low risk:
- Single documentation file changed
- No production runtime code, auth enforcement, permissions, infra, or config changes
- Blast radius is limited to docs/example accuracy
Current approval status is already APPROVED, so no additional approval action was taken.
Sent by Cursor Automation: Assign PR reviewers
There was a problem hiding this comment.
Risk assessment after re-evaluating current diff: Very Low.
I assessed the code changes directly from the PR diff. The change scope is limited to auth/overview.mdx and updates example snippets to define SDK/browser/page objects before use.
Why this remains very low risk:
- Only one documentation file changed
- No production runtime codepaths modified
- No auth enforcement, permissions, infrastructure, or configuration changes
- Blast radius is limited to example correctness in docs
Current PR state is already approved, so no additional approval action was taken.
Sent by Cursor Automation: Assign PR reviewers
masnwilliams
left a comment
There was a problem hiding this comment.
lgtm — pulls auth/overview.mdx into line with .docs/code-example-guide.md and the canonical browsers/create-a-browser.mdx CDP pattern.
heads up that the same class of bugs still exists in the sibling auth docs and isn't covered by this PR:
auth/hosted-ui.mdx— "Use the Profile" (step 5, ~L109) callsawait page.goto(...)with nopagedefined, same as the bug this PR fixes. The "Complete Example" (~L173) also doeskernel = Kernel()(sync client) followed byawait kernel.auth.connections.create(...), which fails at runtime.auth/programmatic.mdx— "Complete Example" (~L169) has the same sync-client-with-awaitissue.auth/profiles.mdx— L32-37 doeskernel = Kernel()thenawait kernel.profiles.create(...), same issue.
after this lands, auth/overview.mdx will be sync Python while the other three auth pages are still async, so the auth folder will be temporarily inconsistent. worth a follow-up PR to migrate the rest.
There was a problem hiding this comment.
Risk assessment after reviewing the current diff: Very Low.
Assessment is based on the code changes themselves:
- Only
auth/overview.mdxis modified - Changes are limited to documentation example snippets (object initialization and variable definition before use)
- No production runtime codepaths, auth enforcement, permissions, infrastructure, or config are changed
- Blast radius is limited to docs/example correctness
The PR is already in an approved state, so I did not add another approval.
Sent by Cursor Automation: Assign PR reviewers


Summary
The Step 3 ("Use the Profile") code snippet in
auth/overview.mdxcallspage.goto(...)but never definespage. Copy-pasting the snippet produces an immediateNameError(Python) /ReferenceError(TypeScript).Fix
Mirror the canonical CDP connection pattern used in
browsers/create-a-browser.mdx:kernelBrowser/kernel_browserso it does not collide with the PlaywrightBrowserobject.page.goto(...).The snippet is now runnable as-is (assuming
playwrightis installed and the surrounding async context).Test plan
auth/overview.mdxlocally and confirm the Step 3 code block looks correct in both TypeScript and Python tabs.NameError/ReferenceError.Note
Low Risk
Low risk: documentation-only changes that adjust example code, with no production logic or API behavior changes.
Overview
Fixes
auth/overview.mdxexamples so they run as-copied.Updates the TypeScript and Python snippets to properly initialize the
Kernelclient, and changes the “Use the Profile” step to connect to the Kernel-launched browser via Playwright CDP (connectOverCDP/connect_over_cdp) and derivecontext/pagebefore callingpage.goto().Reviewed by Cursor Bugbot for commit be1dc86. Bugbot is set up for automated code reviews on this repo. Configure here.