fix(n+1): 批量查询替代循环单查

- IsAdminBootstrapRequired: userRepo.GetByID 循环 → GetByIDs 批量
- AssignRoles: roleRepo.GetByID 循环 → GetByIDs 批量
- 在 userRepositoryInterface 补充 GetByIDs 方法签名
This commit is contained in:
2026-05-08 08:05:26 +08:00
parent 9b1cea246e
commit 2a18a6fb47
39 changed files with 3169 additions and 393 deletions

View File

@@ -0,0 +1,55 @@
# Profile Page Local Closure Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Add a real browser scenario for `/profile`, keep the supported E2E gate green, and add the smallest regression coverage needed if the new scenario exposes a product defect.
**Architecture:** Extend the existing Playwright CDP runner with one dedicated `profile-management` scenario built on the same admin-create-user flow already used by other auth scenarios. Keep product changes minimal and only if the scenario proves a real bug in profile page load, update, or navigation behavior.
**Tech Stack:** Playwright CDP runner, React admin frontend, Vitest, existing Go backend APIs.
---
### Task 1: Add the red browser scenario
**Files:**
- Modify: `frontend/admin/scripts/run-playwright-cdp-e2e.mjs`
- [ ] Add a new scenario entry named `profile-management` to the supported scenario list.
- [ ] Implement the scenario with real admin login, real user creation, real user login, `/profile` page verification, one real profile update, and the `/profile` to `/profile/security` navigation proof.
- [ ] Run `cd frontend/admin && $env:E2E_SCENARIOS='profile-management'; npm.cmd run e2e:full:win`.
- [ ] Confirm the first failure is a real product or runner reason before changing product code.
### Task 2: Fix the exposed issue with TDD if needed
**Files:**
- Modify only the minimal affected product files exposed by Task 1
- Test: affected profile page or service Vitest files only
- [ ] Add the smallest failing regression test for the exposed issue.
- [ ] Run that regression test and verify it fails for the expected reason.
- [ ] Implement the minimal fix.
- [ ] Re-run the targeted regression test until it passes.
### Task 3: Re-verify the profile browser scenario
**Files:**
- Modify: `frontend/admin/scripts/run-playwright-cdp-e2e.mjs`
- [ ] Re-run `cd frontend/admin && $env:E2E_SCENARIOS='profile-management'; npm.cmd run e2e:full:win`.
- [ ] Confirm the targeted profile scenario passes without weakening assertions.
- [ ] If the scenario changed the product contract, re-run the directly affected Vitest files.
### Task 4: Re-run the supported frontend gate and sync docs
**Files:**
- Modify: `docs/status/REAL_PROJECT_STATUS.md`
- Modify: `docs/team/PRODUCTION_CHECKLIST.md`
- Modify: `docs/team/TECHNICAL_GUIDE.md`
- Modify: `docs/team/PROJECT_EXPERIENCE_SUMMARY.md`
- Modify: `docs/team/QUALITY_STANDARD.md`
- [ ] Run `cd frontend/admin && npm.cmd run lint`.
- [ ] Run `cd frontend/admin && npm.cmd run build`.
- [ ] Run `cd frontend/admin && npm.cmd run e2e:full:win`.
- [ ] Update docs only with the results actually observed on this branch state.