…ffer saved mappings (objectui#7740)
`createIdentityImportDataSource` spreads the base adapter and then explicitly
clears six async-job/undo methods, per the file's stated design: the wizard
feature-detects these methods, so clearing them cleanly hides the UI.
An object spread copies own enumerable properties only. `ObjectStackAdapter`
declares `listImportMappings` in its class body, so it lives on the prototype
and the spread never copied it — the saved-mapping selector was hidden on
`sys_user` by a language rule rather than by the design the file describes, and
the adapter degrades a missing method to an empty list so nothing said so.
The wrapper was already written for the "offered" answer: `importRecords`
forwards `mappingName` to an identity endpoint that honours it, so the one
control that could set that field was the one control that could never render.
Director seat, decision batch #68 (ledger objectstack#12708) ruled that identity
import offers saved mappings. Forwarded as one explicit method bound to the
base, beside the six deliberate `undefined`s. The spread idiom is unchanged and
the six job surfaces stay withheld: widening the spread would bring back every
prototype method of the base adapter without a census.
Pins: presence is expressed in both directions (offered off a class-instance
base, not fabricated when the base lacks it), the six withheld surfaces stay
withheld, the objectui#7741 three-state read now reaches `sys_user` through the
wrapper, and the selector actually renders — real adapter, real wrapper, real
wizard, only `fetch` stubbed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01611D6ZaRaMmwTNQmSbk8MH
Fixes #7740
Implements the director-seat ruling recorded on the card (comment 5565349507, decision batch #68, maintainer reply 「同意」, ledger objectstack#12708): option 乙 — identity import offers saved mappings; forward
listImportMappingsexplicitly.What was wrong
createIdentityImportDataSourcespreads the base adapter, then explicitly clears six async-job/undo methods. The file states that design in its own docblock: the wizard feature-detects these methods, so clearing them cleanly hides the corresponding UI.An object spread copies own enumerable properties only.
ObjectStackAdapterdeclareslistImportMappingsin its class body, so it lives on the prototype and the spread never copied it.Re-derived on this branch (the card's own citations were stale):
async listImportMappingsdata-objectstack/src/index.ts:4510:5110:2148:26745110 > 2674⇒ inside the class body ⇒ on the prototype ⇒ dropped by the spread.So on
sys_userthe wizard's probe failed and the saved-mapping selector was hidden — not by the design the file describes, but by a language rule nobody expressed. The adapter degrades a missing method to an empty list, so nothing anywhere said so.The wrapper was already written for the "offered" answer:
importRecordsin the same function forwardsmappingNameto an identity endpoint that honours it. The one control that could set that field was the one control that could never render.What changed
One method, forwarded explicitly beside the six deliberate
undefineds, with a comment naming the ruling:?.keeps a base that genuinely lacks the method from gaining one.ImportMappingsCapableBaseis a local, non-exported type shaped to match the wizard's own probe, so what is forwarded is exactly what the feature detection reads.Verification
All commands run from the repo root. Heavy runs went through the shared verify lock; verdicts quoted from the runner's own
VERDICT command-exitline, never a bare$?.Targeted pins —
VERDICT command-exit 0,Test Files 2 passed (2) · Tests 22 passed (22)Affected package, whole suite —
pnpm exec vitest run packages/app-shell/VERDICT command-exit 0,Test Files 670 passed (670) · Tests 6488 passed | 1 skipped (6489)Type-check —
pnpm run type-checkinpackages/app-shell(tsc --noEmit && tsc -p tsconfig.test.json) →VERDICT command-exit 0.The first attempt returned exit 2 with
Cannot find module '@object-ui/*'for every workspace package — PREREQUISITE NOT MET (workspace unbuilt), read as NOT MEASURED, not as red. Re-run afterturbo run build --filter '@object-ui/app-shell^...' --concurrency=2(28 successful, 28 total).Lint —
eslint .inpackages/app-shell: 1131 files, 0 errors, exit 0. No narrowing was needed, so no narrowing is claimed. (2951 warnings are the package's pre-existingno-explicit-anybaseline; the touched test file carried 11 of them before this PR and carries 16 after, in the sameas anyidiom the file already uses for anunknown-returning factory.)Derived gates, all exit 0:
check:control-bytes(7089 files) ·check:vi-mock-inherit·check:vi-mock-specifiers·check:unreferenced-sources·check:phantom-deps·check:dist-completeness(922 emitted files) ·check-changeset-presence(2 source file(s) of 1 released package(s) changed, and this change declares 1 changeset(s)).All quoted at
07249a3e6, the final commit.Ablation — the pins can actually fail
Reverted only
identityImport.tsto itsorigin/mainbytes, proved the mutation reached disk (forward-line marker1 -> 0, type-decl marker1 -> 0, blobc770efftof3769f4), re-ran both files, then restored fromHEADunder atrap ... EXIT INT TERMand proved the restore bygit diff HEADbeing empty and the on-disk blob matchingHEADexactly.Predicted direction before running: goes red. Observed:
Tests 7 failed | 15 passed (22), exit 1.Red without the fix (7):
listImportMappingsoff a class-instance base —expected 'undefined' to be 'function'thissurvives the hand-offsys_usersys_user—Unable to find an element by: [data-testid="import-saved-mapping-bar"]sys_user— red because the probe never fires at all pre-fixGreen in both worlds, deliberately and stated as such in the test comments (3): "does not fabricate the capability when the base has none", "still withholds the six job surfaces", "does not render when the base adapter has no
listImportMappings". Their discriminating power is against the wrong fix (an unconditional forward, or widening the spread), not against the defect.No
diststaleness channel: the root vitest config aliases@object-ui/*tosrc(vitest.config.mts:509,:513,:533), so both arms ran the mutated source directly.Published surface — measured, not assumed
Built
packages/app-shellon both arms and compared the emitted declaration:createIdentityImportDataSource(opts: IdentityImportDataSourceOptions): unknown— signature unchanged.ImportMappingsCapableBaseis not emitted (local, unexported).dist/views/identityImport.d.tsis the three docblock lines added above the function.⇒ the typed contract did not move. The runtime payload did: the object this published function returns now carries a
listImportMappingskey, and the published behaviour changes (the selector goes from never-rendering to rendering onsys_user). That is a new key on a published payload, so Clause-② isyesandneeds:contract-reviewis attached to both this PR and the card.Line-citation position axis
Judged on stored-vs-computed: only a literal that is stored and used as a key or compared for equality can go stale.
scripts/check-doc-example-types.mjsUNGATED_EXAMPLES: 90 rows, 0 naming any file this PR touches, 0 naming anyapp-shellfile at all.git ls-filesfor anyidentityImport…:NUMBERcitation: 0 hits.cross-file-line-citation-census.mjs: exit 0, 0 mentions of these files. (It cannot seeUNGATED_EXAMPLES, which is why that carrier was measured separately.)git merge --no-ff origin/mainresult tree in a throwaway detached worktree (merge clean, 14 files): same three readings — 90 / 0 / 0 / 0.The card body's own
:4510/:2148/:167-168citations are stale, but they live in the GitHub issue, not in a tracked file, so nothing in the tree needs correcting.Scope note the ruling did not have
On this endpoint a saved mapping can only rename columns.
identityImport.tssendswriteMode,matchFields,runAutomationsandskipBlankMatchKeyexplicitly, and the platform applies an artifact's write semantics only as defaults — those guards never open here. The blast radius is smaller than it was when the ruling was made, which points the same way the ruling does.验收备注
Observations, none filed as cards (nothing here is a reproducible defect, a declared-contract violation, or a metadata trap):
base.listImportMappings?.bind(base), writes the key unconditionally, so literal key-absence is impossible: when the base lacks it the key is present with valueundefined. The prescribed spelling was implemented verbatim, and "absent" is pinned as the fact the wizard actually reads (typeof … === 'function'is false, so the selector does not render). On the base-has arm the pin additionally assertsObject.hasOwn, which is red onmainand compatible with either spelling. Flagged so a reviewer can confirm the reading rather than discover it.承接者: this PR's reviewer.toBeUndefined()pin is left alone. For the six job keys it is sound — the object literal always writes them, so only their value is in question. It is unsound only if copied to a key whose presence is the question, which is exactly this card; the new suite says so in a comment so the next editor does not copy it. Not changed: it is correct where it stands. 承接者: this file's next editor.Red lines honoured
Spread idiom unchanged ·
importRecordsuntouched ·ObjectStackAdapteruntouched · six job methods still cleared ·content/docs/releases/untouched · governed surface untouched (check-governed-queue-guard.mjs --teston all four paths:NOT GOVERNED — 4 path(s) checked against 5 governed surface(s); none matched) · changeset added · no force-push, no push tomain, no merge.Generated by Claude Code
Generated by Claude Code