Skip to content

Add macOS dev/beta auth canary and release guardrails #9160

Closed

Description

@Git-on-my-level

Context

A macOS beta auth regression reached users before we caught it automatically. The user-visible error was:

Could not securely store sign-in tokens. Please try again.

Investigation showed backend OAuth/Firebase was healthy (/v1/auth/token returned 200), but beta desktop builds failed after Auth Token Exchange Completed with:

event = Auth Flow Failed
failure_class = keychain_token_storage_unavailable

Stable/prod macOS sign-in was green in PostHog during the same window, while beta builds had non-zero starts and zero completions.

Current observability gap

We have enough PostHog auth events to diagnose after the fact:

  • Sign In Started
  • Auth Token Exchange Completed
  • Auth Flow Failed
  • Sign In Failed
  • Sign In Completed

But macOS auth events currently lack explicit release/environment dimensions:

  • build_environment
  • update_channel
  • is_beta
  • release_tag
  • backend/auth host fields

So beta-vs-stable has to be inferred from build numbers/appcast state. We also do not have a synthetic dev/beta canary environment that continuously exercises signed desktop auth before real users hit a broken beta.

Proposal

Design a better dev/beta canary path for macOS Desktop releases:

  1. Instrument release/channel dimensions on every macOS analytics event

    • bundle_id
    • app_version
    • app_build
    • release_tag
    • update_channel (stable / beta)
    • inferred_update_channel
    • is_production_bundle
    • is_non_production_bundle
    • auth_api_host
    • python_api_host
    • desktop_backend_host
  2. Create a signed beta auth canary

    • Run against the same signed/notarized app artifact users receive, not only unit-test seams.
    • Use a dedicated test account and fresh local profile/keychain/defaults.
    • Exercise Google/Apple-equivalent OAuth token-finalization path or a backend-issued auth fixture where provider automation is impractical.
    • Validate: token exchange, local token persistence, token refresh/retrieval, app reaches signed-in state.
  3. Emit canary telemetry

    • Synthetic Auth Smoke Started
    • Synthetic Auth Smoke Passed
    • Synthetic Auth Smoke Failed
    • Include stage, failure_class, app_build, update_channel, provider/auth path.
  4. Gate beta appcast promotion

    • Do not advertise a new beta build until the signed artifact canary passes.
    • If canary is skipped/unavailable, fail closed or require explicit manual override.
  5. Alert on real-user and canary regressions

    • Real-user beta auth: starts >= 2 and completions = 0 over 15–30m.
    • Any new/known auth failure_class with >= 2 users over 30m.
    • Canary missing/failing after a beta build publish.

Acceptance criteria

  • macOS analytics events include explicit update channel/release/backend-host properties.
  • A signed beta auth canary exists and runs automatically for new beta artifacts.
  • Canary emits pass/fail telemetry with failure stage/class.
  • Beta appcast publication is blocked or explicitly warned when the canary fails or is missing.
  • PostHog alert(s) or equivalent stability-channel notifications cover beta auth completion failures and canary failures.
  • Documentation explains how to run the canary locally and how to interpret failures.

Related incident evidence

  • Broken beta builds observed in PostHog: 0.12.34/12034, 0.12.35/12035, 0.12.36/12036.
  • Failure class: keychain_token_storage_unavailable.
  • Backend OAuth was healthy; failure occurred in desktop local token persistence.
  • A temporary PostHog saved metric was added: macOS Auth Guardrail: beta/stable sign-in health.

Activity

  1. added
    enhancement
    needs-tests
    on Jul 6, 2026
  2. aryanorastar commented on Aug 6, 2026

    @aryanorastar
    Collaborator

    VERIFY — PARKED (infra/ops epic)

    Re-checked 2026-08-06. Partial progress on main (#9162 keychain, #10443 release-health, Codemagic --auth-storage-canary / qualify-desktop-beta.sh), but remaining ACs need OAuth test-account secrets, synthetic signed-artifact auth canary telemetry, and PostHog alert wiring — maintainer/CI ops scope, not a shrink contributor PR.

  3. Git-on-my-level commented on Sep 8, 2026

    @Git-on-my-level
    MemberAuthor

    Closing with one carve-out. Five of six acceptance criteria are met on main: release/channel super-properties on every macOS event (PostHogManager.swift, #10443); the signed-artifact AuthStorageCanary run by smoke-signed-desktop-artifact.sh --auth-storage-canary in codemagic.yaml; fail-closed guards in check_desktop_auth_session.py and check-release-process-guards.py; documented as mandatory in desktop/macos/AGENTS.md; the original regression fixed by #9162. Not done: AC5, a PostHog alert for beta auth starts with zero completions and for a missing canary after a beta publish. That is a single alert definition in project 302298 and should be filed on its own rather than hold this open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    desktopenhancementneeds-tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions