You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(tech-design): add task list and unit/integration verify lists to auth.admin plan
11 ordered, independently-committable tasks (T1-T11) with dependencies, plus a
verify list spanning type tests, mock behavior, CDK grant assertions, and a
sandbox-gated integration suite (incl. negative least-privilege).
**Mock behavior** — `src/admin.test.ts` (`node:test`, real mock instance, in-memory):
229
+
-[ ]`addUserToGroup` writes to `state.groups`; visible to the same instance's next `requireRole`.
230
+
-[ ]`addUserToGroup` to an unseeded group throws `GroupNotFound`.
231
+
-[ ]`removeUserFromGroup` filters membership.
232
+
-[ ]`createUser` mirrors `signUp` (custom-attr prefixing, password policy); `deleteUser` removes record **and** strips from every group array.
233
+
-[ ]`disableUser`/`enableUser` toggle `MockUserRecord.disabled`; **regression:**`signIn` still rejects a disabled user (existing `index.ts:474` behavior unchanged).
234
+
-[ ]`resetUserPassword`/`setUserPassword` set the existing `forcePasswordChange` flag (no new `forceChangePassword`).
235
+
-[ ]`revokeUserSessions` deletes session records.
236
+
-[ ]`scan`/`listUsersInGroup` paginate via `AsyncIterable`.
237
+
-[ ] Getter throws the named error when `admin` not enabled (runtime guard for untyped JS callers).
-[ ] No `admin` ⇒ synthesized handler role has **no**`Admin*` statement (byte-identical to today).
241
+
-[ ]`actions: ['groups']` ⇒ exactly the 4 group actions, scoped to the pool ARN.
242
+
-[ ]`actions: ['lifecycle']` ⇒ exactly the lifecycle/list actions.
243
+
-[ ]`admin: {}` (omitted actions) ⇒ union of both sets.
244
+
245
+
**Cross-cutting**:
246
+
-[ ]`tsc --build` clean across all four entries + `admin.types-test.ts`.
247
+
-[ ]`conditional-exports.test.ts` (`packages/blocks/src/`) green — confirms no new subpath/export-parity work.
248
+
-[ ]`npm run build --workspace @aws-blocks/bb-auth-cognito` green.
249
+
-[ ]`test-apps/comprehensive` + `test-apps/native-bindings` typecheck after the T5 call-site fixes.
250
+
251
+
### Integration (live AWS; sandbox-gated)
252
+
Exercises the real deployed surface through the Lambda backend, the way `test-apps/comprehensive/test/sandbox-admin-e2e.ts` already does for client methods. **Prereqs:** deployed `bb-test-*` sandbox, `AWS_PROFILE` with Cognito admin + CFN-describe perms, run from `test-apps/comprehensive`.
253
+
-[ ] Deploy comprehensive backend with `admin: { actions: ['groups','lifecycle'] }` on the pool; CFN synth/deploy succeeds and the handler role carries the admin statement.
254
+
-[ ]`auth.admin.createUser` → real Cognito user appears (`AdminGetUser` confirms).
255
+
-[ ]`auth.admin.addUserToGroup` → then `signIn` + `requireRole('admins')` succeeds (membership took effect on fresh token).
256
+
-[ ] Group change on an **existing** session is NOT retroactive until refresh; `revokeUserSessions` forces re-auth and the new claim appears (session-freshness contract).
257
+
-[ ]`auth.admin.disableUser` → subsequent `signIn` returns `NotAuthorizedException`; `enableUser` restores it.
258
+
-[ ]`setUserPassword(permanent:true)` → `signIn` with the new password succeeds, no `NEW_PASSWORD_REQUIRED`.
259
+
-[ ]`scan` paginates across a >1-page user set.
260
+
-[ ]**Negative least-privilege:** a pool deployed WITHOUT `admin` → calling an admin route 500s with an IAM `AccessDenied` server-side (no grant), proving the opt-in gates the grant.
261
+
-[ ] Teardown via existing `sandbox-destroy.ts`.
262
+
196
263
## Open questions (carried from the counter-proposal)
197
264
1. Property name: `admin` vs a louder `adminApi`.
198
265
2.`actions` granularity: `'groups' | 'lifecycle'` vs 1:1 mapping to individual `Admin*` actions.
0 commit comments