Skip to content

Comments

Improve error logging observability for created_via_invite rollout#1607

Merged
riderx merged 2 commits intoriderx/user-joined-metricfrom
copilot/sub-pr-1602-again
Feb 9, 2026
Merged

Improve error logging observability for created_via_invite rollout#1607
riderx merged 2 commits intoriderx/user-joined-metricfrom
copilot/sub-pr-1602-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Summary

Addresses feedback on #1602: log all initial insert errors before retry decisions to improve observability during created_via_invite column rollout.

Pattern change:

// Before: only logged when retrying
if (isMissingCreatedViaInviteColumnError(error)) {
  cloudlog({ message: 'retrying', error })
}

// After: always log initial error, separate retry decision
if (error) {
  cloudlog({ message: 'initial insert error', error })
}
if (isMissingCreatedViaInviteColumnError(error)) {
  cloudlog({ message: 'retrying without column' })
}

This ensures visibility into unexpected errors that might be masked by successful retries, even when the missing column error is not the root cause.

Modified locations:

  • ensurePublicUserRowExists: lines 150-156
  • accept_invitation handler: lines 456-462

Test plan

  • Existing test suite validates no functional changes
  • Logs will be monitored during production rollout

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.

Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
Copilot AI changed the title [WIP] Update logic to exclude invited users from User Joined Improve error logging observability for created_via_invite rollout Feb 9, 2026
Copilot AI requested a review from riderx February 9, 2026 03:10
@riderx riderx marked this pull request as ready for review February 9, 2026 03:13
Copilot AI review requested due to automatic review settings February 9, 2026 03:13
@riderx riderx merged commit 33195df into riderx/user-joined-metric Feb 9, 2026
4 of 5 checks passed
@riderx riderx deleted the copilot/sub-pr-1602-again branch February 9, 2026 03:14
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

riderx added a commit that referenced this pull request Feb 9, 2026
* fix(metrics): exclude invited users from User Joined

* test(metrics): add created_via_invite coverage

* chore(metrics): harden created_via_invite fallback

* test: fix created_via_invite fk

* Improve error logging observability for created_via_invite rollout (#1607)

* Initial plan

* feat: log all initial insert errors before retry decision

Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: riderx <4084527+riderx@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves observability during the created_via_invite backward-compatible column rollout by ensuring initial insert errors are always logged before any retry/fallback behavior in the invitation acceptance flow.

Changes:

  • Added “initial insert error” logging before retry decisions in ensurePublicUserRowExists.
  • Added “initial user insert error” logging before retry decisions in the main accept_invitation handler.
  • Removed the error object from the “retrying without column” log line to avoid duplicating the same error in multiple log events.

Comment on lines +149 to +156
// Log any initial error for observability during rollout
if (insertError) {
cloudlog({
requestId: c.get('requestId'),
message: 'ensurePublicUserRowExists: initial insert error',
error: insertError,
})
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These logs are recording insert failures; consider using cloudlogErr (stderr) instead of cloudlog so error-level logs can be filtered/alerted consistently across runtimes.

Copilot uses AI. Check for mistakes.
Comment on lines +455 to +462
// Log any initial error for observability during rollout
if (userNormalTableError) {
cloudlog({
requestId: c.get('requestId'),
message: 'accept_invitation: initial user insert error',
error: userNormalTableError,
})
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is logging an actual insert error; consider emitting it via cloudlogErr (stderr) instead of cloudlog to keep error logs consistent and easier to detect in production logging pipelines.

Copilot uses AI. Check for mistakes.
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