Skip to content

Comments

Add logging to created_via_invite backward-compat fallback#1606

Closed
Copilot wants to merge 1 commit intoriderx/user-joined-metricfrom
copilot/sub-pr-1602
Closed

Add logging to created_via_invite backward-compat fallback#1606
Copilot wants to merge 1 commit intoriderx/user-joined-metricfrom
copilot/sub-pr-1602

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Summary

Addresses feedback on #1602 to add diagnostic logging when the created_via_invite column backward-compat fallback triggers during invite acceptance.

Changes:

  • Added isMissingCreatedViaInviteColumnError() helper to detect schema cache mismatches (PGRST204, 42703, message substring)
  • Log original insertError with requestId before retry in ensurePublicUserRowExists() and main accept flow
  • Applied same pattern to registers_today metric in logsnag_insights
if (isMissingCreatedViaInviteColumnError(insertError)) {
  cloudlog({
    requestId: c.get('requestId'),
    message: 'ensurePublicUserRowExists: created_via_invite column missing, retrying without it',
    error: insertError,  // Full error object for diagnostics
  })
  const { created_via_invite: _createdViaInvite, ...fallbackPayload } = insertPayload
  ;({ error: insertError } = await supabaseAdmin.from('users').insert(fallbackPayload))
}

Test plan

  • Existing test coverage in tests/user-created-via-invite.test.ts validates column behavior
  • Fallback logic can be manually tested by rolling back migration 20260209014020

Screenshots

N/A - Backend logging change only

Checklist

  • My code follows the code style of this project and passes bun run lint:backend && bun run lint.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • My change has adequate E2E test coverage.
  • I have tested my code manually, and I have provided steps how to reproduce my tests

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI mentioned this pull request Feb 9, 2026
5 tasks
Copilot AI changed the title [WIP] Update to exclude invited users from User Joined functionality Add logging to created_via_invite backward-compat fallback Feb 9, 2026
Copilot AI requested a review from riderx February 9, 2026 03:08
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

@riderx riderx closed this Feb 9, 2026
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.

2 participants