Repository navigation
feat(plugin-grid,app-shell): save the import wizard's column mapping as a shared mapping, and Manage it in Studio - #38357
Merged
Conversation
The preview step offers Save as shared mapping when the host passes a save door, and the saved-mapping list offers Manage when the host passes one. Claude-Session: https://claude.ai/code/session_01L9qibxL8ZWRpBvBqgZ5Vor Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibxL8ZWRpBvBqgZ5Vor Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibxL8ZWRpBvBqgZ5Vor Co-authored-by: Claude <noreply@anthropic.com>
… chip Claude-Session: https://claude.ai/code/session_01L9qibxL8ZWRpBvBqgZ5Vor Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibxL8ZWRpBvBqgZ5Vor Co-authored-by: Claude <noreply@anthropic.com>
… and Manage it in Studio Only the reader who may share a view gets the doors. The save refuses a name a mapping holds, asks for a package when the app has none, and writes nothing when the ask is cancelled. Claude-Session: https://claude.ai/code/session_01L9qibxL8ZWRpBvBqgZ5Vor Co-authored-by: Claude <noreply@anthropic.com>
…list's object chip Claude-Session: https://claude.ai/code/session_01L9qibxL8ZWRpBvBqgZ5Vor Co-authored-by: Claude <noreply@anthropic.com>
… the wizard shows Claude-Session: https://claude.ai/code/session_01L9qibxL8ZWRpBvBqgZ5Vor Co-authored-by: Claude <noreply@anthropic.com>
…ort door reads it The changeset declares the widening: ImportWizard gains two optional props and the package exports two types. Claude-Session: https://claude.ai/code/session_01L9qibxL8ZWRpBvBqgZ5Vor Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Landing · 2026-11-28T17:39Z · zone
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Tesla · project thread
Fixes #37359
repo:objectstack#3 · os-tesla · session_01L9qibxL8ZWRpBvBqgZ5Vor
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
ImportWizardtakes two optional props (ImportWizard.tsx):onSaveSharedMapping(draft): the host's door for saving a sharedmappingitem. When it is passed, the preview step shows "Save as shared mapping" under the write-mode panel, where the columns, the write mode and the match fields are all known (the claim's premise correction: the ruling said the mapping step, but write mode and match fields are collected on the preview step). The form asks for a label and an API name, suggested from the label, and checked against the spec'sSnakeCaseIdentifierSchema. The saved mapping joins the Saved mapping list at once. A rejection keeps the form open and shows its message; a host that resolvesnullwrote nothing and adds nothing.onManageMappings(): "Manage" beside the Saved mapping selector.sharedMappingDraft.ts(new, pure):buildSharedMappingDraftturns the wizard's column index → field map into themappingitem:fieldMappingis one{ source: header, target: field }per mapped column in column order,modeis the write mode,upsertKeythe match fields (only for update and upsert), eachsourcethe header trimmed, as the import door trims a header before it looks one up (import-prepare.ts);sourceFormat: 'csv'(the import door applies acsvmapping to CSV, Excel and pasted rows alike, and the wizard sends such a mapping's rows as CSV text from every source). It refuses: nothing mapped; update or upsert with no match field; a mapped column whose header is blank or shared with another column, since the import door finds a column by its header text. The per-import toggles (create missing options, skip blank match keys, background job) have no key on a mapping and stay with the import.index.tsxexports theSavedMappingandSharedMappingDrafttypes for the host.@object-ui/app-shell), after PR feat(app-shell): a create with no named package asks to pick or create one #38204 merged, per the claim:objectViewSharedMapping.ts(new):sharedMappingDoorshands the wizard both props only whenmayManageViewsholds (an administrator holdingmanage_metadata, the shared-view rule), never on the identity import, and never without a metadata client.ObjectViewspreads it into theImportWizard.saveSharedImportMappingfirst readsGET /meta/mapping/<name>and refuses a name a mapping already holds, in any package. The draft save's first-write pin (If-None-Match: *) only asserts that no draft row exists, so without the read a save would replace a published mapping of the same name; and a name two packages hold is refused at import (409). Then it callssaveAndPublishRuntimeMetadata('mapping', …)with the app (useRuntimeCreateApp), so the mapping goes into the app's package or its pair, or the package the person picks in feat(app-shell): a create with no named package asks to pick or create one #38204's ask. A cancelled ask resolvesnull, which writes nothing and keeps the wizard's form open; a system app and a caller the package door refuses are refused with their reason; a pending draft of that name is refused and nothing is published. No path saves a mapping naming no package.RuntimeArtifactTypegains'mapping'./studio/~all/metadata/mapping?targetObject=<object>: every package's mappings, the same set the wizard's Saved mapping list offers.targetObject(LIST_TARGET_OBJECT_PARAM,metadataListState.ts). It narrows only a type whose reader names a row's object;ResourceListPagegives that reader tomappingalone and draws the narrowing as a chip ("Object: crm_lead ×") in both the Studio and the Setup toolbars, whose × shows every object again.grid.import.*keys and 3console.objectView.sharedMapping*keys (name taken, draft pending, system app) in every language pack;zh-Hantregenerated bygen:zh-hant; 2engine.list.targetObject*keys in the Studio namespace (en, zh). The de quote-pairing pin counts the five new „…“ pairs (128 → 133).37359-import-wizard-shared-mapping.md:@object-ui/plugin-grid,@object-ui/i18nand@object-ui/app-shellpatch. The claim namedminor;check-changeset-no-major.mjsgrades every entrypatchunderMetadata-protocol: none, so patch it is.Tests
sharedMappingDraft.test.ts(9): the insert shape, a header saved trimmed, the upsert shape (also parsed by the spec'sMappingSchema), a match field whose column was unmapped, nothing mapped, blank and shared headers (each named once), a duplicated header on an unmapped column, the name grammar, the name suggestion.ImportWizard.sharedMappingSave-37359.test.tsx(10), through the real wizard: no door → no save; the insert draft; the upsert draft and the "choose the match fields" reason; a shared header refused before any call; a bad API name cannot be sent; a refused save; a saved mapping listed and then picked, after which there is nothing to save; anullsave adds nothing; Manage with and without the door.objectViewSharedMapping-37359.test.ts(11), with a realMetadataClientover a fake/metadoor and the package list stubbed atfetch: the saved request (PUT /meta/mapping/supplier_list?mode=draft&package=com.example.crm,If-None-Match: *, header → field,mode: upsert,upsertKey: ['email'], then the publish); a taken name refused with zero writes; a pending draft refused with no publish; no app package → the ask, and the save names the picked package; a cancelled ask →null, zero writes; a system app refused, never asks, zero writes; who gets the doors (admin both; non-admin, identity import, no client: none); Manage closes and navigates; Manage's address decodes back to the object.metadataListState.targetObject-37359.test.ts(3): the codec round trip and a blank value; narrowing; a reader with no object is not narrowed.ResourceListPage.targetObject-37359.test.tsx(4), the real page: the narrowed list under its chip; the × lists every object and drops the param; no param, no chip; a type whose rows name no object (skill) is not narrowed.Acceptance notes
upsertKey. The wizard offers such fields as match fields, and the draft saves what was chosen.Verification
Tests
pnpm --dir ui exec vitest run packages/plugin-grid/ packages/i18n/: 430 files, 4704 passed, 13 skipped.@object-ui/plugin-gridand@object-ui/i18ntype-check: exit 0.vitest runover app-shell'sResourceListPage*,metadataListState*,runtime-metadata-persistence*,objectView*,ObjectView*,__tests__/identityImport*,useListOrderedNames*andpackages/i18n/: 258 files, 3147 passed, 13 skipped.@object-ui/app-shelltype-check(tsc --noEmit && tsc -p tsconfig.test.json): exit 0, after a declaration build of@object-ui/app-shell^....Ablation
Each mutation landed on disk through
ablation-replace.mjsand was restored (blob equal to HEAD,git diff HEADempty). Import wizard half:upsertKeydropped from the draft: 2 failed (the pure upsert shape and the wizard's upsert draft);App half, against the 18 new app tests (baseline 18/18):
null: 1 failed (cancel);'pending-draft'ignored: 1 failed (pending draft);canManageViewsgate dropped: 1 failed (non-admin gets neither);targetObjectnarrowing deleted: 2 failed (the pure narrowing and the real page's narrowed list);Derived gates
At 9008472: 43 of 43 derived families run, each exit 0;
dispatch-gates --ranaccounted (43 derived, 43 run, 0 not measured, a derived zero). List with exit codes:gates-ran-90084723.listin the card's project folder. The run started at afeff95; the one-file lint fix of 9008472 (objectViewSharedMapping.ts, the caught error kept ascause) landed during it and changes no derived path.At 81774d0 (the trim and the changeset's
Clause-②line, two already-changed files plus a test): no derived path changes;check-changeset-no-majorexit 0, plugin-gridtype-checkexit 0, ESLint 0 errors, the two plugin-grid shared-mapping test files 19/19.overlap-checkat afeff95: clean againstorigin/main(bc31d45) and the two open PRs that share files (#38370 the locale packs, #38318 the Studio namespace).Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01L9qibxL8ZWRpBvBqgZ5Vor