Uh oh!
There was an error while loading. Please reload this page.
spec(api): declare mappingName on ImportRequestSchema with the mutual-exclusion refine (#10330) - #11316
Conversation
…-exclusion refine (#10330) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RadETjNRLALFLhFA3xehZP
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 126 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin d90fb5b889acd5cd9f95f96021ca21515f743005 && git checkout d90fb5b889acd5cd9f95f96021ca21515f743005
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f24c90df3d57d53785f288b1329ae98ce06649ce 81639157557afe4f27228cd2074464e8eff5e163 && git checkout -B drift-repro f24c90df3d57d53785f288b1329ae98ce06649ce && git merge --no-ff 81639157557afe4f27228cd2074464e8eff5e163
node scripts/docs-audit/affected-docs.mjs --json f24c90df3d57d53785f288b1329ae98ce06649ce
|
Uh oh!
There was an error while loading. Please reload this page.
Fixes#10330
What
Declares
mappingNameonImportRequestSchema(packages/spec/src/api/export.zod.ts), next tomapping, with a.describe()naming the artifact resolution and the mutual exclusion.CreateImportJobRequestSchemais the same object, so the async route's declaration lands in the same edit. Deletes the SDK warning callout fromcontent/docs/data-modeling/import-mappings.mdx(the warning pointed at #10330; re-located after PR #11280's edits to the same page). Regenerated surfaces:content/docs/references/api/export.mdxandpackages/spec/authorable-surface/api.jsongained the key under both published names. Changeset: patch on@objectstack/spec(a published contract gains an expressible key).Per the triage determination (issue comment, reusing the maintainer's #11006 option-B sibling ruling, 2026-08-22): enforcement exists, declaration was missing — declare it. Both import routes read
body.mappingNameviaprepareImportRequest(packages/rest/src/import-prepare.ts), which is untouched.The refine question — argued FOR, and added
The triage left "does the exclusion also become a schema refine?" to this PR. Measured, then added:
zod ^4.4.3): refinements live inside schemas, so.refine()returns the sameZodObject—ImportRequestSchema.shapeaccess (pinned by the existing runAutomations describe test atexport.test.ts) still works, theCreateImportJobRequestSchemaaliasing is untouched, andz.toJSONSchemastill converts (verified empirically; the custom check is simply not represented in the JSON Schema). The OpenAPI generator's component list does not include this schema, sogen:openapiis unaffected. No existing caller builds partial bodies through the schema: the only parse call sites (spec's own tests and rest'simport-run-automations-agreement.test.ts) parse complete bodies, and all pass unchanged.export.test.ts) AND the route-level400 CONFLICTING_MAPPING(already pinned inpackages/rest/src/import-integration.test.ts, re-run green). The route parses the raw body itself, so its check never depended on callers using this schema — it stays, unchanged.Zero-migration fact
ImportRequestSchemais a plainz.object— it strips unknown keys rather than rejecting them, so before this changemappingNamewas silently stripped by schema-validating callers and the change is purely additive for every existing caller. The refine only fires on a body carrying bothmappingNameand an inlinemapping— a body the wire has always refused with400 CONFLICTING_MAPPING, so no previously-working schema-built body changes outcome.Tests
packages/spec/src/api/export.test.ts, new describe (7 tests): parse-through with the value surviving on both schema names; the issue's TS2353 repro inverted into a compile-time pin (typedImportRequestliteral +expectTypeOf; the file is compiled bycheck:test-typecheckand is not in the debt ledger); conflicting pair refused at parse with message and path pinned, on both names; each side alone still accepted; the describe prose pinned to mention the exclusion andCONFLICTING_MAPPING.export.zod.tsto the merge-base, confirmed on disk (grep count 0), re-ran the file — 5 of 7 new tests red (the compile-time literal is runtime-neutral and the each-side-alone guard holds on base, as expected); restored, 64/64 green.pnpm --filter @objectstack/spec build, a temporary probe inpackages/clienttype-checked a literal withmappingName(accepted) beside a typo key — tsc reported exactly one TS2561 on the typo, itself suggestingmappingName, proving the client compiles against the rebuilt declarations. Probe deleted; client tsc green again.Verification (all at
816391575, the final commit)pnpm --filter @objectstack/spec build→ verdictcommand-exit 0;grep mappingName packages/spec/dist/*.d.tsnow matches (the issue's measured zero, inverted).pnpm --filter @objectstack/spec check:generated→ aftergen:docsregen,command-exit 0.Test Files 418 passed / Tests 11125 passed. Spec typecheck:check:test-typecheck: OK.import-integration.test.ts+import-run-automations-agreement.test.ts→Test Files 2 passed / Tests 37 passed;tsc --noEmitclean. Client: typecheck green (downstream consumers of the spec change; rest and client are the two packages that read this schema).node scripts/pm/dispatch-gates.mjs(no paths; change set derived from merge base, 6 paths = this diff) → all 32 path-derived families run green, including the convention-triggered test-file family (check:type-check-debt --re-measure: 33 entries, none above ceiling;check:engine-double-contract,check:where-matcher,check:query-options-erasure,check:cross-package-test-inputsall green) andcheck:nul-bytes.Clause-② yes (accept-set change) —
needs:contract-reviewexpected.Generated by Claude Code