Skip to content

Add typed, privacy-safe Google contact sync logging - #833

Draft
qayshp wants to merge 3 commits into
BlueBubblesApp:developmentfrom
qayshp:agent/improve-google-contact-sync-logging
Draft

Add typed, privacy-safe Google contact sync logging#833
qayshp wants to merge 3 commits into
BlueBubblesApp:developmentfrom
qayshp:agent/improve-google-contact-sync-logging

Conversation

@qayshp

@qayshp qayshp commented Jul 23, 2026

Copy link
Copy Markdown

Summary

  • report succeeded, skipped, failed, and total counts after Google contact sync
  • add per-contact debug context using only the one-based batch index and field-presence booleans
  • represent known contact failures with typed ContactInterfaceError codes
  • accept only the fixed CONTACT_ERROR_CODES allow-list in logs; collapse all arbitrary messages and unrecognized codes to unknown-error
  • add focused privacy and result-formatting tests

Why

Issue #677 asks for enough detail to understand partial Google contact imports. The previous implementation tracked only whether any contact failed and logged the raw exception message. That made the final warning difficult to act on and could expose contact or provider data.

Implementation

The final sync summary distinguishes contacts that were saved, skipped because Google supplied no name record, or failed during avatar loading or persistence. Failure debug context contains only:

  • the contact's one-based position in the fetched batch
  • booleans describing whether supported fields were present
  • a stable failure reason from the typed contact-error allow-list, or unknown-error

It does not log names, phone numbers, email addresses, avatar URLs, Google resource identifiers, provider payloads, arbitrary exception messages, or merely string-shaped error codes.

Validation

Passed on the current head:

  • node --test test/contactSyncLogging.test.cjs — 4/4 tests
  • targeted ESLint
  • git diff --check

The tests cover aggregate formatting, present and empty field context, every allow-listed contact error, rejection of arbitrary codes, and suppression of provider/contact values and exception text.

No live Google OAuth/contact import was performed, so validation is limited to the focused automated coverage.

Fixes #677

@qayshp qayshp left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Self-review: one follow-up identified before this draft is ready for maintainer review.

Comment thread packages/server/src/server/services/oauthService/contactSyncLogging.ts Outdated
@qayshp

qayshp commented Jul 23, 2026

Copy link
Copy Markdown
Author

Validation update

Validated on the current SIP-enabled Tahoe host:

  • Passed: npm run test:contact-sync-logging --workspace @bluebubbles/server
  • Result: 4/4 focused tests passed.
  • Coverage includes aggregate result formatting, field-presence context, empty-field handling, stable known reasons, and suppression of provider values and arbitrary exception text.

No live Google OAuth/import workflow was performed, so this records the focused automated coverage only.

@qayshp qayshp changed the title Improve Google contact sync logging Add typed, privacy-safe Google contact sync logging Jul 27, 2026
@qayshp

qayshp commented Jul 27, 2026

Copy link
Copy Markdown
Author

Superseding the earlier validation note: the final head uses typed ContactInterfaceError values and accepts only the fixed CONTACT_ERROR_CODES allow-list; arbitrary messages and unrecognized or merely string-shaped codes become unknown-error. The focused suite passes 4/4 and covers result totals, privacy-safe field-presence context, every known code, and suppression of provider/contact values. Limitation: no live Google OAuth/contact import was performed.

@qayshp

qayshp commented Jul 28, 2026

Copy link
Copy Markdown
Author

Latest-head validation (3164ea4f):

@qayshp
qayshp marked this pull request as ready for review July 28, 2026 07:02
@qayshp
qayshp marked this pull request as draft July 28, 2026 07:30
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