Skip to content

feat(import): use a dedicated rejection reason for VIN conflicts instead of :invalid_fields #5528

Description

@JakobLichterfeld

Context

Follow-up to #5519. The TeslaFi import quarantines a row when its VIN differs from the
import car while the vehicle ID still matches (classify_vehicle/5 in
lib/teslamate/import.ex). This handles TeslaFi variants that omit VINs and rely on the
configured vehicle-ID fallback.

Problem

The quarantined row is currently recorded as :invalid_fields, ["vin"], so the import
page shows "invalid values for vin". That is misleading: the VIN is a perfectly valid
value — it just belongs to a different vehicle than the one the import run identified.

Suggested change

  • Add a dedicated reason such as :vehicle_conflict to the Ecto.Enum values in
    lib/teslamate/import/rejection.ex and use it in classify_vehicle/5.
  • Add a matching rejection_reason/1 clause in
    lib/teslamate_web/live/import_live/index.ex with a gettext string along the lines of
    "row belongs to a different vehicle", and run the gettext extract/merge.

No migration is needed — the reason column is a plain :string.

🤖Issue drafted with Claude Code (Fable 5 high) — sponsored by Claude for Open Source

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions