fix(api): resolve /me 500 and revoke not persisting (GRO-206) #161

Closed
groombook-engineer[bot] wants to merge 10 commits from fix/gro-206-superuser-revoke-bug into main

10 Commits

Author SHA1 Message Date
groombook-ci[bot] 0013afff7d fix(ci): remove errant space in github.sha template expression
Space in `github.sha ::7` caused workflow validation to fail on push
events (0s run, no jobs). Fixes the template syntax so the SHA
subexpression is `github.sha::7`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 22:39:15 +00:00
groombook-ci[bot] 54c4ee3555 ci: trigger fresh build for fix verification
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 22:37:40 +00:00
groombook-ci[bot] ddf1384edd ci: trigger fresh build for fix verification
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 22:37:34 +00:00
groombook-ci[bot] 7922781908 fix(ci): include GitHub SHA in image tag to prevent stale cache reuse
Each CI build now produces an immutable tag (pr-N-sha7 or
YYYY.MM.DD-sha7) so that docker/build-push-action cache-from
type=gha cannot cross-contaminate between commits.

Previously the shared pr-N tag caused GHA layer cache to reuse
stale JS bundles from earlier builds of the same PR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 22:33:38 +00:00
groombook-ci[bot] 7a4be8a924 chore: trigger CI rebuild for web Docker image (GRO-206)
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-29 21:59:03 +00:00
groombook-ci[bot] 9724327559 fix(api): correct superuser guard condition from <= 1 to < 1
The guardrail should block ONLY when there are zero other active super
users. With the previous <= 1 condition, revoking/deleting a superuser
was incorrectly blocked when there were exactly 2 superusers total
(count of 1 other <= 1 triggered the block). Change to < 1 so that
having 1+ other superuser(s) correctly allows the operation.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-29 21:15:43 +00:00
groombook-ci[bot] 7523d4cbd9 fix(api): add error handling and null guard to /api/staff/me
Wrap c.json() in try/catch to surface any remaining serialization
errors rather than crashing with a generic 500. Also change the null-
staff guard from 404 → 500 since a missing staff context is an
internal error, not a not-found case.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-29 20:38:18 +00:00
groombook-ci[bot] 23273a0ab8 chore: ignore transpiled .js files in apps/web/src to prevent shadowing
Vite resolves .js before .tsx when both exist, causing stale compiled
JS output to shadow TSX source files. Add .gitignore exceptions for
legitimate standalone JS files.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-29 15:38:50 +00:00
groombook-ci[bot] e965b8bb7d fix(portal): add Super User grant/revoke toggle to Staff page (GRO-206)
- Add isSuperUser boolean to Staff interface in types
- Fetch current user via /api/staff/me to determine if super user
- Show "Super User" column and Grant/Revoke buttons only for super users
- Disable revoke button when target is the last active super user
- Show API error messages when last-super-user guardrail triggers
- Prevent self-revocation (no Grant/Revoke button on own row)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-29 15:15:14 +00:00
groombook-ci[bot] 8ebfead2d0 fix(api): resolve /me 500 and revoke not persisting (GRO-206)
- Add explicit null check and field serialization for /api/staff/me
  to prevent serialization errors with BigInt/Date fields
- Fix revoke: separate UPDATE from RETURNING in superuser guard
  transaction to avoid FOR UPDATE + RETURNING issues in DB driver
- Add explicit updateStaffSchema with isSuperUser field (not derived
  from createStaffSchema.partial())

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-29 14:43:14 +00:00