Skip to content

[Reliability] Keep crash-report user identity current - #149

Draft
joashrajin wants to merge 1 commit into
trunkfrom
codex/refresh-crash-user-identity
Draft

joashrajin wants to merge 1 commit into
trunkfrom
codex/refresh-crash-user-identity

Conversation

@joashrajin

Copy link
Copy Markdown
Owner

Fix

Crash logging initializes before Simplenote constructs Simperium. The existing user flow samples
app.simperium.user once and completes, while Simperium restores only its access token and email—not a user ID.
An authenticated cold start can therefore remain anonymous in crash reporting, and later sign-in or sign-out changes
are not reflected.

Observe Simperium's credential preferences for the lifetime of the crash-logging collector. Each initial or changed
signal reads both values from one preference snapshot, emits an email-only user when the token and email are both
nonblank, coalesces the two callbacks from one authentication update, and clears the user when the credentials
disappear. Reading the snapshot downstream also prevents a concurrent login callback from being overwritten by an
older initial value. The access token is only a session-presence check and is never sent to crash logging.

This changes crash-report identity metadata only. Authentication, credential persistence, sync, and the existing
analytics setting and crash-event gating are unchanged.

Test

  • Ran the same compiled regression (class SHA-256
    96ba297a81348f032e6d0730c70e44ca5af683131f0fa27e8f9dc918a94d1069) against exact fork trunk
    a1280c2e and the fix:
    • Base: 3/6 passed. Restored-session identity, sign-in/sign-out updates, and concurrent initial/login ordering failed.
    • Fixed: 6/6 passed, including duplicate callback suppression and listener cleanup.
  • Ran the forced local matrix: 169/169 Gradle tasks executed successfully.
    • JVM tests: 308/308 across 34 suites.
    • Android-test sources compiled successfully (32 Kotlin and 17 Java class outputs); no device test was run.
    • Roborazzi: 14/14 references unchanged.
    • Debug/release APKs, the release AAB, and release mapping were rebuilt; all archives passed integrity checks.
    • The debug APK verifies with v1/v2 under the Android Debug certificate; the release APK and AAB are unsigned as
      expected locally.
    • Sentry mapping upload was excluded because SENTRY_AUTH_TOKEN was unset.
  • Ran :Simplenote:lintDebug: 0 errors, 263 warnings, 1 hint, with no findings on either changed path.

Review

Please focus on the preference-listener lifetime and cleanup, the single-snapshot read under concurrent initial/login
ordering, and the token's presence-only role.

The tests use mocked preferences and the crash-logging data provider. They do not initialize a real Sentry client,
contact a crash backend, execute a real Simperium authentication flow, run on a device, or change/test crash-report
consent behavior.

Before publication, neither changed path appeared in any of 118 open fork PRs or 9 open upstream PRs. This branch is
based directly on fork trunk; no upstream branch or PR was written.

Release

Release notes are not needed; this is diagnostics reliability hardening.

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