Skip to content

Fix customer contact user type invariant#239

Draft
roncodes wants to merge 1 commit into
dev-v0.6.48from
feature/fix-customer-user-type-invariant
Draft

Fix customer contact user type invariant#239
roncodes wants to merge 1 commit into
dev-v0.6.48from
feature/fix-customer-user-type-invariant

Conversation

@roncodes
Copy link
Copy Markdown
Member

Summary

  • enforce the FleetOps customer invariant from the internal contact save flow: contact.type=customer normalizes the linked user to user.type=customer
  • prevent existing customer contacts from being changed away from type=customer
  • add an idempotent repair migration for historical customer contacts and strong Fleet-Ops Customer role hints

Root cause

FleetOps console/internal customer creation goes through the generic internal contact controller, which could persist a contact with type=customer while leaving the associated user as a normal user/contact. Customer identity should come from the contact/user type pair, not from order-customer polymorphism or roles.

Notes

  • Order customer handling is intentionally untouched; a normal contact may be an order customer without becoming a FleetOps customer.
  • The Fleet-Ops Customer role is only used in the migration as historical repair evidence, not as runtime source of truth.

Verification

  • php -l on touched PHP files
  • targeted PHP CS Fixer dry-run on touched files
  • git diff --check

Known gap

  • composer test:unit is blocked in this checkout because the local Pest install under server_vendor is missing its nested vendor autoload.

@roncodes roncodes force-pushed the feature/fix-customer-user-type-invariant branch from bfd4d57 to 94d7f39 Compare May 13, 2026 07:30
@roncodes roncodes changed the base branch from main to dev-v0.6.48 May 13, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant