Skip to content

refactor(domain): OneDriveAccount.DriveId uses raw string? — should be strongly-typed DriveId wrapper #48

@jaybarden1

Description

@jaybarden1

Problem

Domain/OneDriveAccount.cs line 18: public string? DriveId { get; init; }. The DriveId wrapper (readonly record struct from Persistence/ValueObjects/DriveId) exists and has a registered converter. Using raw string? here is primitive obsession and is the direct cause of the ?? string.Empty guard needed in AccountOnboardingService.

Required fix

// Domain/OneDriveAccount.cs
public DriveId? DriveId { get; init; }

Update all call sites: AuthService, AccountOnboardingService, WorkspaceViewModel, AddAccountWizardViewModel. With a typed DriveId?, the null guard in onboarding becomes cleaner:

if (account.DriveId is null)
    return new Fail<OneDriveAccount, PersistenceError>(
        PersistenceErrorFactory.Unexpected("Cannot onboard account: DriveId is missing."));

Rule reference

@.claude/rules/onedrive-persistence.md — Required domain value types table

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions