Skip to content

T-2: Extend Project model with canonicalPath + SwiftData migration #196

@kirich1409

Description

@kirich1409

Part of EPIC #193. Depends on #194.

Description

Add a canonicalPath: String field to the Project model (SharedModels) and its SwiftData ProjectModel. Implement a lightweight VersionedSchema migration — the new column is nullable. On first load, lazy-backfill canonicalPath via ProjectID(path:) and persist. Keep the UUID id for backward compatibility. Update ProjectRepository.addProject to deduplicate by canonicalPath rather than raw path.

Acceptance Criteria

  • VersionedSchema.V2 added with a migration path from V1
  • Existing UUID-based records are not lost after the update
  • ProjectRepository.addProject(url:) deduplicates via canonicalPath
  • Lazy backfill — after the first launch post-upgrade, all recent projects have canonicalPath populated
  • Two different spellings of the same path (~/work/proj and /Users/me/work/proj) in addProject result in a single entry
  • Integration tests: V1→V2 migration, dedup after migration, idempotent backfill
  • Build passes, swiftlint lint --strict clean

Module / Layer

SharedModels + Persistence / Data

Complexity

Medium

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions