feat(auth): migrate assets + projects to TenantId (PMS-139 sweep batch 2) #160

Merged
longjacksonle merged 1 commit from feat/pms-139-sweep-assets-projects into main 2026-06-11 05:28:41 +02:00

What

Second per-module batch of the PMS-139 sweep: migrates assets and projects to TenantId.

Pattern

  • Handlers: RequireAssets { user: u, .. } / RequireProjects { user: u, .. } -> pass u.tenant().
  • Services: every method takes tenant_id: TenantId. assets' performer: Uuid (a user id, not a tenant) is deliberately left as Uuid.

Transitional .get() (4 sites)

Both services write to the audit trail via the audit_write hub, which stays on Uuid until it is swept last (it's called by many modules). So the tenant_id argument is unwrapped with tenant_id.get() at those four call sites (credential create/delete in assets; update_task / update_project in projects), each with a // PMS-139 note. They disappear when audit_write is migrated.

Tests

--test assets (4), --test projects (4), and the doctest guard all green; clippy --all-targets clean. Both modules' integration tests go through HTTP, so no from_trusted test changes were needed.

Progress

Migrated: reports, rmm, time_tracking, assets, projects. ~12 modules remain; dev-docs cross-cutting #8 updated.

🤖 Generated with Claude Code

## What Second per-module batch of the PMS-139 sweep: migrates **`assets`** and **`projects`** to `TenantId`. ## Pattern - **Handlers**: `RequireAssets { user: u, .. }` / `RequireProjects { user: u, .. }` -> pass `u.tenant()`. - **Services**: every method takes `tenant_id: TenantId`. `assets`' `performer: Uuid` (a user id, not a tenant) is deliberately left as `Uuid`. ## Transitional `.get()` (4 sites) Both services write to the audit trail via the `audit_write` hub, which stays on `Uuid` until it is swept last (it's called by many modules). So the `tenant_id` argument is unwrapped with `tenant_id.get()` at those four call sites (credential create/delete in `assets`; `update_task` / `update_project` in `projects`), each with a `// PMS-139` note. They disappear when `audit_write` is migrated. ## Tests `--test assets` (4), `--test projects` (4), and the doctest guard all green; `clippy --all-targets` clean. Both modules' integration tests go through HTTP, so no `from_trusted` test changes were needed. ## Progress Migrated: `reports`, `rmm`, `time_tracking`, **`assets`**, **`projects`**. ~12 modules remain; dev-docs cross-cutting #8 updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(auth): migrate assets + projects to TenantId (PMS-139 sweep batch 2)
All checks were successful
E2E (staging) / Playwright against staging (pull_request) Successful in 38s
Create release / Create release from merged PR (pull_request) Has been skipped
Check / fmt + clippy + compile + tests (pull_request) Successful in 1m34s
Build OCI container / Build and push mokosh-api image (push) Successful in 3m37s
ee26720d5d
Second per-module batch. Both services are self-contained (no external callers); the only cross-module touch is the audit_write hub (credential create/delete in assets; update_task/update_project in projects), which stays on Uuid until it is swept last, so those four call sites unwrap with tenant_id.get() behind a // PMS-139 comment. Otherwise mechanical: handlers read u.tenant(), service methods take tenant_id: TenantId, and assets' performer: Uuid (a user id, not a tenant) is untouched. Green: assets (4), projects (4), doctests; clippy --all-targets clean. dev-docs #8 updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
longjacksonle deleted branch feat/pms-139-sweep-assets-projects 2026-06-11 05:28:41 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!160
No description provided.