Skip to content

Data import: allow alternative match keys per row (e.g. credit code, else country + registration no.) #25476

Closed as duplicate

Description

@marchtian

Ruled: 6377845536 · batch #9 item 3b · letter A · 2026-10-24T00:43:45Z (ordered key sets; a row blank on every set is a row error, not a silent skip)

Context

In hotsrm a supplier's identity depends on where it is registered (ADR-0007): domestic suppliers are unique by credit_code, overseas ones by country + registration_no (credit_code is blank for them). One legacy supplier sheet contains both.

Gap

ImportRequest.matchFields is a single key set for the whole import. With matchFields: ['credit_code'], overseas rows have a blank key and upsert creates them again on every run (duplicates), unless skipBlankMatchKey is set, in which case they are not imported at all.

Proposal

Accept an ordered list of key sets, first non-blank one wins per row:

{ "writeMode": "upsert", "matchKeys": [["credit_code"], ["country", "registration_no"]] }

(or matchFields accepting string[][]). Ambiguity rules stay as today (AMBIGUOUS_MATCH if a key set hits more than one row).

Workaround in hotsrm (temporary)

Import the same sheet twice with skipBlankMatchKey: true: pass 1 matchFields: ['credit_code'], pass 2 matchFields: ['country', 'registration_no']. Each pass skips the other kind of row. Correct, but the operator has to run two imports and read two reports, and a domestic row with a blank credit code is only reported as BLANK_MATCH_KEY skipped, not as an error.

Linked: objectstack-ai/hotsrm#10

Activity

  1. marchtian commented on Oct 23, 2026

    @marchtian
    CollaboratorAuthor

    Trial import finding that makes this more than a convenience: with the two-pass workaround, a domestic supplier row whose credit code is missing is skipped as BLANK_MATCH_KEY in both passes and never reported as an error, and the same happens to an overseas row with no registration number. With ordered match keys the runner could report "no match key in any set" as a row error instead.


    Generated by Claude Code

  2. added
    area:recordsBusiness objects, records, the views that show data, usable forms, search
    domain:specDomain lane — seat card indexed by label:pm:seat
    enhancementNew feature or request
    needs-user-decisionBlocked on a maintainer decision — do not dispatch; decision cards only, never on a PR
    on Oct 23, 2026
  3. objectstack-fleet commented on Oct 23, 2026

    @objectstack-fleet
    Contributor

    Triage: decision-shaped (filing-gate ②: a feature / contract-shape proposal from a real app). Lands in packages/spec (ImportRequest.matchFields) first, then the import runner in packages/rest. Marked needs-user-decision; not dispatchable until ruled.
    Path: records · 把客户的存量数据搬进来 | records-forms.named-import-mapping (P2) | step ⑥
    Type: Feature

    维护者速读

    同一张供应商表里,国内供应商按信用代码识别,海外供应商按"国家 + 注册号"识别。现在一次导入只能用一组匹配键,只能分两遍导;而两遍都缺键的行会被静默跳过,不报错。

    • A:匹配键接受有序的多组(matchKeys: [[credit_code], [country, registration_no]]),每行用第一组非空的;哪组都空就报行错误。
    • B:不加多组,只把"匹配键为空"从静默跳过改成可选的行错误。
    • C:不做,继续两遍导入。

    推荐 A:它同时解决重复和"缺键不报错",B 只修后半。问:A / B / C?

    os-decision-facets

    • ① 项目长远合理性:A 把"一行的身份可能有多种"表达成一个声明,和对象自身的多组唯一键一致;B 是半修;C 让每次迁移都要人读两份报告。
    • ② 实际业务拉动:hotsrm#10 试导实测,且评论里证实缺键行两遍都被静默跳过。
    • ③ 防 AI 犯错:A 让"无键"变成响亮的行错误;今天的两遍法把缺失数据静默吞掉。
    • ④ 创业阶段不扩散:A 扩一个键的形状(string[][]);B 加一个开关;C 零新增。

    Governing text: ImportRequestSchema.matchFields / skipBlankMatchKey (packages/spec).
    Prior rulings read: unresolved (not searched with check-prior-rulings.mjs).

    Batch note: one of five import / automation proposals from hotsrm's trial import filed on 2026-10-23 (#25475, #25476, #25477, #25481, #25493); the earlier hotsrm platform evaluation is the decision card #25496. They can be ruled as one batch.

    Session: session_01AkmasAfXt3cu83xGzkuKhe (objectstack triage, run on the maintainer's request in the project thread)


    Generated by Claude Code

  4. os-elon-musk commented on Oct 24, 2026

    @os-elon-musk
    Collaborator

    Ruling: batch #9 item 3b · letter A · maintainer 「#9 同意」 2026-10-24T00:43:45Z

    A = 匹配键接受有序多组(matchFields 接受 string[][],单组写法照旧有效),每行用第一组非空的键;哪组都空就报行错误,不再静默跳过;AMBIGUOUS_MATCH 规则不变。工作量 spec + server S–M。先 spec 后 server,可与 #25475 合成一个导入契约 PR + 一个跑者 PR;hotsrm 发版后拆掉两遍导入的绕行。

    标签 needs-user-decision → pm:queue,分级按协议变更口径由分诊定;裁不派。简报:https://claude.ai/artifact/XKBVwFLq2V5nBTNy3enkbz(卡 3)。


    Generated by Claude Code

  5. added
    pm:queueReady for the PM dispatch loop
    and removed
    needs-user-decisionBlocked on a maintainer decision — do not dispatch; decision cards only, never on a PR
    on Oct 24, 2026
  6. objectstack-fleet commented on Oct 24, 2026

    @objectstack-fleet
    Contributor

    Closed 2026-10-24T01:38Z. Superseded by #25578 — the same card ("data import cannot take alternative match keys per row"), re-filed as objectstack-fleet[bot] with this body and these labels. This card was written off the fleet relay, under the maintainer's personal account, by a project-thread session through GitHub MCP, which pm-dispatch does not allow for content writes. The thread above stays here for reference; the queue continues on #25578.

    Instruction: the maintainer 田騏, in the Objectstack project thread, 2026-10-24T01:19:49Z: 「我看到有一些使用个人账户而不是车队账户提交的issue,应该严格按照 pm-dispatch 的规则处理」
    Session: session_018fnREjMeK9XQeHDwkJXKMW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:recordsBusiness objects, records, the views that show data, usable forms, searchdomain:specDomain lane — seat card indexed by label:pm:seatenhancementNew feature or requestpriority:p2Medium: important, M3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions