Skip to content

Conversation

@ankur22
Copy link
Contributor

@ankur22 ankur22 commented Oct 13, 2025

What?

This moves the use of Sobek into the mapping layer for locator and away from the business logic.

Why?

Separating the two will help make things clearer and might also prevent race conditions with Sobek.

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

Checklist: Documentation (only for k6 maintainers and if relevant)

Please do not merge this PR until the following items are filled out.

  • I have added the correct milestone and labels to the PR.
  • I have updated the release notes: link
  • I have updated or added an issue to the k6-documentation: grafana/k6-docs#NUMBER if applicable
  • I have updated or added an issue to the TypeScript definitions: grafana/k6-DefinitelyTyped#NUMBER if applicable

Related PR(s)/Issue(s)

Closes: #4223

@ankur22 ankur22 temporarily deployed to azure-trusted-signing October 13, 2025 12:13 — with GitHub Actions Inactive
@ankur22 ankur22 temporarily deployed to azure-trusted-signing October 13, 2025 12:15 — with GitHub Actions Inactive
@ankur22 ankur22 temporarily deployed to azure-trusted-signing October 13, 2025 12:27 — with GitHub Actions Inactive
@ankur22 ankur22 temporarily deployed to azure-trusted-signing October 13, 2025 12:28 — with GitHub Actions Inactive
@ankur22 ankur22 temporarily deployed to azure-trusted-signing October 13, 2025 12:43 — with GitHub Actions Inactive
@ankur22 ankur22 temporarily deployed to azure-trusted-signing October 13, 2025 12:46 — with GitHub Actions Inactive
@ankur22 ankur22 temporarily deployed to azure-trusted-signing October 13, 2025 13:47 — with GitHub Actions Inactive
@ankur22 ankur22 temporarily deployed to azure-trusted-signing October 13, 2025 13:49 — with GitHub Actions Inactive
@ankur22 ankur22 temporarily deployed to azure-trusted-signing October 13, 2025 14:00 — with GitHub Actions Inactive
@ankur22 ankur22 temporarily deployed to azure-trusted-signing October 13, 2025 14:02 — with GitHub Actions Inactive
@ankur22 ankur22 added this to the v1.4.0 milestone Oct 13, 2025
@ankur22 ankur22 marked this pull request as ready for review October 13, 2025 14:28
@ankur22 ankur22 requested a review from a team as a code owner October 13, 2025 14:28
@ankur22 ankur22 requested review from inancgumus, joanlopez and oleiade and removed request for a team and joanlopez October 13, 2025 14:28
Copy link
Contributor

@inancgumus inancgumus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Since we don't need/want Sobek in the business logic, it'd be great if you could move the option parsing to the mapping layer as well, like this. Maybe in a separate PR?

@ankur22
Copy link
Contributor Author

ankur22 commented Oct 13, 2025

Since we don't need/want Sobek in the business logic, it'd be great if you could move the option parsing to the mapping layer as well, like this. Maybe in a separate PR?

Sure, in another PR 👍

@ankur22
Copy link
Contributor Author

ankur22 commented Oct 13, 2025

@inancgumus i explored moving the parse logic, but it's a lot of changes, and I'm not sure this strategy is quite the right one we should be doing. Instead of just moving the parse logic to the browser package, I think we should move the types and the parse logic to a new package, one that both common and browser can reference without cyclic dependency issues. It feels odd to have types in common, parse in browser.

Part of what i explored also brought out the issue of having to refactor frame, page and elementHandle too so that I could remove the parse logic completely from the browser package, and not leave duplicates around. Again, a lot of work.

I propose we think about this properly and set out a plan to enable us to refactor with a bit more ease and that everyone agrees on.

For now, i've abandoned the plan to move the parse logic out into common.

@inancgumus
Copy link
Contributor

@ankur22

The common package should not care about how options are parsed (Sobek), but it needs options (Go types). We've been moving the parsing functionality to the browser package for quite a while. Since only the mapping layer requires parsing Sobek options, I feel like it's the right strategy to move that logic into where it's done (browser).

We can also move parsing to another package if it becomes unwieldy. I can give another look at this myself. Maybe we're not talking about the same thing.

@ankur22 ankur22 merged commit ad1a2b3 into master Oct 14, 2025
58 of 61 checks passed
@ankur22 ankur22 deleted the refactor/locator-sobek branch October 14, 2025 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

De-sobekify Locator methods

3 participants