Uh oh!
There was an error while loading. Please reload this page.
feat: sys_user.primary_business_unit_id projection — pick people by BU (ADR-0057 D12) - #2146
Merged
Merged
Conversation
…_id projection (ADR-0057 D12)
Denormalise the user's primary business unit onto sys_user, maintained by plugin-sharing from sys_business_unit_member.is_primary (insert/update/delete hooks + a boot-time backfill), so "pick people by BU" (Dataverse filtered lookup / ServiceNow reference qualifier) is expressible as a plain where:{primary_business_unit_id:X} — and thus a lookupFilters picker filter — with zero query-engine change, no junction traversal. Homed in plugin-sharing (always loaded, owns the BU graph) rather than plugin-org-scoping, so it works single-tenant. afterDelete loses the row, so user_id is captured in beforeDelete via the shared hookContext. Adds en/zh/ja/es labels + a dogfood proof (insert sets it, query filters by it, primary-flag move follows, delete clears).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 3 package(s): 6 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Final implementation increment of the ADR-0057 addendum (#2141) — PS-3 / D12. Builds on PS-1 (#2143).
What
Adds a denormalised
sys_user.primary_business_unit_idlookup, maintained by plugin-sharing as a projection ofsys_business_unit_member.is_primary.Why
"Pick people by business unit" — the Dataverse filtered lookup / ServiceNow reference qualifier interaction — is a baseline ERP need that requires no hierarchy rollup. But it wasn't expressible: lookup fields filter only on the target object's own columns,
sys_userhad no BU column, and ObjectQL can't traverse thesys_business_unit_memberjunction in a single filter. Denormalising the primary BU ontosys_usermakeswhere: { primary_business_unit_id: X }(and thus alookupFilterspicker filter) work with zero query-engine change.How
sys_user(mirrorsmanager_id, feat(platform-objects): add sys_user.manager_id to back the own_and_reports scope (ADR-0057) #2133) + en/zh/ja/es labels.afterInsert/afterUpdate/afterDeletehooks onsys_business_unit_memberthat recompute the owner's projection, plus a boot-time backfill for pre-existing rows.afterDeleteexposes neitherpreviousnor the deleted row, souser_idis captured inbeforeDeletevia the sharedhookContext.BusinessUnitGraphService), not plugin-org-scoping — that plugin is multi-tenant-only, and BU membership is usable single-tenant. So picker-filtering by BU is an open capability; only hierarchy rollup stays paid.Notes / scope
sys_business_unit_memberremains the effective-dated, matrix source of truth; the column is a maintained projection ofis_primary, not a second source. Matrix/multi-BU pickers still use the two-step junction expansion.lookupFiltersis a client-side picker hint (no server enforcement), so the dogfood proves the server-verifiable deliverable: the column is maintained on insert/update/delete and filterable. Test: insert sets it, query filters by it, primary-flag move follows, delete clears.Changeset:
@objectstack/platform-objects+@objectstack/plugin-sharingminor.🤖 Generated with Claude Code