Skip to content

M10 (architecture): unified UserFacingError + ErrorReporter funnel #67

Closed

Description

@wei18

Source: Architect audit Wave 3, finding #4 (2026-05-20)

Problem

Error handling is per-callsite and inconsistent:

  • RootViewModel.bootstrap swallows persistence errors to nil
  • GameViewModel uses try? on every session/persistence call (12+ sites)
  • GameCenterSink swallows by policy
  • BoardLoaderView stringifies via String(describing:)

A real CloudKit iCloudSignedOutDuringSession error will silently disappear — no user surface, no telemetry breadcrumb.

Proposal

  1. Define a UserFacingError value type at the AppComposition seam (sum of expected failure modes: networkUnavailable, iCloudSignedOut, persistencePermanent, gameCenterUnauthenticated, unknown)
  2. Define an ErrorReporter protocol; default Live implementation routes through Telemetry.errorOccurred + an in-memory recent-errors buffer
  3. Replace try? patterns with try / catch → reporter.report(...) at module boundaries
  4. UI surfaces (BoardLoaderView, RootView) consume UserFacingError, render localized copy

Acceptance

  • rg "try\\?" Packages/SudokuKit/Sources/ returns <5 sites (only where nil semantics are genuinely correct)
  • ErrorReporter protocol has Live + Fake implementations
  • New tests assert that a thrown CloudKit error surfaces a telemetry event

Out of scope

  • Not blocking v2 ship; tackle in v2 stabilization milestone

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions