Skip to content

refactor(interface-dms)!: remove TenantMemberModel.listAll() - #1228

Merged
Upd4ting merged 3 commits into
mainfrom
refactor/wec9b4589-22-remove-listall
Nov 20, 2026
Merged

Upd4ting merged 3 commits into
mainfrom
refactor/wec9b4589-22-remove-listall

Conversation

@Upd4ting

@Upd4ting Upd4ting commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Wec9b4589-22.

⚠ sensitive: removes TenantMemberModel.listAll() from the interface-dms contract

Summary

TenantMemberModel.listAll() read every member of a workspace with no bound. This PR removes it from @antelopejs/interface-dms, so a new call fails the typecheck, and moves every dms caller to a bounded read first.

  • page_verify (packages/dms/src/mcp/page-verify/accounts.ts) loaded every member of the owner's workspace to pick, per role, a member holding that role alone. pickMember now asks the database for that member directly: one filtered row per role (roleIds equal to [roleId], not a workspace owner, not a platform owner), projected to userId, roleIds and isTenantOwner. The rule it applies is unchanged.
  • The two tests that read members back to build their in-memory expectation (role-holder-reads.test.ts, notification-recipients.test.ts) now read only the fields they compare, with table.pluck(...).
  • The test model that refuses every membership read drops its listAll override.
  • The tenancy docs drop the listAll() row.
flowchart TD
  A[loadWorkspace] --> B[roles of the owner's workspace + platform owners]
  B --> C{for each role}
  C --> D["pickMember: first row where roleIds = [role], not tenant owner, not platform owner<br/>(was: listAll() of every member, then find in JS)"]
  D --> E[memberByRole]
Loading

Breaking change

TenantMemberModel.listAll() no longer exists. Migration: read members through count(), listOwners(), or a filtered, projected query on model.table, such as model.table.filter(...).pluck("userId", "roleIds").run().

This must ship in a minor release (0.15.0), not a 0.14.x patch: two module repos still call it and pin <0.15.0, so they keep resolving 0.14.x until they upgrade.

Module repos (code search of the AntelopeJS org, then each file read):

  • cloud calls it in product code, src/access/contacts.ts:57 and src/access/rows.ts:176, and pins >=0.14.1 <0.15.0.
  • dms-saas product code has no caller left (ANT-3518). Two dms-saas tests still call it, and dms-saas pins >=0.14.0 <0.15.0.

Both are listed under Follow-ups.

Related issue

Wec9b4589-22 (no Notion page). Follows ANT-3518 (AntelopeJS/dms-saas#320).

Verification

A probe file in packages/dms/src calling the removed method:

export const probe = () => GetModel(TenantMemberModel, "t").listAll();

pnpm --dir packages/dms typecheck before the removal (exit 0):

> node scripts/unless-prebuilt.mjs pnpm --filter @antelopejs/interface-dms --filter @antelopejs/interface-dms-builder exec antelopejs-tsc && antelopejs-tsc --noEmit

After (exit 1):

src/probe-wec9b4589-22/probe.ts(4,61): error TS2339: Property 'listAll' does not exist on type 'TenantMemberModel'.
 ELIFECYCLE  Command failed with exit code 1.

The pickMember unit test (page-verify.test.ts) now seeds members into a workspace: a member with two roles, a workspace owner, a platform owner, sole holders, a sole holder stored without isTenantOwner, and a sole holder in another workspace. Three mutants of the built query fail it:

  • matching "holds the role" instead of "holds it alone": AssertionError: expected { …(4) } to equal undefined
  • dropping the workspace-owner clause: AssertionError: expected 'owner' to equal 'viewer-only'
  • requiring isTenantOwner to equal false, which skips a row stored without the field: AssertionError: expected undefined to equal 'unflagged'

Runs (in-memory MongoDB, one file each):

  • dist/test/unit/mcp/page-verify.test.js: 10 passing
  • dist/test/unit/pages/settings/role-holder-reads.test.js: 6 passing
  • dist/test/integration/notification-recipients.test.js: 4 passing
  • pnpm run typecheck: exit 0. oxlint on the changed files: no findings.

Follow-ups

  • proposed AntelopeJS/cloud: src/access/contacts.ts:57 and src/access/rows.ts:176 read every member of a workspace with TenantMemberModel.listAll(), done means both read through a bounded or projected query and cloud typechecks against interface-dms 0.15.0, which drops listAll().
  • proposed AntelopeJS/dms-saas: packages/dms-saas/test/seat-usage-queries.test.ts:37 and packages/dms-saas/test/platform-reads-in-query.test.ts:427 still call TenantMemberModel.listAll() (ANT-3518's Done means covers product code only), done means both tests read members through a projected query and the dms-saas test typecheck passes against an interface-dms without listAll().

Checklist

  • The pull request title follows Conventional Commits.
  • I added or updated tests when behavior changed.
  • I updated documentation when users or contributors are affected.
  • I documented breaking changes and migration steps.
  • I did not include credentials or unrelated changes.

… listAll

page_verify picks a sole holder per role with one projected row per role,
and the tests read only the member fields they compare.
BREAKING CHANGE: TenantMemberModel.listAll() is gone. Read members through
count(), listOwners() or a projected, bounded query on the table.
@Upd4ting
Upd4ting marked this pull request as ready for review November 20, 2026 22:24
@Upd4ting
Upd4ting enabled auto-merge November 20, 2026 22:24
@Upd4ting
Upd4ting added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 9a5478b Nov 20, 2026
27 of 40 checks passed
@Upd4ting
Upd4ting deleted the refactor/wec9b4589-22-remove-listall branch November 20, 2026 22:37
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.

1 participant