Skip to content

feat: add forShare and skipLocked selection modifiers to knex loader - #705

Merged
wschurman merged 1 commit into
mainfrom
09-24-feat_add_forshare_and_skiplocked_selection_modifiers_to_knex_loader
Sep 24, 2026
Merged

wschurman merged 1 commit into
mainfrom
09-24-feat_add_forshare_and_skiplocked_selection_modifiers_to_knex_loader

Conversation

@wschurman

@wschurman wschurman commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Why

Similar to #704, other common reasons Expo engineers drop down to raw knex is that they want to use forShare and skipLocked during a transaction. This adds the functionality to entity.

How

Told claude: "add skipLocked and forShare as well"

I read through the code manually.

Test Plan

Run added tests.

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@wschurman
wschurman marked this pull request as ready for review September 24, 2026 20:36
@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (727f166) to head (cb66e23).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #705   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          109       109           
  Lines        18093     18169   +76     
  Branches      1546      1549    +3     
=========================================
+ Hits         18093     18169   +76     
Flag Coverage Δ
integration 28.85% <91.11%> (+0.26%) ⬆️
unittest 94.71% <74.44%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

/**
* Lock the selected rows for update using `SELECT ... FOR UPDATE`. The lock is held until the
* end of the transaction, so the query must be executed in a transactional query context.
* Mutually exclusive with `forShare`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we throw an error if forShare is set? I think it's not a bad idea to enforce these requirements outside the validator.

@wschurman wschurman Sep 24, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We do in EntityKnexDataManager, yep!

Edit: misread your comment. I think so far these are roughly the builder pattern, though not a true build(). I'm undecided. Most builders throw upon build() which in this case is executeAsync(), which is what runs the validation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think I'll keep it as-is for now, but we can see how it feels and add the validation if we see places it'd be better to throw earlier.

@wschurman
wschurman merged commit 243a038 into main Sep 24, 2026
7 checks passed
@wschurman
wschurman deleted the 09-24-feat_add_forshare_and_skiplocked_selection_modifiers_to_knex_loader branch September 24, 2026 22:53
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.

3 participants