Skip to content

Identity and installation upgrade

Run the published Shopify Commerce and Contacts migrations before restarting queue workers. Shopify mirrors now record their installation generation. Existing mirrors are attributed to the connection generation present at upgrade because older rows contain no reliable installation history. New writes retain explicit ownership. An old shop/redact erases only its recorded generation; it cannot revoke a newer connection. Current-generation shop redaction still requires the existing remote uninstall confirmation.

Contacts builds its source index from Shopify profiles, Shopify source relations and Shopify activities. A contact’s current email is never used as evidence for a different source. Field provenance is separated by connection and installation. Erasure restores the most recent remaining source value, using the stored per-field timestamp and a stable source-key tie break. Legacy mixed-source fields without proven ownership remain unchanged.

Legacy rows. Contacts records per-installation ownership in the encrypted profile: whether the installation created the Contact, and which installation wrote each field. A value counts as Shopify’s only while the Contact still holds what Shopify supplied, so a staff edit is kept. Rows from before this record have no proof. The upgrade migration records Shopify creation only for a Contact linked to its Shopify customer, with no other source, lead or activity, first seen within 60 seconds of that customer’s first sync. Every other legacy row stays unknown and a resync never relabels it. customers/redact and shop/redact then erase only values Shopify provably wrote, remove the Shopify provenance, keep the remaining details and add a Shopify erasure review activity naming the kept fields, never their values. A privacy operator must review each flagged Contact and anonymize it if the details came from that customer. Merges move the source index and ownership to the surviving Contact: a hand-made side makes the merged Contact not Shopify-created, and an unknown side keeps it unknown.

Shopify webhook events now live in Core’s inbound webhook table. The upgrade migration moves each stored event there with a receipt per installation, queues anything Pending, Processing or Failed, and drops shopify_webhook_events. An event that keeps failing stays in Developer > Webhook Events; once the cause is fixed, recover it with capell:webhooks:replay {event}. The bulk replay command, capell-shopify-commerce:webhooks:replay, is retired. Rolling the migration back is refused while moved events or receipts exist.

  1. Keep the outgoing key in Laravel’s app.previous_keys (normally configured from APP_PREVIOUS_KEYS) when setting the new APP_KEY. Keep every earlier key still needed by encrypted data or erasure markers. Rebuild configuration and restart workers so they share the same key set.

  2. Preview the scan, then rehash recoverable identities:

    Terminal window
    php artisan capell-shopify-commerce:rehash-identities --hash-version=2 --dry-run
    php artisan capell-shopify-commerce:rehash-identities --hash-version=2
  3. The command scans at most 10,000 rows per store by default in batches of 100. It prints each store’s last scanned ID. Continue each store separately with its checkpoint, for example:

    Terminal window
    php artisan capell-shopify-commerce:rehash-identities --store=customers --after-id=10000 --limit=10000

    Store names are customers, products and contacts. Repeat until the checkpoint stops advancing. A dry run prints scan checkpoints without writing; resume a real run from its last written checkpoint. Repeating a batch is safe. Run during a quiet period or repeat from zero afterwards: rows changed concurrently are left for a later pass rather than overwriting fresh data.

Shopify email lookups match the current key, all app.previous_keys and the legacy unkeyed format. Contacts email, phone and identifier lookups also accept previous application keys when Contacts uses the application key. A separately configured capell-contacts.hash_secret remains its own stable secret; changing that secret is outside this application-key rotation procedure.

The command rewrites customer email hashes and recoverable product customer-email indexes. Webhook receipts keep only the keyed hash a customer redaction named, which has no email to rehash, so it remains under its original key. When Contacts is enabled, its synchronous ShopifyIdentityRehashRequested listener also rewrites Contact lookup hashes and Shopify source indexes using encrypted source provenance. The command adds current-key aliases for matching erasure markers while retaining old hashes. It never reconstructs or stores erased email addresses.

Do not remove a previous key merely because the scan completed. A marker or minimized webhook index with no source email cannot be rehashed. Keep its key for as long as the marker or index is needed. Backups and other encrypted records can independently require old keys. Verify the host application’s retention and encryption requirements before retiring any key.