Report
On production: created a new user via the admin invite wizard with Trinity House attached as a partner, and it failed with an error along the lines of "partner invalid". Workaround that succeeded: create the user as a plain citizen first, then attach the partner from the user edit page afterwards.
Investigation so far (2026-07-15)
Could not reproduce locally on current code, logged in as root:
- Ran the full invite wizard (personal details → permissions → select partner → Invite User) with a valid partner: user created, partner attached correctly.
- Repeated with a partner record made deliberately invalid (failing current Partner validations, simulating legacy prod data): user still created fine and the partner attached. Rails does not validate unchanged existing HABTM records when saving a new user, so "legacy invalid partner blocks user creation" is ruled out as the mechanism on current code.
- The server accepts
user[partner_ids][] on create for root (UserPolicy#permitted_attributes_for_create) and Admin::UsersController#create attaches them via invite!.
- AppSignal: no error incidents or retained traces for
Admin::UsersController#create, and log retention (24h) has already rolled past the attempt, so the exact prod error text is unrecoverable.
Leads for next time it happens
- Capture the exact error message (screenshot ideally) — "partner invalid" vs "Partners is invalid" vs the non-root guard message point at different code paths.
- Check the Trinity House record in prod console:
Partner.find_by(name: 'Trinity House').tap(&:valid?).errors.full_messages — and whether anything about it is unusual (service areas, tags, hidden state).
- Confirm which account/role did the creating. Non-root creators hit
validate_partner_relation in Admin::UsersController ("You must assign a Partner to the User…"), a different path from root.
- Check which release was deployed at the time of the attempt — the failure may predate a recent admin users redesign deploy.
Report
On production: created a new user via the admin invite wizard with Trinity House attached as a partner, and it failed with an error along the lines of "partner invalid". Workaround that succeeded: create the user as a plain citizen first, then attach the partner from the user edit page afterwards.
Investigation so far (2026-07-15)
Could not reproduce locally on current code, logged in as root:
user[partner_ids][]on create for root (UserPolicy#permitted_attributes_for_create) andAdmin::UsersController#createattaches them viainvite!.Admin::UsersController#create, and log retention (24h) has already rolled past the attempt, so the exact prod error text is unrecoverable.Leads for next time it happens
Partner.find_by(name: 'Trinity House').tap(&:valid?).errors.full_messages— and whether anything about it is unusual (service areas, tags, hidden state).validate_partner_relationinAdmin::UsersController("You must assign a Partner to the User…"), a different path from root.