Skip to content

fix: move EntityPrivacyUtils back into core package#429

Merged
wschurman merged 1 commit intomainfrom
wschurman/02-09-fix_move_entityprivacyutils_back_into_core_package
Feb 12, 2026
Merged

fix: move EntityPrivacyUtils back into core package#429
wschurman merged 1 commit intomainfrom
wschurman/02-09-fix_move_entityprivacyutils_back_into_core_package

Conversation

@wschurman
Copy link
Member

@wschurman wschurman commented Feb 10, 2026

Why

As discussed on #407, this moves EntityPrivacyUtils back to the core package since it's a core concept.

How

Move the files, then...

It required adding a new loader method, loadOneByFieldEqualingAsync, which loads one of a set of entities for use with the EntityEdgeDeletionAuthorizationInferenceBehavior.ONE_IMPLIES_ALL deletion permission check optimization.

It is unlikely that this method will be used too frequently in application code so I marked it as @internal, but it is still in the types same as every other method.

Test Plan

Full coverage and tests for the EntityPrivacyUtils/canViewerDelete.

@wschurman wschurman force-pushed the wschurman/02-09-fix_move_entityprivacyutils_back_into_core_package branch from a8aad6a to f25d7ab Compare February 10, 2026 03:08
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (be40bcf) to head (30fb9dc).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main      #429    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          108       108            
  Lines        14872     15061   +189     
  Branches      1302      1318    +16     
==========================================
+ Hits         14872     15061   +189     
Flag Coverage Δ
integration 22.31% <19.08%> (-0.09%) ⬇️
unittest 96.34% <92.94%> (-0.13%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@wschurman wschurman force-pushed the wschurman/02-09-fix_move_entityprivacyutils_back_into_core_package branch from f25d7ab to 64712a7 Compare February 10, 2026 03:24
@wschurman wschurman requested a review from ide February 10, 2026 03:32
@wschurman wschurman marked this pull request as ready for review February 10, 2026 03:32
Copy link
Member

@ide ide left a comment

Choose a reason for hiding this comment

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

Approved but make the docs really clear that this method usually should not be used. Otherwise it may pop in PRs and people won't know better.

tableValue: tableTuple[index],
})),
[],
{ limit: 1, orderBy: undefined, offset: undefined },
Copy link
Member

Choose a reason for hiding this comment

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

I forget, do we require orderBy and offset to be undefined vs. omitted?

Copy link
Member Author

Choose a reason for hiding this comment

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

For this internal interface, yep. For the public method types, they can be omitted.

Comment on lines 108 to 109
* Load one entity where fieldName equals fieldValue, or null if no entity exists.
* Not cached or coalesced, and not guaranteed to be deterministic if multiple entities match the condition.
Copy link
Member

Choose a reason for hiding this comment

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

In the documentation, I would make clear always to use loadByFieldEqualingAsync when the given field uniquely identifies an entity and there is guaranteed to be at most one match.

loadOneByFieldEqualingAsync is only appropriate when there is the possibility of many results that match the given fields, and we are fetching one solely for performance optimization like EntityEdgeDeletionAuthorizationInferenceBehavior.ONE_IMPLIES_ALL.

(Same docs for the non-enforcing loader.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Decided to just make it private and call via loader['loadOneByFieldEqualingAsync']. I agree that there isn't a strong-enough docblock that could make it never be used. In the future we could optionally expose a internal method of getting a data manager outside of a loader, though I think that's overkill for now and loader has the cleanest API for field translation and authorization.

@wschurman wschurman changed the base branch from wschurman/02-06-fix_type_idfield_in_entityconfiguration_as_tidfield to graphite-base/429 February 12, 2026 01:27
@wschurman wschurman force-pushed the wschurman/02-09-fix_move_entityprivacyutils_back_into_core_package branch from 64712a7 to e63584e Compare February 12, 2026 01:30
@graphite-app graphite-app bot changed the base branch from graphite-base/429 to main February 12, 2026 01:31
@wschurman wschurman force-pushed the wschurman/02-09-fix_move_entityprivacyutils_back_into_core_package branch from e63584e to 3e7e550 Compare February 12, 2026 01:31
@wschurman wschurman force-pushed the wschurman/02-09-fix_move_entityprivacyutils_back_into_core_package branch from 3e7e550 to 30fb9dc Compare February 12, 2026 03:14
@wschurman wschurman merged commit 56ec27d into main Feb 12, 2026
5 checks passed
@wschurman wschurman deleted the wschurman/02-09-fix_move_entityprivacyutils_back_into_core_package branch February 12, 2026 03:20
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.

2 participants

Comments