--- phase: 37 slug: admin-global-item-management status: draft nyquist_compliant: false wave_0_complete: false created: 2026-04-19 --- # Phase 37 — Validation Strategy > Per-phase validation contract for feedback sampling during execution. --- ## Test Infrastructure | Property | Value | |----------|-------| | **Framework** | Bun test runner | | **Config file** | package.json (bun test) | | **Quick run command** | `bun test tests/services/global-item.service.test.ts` | | **Full suite command** | `bun test` | | **Build check** | `bun run build` | | **Estimated runtime** | ~15 seconds | --- ## Sampling Rate - **After every task commit:** Run `bun run build` (TypeScript check) - **After service tasks:** Run `bun test tests/services/global-item.service.test.ts` - **After every plan wave:** Run `bun test` - **Before `/gsd-verify-work`:** Full suite + build must be green - **Max feedback latency:** ~15 seconds --- ## Per-Task Verification Map | Task ID | Plan | Wave | Requirement | Secure Behavior | Test Type | Automated Command | Status | |---------|------|------|-------------|-----------------|-----------|-------------------|--------| | 37-01-T1 | 01 | 1 | ADMN-02 | deleteGlobalItem nullifies FK before delete | unit | `bun test tests/services/global-item.service.test.ts` | ⬜ pending | | 37-01-T2 | 01 | 1 | ADMN-02 | listGlobalItemsForAdmin returns paginated results | unit | `bun test tests/services/global-item.service.test.ts` | ⬜ pending | | 37-01-T3 | 01 | 1 | ADMN-03 | updateGlobalItemById updates by id | unit | `bun test tests/services/global-item.service.test.ts` | ⬜ pending | | 37-01-T4 | 01 | 1 | ADMN-02 | GET /api/admin/items returns 401/403 without auth | manual | `curl -s localhost:3000/api/admin/items` | ⬜ pending | | 37-01-T5 | 01 | 1 | ADMN-04 | DELETE /api/admin/items/:id returns 403 for non-admin | manual | curl test | ⬜ pending | | 37-02-T1 | 02 | 2 | ADMN-02 | Admin items list renders table with rows | build | `bun run build` | ⬜ pending | | 37-02-T2 | 02 | 2 | ADMN-02 | Infinite scroll hook: useInfiniteQuery + sentinel div | build | `bun run build` | ⬜ pending | | 37-02-T3 | 02 | 2 | ADMN-03 | Edit page form renders all fields | build | `bun run build` | ⬜ pending | | 37-02-T4 | 02 | 2 | ADMN-04 | Delete confirmation shows ownerCount | manual | Browser test | ⬜ pending | | 37-02-T5 | 02 | 2 | ADMN-02 | Sidebar Items link is active and navigates | build | `bun run build` + routeTree check | ⬜ pending | *Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky* --- ## Wave 0 Requirements Existing infrastructure covers all phase requirements. No new test files need to be created — existing `tests/services/global-item.service.test.ts` should be extended for the new service functions. --- ## Manual-Only Verifications | Behavior | Requirement | Why Manual | Test Instructions | |----------|-------------|------------|-------------------| | Admin items list loads with pagination | ADMN-02 | Requires live server + admin user | Dev server: navigate to /admin/items as admin | | Infinite scroll fetches next page | ADMN-02 | Requires live browser with enough data | Scroll to bottom of items list | | Edit form saves and redirects | ADMN-03 | Requires live server + form interaction | Open any item, change a field, save | | Delete with ownerCount > 0 warns | ADMN-04 | Requires item with actual owners | Use seeded item, confirm dialog shows count | | Non-admin redirect from /admin/items | ADMN-01 | Client-side guard requires browser | Log in as non-admin, navigate to /admin/items | --- ## Validation Sign-Off - [ ] All tasks have `` verify or manual test instructions - [ ] TypeScript build is the primary automated gate for client-side tasks - [ ] Service-layer functions have unit tests - [ ] No watch-mode flags - [ ] Feedback latency < 30s - [ ] `nyquist_compliant: true` set in frontmatter **Approval:** pending