@prisma-next/cli 0.14.0 → 0.15.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.mjs +33 -14
  3. package/dist/cli.mjs.map +1 -1
  4. package/dist/{client-CJzuo5wX.mjs → client-DigVI8zX.mjs} +90 -104
  5. package/dist/client-DigVI8zX.mjs.map +1 -0
  6. package/dist/{command-helpers-DGMvGBeX.mjs → command-helpers-CUoKYTlG.mjs} +13 -10
  7. package/dist/command-helpers-CUoKYTlG.mjs.map +1 -0
  8. package/dist/commands/contract-emit.mjs +1 -1
  9. package/dist/commands/contract-infer.mjs +1 -1
  10. package/dist/commands/db-init.mjs +3 -3
  11. package/dist/commands/db-schema.mjs +3 -3
  12. package/dist/commands/db-sign.mjs +5 -5
  13. package/dist/commands/db-sign.mjs.map +1 -1
  14. package/dist/commands/db-update.mjs +4 -4
  15. package/dist/commands/db-verify.d.mts.map +1 -1
  16. package/dist/commands/db-verify.mjs +1 -1
  17. package/dist/commands/migrate.d.mts +1 -1
  18. package/dist/commands/migrate.d.mts.map +1 -1
  19. package/dist/commands/migrate.mjs +37 -38
  20. package/dist/commands/migrate.mjs.map +1 -1
  21. package/dist/commands/migration-check.d.mts +1 -1
  22. package/dist/commands/migration-check.mjs +1 -1
  23. package/dist/commands/migration-graph.d.mts +1 -1
  24. package/dist/commands/migration-graph.mjs +9 -9
  25. package/dist/commands/migration-graph.mjs.map +1 -1
  26. package/dist/commands/migration-list.d.mts +6 -6
  27. package/dist/commands/migration-list.d.mts.map +1 -1
  28. package/dist/commands/migration-list.mjs +1 -1
  29. package/dist/commands/migration-log.d.mts +1 -1
  30. package/dist/commands/migration-log.mjs +1 -1
  31. package/dist/commands/migration-new.mjs +4 -4
  32. package/dist/commands/migration-new.mjs.map +1 -1
  33. package/dist/commands/migration-plan.d.mts.map +1 -1
  34. package/dist/commands/migration-plan.mjs +1 -1
  35. package/dist/commands/migration-show.mjs +4 -4
  36. package/dist/commands/migration-show.mjs.map +1 -1
  37. package/dist/commands/migration-status.d.mts +1 -1
  38. package/dist/commands/migration-status.mjs +1 -1
  39. package/dist/commands/ref.d.mts +1 -1
  40. package/dist/commands/ref.mjs +3 -3
  41. package/dist/commands/ref.mjs.map +1 -1
  42. package/dist/commands/telemetry/index.mjs +1 -1
  43. package/dist/{contract-at-errors-CFXsstzm.mjs → contract-at-errors-D8CNDD7g.mjs} +2 -2
  44. package/dist/{contract-at-errors-CFXsstzm.mjs.map → contract-at-errors-D8CNDD7g.mjs.map} +1 -1
  45. package/dist/{contract-emit-C8HmtboH.mjs → contract-emit-sYrqzsdN.mjs} +9 -11
  46. package/dist/contract-emit-sYrqzsdN.mjs.map +1 -0
  47. package/dist/{contract-emit-B_qriF8B.mjs → contract-emit-wgqrOXUI.mjs} +6 -6
  48. package/dist/contract-emit-wgqrOXUI.mjs.map +1 -0
  49. package/dist/{contract-infer-BYT_ra_U.mjs → contract-infer-6SQnnVj7.mjs} +3 -3
  50. package/dist/{contract-infer-BYT_ra_U.mjs.map → contract-infer-6SQnnVj7.mjs.map} +1 -1
  51. package/dist/{contract-space-aggregate-loader-ClI1KN6d.mjs → contract-space-aggregate-loader-DpB4x97a.mjs} +63 -5
  52. package/dist/contract-space-aggregate-loader-DpB4x97a.mjs.map +1 -0
  53. package/dist/{db-verify-C24FKhb7.mjs → db-verify-CEsG5Gek.mjs} +57 -61
  54. package/dist/db-verify-CEsG5Gek.mjs.map +1 -0
  55. package/dist/exports/control-api.d.mts +3 -3
  56. package/dist/exports/control-api.d.mts.map +1 -1
  57. package/dist/exports/control-api.mjs +2 -2
  58. package/dist/exports/index.d.mts +5 -1
  59. package/dist/exports/index.d.mts.map +1 -1
  60. package/dist/exports/index.mjs +4 -3
  61. package/dist/exports/index.mjs.map +1 -1
  62. package/dist/format-CjongNb1.mjs +102 -0
  63. package/dist/format-CjongNb1.mjs.map +1 -0
  64. package/dist/{framework-components-YVQHhPH7.mjs → framework-components-BbnM1RYm.mjs} +2 -2
  65. package/dist/{framework-components-YVQHhPH7.mjs.map → framework-components-BbnM1RYm.mjs.map} +1 -1
  66. package/dist/{init-0HwB-Vh8.mjs → init-D8YFfaD6.mjs} +27 -19
  67. package/dist/init-D8YFfaD6.mjs.map +1 -0
  68. package/dist/{inspect-live-schema-DF6IwcDl.mjs → inspect-live-schema-CEt_ztBJ.mjs} +4 -4
  69. package/dist/inspect-live-schema-CEt_ztBJ.mjs.map +1 -0
  70. package/dist/{migration-check-VwM8xCZV.mjs → migration-check-ByeQHOhK.mjs} +10 -12
  71. package/dist/migration-check-ByeQHOhK.mjs.map +1 -0
  72. package/dist/migration-cli.mjs +1 -1
  73. package/dist/migration-cli.mjs.map +1 -1
  74. package/dist/{migration-command-scaffold-DA-Lhx6o.mjs → migration-command-scaffold-CJO3tjiR.mjs} +4 -4
  75. package/dist/migration-command-scaffold-CJO3tjiR.mjs.map +1 -0
  76. package/dist/{migration-graph-command-render-CEez7YUK.mjs → migration-graph-command-render-B83xrnNy.mjs} +24 -24
  77. package/dist/{migration-graph-command-render-CEez7YUK.mjs.map → migration-graph-command-render-B83xrnNy.mjs.map} +1 -1
  78. package/dist/{migration-list-DlJJ_38Z.mjs → migration-list-DTYM8xvm.mjs} +16 -16
  79. package/dist/migration-list-DTYM8xvm.mjs.map +1 -0
  80. package/dist/{migration-log-CG0qQAFm.mjs → migration-log-qZ8LpQIl.mjs} +5 -5
  81. package/dist/migration-log-qZ8LpQIl.mjs.map +1 -0
  82. package/dist/{migration-path-target-Ce6OZImp.mjs → migration-path-target-DmNwsDgs.mjs} +2 -2
  83. package/dist/{migration-path-target-Ce6OZImp.mjs.map → migration-path-target-DmNwsDgs.mjs.map} +1 -1
  84. package/dist/{migration-plan-W_E8FQOk.mjs → migration-plan-CfPrB80t.mjs} +30 -30
  85. package/dist/migration-plan-CfPrB80t.mjs.map +1 -0
  86. package/dist/{migration-status-CD-LC2Ip.mjs → migration-status-DRuS-rP5.mjs} +14 -15
  87. package/dist/migration-status-DRuS-rP5.mjs.map +1 -0
  88. package/dist/{telemetry-BIM4beEO.mjs → telemetry-DHBBq5wT.mjs} +2 -2
  89. package/dist/{telemetry-BIM4beEO.mjs.map → telemetry-DHBBq5wT.mjs.map} +1 -1
  90. package/dist/{types-C_tYiJYx.d.mts → types-DFoqNIcQ.d.mts} +27 -21
  91. package/dist/types-DFoqNIcQ.d.mts.map +1 -0
  92. package/dist/{verify-DcOYZ1tH.mjs → verify-DDCb0R2r.mjs} +57 -159
  93. package/dist/verify-DDCb0R2r.mjs.map +1 -0
  94. package/package.json +28 -30
  95. package/src/cli.ts +7 -0
  96. package/src/commands/contract-emit.ts +1 -1
  97. package/src/commands/db-sign.ts +1 -1
  98. package/src/commands/db-verify.ts +34 -20
  99. package/src/commands/format.ts +75 -0
  100. package/src/commands/init/detect-package-manager.ts +8 -4
  101. package/src/commands/init/hygiene-package-scripts.ts +16 -3
  102. package/src/commands/inspect-live-schema.ts +1 -1
  103. package/src/commands/lsp.ts +32 -0
  104. package/src/commands/migrate.ts +47 -44
  105. package/src/commands/migration-check.ts +6 -6
  106. package/src/commands/migration-graph.ts +5 -5
  107. package/src/commands/migration-list.ts +13 -13
  108. package/src/commands/migration-log.ts +1 -1
  109. package/src/commands/migration-new.ts +1 -1
  110. package/src/commands/migration-plan.ts +15 -4
  111. package/src/commands/migration-show.ts +1 -1
  112. package/src/commands/migration-status.ts +10 -10
  113. package/src/commands/ref.ts +1 -1
  114. package/src/control-api/client.ts +8 -23
  115. package/src/control-api/operations/contract-emit.ts +9 -27
  116. package/src/control-api/operations/db-init.ts +2 -2
  117. package/src/control-api/operations/db-run.ts +18 -17
  118. package/src/control-api/operations/db-verify.ts +52 -44
  119. package/src/control-api/operations/format.ts +98 -0
  120. package/src/control-api/operations/migrate.ts +72 -72
  121. package/src/control-api/operations/run-migration.ts +6 -5
  122. package/src/control-api/types.ts +8 -8
  123. package/src/exports/index.ts +1 -0
  124. package/src/migration-cli.ts +1 -1
  125. package/src/utils/combine-verify-results.ts +94 -0
  126. package/src/utils/extension-pack-inputs.ts +1 -1
  127. package/src/utils/formatters/errors.ts +13 -5
  128. package/src/utils/formatters/verify.ts +88 -227
  129. package/src/utils/migration-command-scaffold.ts +1 -1
  130. package/src/utils/plan-resolution.ts +18 -18
  131. package/dist/client-CJzuo5wX.mjs.map +0 -1
  132. package/dist/command-helpers-DGMvGBeX.mjs.map +0 -1
  133. package/dist/config-loader-p9JMrekQ.mjs +0 -88
  134. package/dist/config-loader-p9JMrekQ.mjs.map +0 -1
  135. package/dist/config-loader.d.mts +0 -16
  136. package/dist/config-loader.d.mts.map +0 -1
  137. package/dist/config-loader.mjs +0 -2
  138. package/dist/contract-emit-B_qriF8B.mjs.map +0 -1
  139. package/dist/contract-emit-C8HmtboH.mjs.map +0 -1
  140. package/dist/contract-space-aggregate-loader-ClI1KN6d.mjs.map +0 -1
  141. package/dist/db-verify-C24FKhb7.mjs.map +0 -1
  142. package/dist/extension-pack-inputs-1ySHqxKG.mjs +0 -62
  143. package/dist/extension-pack-inputs-1ySHqxKG.mjs.map +0 -1
  144. package/dist/init-0HwB-Vh8.mjs.map +0 -1
  145. package/dist/inspect-live-schema-DF6IwcDl.mjs.map +0 -1
  146. package/dist/migration-check-VwM8xCZV.mjs.map +0 -1
  147. package/dist/migration-command-scaffold-DA-Lhx6o.mjs.map +0 -1
  148. package/dist/migration-list-DlJJ_38Z.mjs.map +0 -1
  149. package/dist/migration-log-CG0qQAFm.mjs.map +0 -1
  150. package/dist/migration-plan-W_E8FQOk.mjs.map +0 -1
  151. package/dist/migration-status-CD-LC2Ip.mjs.map +0 -1
  152. package/dist/types-C_tYiJYx.d.mts.map +0 -1
  153. package/dist/verify-DcOYZ1tH.mjs.map +0 -1
  154. package/src/config-loader.ts +0 -92
  155. package/src/config-path-validation.ts +0 -74
  156. package/src/utils/combine-schema-results.ts +0 -84
@@ -1,14 +1,13 @@
1
- import { F as CliStructuredError } from "./command-helpers-DGMvGBeX.mjs";
2
- import { n as toExtensionInputs } from "./extension-pack-inputs-1ySHqxKG.mjs";
3
- import { t as assertFrameworkComponentsCompatible } from "./framework-components-YVQHhPH7.mjs";
1
+ import { F as CliStructuredError } from "./command-helpers-CUoKYTlG.mjs";
2
+ import { t as assertFrameworkComponentsCompatible } from "./framework-components-BbnM1RYm.mjs";
4
3
  import { t as enrichContract } from "./contract-enrichment-gn9sWbPw.mjs";
5
- import { t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-ClI1KN6d.mjs";
4
+ import { t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-DpB4x97a.mjs";
6
5
  import { emit } from "@prisma-next/emitter";
7
6
  import { ifDefined } from "@prisma-next/utils/defined";
8
7
  import { notOk, ok } from "@prisma-next/utils/result";
9
- import { APP_SPACE_ID, createControlStack, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaView } from "@prisma-next/framework-components/control";
8
+ import { APP_SPACE_ID, createControlStack, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaSubjectClassifier, hasSchemaView } from "@prisma-next/framework-components/control";
10
9
  import { blindCast, castAs } from "@prisma-next/utils/casts";
11
- import { buildSynthMigrationEdge, collectAggregateNamespaces, graphWalkStrategy, planMigration, requireHeadRef, verifyMigration } from "@prisma-next/migration-tools/aggregate";
10
+ import { buildFabricatedMigrationEdge, collectAggregateNamespaces, planMigration, requireHeadRef, resolveRecordedPath, verifyMigration } from "@prisma-next/migration-tools/aggregate";
12
11
  import { EMPTY_CONTRACT_HASH } from "@prisma-next/migration-tools/constants";
13
12
  import { errorNoInvariantPath } from "@prisma-next/migration-tools/errors";
14
13
  import { findPathWithDecision } from "@prisma-next/migration-tools/migration-graph";
@@ -144,7 +143,7 @@ function buildPerSpaceBreakdown(orderedResolutions, appSpaceId, options) {
144
143
  }
145
144
  /**
146
145
  * Materialise the `applyOrder` ordering into resolved per-space
147
- * entries. Throws if the planner output is missing a member listed
146
+ * entries. Throws if the planner output is missing a contract space listed
148
147
  * in `applyOrder` — a wiring bug that should never reach runtime.
149
148
  *
150
149
  * Exported so callers building their own success envelopes after a
@@ -196,10 +195,11 @@ const SPAN_IDS$1 = {
196
195
  * integrity violation short-circuits with a structured error.
197
196
  * 2. **Read DB state**: marker rows (`familyInstance.readAllMarkers`)
198
197
  * + introspected schema (`familyInstance.introspect`).
199
- * 3. **Plan**: {@link planMigration} chooses graph-walk vs synth per
200
- * member according to `callerPolicy.ignoreGraphFor`. The app member
201
- * is forced through synth (today's daily-driver behaviour); every
202
- * extension member walks its on-disk graph.
198
+ * 3. **Plan**: {@link planMigration} chooses `resolveRecordedPath` vs
199
+ * `planFromDiff` per space according to `callerPolicy.ignoreGraphFor`.
200
+ * The app space is forced through `planFromDiff` (today's daily-driver
201
+ * behaviour); every extension space walks its on-disk graph via
202
+ * `resolveRecordedPath`.
203
203
  * 4. **Apply** (when `mode === 'apply'`): every per-space `MigrationPlan`
204
204
  * feeds into the runner's `execute` — one outer
205
205
  * transaction across every space; failure on any space rolls back
@@ -252,7 +252,7 @@ async function executeRun(options) {
252
252
  adapter,
253
253
  migrations,
254
254
  frameworkComponents,
255
- callerPolicy: { ignoreGraphFor: new Set([aggregate.app.spaceId]) },
255
+ callerPolicy: { ignoreGraphFor: /* @__PURE__ */ new Set([aggregate.app.spaceId]) },
256
256
  operationPolicy: policy
257
257
  });
258
258
  if (!planResult.ok) {
@@ -273,7 +273,7 @@ async function executeRun(options) {
273
273
  const orderedResolutions = collectOrdered(planResult.value.applyOrder, planResult.value.perSpace);
274
274
  const plannerWarnings = aggregatePlannerWarnings(orderedResolutions);
275
275
  const appResolution = orderedResolutions.find((r) => r.spaceId === aggregate.app.spaceId);
276
- if (!appResolution) throw new Error("Aggregate planner returned no plan for the app member — the planner is supposed to always emit one.");
276
+ if (!appResolution) throw new Error("Aggregate planner returned no plan for the app space — the planner is supposed to always emit one.");
277
277
  const appPlan = appResolution.entry.plan;
278
278
  if (mode === "plan") {
279
279
  const aggregateOps = orderedResolutions.flatMap((r) => r.entry.displayOps);
@@ -325,22 +325,22 @@ function aggregatePlannerWarnings(orderedResolutions) {
325
325
  }
326
326
  /**
327
327
  * Compare the live `_prisma_marker` rows against the aggregate's
328
- * declared members. Any marker row whose `space` is not a member of
328
+ * declared contract spaces. Any marker row whose `space` is not a space of
329
329
  * the aggregate is an "orphan" — typically a marker left behind by
330
330
  * an extension that was removed from `extensionPacks` without first
331
331
  * cleaning up its on-disk migrations / database tables.
332
332
  *
333
333
  * Returns a {@link CliStructuredError} envelope (code `5002`,
334
334
  * `kind: 'orphanMarker'`) for the first orphan it finds, or `null`
335
- * when every marker row maps to a declared member. Mirrors the M2
335
+ * when every marker row maps to a declared contract space. Mirrors the M2
336
336
  * `runContractSpaceVerifierMarkerCheck` envelope so downstream
337
337
  * tooling (integration tests, JSON consumers) keeps asserting on the
338
338
  * same shape.
339
339
  */
340
340
  function detectOrphanMarkers(aggregate, markerRows) {
341
- const memberSpaceIds = new Set([aggregate.app.spaceId, ...aggregate.extensions.map((m) => m.spaceId)]);
341
+ const aggregateSpaceIds = /* @__PURE__ */ new Set([aggregate.app.spaceId, ...aggregate.extensions.map((m) => m.spaceId)]);
342
342
  const orphans = [];
343
- for (const [spaceId, row] of markerRows) if (row !== null && row !== void 0 && !memberSpaceIds.has(spaceId)) orphans.push(spaceId);
343
+ for (const [spaceId, row] of markerRows) if (row !== null && row !== void 0 && !aggregateSpaceIds.has(spaceId)) orphans.push(spaceId);
344
344
  if (orphans.length === 0) return null;
345
345
  orphans.sort((a, b) => a.localeCompare(b));
346
346
  return new CliStructuredError("5002", orphans.length === 1 ? `Orphan contract-space marker detected for "${orphans[0]}"` : `Orphan contract-space markers detected for ${orphans.length} spaces`, {
@@ -355,7 +355,7 @@ function detectOrphanMarkers(aggregate, markerRows) {
355
355
  });
356
356
  }
357
357
  function mapPlannerError(error) {
358
- if (error.kind === "appSynthFailure") return blindCast(notOk({
358
+ if (error.kind === "planFromDiffFailed") return blindCast(notOk({
359
359
  code: "PLANNING_FAILED",
360
360
  summary: "Migration planning failed due to conflicts",
361
361
  conflicts: error.conflicts,
@@ -544,11 +544,11 @@ const SPAN_IDS = {
544
544
  * structured CLI error.
545
545
  * 2. **Read DB state**: marker rows + (when `skipSchema` is `false`)
546
546
  * schema introspection.
547
- * 3. **Verify**: {@link verifyMigration} returns per-space
548
- * `markerCheck` + per-space pre-projected `schemaCheck` (closes F23).
549
- * Marker mismatches map to `CliStructuredError` (code `5002`) so
550
- * callers (CLI command) can render and exit. Schema results are
551
- * returned to the caller verbatim.
547
+ * 3. **Verify**: {@link verifyMigration} returns per-space `markerCheck` +
548
+ * per-space `schemaCheck` (each contract space verified against the full schema,
549
+ * then scoped to its own contract space). Marker mismatches map to
550
+ * `CliStructuredError` (code `5002`) so callers (CLI command) can render
551
+ * and exit. Verify results are returned to the caller verbatim.
552
552
  */
553
553
  async function executeDbVerify(options) {
554
554
  const { driver, familyInstance, onProgress, skipSchema, skipMarker } = options;
@@ -562,6 +562,8 @@ async function executeDbVerify(options) {
562
562
  onProgress,
563
563
  contract: collectAggregateNamespaces(aggregate)
564
564
  });
565
+ const classifySubjectGranularity = hasSchemaSubjectClassifier(familyInstance) ? (issue) => familyInstance.classifySubjectGranularity(issue) : void 0;
566
+ const classifyEntityKind = hasSchemaSubjectClassifier(familyInstance) ? (issue) => familyInstance.classifyEntityKind(issue) : void 0;
565
567
  emitVerifySpan(onProgress, "spanStart");
566
568
  return finaliseVerifyResult({
567
569
  verifyResult: verifyMigration({
@@ -569,7 +571,9 @@ async function executeDbVerify(options) {
569
571
  markersBySpaceId,
570
572
  schemaIntrospection,
571
573
  mode: options.mode,
572
- verifySchemaForMember: createPerMemberVerifier(options)
574
+ verifySchemaForSpace: createPerSpaceVerifier(options),
575
+ ...ifDefined("classifySubjectGranularity", classifySubjectGranularity),
576
+ ...ifDefined("classifyEntityKind", classifyEntityKind)
573
577
  }),
574
578
  aggregate,
575
579
  skipMarker,
@@ -616,18 +620,18 @@ async function runIntrospection(args) {
616
620
  }
617
621
  }
618
622
  /**
619
- * Build the per-member schema callback handed to the aggregate verifier.
623
+ * Build the per-space schema callback handed to the aggregate verifier.
620
624
  * When `skipSchema` is true the callback short-circuits with a synthetic
621
625
  * `ok` result so the verifier still runs the (cheap) schemaCheck loop
622
626
  * without invoking the family's verification path.
623
627
  */
624
- function createPerMemberVerifier(options) {
628
+ function createPerSpaceVerifier(options) {
625
629
  const { skipSchema, familyInstance, frameworkComponents } = options;
626
- return (projectedSchema, member, verifyMode) => {
627
- if (skipSchema) return buildSkippedSchemaResult(member);
630
+ return (schema, space, verifyMode) => {
631
+ if (skipSchema) return buildSkippedSchemaResult(space);
628
632
  return familyInstance.verifySchema({
629
- contract: member.contract(),
630
- schema: blindCast(projectedSchema),
633
+ contract: space.contract(),
634
+ schema,
631
635
  strict: verifyMode === "strict",
632
636
  frameworkComponents
633
637
  });
@@ -674,13 +678,14 @@ function finaliseVerifyResult(args) {
674
678
  emitVerifySpan(onProgress, "spanEndOk");
675
679
  return ok({
676
680
  schemaResults: verifyResult.value.schemaCheck.perSpace,
677
- memberOrder: [aggregate.app.spaceId, ...aggregate.extensions.map((e) => e.spaceId)],
681
+ unclaimed: verifyResult.value.schemaCheck.unclaimed,
682
+ spaceOrder: [aggregate.app.spaceId, ...aggregate.extensions.map((e) => e.spaceId)],
678
683
  appSpaceId: aggregate.app.spaceId
679
684
  });
680
685
  }
681
- function buildSkippedSchemaResult(member) {
682
- const contract = member.contract();
683
- const headRef = requireHeadRef(member);
686
+ function buildSkippedSchemaResult(space) {
687
+ const contract = space.contract();
688
+ const headRef = requireHeadRef(space);
684
689
  const profileHash = castAs(contract).profileHash;
685
690
  return {
686
691
  ok: true,
@@ -690,26 +695,7 @@ function buildSkippedSchemaResult(member) {
690
695
  ...profileHash ? { profileHash } : {}
691
696
  },
692
697
  target: { expected: contract.target },
693
- schema: {
694
- issues: [],
695
- root: {
696
- status: "pass",
697
- kind: "skipped",
698
- name: member.spaceId,
699
- contractPath: "",
700
- code: "SKIPPED",
701
- message: "Schema verification skipped",
702
- expected: void 0,
703
- actual: void 0,
704
- children: []
705
- },
706
- counts: {
707
- pass: 0,
708
- warn: 0,
709
- fail: 0,
710
- totalNodes: 0
711
- }
712
- },
698
+ schema: { issues: [] },
713
699
  timings: { total: 0 }
714
700
  };
715
701
  }
@@ -756,16 +742,16 @@ function mapMarkerCheckFailures(appSpaceId, section) {
756
742
  /**
757
743
  * Apply pending migrations across every contract space (app +
758
744
  * extensions). Replay-only: graph-walk against the on-disk graph for
759
- * every member; no synth, no introspection.
745
+ * every contract space; no synth, no introspection.
760
746
  *
761
747
  * Pipeline:
762
748
  *
763
749
  * 1. Load aggregate from disk (loader hydrates extension graphs;
764
750
  * caller provides app-space packages).
765
751
  * 2. Read live marker rows per space (`familyInstance.readAllMarkers`).
766
- * 3. Per member: `graphWalkStrategy` plots the path from the live
767
- * marker to `member.headRef.hash` (or `refHash` for the app
768
- * member when provided). Empty-graph members fail loudly — a
752
+ * 3. Per space: `resolveRecordedPath` plots the path from the live
753
+ * marker to `space.headRef.hash` (or `refHash` for the app
754
+ * space when provided). Empty-graph spaces fail loudly — a
769
755
  * "never planned" space is a user-error condition for replay.
770
756
  * 4. Hand off to {@link runMigration} (the runner-driving tail
771
757
  * shared with `db init` / `db update`). Marker advancement is
@@ -786,29 +772,29 @@ async function executeMigrate(options) {
786
772
  if (!loaded.ok) throw loaded.failure;
787
773
  const aggregate = loaded.value;
788
774
  const markerRows = await familyInstance.readAllMarkers({ driver });
789
- const allMembers = [aggregate.app, ...aggregate.extensions];
775
+ const allSpaces = [aggregate.app, ...aggregate.extensions];
790
776
  const perSpacePlans = /* @__PURE__ */ new Map();
791
777
  const atHeadResolutions = /* @__PURE__ */ new Map();
792
- for (const member of allMembers) {
793
- const isAppMember = member.spaceId === aggregate.app.spaceId;
794
- const headRef = requireHeadRef(member);
795
- const memberTargetHash = isAppMember && refHash !== void 0 ? refHash : headRef.hash;
796
- const outcome = planMemberPath({
797
- member,
778
+ for (const space of allSpaces) {
779
+ const isAppSpace = space.spaceId === aggregate.app.spaceId;
780
+ const headRef = requireHeadRef(space);
781
+ const spaceTargetHash = isAppSpace && refHash !== void 0 ? refHash : headRef.hash;
782
+ const outcome = planSpacePath({
783
+ space,
798
784
  aggregate,
799
- targetHash: memberTargetHash,
800
- refInvariants: isAppMember && refHash !== void 0 ? refInvariants : void 0,
801
- liveMarker: markerRows.get(member.spaceId) ?? null,
802
- ...isAppMember ? { refName } : {}
785
+ targetHash: spaceTargetHash,
786
+ refInvariants: isAppSpace && refHash !== void 0 ? refInvariants : void 0,
787
+ liveMarker: markerRows.get(space.spaceId) ?? null,
788
+ ...isAppSpace ? { refName } : {}
803
789
  });
804
790
  if (outcome.kind === "at-head") {
805
- atHeadResolutions.set(member.spaceId, outcome.plan);
791
+ atHeadResolutions.set(space.spaceId, outcome.plan);
806
792
  continue;
807
793
  }
808
794
  if (outcome.kind === "never-planned") return notOk(buildNeverPlannedFailure(outcome.spaceId, outcome.targetHash));
809
795
  if (outcome.kind === "unreachable") return notOk(buildPathNotFoundFailure(outcome.spaceId, outcome.liveMarker, outcome.targetHash));
810
796
  if (outcome.kind === "unsatisfiable") {
811
- const structural = findPathWithDecision(outcome.targetMember.graph(), outcome.liveHash, memberTargetHash, { required: /* @__PURE__ */ new Set() });
797
+ const structural = findPathWithDecision(outcome.targetSpace.graph(), outcome.liveHash, spaceTargetHash, { required: /* @__PURE__ */ new Set() });
812
798
  const structuralPath = structural.kind === "ok" ? structural.decision.selectedPath.map((edge) => ({
813
799
  dirName: edge.dirName,
814
800
  migrationHash: edge.migrationHash,
@@ -823,7 +809,7 @@ async function executeMigrate(options) {
823
809
  structuralPath
824
810
  });
825
811
  }
826
- perSpacePlans.set(member.spaceId, outcome.plan);
812
+ perSpacePlans.set(space.spaceId, outcome.plan);
827
813
  }
828
814
  const canonicalOrder = [...aggregate.extensions.map((m) => m.spaceId), aggregate.app.spaceId];
829
815
  const applyOrder = canonicalOrder.filter((spaceId) => perSpacePlans.has(spaceId));
@@ -892,7 +878,7 @@ async function executeMigrate(options) {
892
878
  }));
893
879
  }
894
880
  /**
895
- * Compute the graph-walk path for one contract-space member.
881
+ * Compute the graph-walk path for one contract space.
896
882
  *
897
883
  * Encapsulates the invariant-correct input assembly that both
898
884
  * `executeMigrate` and `executeMigrateShowCommand` must use:
@@ -901,48 +887,48 @@ async function executeMigrate(options) {
901
887
  * - `targetInvariants` uses the caller-supplied `refInvariants` when a
902
888
  * `--to` ref was resolved (not always the file head ref's invariants).
903
889
  *
904
- * Both callers map the returned `MemberPathOutcome` to their own error
890
+ * Both callers map the returned `SpacePathOutcome` to their own error
905
891
  * representation; the path-compute logic is shared and identical.
906
892
  *
907
893
  * @internal Exported for `executeMigrateShowCommand`.
908
894
  */
909
- function planMemberPath({ member, aggregate, targetHash, refInvariants, liveMarker, refName }) {
910
- const isAppMember = member.spaceId === aggregate.app.spaceId;
911
- const headRef = requireHeadRef(member);
912
- if (member.graph().nodes.size === 0) {
895
+ function planSpacePath({ space, aggregate, targetHash, refInvariants, liveMarker, refName }) {
896
+ const isAppSpace = space.spaceId === aggregate.app.spaceId;
897
+ const headRef = requireHeadRef(space);
898
+ if (space.graph().nodes.size === 0) {
913
899
  const liveHash = liveMarker?.storageHash;
914
900
  if (targetHash === liveHash || liveHash === void 0 && targetHash === EMPTY_CONTRACT_HASH) return {
915
901
  kind: "at-head",
916
902
  plan: buildAtHeadResolution({
917
903
  aggregateTargetId: aggregate.targetId,
918
- member,
904
+ space,
919
905
  targetHash,
920
906
  liveMarker
921
907
  })
922
908
  };
923
909
  return {
924
910
  kind: "never-planned",
925
- spaceId: member.spaceId,
911
+ spaceId: space.spaceId,
926
912
  targetHash
927
913
  };
928
914
  }
929
- const targetInvariants = isAppMember && refInvariants !== void 0 ? refInvariants : headRef.invariants;
930
- const targetMember = targetHash === headRef.hash && targetInvariants === headRef.invariants ? member : {
931
- ...member,
915
+ const targetInvariants = isAppSpace && refInvariants !== void 0 ? refInvariants : headRef.invariants;
916
+ const targetSpace = targetHash === headRef.hash && targetInvariants === headRef.invariants ? space : {
917
+ ...space,
932
918
  headRef: {
933
919
  hash: targetHash,
934
920
  invariants: targetInvariants
935
921
  }
936
922
  };
937
- const walked = graphWalkStrategy({
923
+ const walked = resolveRecordedPath({
938
924
  aggregateTargetId: aggregate.targetId,
939
- member: targetMember,
925
+ space: targetSpace,
940
926
  currentMarker: liveMarker,
941
- ...isAppMember && refName !== void 0 ? { refName } : {}
927
+ ...isAppSpace && refName !== void 0 ? { refName } : {}
942
928
  });
943
929
  if (walked.kind === "unreachable") return {
944
930
  kind: "unreachable",
945
- spaceId: member.spaceId,
931
+ spaceId: space.spaceId,
946
932
  liveMarker,
947
933
  targetHash
948
934
  };
@@ -950,11 +936,11 @@ function planMemberPath({ member, aggregate, targetHash, refInvariants, liveMark
950
936
  const liveHash = liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;
951
937
  return {
952
938
  kind: "unsatisfiable",
953
- spaceId: member.spaceId,
954
- isAppMember,
939
+ spaceId: space.spaceId,
940
+ isAppSpace,
955
941
  missing: walked.missing,
956
942
  targetInvariants,
957
- targetMember,
943
+ targetSpace,
958
944
  liveHash,
959
945
  refName
960
946
  };
@@ -966,26 +952,26 @@ function planMemberPath({ member, aggregate, targetHash, refInvariants, liveMark
966
952
  }
967
953
  /**
968
954
  * Build a zero-op {@link PerSpacePlan} for an empty-graph
969
- * member whose live marker already matches the target. Lets the apply
970
- * pipeline thread the member through `perSpacePlans` -> `applyOrder`
955
+ * space whose live marker already matches the target. Lets the apply
956
+ * pipeline thread the space through `perSpacePlans` -> `applyOrder`
971
957
  * -> the success envelope's `perSpace[]` block so the result reflects
972
958
  * every loaded space, even when there is nothing to execute.
973
959
  */
974
960
  function buildAtHeadResolution(args) {
975
- const { aggregateTargetId, member, targetHash, liveMarker } = args;
961
+ const { aggregateTargetId, space, targetHash, liveMarker } = args;
976
962
  return {
977
963
  plan: {
978
964
  targetId: aggregateTargetId,
979
- spaceId: member.spaceId,
965
+ spaceId: space.spaceId,
980
966
  origin: liveMarker === null ? null : { storageHash: liveMarker.storageHash },
981
967
  destination: { storageHash: targetHash },
982
968
  operations: [],
983
969
  providedInvariants: []
984
970
  },
985
971
  displayOps: [],
986
- destinationContract: member.contract(),
987
- strategy: "graph-walk",
988
- migrationEdges: [buildSynthMigrationEdge({
972
+ destinationContract: space.contract(),
973
+ strategy: "declared-state",
974
+ migrationEdges: [buildFabricatedMigrationEdge({
989
975
  currentMarkerStorageHash: liveMarker?.storageHash,
990
976
  destinationStorageHash: targetHash,
991
977
  operationCount: 0
@@ -1494,16 +1480,15 @@ var ControlClientImpl = class {
1494
1480
  });
1495
1481
  try {
1496
1482
  const stack = this.stack;
1497
- const extensionInputs = toExtensionInputs(blindCast(stack.extensionPacks));
1498
- const composedExtensionContracts = new Map(extensionInputs.filter((p) => p.contractSpace !== void 0).map((p) => [p.id, blindCast(p.contractSpace.contractJson)]));
1499
1483
  const sourceContext = {
1500
1484
  composedExtensionPacks: stack.extensionPacks.map((p) => p.id),
1501
- composedExtensionContracts,
1485
+ composedExtensionContracts: stack.extensionContracts,
1502
1486
  scalarTypeDescriptors: stack.scalarTypeDescriptors,
1503
1487
  authoringContributions: stack.authoringContributions,
1504
1488
  codecLookup: stack.codecLookup,
1505
1489
  controlMutationDefaults: stack.controlMutationDefaults,
1506
- resolvedInputs: contractConfig.source.inputs ?? []
1490
+ resolvedInputs: contractConfig.source.inputs ?? [],
1491
+ capabilities: stack.capabilities
1507
1492
  };
1508
1493
  const providerResult = await contractConfig.source.load(sourceContext);
1509
1494
  if (!providerResult.ok) {
@@ -1558,9 +1543,10 @@ var ControlClientImpl = class {
1558
1543
  });
1559
1544
  try {
1560
1545
  const enrichedIR = enrichContract(contractRaw, this.frameworkComponents ?? []);
1546
+ const rawContractJson = this.options.target.contractSerializer.serializeContract(enrichedIR);
1561
1547
  let deserializedContract;
1562
1548
  try {
1563
- deserializedContract = this.familyInstance.deserializeContract(enrichedIR);
1549
+ deserializedContract = this.familyInstance.deserializeContract(rawContractJson);
1564
1550
  } catch (error) {
1565
1551
  onProgress?.({
1566
1552
  action: "emit",
@@ -1606,6 +1592,6 @@ var ControlClientImpl = class {
1606
1592
  }
1607
1593
  };
1608
1594
  //#endregion
1609
- export { executeDbInit as a, executeDbUpdate as i, planMemberPath as n, ContractValidationError as o, executeDbVerify as r, createControlClient as t };
1595
+ export { executeDbInit as a, executeDbUpdate as i, planSpacePath as n, ContractValidationError as o, executeDbVerify as r, createControlClient as t };
1610
1596
 
1611
- //# sourceMappingURL=client-CJzuo5wX.mjs.map
1597
+ //# sourceMappingURL=client-DigVI8zX.mjs.map