Skip to content

Import wizard: the duplicate-match-key row error is an English sentence in a zh-CN session, and record-level validation errors carry a _record: prefix #36980

Description

@sunhaolin

What happens

Console import wizard (list → Import), UI language zh-CN, @objectstack/* 18.6.0, HotCRM lead import (saved mapping, upsert on email). Two kinds of row error reach the user in a form they cannot read as the rest of the dialog:

1. The duplicate-match-key refusal is an English sentence with a machine field name

Upload a file where two rows carry the same upsert key, then Validate. The preview lists, for each of those rows:

第 1 行:Rows 1, 5 of this import have the same match key (email), so none of them was written: keep one row per key and import again

Everything around it is Chinese. The sentence is composed in English in packages/core/src/utils/import-runner.ts (code: 'DUPLICATE_MATCH_KEY', still so on main), and the wizard prints error as is. The key is named by its API name (email), not the field label (邮箱), unlike the field errors next to it.

2. A record-level validation error is prefixed with _record:

A row refused by an object-level validation rule (here crm_lead.disqualification_reason_required) is shown as:

第 3 行:_record: 线索标记为不合格时必须填写取消资格原因

A field-level error on the same screen is shown with the field label (名字: 此字段为必填项, 行业: … 不在允许的选项范围内). The record-level one leaks the internal _record path token as if it were a field name. The same text is what the result page and (presumably) the failed-rows download carry.

Expected

  1. The duplicate-key row error is rendered in the request's language (the wizard has the code and could compose it client-side, or the runner localizes it as it does validation messages), and names the key by field label.
  2. A record-level error is shown without the _record: prefix (just the message, as a record form's banner shows it).

Steps

  1. HotCRM 6.6.0 local dev, sign in, language 简体中文, Sales → 线索 → 导入.
  2. Upload a CSV with headers First Name,Last Name,Company,Email,Lead Status where rows 1 and 5 share an email, and one row has Lead Status = Disqualified.
  3. 下一步 → 校验数据.

Found in a UI test pass of HotCRM; not worked around there.

Activity

  1. added
    bug
    priority:p1
    domain:ui
    on Nov 24, 2026
  2. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Triage: lands in area:ux · domain:ui · priority:p1 · Bug · pm:queue.
    Rationale: the p1 grade is the filer's and stays as set. It is routed to repo:objectstack#3 (area:ux) by the maintainer's seat routing.

  3. added
    pm:queue
    on Nov 24, 2026
  4. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#3 · os-support-ai · session_01WGufzh1FMUQYf1PcEunaaK

    Claim: PM loop round 1 (area ux-D)
    Session: session_01WGufzh1FMUQYf1PcEunaaK
    Account: os-support-ai
    Branch: claude/issue-36980-import-row-errors-reader-language
    Worktree: objectstack-issue-36980
    Domain: domain:ui
    Seat: repo:objectstack#3
    Area: ux-D
    File surface: the DUPLICATE_MATCH_KEY row refusal in packages/core/src/utils/import-runner.ts (composed through the runner's existing messageTranslator in the request locale, naming the key by field label), the keyed message entry and its locale texts wherever the runner's other translated row messages live (the dev names the catalogue; if it is non-test packages/spec/src/** the PR owes an L2), the console import wizard's row-error rendering in ui/packages/plugin-grid/src/ImportWizard.tsx (and the result page / failed-rows readers it shares) for the _record: prefix, new pins named for this card, a changeset (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: default — dispatch-gates.mjs --tier: "Model tier — no path-derived mandate", effort: high
    Clause-②: no (expected: the row result keeps its shape and only its error text reads in the request language; a new row-result member would make it yes (widening), declared in the PR and owing an L2)
    Metadata-protocol: none
    Responsibility: the import runner in objectstack-ai/objectstack composes the duplicate-key refusal in English with API names, and the console wizard prints a record-level error's internal _record path | none | every console user who imports with an upsert key or hits an object-level validation rule (HotCRM lead import seen)
    Thread-read: 7132980313
    Premise: holds — measured on origin/main 57445a6: import-runner.ts:1589-1590 builds code: 'DUPLICATE_MATCH_KEY' with an English template naming shared.keySet (API names), while the cell-coercion errors beside it go through translate: messageTranslator with locale: context?.locale (:1063); the _record: prefix reader is located by the dev
    Pre-claim lane: packages/core/** (runner text) + ui/packages/plugin-grid/** kept in ux-D (seat route, mailbox 7133050108, translations card); any spec catalogue text is lane-keep with an L2 by L1-b (2)
    Pre-claim deps: no Blocked-by:; p1 routed to ux-D by the seat
    Prior rulings read: check-prior-rulings --card 36980 --paths import-runner.ts, ImportWizard.tsx → 4 ruling, 0 maintainer, 11 ⛔ hit lines; ADR term hits ADR-0002 §4, ADR-0031 §4/§6, ADR-0032 §1, ADR-0077 §3, ADR-0104 D1/D2, ADR-0137 D2: the dev reads those near every line it edits (ADR-0104 on refusal wording first); no same-day churn; repo: objectstack-ai/objectstack
    Serial constraints cleared: none — no open PR touches import-runner.ts or ImportWizard.tsx

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 24, 2026
  6. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#3 · os-support-ai · session_01WGufzh1FMUQYf1PcEunaaK
    os-dev-report

    {
      "issue": 36980,
      "status": "done",
      "branch": "claude/issue-36980-import-row-errors-reader-language",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37009",
      "session": "session_01WGufzh1FMUQYf1PcEunaaK",
      "premise_still_valid": true,
      "summary": "(1) The DUPLICATE_MATCH_KEY row refusal in packages/core/src/utils/import-runner.ts is now rendered through renderValidationMessage with the request locale (context.locale) and the runner's messageTranslator, from a new catalog entry import_duplicate_match_key in packages/spec/src/system/validation-message.ts (en, zh-CN, ja-JP, es-ES; override key validation.field.import_duplicate_match_key). It names the key set by field label, with the API name only as fallback, and keeps the row numbers; the row keeps its shape (code, error), so Clause-2 is no. (2) ui/packages/plugin-grid/src/ImportWizard.tsx gains rowErrorFieldLabel, which gives no label for the _record sentinel, used by formatDryRunError (dry-run findings and result screen) and by the failed-rows download. A record-level error shows as its message alone; a field-level error keeps 'Label: message'. Bounded in-place fix, declared in the PR: the download's field-level prefix now uses the label instead of the API name. The premise held on origin/main 57445a69: the English template and API-name join were at the DUPLICATE_MATCH_KEY site, and the _record: prefix came from the wizard's label fallback (fieldLabelByName.get(field) ?? field) plus the download's raw e.field prefix. Non-test packages/spec/src is touched, so the PR owes an L2 contract review (a catalog key and a docblock paragraph; no Zod shape, export, error code or authorable key).",
      "tests": "At head 5ed720f84f: core new pin import-runner-duplicate-match-key-36980.test.ts 5/5 passed (verbose). Full @objectstack/core vitest: Test Files 165 passed (165), Tests 3854 passed (3854). Full @objectstack/spec vitest: Test Files 982 passed (982), Tests 29733 passed, 1 todo (lock VERDICT command-exit 0). rest import-upsert-in-file-duplicate-key.test.ts plus import-row-cell-errors.test.ts: Test Files 2 passed, Tests 15 passed. UI pnpm --dir ui exec vitest run packages/plugin-grid/: Test Files 311 passed (311), Tests 2763 passed (2763), including the new ImportWizard.recordLevelRowError-36980.test.tsx 3/3. Ablations through scripts/ablation-replace.mjs (anchor 1 to 0, blob moved; restore proven by blob == HEAD and git diff HEAD empty): runner label replaced by keySet.join(' + '): 5 failed / 5. Wizard sentinel check dropped: 3 failed / 3. Both subjects resolve from source (relative import), so no dist rebuild was needed for the ablation legs; the spec catalog dist was rebuilt before the runs.",
      "gates": "Local: typecheck core and rest (each with check:test-typecheck), spec and plugin-grid type-check, exit 0. dispatch-gates --commands (93 commands at 5ed720f84f): 92 exit 0, 1 exit 3 PREREQUISITE NOT MET = NOT MEASURED (check:dual-build-cjs-loads, needs a full workspace build). --ran with ':: exit N' annotations: '93 derived famil(ies) accounted for — 92 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)', exit 0. ui check:new-line-citations: 0 new, exit 0. overlap-check before every push: VERDICT clean exit 0. CI on PR #37009 head 5ed720f84f: 24 check-runs at report time, 5 completed and 19 in_progress, so the required set is in_progress and has no verdict yet. PR mergeable_state blocked, not dirty. No check-platform-checklist run: no exported symbol was renamed or removed.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "2 — fleet-write relay pr_create (POST /repos/objectstack-ai/objectstack/dispatches leading to POST /repos/objectstack-ai/objectstack/pulls, draft, assignees os-support-ai), and post-stamped issue comment (POST /repos/objectstack-ai/objectstack/issues/36980/comments). git push is not counted.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed — the same runner still composes BLANK_MATCH_KEY ('The row has no match key: every key set in matchFields (...)') and the multi-value match-key refusal in English with API names. These were read only and not reproduced through a public door, so they have no reach line. They are the same family as this card and are listed in the PR's Acceptance notes. Dedupe words: BLANK_MATCH_KEY, import row English, matchFields API name, multiValueMatchKeyRefusal"
      ],
      "Dev-effort": "high",
      "Rounds": 1,
      "pr_number": 37009,
      "head_sha": "5ed720f84f87124dba68e61d5074f7d3fc1ecaa8",
      "line_budget": "315 changed lines (+307 / -8) over 7 files, per dispatch-gates' numstat vs merge base 57445a699",
      "files_changed": [
        ".changeset/36980-import-row-errors-reader-language.md",
        "packages/core/src/utils/import-runner.ts",
        "packages/core/src/utils/import-runner-duplicate-match-key-36980.test.ts",
        "packages/rest/src/import-upsert-in-file-duplicate-key.test.ts",
        "packages/spec/src/system/validation-message.ts",
        "ui/packages/plugin-grid/src/ImportWizard.tsx",
        "ui/packages/plugin-grid/src/ImportWizard.recordLevelRowError-36980.test.tsx"
      ],
      "deviations": [
        "packages/rest/src/import-upsert-in-file-duplicate-key.test.ts is outside the claim's named file surface. Its duplicate() helper asserted the old English sentence with API names, which this change makes false, so only the expected key-set spelling was changed to labels ('Supplier + Type + No.', 'Supplier + Note'). Every row, code and count assertion is unchanged. I judged this part of the fix rather than a new surface, and did not stop.",
        "Bounded in-place fix under os-dev rule 3: the failed-rows download now prefixes a field-level error with the field label instead of its API name. Same defect class, mechanical, same claimed file, same gate family. It is named in the PR body and pinned.",
        "The changeset names @objectstack/rest (patch) because the diff touches it, although only a test file changed there, as the order asks for every touched package.",
        "Local scope: the full @objectstack/rest suite was not run locally (only the two import test files); CI Test Core is the reading. check:dual-build-cjs-loads NOT MEASURED (exit 3).",
        "PR body layout: the order's two attribution lines come first, then Fixes, the two declaration lines and the plain signature line, as in the lane's precedent PR. The signed comment is the last non-empty line.",
        "Process note: the first --ran attempt used a tab-separated exit format the tool does not parse (it read 93 UNRUN). It was re-run with the ':: exit N' annotation and reconciled."
      ]
    }
  7. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#3 · os-support-ai · session_01WGufzh1FMUQYf1PcEunaaK

    Claim amendment · 2026-11-24T15:51Z · on PR #37009 (head ef15e26)
    File surface (amended): the catalogue the claim let the dev name is packages/spec/src/system/validation-message.ts (new keyed entry import_duplicate_match_key, en / zh-CN / ja-JP / es-ES, plus one docblock paragraph): non-test packages/spec/src/** text, so the PR owes an L2 contract review. The surface also names packages/rest/src/import-upsert-in-file-duplicate-key.test.ts, whose expected key-set spelling moves from API names to field labels (row, code and count assertions unchanged), and the failed-rows download's field-level prefix in ImportWizard.tsx (field label instead of API name, same defect class, pinned). Clause-②: no (the row result keeps code and error), Metadata-protocol: none unchanged.

  8. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#3 · os-support-ai · session_01WGufzh1FMUQYf1PcEunaaK

    Close-out · 2026-11-24T16:45Z · PR #37009 merged as 422df616 at 2026-11-24T16:32Z (L1 ACCEPT 7136960885, contract review PASS 7136918215, landing 7137030986). The duplicate-match-key row refusal reads in the request language and names the key by field label; a record-level error shows its message without the _record: prefix; the failed-rows download prefixes field errors with the label. N1 (the download reads the label twice for a cell failure, not new) went to the seat; N2 (BLANK_MATCH_KEY and the multi-value refusal still in English) is filed with triage by the seat; N3 stays in the review record. pm:dispatched removed.

  9. removed
    pm:dispatched
    on Nov 24, 2026
  10. added 2 commits that reference this issue on Dec 1, 2026
    422df61
    d15e439
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:uxbugdomain:uipriority:p1

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions