Skip to content

[Decision] 导入用的共享字段映射,在哪里新建和管理 #37359

Backlog

Description

@objectstack-fleet

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

④ sub-issue of #36890 · Source: #37192 proposal §3.10 (F2), filed after #37201 landed (PR #37341). Part of #36890.

维护者速读

  • 问题:导入数据时可以选一个大家共用的「字段映射」(文件的列对应哪个字段、值怎么转换),但它只能在 Studio「高级」的列表里对着表单手填出来,导入向导里只能选、不能存。按固定格式反复导入数据的管理员会碰到,目前没有人提过。
  • 选项:A 管理员在应用的导入向导里对好列之后,可以存成大家都能选的共享映射,旁边有「管理」通到 Studio 的列表,约 1 到 2 个 PR;B 向导里只加一个「管理映射」链接,映射还是去 Studio 手填,约 1 个 PR;C 在 Studio 新建映射时可以传一个样例文件,列名自动带出、字段从列表里选,约 1 个 PR;D 在 Studio 的对象页里加一块「导入映射」,约 2 个 PR;E 不做。
  • 推荐 A,但先不排期:映射本来就该在拿着文件对列的时候建,将来接外部系统的同步向导也是这样建;现在没人提过,所以定了方向先不做,做之前界面和 E 一样。
  • 不定会怎样:不会坏,共享映射继续只能由开发人员在 Studio 或代码里建;新建的应用还没有任何映射时菜单里连这个列表都没有,要等「高级里一条都没有的类型从哪里新建」那张卡定了才有入口。

Analysis

Decision thread for seat repo:objectstack#4, zone a4-S. Read-only. Code read at origin/main 134b71db (2026-11-25T21:25Z).

The question in one sentence

A person who imports the same kind of file again and again can pick a shared column mapping in the import wizard but cannot make one there: where is a shared mapping made and looked after?

Background, and two corrections to the source

Proposal §3.10 on #37192 wrote F2 as: "A mapping is used by the object's import. Decide whether it is managed from the import wizard on the 记录 tab."

Correction 1: Studio's 记录 tab has no import wizard. The wizard is in the running app: on an object's list page, in the AI assistant's Excel import bar, and in the user import (premise 1). So "the import wizard on the 记录 tab" is the app's wizard, not a Studio one. Adding an import to Studio's object page is not proposed here: importing data is the running app's job.

Correction 2: a mapping has more consumers than the wizard. It is a named, governed item that carries column renames, value transforms, the write mode and the match fields. It is used by:

What the wizard has today, side by side on one step:

  • 「映射模板」 with 「保存当前映射」: it saves the columns the person just mapped as a template in this browser's local storage. Nobody else sees it, and another computer does not have it (premise 2). It is a personal convenience.
  • 「已保存的映射」: it lists the shared mappings. It can pick one. It cannot make, change or remove one.

There is no way from the first to the second. A shared mapping is made by typing it into a form in Studio (高级 › 字段映射), with no file in hand, or in code.

Governing text:

  • ADR-0084, amendment of 2026-11-25, the rule that sorts a type, item 1: "A type bound to one object is authored from that object." — git grep -n "It has no parent object" origin/main -- docs/adr/0084-application-builder-information-architecture.md (line 281). A mapping requires one target object (premise 3). This is a clause of the menu's sorting rule: it gives the direction and binds no particular door, so no option below conflicts with it, E included.
  • ADR-0153 D11: "The Studio sync wizard creates the synced object, the mapping and that job." — git grep -n "The Studio sync wizard creates" origin/main -- docs/adr/0153-one-way-sync-in-beside-federation.md (line 717). The record's status line reads Proposed; its epic [Epic] One-way sync-in beside federation: external data becomes ordinary objects with a provenance marker, read-only by default, write-back only through declared actions (ruled A, 2026-11-09) #31763 is titled "ruled A, 2026-11-09"; the wizard is not built.
  • ADR-0146, note of 2026-11-24: "The running app is an editing surface too, for a workspace administrator." It lists what is edited there: the app's layout, a dashboard, a report, a list or kanban view's settings. A mapping is not on that list, so option A adds to it, by a dated line. On where such a save lands: "A view created in the app is saved into the app's package when that is writable, otherwise into its pair." — git grep -n "A view created in the app is saved into the app's package" origin/main -- docs/adr/0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md.

No text says where a mapping for a file import is made.

Protocol: Metadata-protocol: none, Clause-②: no, for every option. The mapping type, its schema and its write door exist; no option adds a key.

Premises (each with its re-check, run at the repository root)

  1. Studio's object page has no import; the wizard's hosts are in the running app.
    • git grep -c "ImportWizard" origin/main -- ui/packages/app-shell/src/views/studio-design/ → prints nothing (zero hits).
    • git grep -l "ImportWizard" origin/main -- 'ui/packages/app-shell/src/**/*.tsx' ':!*.test.*' → views/ObjectView.tsx, views/IdentityImportPanels.tsx, console/ai/ExcelImportBar.tsx, console/ai/AiChatPage.tsx.
  2. The wizard picks a shared mapping read-only, and saves personal templates in the browser.
    • git grep -n -E "grid.import.savedMappingHint'|grid.import.saveCurrent'" origin/main -- ui/packages/plugin-grid/src/ImportWizard.tsx (the strings at lines 83 and 92, drawn at lines 1529 and 1686; the hint ends "Column mapping is read-only.").
    • The Chinese label: git grep -n "saveCurrent: " origin/main -- ui/packages/i18n/src/locales/zh-Hans.ts (line 720, 「保存当前映射」).
    • git grep -n "objectui:import-templates" origin/main -- ui/packages/plugin-grid/src/ImportWizard.tsx (lines 402 and 2447: the local storage key).
  3. A mapping requires one target object and can be created at run time.
    • git grep -n "targetObject: z.string()" origin/main -- packages/spec/src/data/mapping.zod.ts (line 450).
    • git grep -n "type: 'mapping'" origin/main -- packages/spec/src/kernel/metadata-plugin.zod.ts (line 937: allowRuntimeCreate: true, domain: 'data').
  4. Studio lists 字段映射 under 高级, and only when the package holds one.
    • git grep -n "{ type: 'mapping', tier: 'advanced' }" origin/main -- ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts.
    • git grep -n "packagesByType\[e.type\]" origin/main -- ui/packages/app-shell/src/views/metadata-admin/directoryScope.ts (line 40). The sibling card F3 is about that rule.
  5. A source column typed wrongly in a mapping fails silently; a wrong target field is refused.
    • The value is read from the row by the header's text, with no check that the file has that column: git show origin/main:packages/core/src/utils/import-mapping.ts | sed -n '208,224p' (row[first(entry.source)], lines 214 and 221). A header that matches no column leaves the field empty and nothing is said. Read in the code, not run.
    • A target that is not a field of the object is refused: git grep -n "refuseUnknownMappingTargets" origin/main -- packages/core/src/utils/import-mapping.test.ts (line 68).
  6. Use today. One authored mapping in the repository's example apps: git grep -c "defineMapping(" origin/main -- examples packages/apps → examples/app-showcase/src/data/mappings/index.ts:1. Three on the 销售 package (the per-type table of the proposal on [Decision] Studio left menu: features are there but the focus is unclear — order and visual weight inside the groups #37192, from the maintainer's screenshot); re-check needs that deployment: open the package in Studio, open 高级, and read the number beside 字段映射.
  7. The same people may enter Studio and may write shared items in the app. Both ask for a workspace administrator who holds manage_metadata: git grep -n "isAdmin && canAuthorMetadata" origin/main -- ui/packages/app-shell/src/hooks/useStudioDesignGate.ts ui/packages/app-shell/src/views/objectViewViewSharing.ts.

Options

What is done What the customer sees Effort
A — a shared mapping is made in the app's wizard, with the file in hand In the app's import wizard, an administrator who holds the metadata capability gets 「保存为共享映射」 on the mapping step. It saves a mapping that holds the column renames, the write mode and the match fields the wizard has already collected, into the app's package when that is writable and otherwise into its pair, as a view made in the app is saved. Beside 「已保存的映射」 the same person gets 「管理」, which opens Studio's 字段映射 list showing this object's mappings. Value transforms, connector sources and deleting stay in Studio. 「保存当前映射」 stays as the personal, this-browser template. An administrator maps the columns once, on the real file, and saves it for everyone. The next person who imports that kind of file picks it from the list, and an API import can name it. Other people still see only their own 「保存当前映射」. ui (the wizard and the app's list page) · 1 to 2 PRs, plus one dated line in ADR-0146's note · precedent PR #27575 (+964/−32, 23 files): a governed item made in place where it is used (New dataset beside the report and chart pickers). No server work is expected: the type and its write door exist (PR #2629, +581/−14, 19 files).
B — a link only Beside 「已保存的映射」, an administrator gets 「管理映射」, which opens Studio's 字段映射 list showing this object's mappings. A mapping is still typed into Studio's form. The administrator can get from the wizard to the list. To make a mapping they type each source column's header by hand, with no file to pick from. ui · 1 PR · 无先例 (no landed PR links a run-time dialog to a Studio list). Nearest size: PR #36782 (+342/−41, 10 files).
C — Studio's mapping form reads a sample file In Studio, New mapping takes a sample file: the source columns are filled from its header row and each target is picked from the object's fields. Nothing changes in the app's wizard. A developer making a mapping in Studio uploads one example of the file and picks, instead of typing headers. The administrator who is importing still leaves the wizard, opens Studio and uploads the file a second time. ui · 1 PR · 无先例 (Studio has no form that reads a sample file). Nearest size: PR #27575 (+964/−32, 23 files).
D — a block on Studio's object page The object page in Studio gets an 「导入映射」 block that lists this object's mappings, with New. A builder finds the object's mappings on the object. Making one is still typing headers with no file. ui · 2 PRs · 无先例 in this repository. Nearest size: PR #30211 (+908/−30, 7 files).
E — nothing 高级 › 字段映射 and code stay the only two ways. As today. none

Weighed and not offered: retiring 「保存当前映射」 so that the shared mapping is the only saved thing. People who are not administrators cannot write a shared item, and a personal mapping has no home on the server, so this would take a working convenience from them and give nothing back. That 「保存当前映射」 lives only in one browser is a shortcoming of its own, not asked here.

Business meaning:

  • A is "the first person who works out how the supplier's spreadsheet lines up saves the answer for everyone". Microsoft Dynamics 365 does this: its import wizard saves the column mapping as a named data map, and the data maps are listed in settings.
  • B is "a signpost from the wizard to the workshop".
  • C is "the workshop gets a ruler": the developer measures against a real sample, in the workshop.
  • D is "a drawer for mappings in the design room".
  • E is "only someone who opens Studio or writes code makes a shared mapping".

Four axes (business view)

Long-term soundness (weighted at least half). Two years out, a mapping is born in a wizard, at the moment someone has the real file or the real source open, and from then on it is a named item that people, API calls and scheduled pulls reuse; Studio's list is where transforms are added to it. Two things point there. ADR-0153 proposes that shape for sync: its wizard, not yet built, creates the mapping. And the mainstream model matches: Dynamics 365 saves a data map from the import wizard and lists data maps in settings; Salesforce's import wizard and HubSpot map columns inside the wizard (from recall, not re-checked). A gives the file import that shape and opens a way from the personal template to the shared mapping, which today sit side by side on one step with nothing between them. Personal and shared stay two things, as they are for views, where only an administrator makes a shared one in the app (#36371).

A also gives a mapping a second place where it is made, the wizard beside Studio's form. That is a cost on this axis. It is the same shape views already have (made in the app, also listed and editable in Studio), and both places write the one item through the one write door. C avoids the second place and fixes the blind typing inside Studio, which makes it the nearest to A; what it leaves is that the person holding the file is in the wizard, not in Studio. B and D keep the mapping typed blind.

Real business pull. Measured: one mapping in the repository's example apps and three on 销售. The dedupe search returns no card that asks to save a shared mapping from the wizard. 「保存当前映射」 already serves one person on one browser, and a way to make a shared mapping exists (Studio's list). So the pull today is none measured, and this axis sets the timing. The sibling card F3 reads "no report" differently because there no way exists on screen at all.

Preventing AI and authoring mistakes. With A and C the source columns come from the file's own header row and the targets from the object's field list, so neither is typed. With B, D and E a person, or an AI writing the mapping, types the headers. A wrong target field is refused at import. A wrong source header is not: the import runs, that field stays empty, and nobody is told (premise 5).

Startup focus. A adds one save path, one link and one ADR line. It adds no type and no key. C adds one upload to one form. E adds nothing. By this axis alone the answer today is "not now".

os-decision-facets
① Long-term: A makes a mapping at the moment the real file is open, the shape ADR-0153 proposes for sync and Dynamics 365 uses, and opens a way from the personal template to the shared mapping; its cost is a second place a mapping is made; C fixes blind typing in Studio only; B, D and E keep it typed blind — favours A, then C.
② Business pull: 1 mapping in the example apps, 3 on 销售, no card asking for it, a way to make one exists — no measured pull; sets timing to "not scheduled".
③ AI mistakes: a mistyped source header fails silently (the field stays empty); A and C take headers from the file and targets from the field list — favours A and C.
④ Startup focus: A adds one save path, one link and one ADR line, no type and no key; C adds one upload; E adds nothing — favours E today.
Prior rulings read: mapping,import,wizard,studio → 66 hits (1 at two terms: ADR-0153 D8); ADR-0153 D11 (status line Proposed), ADR-0084 amendment 2026-11-25 rule 1, ADR-0146 note 2026-11-24; thread: none (new card; the source ruling is #37192 record 7151834490)

Recommendation

A as the direction, not scheduled. By axis ① alone: two years out a mapping is made at the moment someone has the file open, as Dynamics 365's import wizard does and as ADR-0153 proposes for the sync wizard; the app's import wizard is where that moment is.

Self-check: 只看①选 A;②③④ 是否翻转:是(② 没有实测拉动,④ 多一条保存路径和一行 ADR)。字母不改,只调时序:裁 A 后先不排期。

What "not scheduled" means, plainly:

  • Until it is scheduled, the screen is the same as under E. Ruling A now buys one thing: when the pull comes, the work is dispatched without a second decision round.
  • Two fleet rules pull apart here, and the maintainer should see both. The card format says the letter comes from ① and the other axes only move timing (decision-analysis.md, 「②③④与工作量只调时序分期 ⛔ 不翻字母」). The dispatch skill says zero pull recommends not spreading (SKILL.md 〈升级与决策〉, 「零拉动 ⇒ 荐不扩散」). This card follows the first for the letter and the second for the timing. A maintainer who weighs the second more rules E, and nothing is lost: this analysis stays on the card.
  • Restart-when: the first card or customer request that asks to share an import mapping with other people, or card sync-in P3 Studio (epic #31763, ADR-0153): the sync wizard beside the virtual-object one, read-only synced objects, run history #32064 (the sync wizard) being dispatched, whichever comes first.

Why not the others:

  • Not B: it is the smaller half of A. It adds the signpost and leaves the mapping typed blind.
  • Not C: the nearest to A, and named because the rule asks. It is about the same size as A or smaller (1 PR against 1 to 2; no like-for-like precedent for either), and it removes the silent failure for a developer. It does not reach the person who has the file open in the wizard.
  • Not D: a block on the object page for something set once per file format, and still typed blind.
  • Not E as the direction: a mistyped header keeps failing silently, and the personal template and the shared mapping never meet. E is what the screen shows until A is scheduled.

Confidence gaps.

  • The platform comparisons are from recall.
  • No usage numbers exist for 「保存当前映射」 or for shared mappings in real deployments.
  • Read from the registry flag only, not exercised: that the existing write door takes a mapping created at run time into the app's package or its pair.
  • Premise 5's silent failure is read in the code and not run.
  • ADR-0153 is Proposed and its wizard is not built; if that record changes, the "same shape as sync" argument weakens.
  • F3 changes how E feels. If F3 gives every package a way to an empty 字段映射 list, a developer can at least reach the list on a new app.

After the ruling

  • A, not scheduled (as recommended): the seat records the ruling and the Restart-when line on this card and files no execution card yet. When the trigger comes, the seat re-runs the premises above and files one ui card under 专题:Studio 重构——某个应用的开发界面:左侧按类型分组的菜单 → 列表 → 右侧全屏详情(去掉顶部分区) #36890 or its successor (p2), with the dated ADR-0146 line in the weekly ADR PR. The dispatch order names two premises for the dev to verify first: (1) the existing write door accepts a mapping created at run time into the app's package, or into its pair when the package is read-only; (2) the wizard's mapped columns, write mode and match fields are enough to build a valid mapping. If either fails, the dev reports the fork. ⛔ The dev does not save a package-less mapping, and does not fall back to the link alone.
  • A, schedule it now: the same card, filed and dispatched now (zone a4-S).
  • B: one small ui card, same zone.
  • C: one ui card, same zone.
  • D: a design pass first (where on the object page), then two cards.
  • E: no card. The seat records the ruling and closes this card.

Related

Dedupe (gh api -X GET search/issues, is:issue, open and closed): studio import mapping wizard (54), 字段映射 (223), mapping import wizard saved (56). No card holds this question. Nearest: #32064 (the sync wizard, a different wizard) and #34939 (closed).

Filed by seat repo:objectstack#4 on the maintainer's authorization in the seat session (「F2、F3 决策卡立卡放行」). The analysis session (session_01QSeKYmRB3CUmS2Fp5cK3aN, zone a4-S) prepared this body and dry-ran it; its own create was refused by its permission check and not retried.

Activity

  1. added
    priority:p2
    needs-user-decision
    domain:ui
    on Nov 25, 2026
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:uxdomain:uineeds-user-decisionpriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions