Skip to content

design(import): reject duplicate effective CSV headers instead of last-wins #2807

Description

@yinlianghui

Baseline and classification

Minimal reproduction

Import this CSV while mapping both title columns to title:

ID,标题,标题
dup,first,second

Both executions succeed and persist title=second; the first value is silently discarded.

The same ambiguity can occur when distinct source headers map to the same destination field.

Decision needed / current behavior

  • Safer expected behavior: reject duplicate effective destination headers/keys before writes, with a request-level or row-independent mapping error.
  • Actual: parseCsvToRows assigns object keys in order, so later values silently overwrite earlier ones.

Impact

Malformed files or ambiguous mapping can cause silent data loss while the import summary reports success.

Evidence and exclusions

  • Source: packages/rest/src/import-prepare.ts, CSV header mapping/object assignment.
  • Quoted commas, BOM, CRLF, escaped quotes, and ordinary mappings passed QA.
  • Because no public duplicate-header contract was found, this issue requests an explicit validation decision rather than labeling existing behavior a regression.

Required regression tests

  • Duplicate raw headers.
  • Two distinct raw headers mapped to one destination field.
  • Error occurs before any row is written and identifies the conflicting columns/field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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