@prisma-next/cli 0.14.0-dev.5 → 0.14.0-dev.51

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 (112) hide show
  1. package/dist/cli.mjs +14 -14
  2. package/dist/cli.mjs.map +1 -1
  3. package/dist/{client-EnAjSmZg.mjs → client-DL6KE_c0.mjs} +88 -99
  4. package/dist/client-DL6KE_c0.mjs.map +1 -0
  5. package/dist/{command-helpers-6cNJZ863.mjs → command-helpers-DMG0RsR1.mjs} +3 -3
  6. package/dist/command-helpers-DMG0RsR1.mjs.map +1 -0
  7. package/dist/commands/contract-emit.mjs +1 -1
  8. package/dist/commands/contract-infer.mjs +1 -1
  9. package/dist/commands/db-init.mjs +3 -3
  10. package/dist/commands/db-schema.mjs +3 -3
  11. package/dist/commands/db-sign.mjs +4 -4
  12. package/dist/commands/db-update.mjs +4 -4
  13. package/dist/commands/db-verify.mjs +1 -1
  14. package/dist/commands/migrate.d.mts +1 -1
  15. package/dist/commands/migrate.d.mts.map +1 -1
  16. package/dist/commands/migrate.mjs +35 -35
  17. package/dist/commands/migrate.mjs.map +1 -1
  18. package/dist/commands/migration-check.d.mts +1 -1
  19. package/dist/commands/migration-check.mjs +1 -1
  20. package/dist/commands/migration-graph.d.mts +1 -1
  21. package/dist/commands/migration-graph.mjs +7 -7
  22. package/dist/commands/migration-graph.mjs.map +1 -1
  23. package/dist/commands/migration-list.d.mts +6 -6
  24. package/dist/commands/migration-list.d.mts.map +1 -1
  25. package/dist/commands/migration-list.mjs +1 -1
  26. package/dist/commands/migration-log.d.mts +1 -1
  27. package/dist/commands/migration-log.mjs +1 -1
  28. package/dist/commands/migration-new.mjs +3 -3
  29. package/dist/commands/migration-plan.d.mts.map +1 -1
  30. package/dist/commands/migration-plan.mjs +1 -1
  31. package/dist/commands/migration-show.mjs +3 -3
  32. package/dist/commands/migration-status.d.mts +1 -1
  33. package/dist/commands/migration-status.mjs +1 -1
  34. package/dist/commands/ref.d.mts +1 -1
  35. package/dist/commands/ref.mjs +2 -2
  36. package/dist/commands/telemetry/index.mjs +1 -1
  37. package/dist/{contract-at-errors-DdxWRjMc.mjs → contract-at-errors-bF4CGDl0.mjs} +2 -2
  38. package/dist/{contract-at-errors-DdxWRjMc.mjs.map → contract-at-errors-bF4CGDl0.mjs.map} +1 -1
  39. package/dist/{contract-emit-fz6pDR2n.mjs → contract-emit-BM7oxYIG.mjs} +7 -5
  40. package/dist/{contract-emit-fz6pDR2n.mjs.map → contract-emit-BM7oxYIG.mjs.map} +1 -1
  41. package/dist/{contract-emit-D4xDDFkO.mjs → contract-emit-DnCG2JaQ.mjs} +3 -3
  42. package/dist/{contract-emit-D4xDDFkO.mjs.map → contract-emit-DnCG2JaQ.mjs.map} +1 -1
  43. package/dist/{contract-infer-Ars4yjBv.mjs → contract-infer-Dq9XNQCx.mjs} +3 -3
  44. package/dist/{contract-infer-Ars4yjBv.mjs.map → contract-infer-Dq9XNQCx.mjs.map} +1 -1
  45. package/dist/{contract-space-aggregate-loader-Bu2fjSWV.mjs → contract-space-aggregate-loader-DAa8u6bi.mjs} +2 -2
  46. package/dist/{contract-space-aggregate-loader-Bu2fjSWV.mjs.map → contract-space-aggregate-loader-DAa8u6bi.mjs.map} +1 -1
  47. package/dist/{db-verify-CZxRV_er.mjs → db-verify-BpfJvC8O.mjs} +56 -60
  48. package/dist/db-verify-BpfJvC8O.mjs.map +1 -0
  49. package/dist/exports/control-api.d.mts +3 -3
  50. package/dist/exports/control-api.mjs +2 -2
  51. package/dist/exports/index.mjs +2 -2
  52. package/dist/extension-pack-inputs-1ySHqxKG.mjs.map +1 -1
  53. package/dist/{format-C3XdaDuA.mjs → format-DrUSkdqR.mjs} +2 -2
  54. package/dist/{format-C3XdaDuA.mjs.map → format-DrUSkdqR.mjs.map} +1 -1
  55. package/dist/{framework-components-5RljWT7Q.mjs → framework-components-BdmVlRSS.mjs} +2 -2
  56. package/dist/{framework-components-5RljWT7Q.mjs.map → framework-components-BdmVlRSS.mjs.map} +1 -1
  57. package/dist/{init-C79Yb97u.mjs → init-C0YyVoGj.mjs} +3 -3
  58. package/dist/{init-C79Yb97u.mjs.map → init-C0YyVoGj.mjs.map} +1 -1
  59. package/dist/{inspect-live-schema-DR8Eyt29.mjs → inspect-live-schema-Bs_0M6z8.mjs} +3 -3
  60. package/dist/{inspect-live-schema-DR8Eyt29.mjs.map → inspect-live-schema-Bs_0M6z8.mjs.map} +1 -1
  61. package/dist/{migration-check-CTcJfCC4.mjs → migration-check-DYxrNfK-.mjs} +9 -9
  62. package/dist/migration-check-DYxrNfK-.mjs.map +1 -0
  63. package/dist/{migration-command-scaffold-6OT_Q-3Y.mjs → migration-command-scaffold-DB5DQLvF.mjs} +3 -3
  64. package/dist/{migration-command-scaffold-6OT_Q-3Y.mjs.map → migration-command-scaffold-DB5DQLvF.mjs.map} +1 -1
  65. package/dist/{migration-list-DVHVmMrf.mjs → migration-list-BX5w9HAn.mjs} +14 -14
  66. package/dist/migration-list-BX5w9HAn.mjs.map +1 -0
  67. package/dist/{migration-log-CQpc9JoL.mjs → migration-log-CB1KzVOG.mjs} +3 -3
  68. package/dist/{migration-log-CQpc9JoL.mjs.map → migration-log-CB1KzVOG.mjs.map} +1 -1
  69. package/dist/{migration-path-target-zK6RG6JY.mjs → migration-path-target-CEFRK2Q7.mjs} +2 -2
  70. package/dist/{migration-path-target-zK6RG6JY.mjs.map → migration-path-target-CEFRK2Q7.mjs.map} +1 -1
  71. package/dist/{migration-plan-o2aqjnfd.mjs → migration-plan-DMKl_HnV.mjs} +29 -28
  72. package/dist/migration-plan-DMKl_HnV.mjs.map +1 -0
  73. package/dist/{migration-status-2aXGtYMW.mjs → migration-status-BeNAmEju.mjs} +12 -12
  74. package/dist/migration-status-BeNAmEju.mjs.map +1 -0
  75. package/dist/{telemetry-BckOSUWG.mjs → telemetry-_19qtfXp.mjs} +2 -2
  76. package/dist/{telemetry-BckOSUWG.mjs.map → telemetry-_19qtfXp.mjs.map} +1 -1
  77. package/dist/{types-qETCCNbe.d.mts → types-DFoqNIcQ.d.mts} +26 -20
  78. package/dist/types-DFoqNIcQ.d.mts.map +1 -0
  79. package/dist/{verify-DLqhL2LU.mjs → verify-Djo-Jep_.mjs} +57 -159
  80. package/dist/verify-Djo-Jep_.mjs.map +1 -0
  81. package/package.json +21 -21
  82. package/src/commands/db-verify.ts +31 -19
  83. package/src/commands/lsp.ts +3 -1
  84. package/src/commands/migrate.ts +46 -43
  85. package/src/commands/migration-check.ts +5 -5
  86. package/src/commands/migration-graph.ts +4 -4
  87. package/src/commands/migration-list.ts +12 -12
  88. package/src/commands/migration-plan.ts +14 -3
  89. package/src/commands/migration-status.ts +9 -9
  90. package/src/control-api/client.ts +5 -3
  91. package/src/control-api/operations/contract-emit.ts +7 -6
  92. package/src/control-api/operations/db-init.ts +2 -2
  93. package/src/control-api/operations/db-run.ts +18 -17
  94. package/src/control-api/operations/db-verify.ts +52 -44
  95. package/src/control-api/operations/migrate.ts +72 -72
  96. package/src/control-api/operations/run-migration.ts +6 -5
  97. package/src/control-api/types.ts +8 -8
  98. package/src/utils/combine-verify-results.ts +94 -0
  99. package/src/utils/extension-pack-inputs.ts +1 -1
  100. package/src/utils/formatters/errors.ts +12 -4
  101. package/src/utils/formatters/verify.ts +88 -227
  102. package/src/utils/plan-resolution.ts +18 -18
  103. package/dist/client-EnAjSmZg.mjs.map +0 -1
  104. package/dist/command-helpers-6cNJZ863.mjs.map +0 -1
  105. package/dist/db-verify-CZxRV_er.mjs.map +0 -1
  106. package/dist/migration-check-CTcJfCC4.mjs.map +0 -1
  107. package/dist/migration-list-DVHVmMrf.mjs.map +0 -1
  108. package/dist/migration-plan-o2aqjnfd.mjs.map +0 -1
  109. package/dist/migration-status-2aXGtYMW.mjs.map +0 -1
  110. package/dist/types-qETCCNbe.d.mts.map +0 -1
  111. package/dist/verify-DLqhL2LU.mjs.map +0 -1
  112. package/src/utils/combine-schema-results.ts +0 -84
@@ -1,14 +1,14 @@
1
- import { F as CliStructuredError } from "./command-helpers-6cNJZ863.mjs";
1
+ import { F as CliStructuredError } from "./command-helpers-DMG0RsR1.mjs";
2
2
  import { n as toExtensionInputs } from "./extension-pack-inputs-1ySHqxKG.mjs";
3
- import { t as assertFrameworkComponentsCompatible } from "./framework-components-5RljWT7Q.mjs";
3
+ import { t as assertFrameworkComponentsCompatible } from "./framework-components-BdmVlRSS.mjs";
4
4
  import { t as enrichContract } from "./contract-enrichment-gn9sWbPw.mjs";
5
- import { t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-Bu2fjSWV.mjs";
5
+ import { t as buildContractSpaceAggregate } from "./contract-space-aggregate-loader-DAa8u6bi.mjs";
6
6
  import { emit } from "@prisma-next/emitter";
7
7
  import { ifDefined } from "@prisma-next/utils/defined";
8
8
  import { notOk, ok } from "@prisma-next/utils/result";
9
- import { APP_SPACE_ID, createControlStack, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaView } from "@prisma-next/framework-components/control";
9
+ import { APP_SPACE_ID, createControlStack, hasMigrations, hasOperationPreview, hasPslContractInfer, hasSchemaSubjectClassifier, hasSchemaView } from "@prisma-next/framework-components/control";
10
10
  import { blindCast, castAs } from "@prisma-next/utils/casts";
11
- import { buildSynthMigrationEdge, collectAggregateNamespaces, graphWalkStrategy, planMigration, requireHeadRef, verifyMigration } from "@prisma-next/migration-tools/aggregate";
11
+ import { buildFabricatedMigrationEdge, collectAggregateNamespaces, planMigration, requireHeadRef, resolveRecordedPath, verifyMigration } from "@prisma-next/migration-tools/aggregate";
12
12
  import { EMPTY_CONTRACT_HASH } from "@prisma-next/migration-tools/constants";
13
13
  import { errorNoInvariantPath } from "@prisma-next/migration-tools/errors";
14
14
  import { findPathWithDecision } from "@prisma-next/migration-tools/migration-graph";
@@ -144,7 +144,7 @@ function buildPerSpaceBreakdown(orderedResolutions, appSpaceId, options) {
144
144
  }
145
145
  /**
146
146
  * Materialise the `applyOrder` ordering into resolved per-space
147
- * entries. Throws if the planner output is missing a member listed
147
+ * entries. Throws if the planner output is missing a contract space listed
148
148
  * in `applyOrder` — a wiring bug that should never reach runtime.
149
149
  *
150
150
  * Exported so callers building their own success envelopes after a
@@ -196,10 +196,11 @@ const SPAN_IDS$1 = {
196
196
  * integrity violation short-circuits with a structured error.
197
197
  * 2. **Read DB state**: marker rows (`familyInstance.readAllMarkers`)
198
198
  * + 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.
199
+ * 3. **Plan**: {@link planMigration} chooses `resolveRecordedPath` vs
200
+ * `planFromDiff` per space according to `callerPolicy.ignoreGraphFor`.
201
+ * The app space is forced through `planFromDiff` (today's daily-driver
202
+ * behaviour); every extension space walks its on-disk graph via
203
+ * `resolveRecordedPath`.
203
204
  * 4. **Apply** (when `mode === 'apply'`): every per-space `MigrationPlan`
204
205
  * feeds into the runner's `execute` — one outer
205
206
  * transaction across every space; failure on any space rolls back
@@ -273,7 +274,7 @@ async function executeRun(options) {
273
274
  const orderedResolutions = collectOrdered(planResult.value.applyOrder, planResult.value.perSpace);
274
275
  const plannerWarnings = aggregatePlannerWarnings(orderedResolutions);
275
276
  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.");
277
+ if (!appResolution) throw new Error("Aggregate planner returned no plan for the app space — the planner is supposed to always emit one.");
277
278
  const appPlan = appResolution.entry.plan;
278
279
  if (mode === "plan") {
279
280
  const aggregateOps = orderedResolutions.flatMap((r) => r.entry.displayOps);
@@ -325,22 +326,22 @@ function aggregatePlannerWarnings(orderedResolutions) {
325
326
  }
326
327
  /**
327
328
  * Compare the live `_prisma_marker` rows against the aggregate's
328
- * declared members. Any marker row whose `space` is not a member of
329
+ * declared contract spaces. Any marker row whose `space` is not a space of
329
330
  * the aggregate is an "orphan" — typically a marker left behind by
330
331
  * an extension that was removed from `extensionPacks` without first
331
332
  * cleaning up its on-disk migrations / database tables.
332
333
  *
333
334
  * Returns a {@link CliStructuredError} envelope (code `5002`,
334
335
  * `kind: 'orphanMarker'`) for the first orphan it finds, or `null`
335
- * when every marker row maps to a declared member. Mirrors the M2
336
+ * when every marker row maps to a declared contract space. Mirrors the M2
336
337
  * `runContractSpaceVerifierMarkerCheck` envelope so downstream
337
338
  * tooling (integration tests, JSON consumers) keeps asserting on the
338
339
  * same shape.
339
340
  */
340
341
  function detectOrphanMarkers(aggregate, markerRows) {
341
- const memberSpaceIds = new Set([aggregate.app.spaceId, ...aggregate.extensions.map((m) => m.spaceId)]);
342
+ const aggregateSpaceIds = new Set([aggregate.app.spaceId, ...aggregate.extensions.map((m) => m.spaceId)]);
342
343
  const orphans = [];
343
- for (const [spaceId, row] of markerRows) if (row !== null && row !== void 0 && !memberSpaceIds.has(spaceId)) orphans.push(spaceId);
344
+ for (const [spaceId, row] of markerRows) if (row !== null && row !== void 0 && !aggregateSpaceIds.has(spaceId)) orphans.push(spaceId);
344
345
  if (orphans.length === 0) return null;
345
346
  orphans.sort((a, b) => a.localeCompare(b));
346
347
  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 +356,7 @@ function detectOrphanMarkers(aggregate, markerRows) {
355
356
  });
356
357
  }
357
358
  function mapPlannerError(error) {
358
- if (error.kind === "appSynthFailure") return blindCast(notOk({
359
+ if (error.kind === "planFromDiffFailed") return blindCast(notOk({
359
360
  code: "PLANNING_FAILED",
360
361
  summary: "Migration planning failed due to conflicts",
361
362
  conflicts: error.conflicts,
@@ -544,11 +545,11 @@ const SPAN_IDS = {
544
545
  * structured CLI error.
545
546
  * 2. **Read DB state**: marker rows + (when `skipSchema` is `false`)
546
547
  * 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.
548
+ * 3. **Verify**: {@link verifyMigration} returns per-space `markerCheck` +
549
+ * per-space `schemaCheck` (each contract space verified against the full schema,
550
+ * then scoped to its own contract space). Marker mismatches map to
551
+ * `CliStructuredError` (code `5002`) so callers (CLI command) can render
552
+ * and exit. Verify results are returned to the caller verbatim.
552
553
  */
553
554
  async function executeDbVerify(options) {
554
555
  const { driver, familyInstance, onProgress, skipSchema, skipMarker } = options;
@@ -562,6 +563,8 @@ async function executeDbVerify(options) {
562
563
  onProgress,
563
564
  contract: collectAggregateNamespaces(aggregate)
564
565
  });
566
+ const classifySubjectGranularity = hasSchemaSubjectClassifier(familyInstance) ? (issue) => familyInstance.classifySubjectGranularity(issue) : void 0;
567
+ const classifyEntityKind = hasSchemaSubjectClassifier(familyInstance) ? (issue) => familyInstance.classifyEntityKind(issue) : void 0;
565
568
  emitVerifySpan(onProgress, "spanStart");
566
569
  return finaliseVerifyResult({
567
570
  verifyResult: verifyMigration({
@@ -569,7 +572,9 @@ async function executeDbVerify(options) {
569
572
  markersBySpaceId,
570
573
  schemaIntrospection,
571
574
  mode: options.mode,
572
- verifySchemaForMember: createPerMemberVerifier(options)
575
+ verifySchemaForSpace: createPerSpaceVerifier(options),
576
+ ...ifDefined("classifySubjectGranularity", classifySubjectGranularity),
577
+ ...ifDefined("classifyEntityKind", classifyEntityKind)
573
578
  }),
574
579
  aggregate,
575
580
  skipMarker,
@@ -616,18 +621,18 @@ async function runIntrospection(args) {
616
621
  }
617
622
  }
618
623
  /**
619
- * Build the per-member schema callback handed to the aggregate verifier.
624
+ * Build the per-space schema callback handed to the aggregate verifier.
620
625
  * When `skipSchema` is true the callback short-circuits with a synthetic
621
626
  * `ok` result so the verifier still runs the (cheap) schemaCheck loop
622
627
  * without invoking the family's verification path.
623
628
  */
624
- function createPerMemberVerifier(options) {
629
+ function createPerSpaceVerifier(options) {
625
630
  const { skipSchema, familyInstance, frameworkComponents } = options;
626
- return (projectedSchema, member, verifyMode) => {
627
- if (skipSchema) return buildSkippedSchemaResult(member);
631
+ return (schema, space, verifyMode) => {
632
+ if (skipSchema) return buildSkippedSchemaResult(space);
628
633
  return familyInstance.verifySchema({
629
- contract: member.contract(),
630
- schema: blindCast(projectedSchema),
634
+ contract: space.contract(),
635
+ schema,
631
636
  strict: verifyMode === "strict",
632
637
  frameworkComponents
633
638
  });
@@ -674,13 +679,14 @@ function finaliseVerifyResult(args) {
674
679
  emitVerifySpan(onProgress, "spanEndOk");
675
680
  return ok({
676
681
  schemaResults: verifyResult.value.schemaCheck.perSpace,
677
- memberOrder: [aggregate.app.spaceId, ...aggregate.extensions.map((e) => e.spaceId)],
682
+ unclaimed: verifyResult.value.schemaCheck.unclaimed,
683
+ spaceOrder: [aggregate.app.spaceId, ...aggregate.extensions.map((e) => e.spaceId)],
678
684
  appSpaceId: aggregate.app.spaceId
679
685
  });
680
686
  }
681
- function buildSkippedSchemaResult(member) {
682
- const contract = member.contract();
683
- const headRef = requireHeadRef(member);
687
+ function buildSkippedSchemaResult(space) {
688
+ const contract = space.contract();
689
+ const headRef = requireHeadRef(space);
684
690
  const profileHash = castAs(contract).profileHash;
685
691
  return {
686
692
  ok: true,
@@ -690,26 +696,7 @@ function buildSkippedSchemaResult(member) {
690
696
  ...profileHash ? { profileHash } : {}
691
697
  },
692
698
  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
- },
699
+ schema: { issues: [] },
713
700
  timings: { total: 0 }
714
701
  };
715
702
  }
@@ -756,16 +743,16 @@ function mapMarkerCheckFailures(appSpaceId, section) {
756
743
  /**
757
744
  * Apply pending migrations across every contract space (app +
758
745
  * extensions). Replay-only: graph-walk against the on-disk graph for
759
- * every member; no synth, no introspection.
746
+ * every contract space; no synth, no introspection.
760
747
  *
761
748
  * Pipeline:
762
749
  *
763
750
  * 1. Load aggregate from disk (loader hydrates extension graphs;
764
751
  * caller provides app-space packages).
765
752
  * 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
753
+ * 3. Per space: `resolveRecordedPath` plots the path from the live
754
+ * marker to `space.headRef.hash` (or `refHash` for the app
755
+ * space when provided). Empty-graph spaces fail loudly — a
769
756
  * "never planned" space is a user-error condition for replay.
770
757
  * 4. Hand off to {@link runMigration} (the runner-driving tail
771
758
  * shared with `db init` / `db update`). Marker advancement is
@@ -786,29 +773,29 @@ async function executeMigrate(options) {
786
773
  if (!loaded.ok) throw loaded.failure;
787
774
  const aggregate = loaded.value;
788
775
  const markerRows = await familyInstance.readAllMarkers({ driver });
789
- const allMembers = [aggregate.app, ...aggregate.extensions];
776
+ const allSpaces = [aggregate.app, ...aggregate.extensions];
790
777
  const perSpacePlans = /* @__PURE__ */ new Map();
791
778
  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,
779
+ for (const space of allSpaces) {
780
+ const isAppSpace = space.spaceId === aggregate.app.spaceId;
781
+ const headRef = requireHeadRef(space);
782
+ const spaceTargetHash = isAppSpace && refHash !== void 0 ? refHash : headRef.hash;
783
+ const outcome = planSpacePath({
784
+ space,
798
785
  aggregate,
799
- targetHash: memberTargetHash,
800
- refInvariants: isAppMember && refHash !== void 0 ? refInvariants : void 0,
801
- liveMarker: markerRows.get(member.spaceId) ?? null,
802
- ...isAppMember ? { refName } : {}
786
+ targetHash: spaceTargetHash,
787
+ refInvariants: isAppSpace && refHash !== void 0 ? refInvariants : void 0,
788
+ liveMarker: markerRows.get(space.spaceId) ?? null,
789
+ ...isAppSpace ? { refName } : {}
803
790
  });
804
791
  if (outcome.kind === "at-head") {
805
- atHeadResolutions.set(member.spaceId, outcome.plan);
792
+ atHeadResolutions.set(space.spaceId, outcome.plan);
806
793
  continue;
807
794
  }
808
795
  if (outcome.kind === "never-planned") return notOk(buildNeverPlannedFailure(outcome.spaceId, outcome.targetHash));
809
796
  if (outcome.kind === "unreachable") return notOk(buildPathNotFoundFailure(outcome.spaceId, outcome.liveMarker, outcome.targetHash));
810
797
  if (outcome.kind === "unsatisfiable") {
811
- const structural = findPathWithDecision(outcome.targetMember.graph(), outcome.liveHash, memberTargetHash, { required: /* @__PURE__ */ new Set() });
798
+ const structural = findPathWithDecision(outcome.targetSpace.graph(), outcome.liveHash, spaceTargetHash, { required: /* @__PURE__ */ new Set() });
812
799
  const structuralPath = structural.kind === "ok" ? structural.decision.selectedPath.map((edge) => ({
813
800
  dirName: edge.dirName,
814
801
  migrationHash: edge.migrationHash,
@@ -823,7 +810,7 @@ async function executeMigrate(options) {
823
810
  structuralPath
824
811
  });
825
812
  }
826
- perSpacePlans.set(member.spaceId, outcome.plan);
813
+ perSpacePlans.set(space.spaceId, outcome.plan);
827
814
  }
828
815
  const canonicalOrder = [...aggregate.extensions.map((m) => m.spaceId), aggregate.app.spaceId];
829
816
  const applyOrder = canonicalOrder.filter((spaceId) => perSpacePlans.has(spaceId));
@@ -892,7 +879,7 @@ async function executeMigrate(options) {
892
879
  }));
893
880
  }
894
881
  /**
895
- * Compute the graph-walk path for one contract-space member.
882
+ * Compute the graph-walk path for one contract space.
896
883
  *
897
884
  * Encapsulates the invariant-correct input assembly that both
898
885
  * `executeMigrate` and `executeMigrateShowCommand` must use:
@@ -901,48 +888,48 @@ async function executeMigrate(options) {
901
888
  * - `targetInvariants` uses the caller-supplied `refInvariants` when a
902
889
  * `--to` ref was resolved (not always the file head ref's invariants).
903
890
  *
904
- * Both callers map the returned `MemberPathOutcome` to their own error
891
+ * Both callers map the returned `SpacePathOutcome` to their own error
905
892
  * representation; the path-compute logic is shared and identical.
906
893
  *
907
894
  * @internal Exported for `executeMigrateShowCommand`.
908
895
  */
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) {
896
+ function planSpacePath({ space, aggregate, targetHash, refInvariants, liveMarker, refName }) {
897
+ const isAppSpace = space.spaceId === aggregate.app.spaceId;
898
+ const headRef = requireHeadRef(space);
899
+ if (space.graph().nodes.size === 0) {
913
900
  const liveHash = liveMarker?.storageHash;
914
901
  if (targetHash === liveHash || liveHash === void 0 && targetHash === EMPTY_CONTRACT_HASH) return {
915
902
  kind: "at-head",
916
903
  plan: buildAtHeadResolution({
917
904
  aggregateTargetId: aggregate.targetId,
918
- member,
905
+ space,
919
906
  targetHash,
920
907
  liveMarker
921
908
  })
922
909
  };
923
910
  return {
924
911
  kind: "never-planned",
925
- spaceId: member.spaceId,
912
+ spaceId: space.spaceId,
926
913
  targetHash
927
914
  };
928
915
  }
929
- const targetInvariants = isAppMember && refInvariants !== void 0 ? refInvariants : headRef.invariants;
930
- const targetMember = targetHash === headRef.hash && targetInvariants === headRef.invariants ? member : {
931
- ...member,
916
+ const targetInvariants = isAppSpace && refInvariants !== void 0 ? refInvariants : headRef.invariants;
917
+ const targetSpace = targetHash === headRef.hash && targetInvariants === headRef.invariants ? space : {
918
+ ...space,
932
919
  headRef: {
933
920
  hash: targetHash,
934
921
  invariants: targetInvariants
935
922
  }
936
923
  };
937
- const walked = graphWalkStrategy({
924
+ const walked = resolveRecordedPath({
938
925
  aggregateTargetId: aggregate.targetId,
939
- member: targetMember,
926
+ space: targetSpace,
940
927
  currentMarker: liveMarker,
941
- ...isAppMember && refName !== void 0 ? { refName } : {}
928
+ ...isAppSpace && refName !== void 0 ? { refName } : {}
942
929
  });
943
930
  if (walked.kind === "unreachable") return {
944
931
  kind: "unreachable",
945
- spaceId: member.spaceId,
932
+ spaceId: space.spaceId,
946
933
  liveMarker,
947
934
  targetHash
948
935
  };
@@ -950,11 +937,11 @@ function planMemberPath({ member, aggregate, targetHash, refInvariants, liveMark
950
937
  const liveHash = liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;
951
938
  return {
952
939
  kind: "unsatisfiable",
953
- spaceId: member.spaceId,
954
- isAppMember,
940
+ spaceId: space.spaceId,
941
+ isAppSpace,
955
942
  missing: walked.missing,
956
943
  targetInvariants,
957
- targetMember,
944
+ targetSpace,
958
945
  liveHash,
959
946
  refName
960
947
  };
@@ -966,26 +953,26 @@ function planMemberPath({ member, aggregate, targetHash, refInvariants, liveMark
966
953
  }
967
954
  /**
968
955
  * 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`
956
+ * space whose live marker already matches the target. Lets the apply
957
+ * pipeline thread the space through `perSpacePlans` -> `applyOrder`
971
958
  * -> the success envelope's `perSpace[]` block so the result reflects
972
959
  * every loaded space, even when there is nothing to execute.
973
960
  */
974
961
  function buildAtHeadResolution(args) {
975
- const { aggregateTargetId, member, targetHash, liveMarker } = args;
962
+ const { aggregateTargetId, space, targetHash, liveMarker } = args;
976
963
  return {
977
964
  plan: {
978
965
  targetId: aggregateTargetId,
979
- spaceId: member.spaceId,
966
+ spaceId: space.spaceId,
980
967
  origin: liveMarker === null ? null : { storageHash: liveMarker.storageHash },
981
968
  destination: { storageHash: targetHash },
982
969
  operations: [],
983
970
  providedInvariants: []
984
971
  },
985
972
  displayOps: [],
986
- destinationContract: member.contract(),
987
- strategy: "graph-walk",
988
- migrationEdges: [buildSynthMigrationEdge({
973
+ destinationContract: space.contract(),
974
+ strategy: "declared-state",
975
+ migrationEdges: [buildFabricatedMigrationEdge({
989
976
  currentMarkerStorageHash: liveMarker?.storageHash,
990
977
  destinationStorageHash: targetHash,
991
978
  operationCount: 0
@@ -1503,7 +1490,8 @@ var ControlClientImpl = class {
1503
1490
  authoringContributions: stack.authoringContributions,
1504
1491
  codecLookup: stack.codecLookup,
1505
1492
  controlMutationDefaults: stack.controlMutationDefaults,
1506
- resolvedInputs: contractConfig.source.inputs ?? []
1493
+ resolvedInputs: contractConfig.source.inputs ?? [],
1494
+ capabilities: stack.capabilities
1507
1495
  };
1508
1496
  const providerResult = await contractConfig.source.load(sourceContext);
1509
1497
  if (!providerResult.ok) {
@@ -1558,9 +1546,10 @@ var ControlClientImpl = class {
1558
1546
  });
1559
1547
  try {
1560
1548
  const enrichedIR = enrichContract(contractRaw, this.frameworkComponents ?? []);
1549
+ const rawContractJson = this.options.target.contractSerializer.serializeContract(enrichedIR);
1561
1550
  let deserializedContract;
1562
1551
  try {
1563
- deserializedContract = this.familyInstance.deserializeContract(enrichedIR);
1552
+ deserializedContract = this.familyInstance.deserializeContract(rawContractJson);
1564
1553
  } catch (error) {
1565
1554
  onProgress?.({
1566
1555
  action: "emit",
@@ -1606,6 +1595,6 @@ var ControlClientImpl = class {
1606
1595
  }
1607
1596
  };
1608
1597
  //#endregion
1609
- export { executeDbInit as a, executeDbUpdate as i, planMemberPath as n, ContractValidationError as o, executeDbVerify as r, createControlClient as t };
1598
+ export { executeDbInit as a, executeDbUpdate as i, planSpacePath as n, ContractValidationError as o, executeDbVerify as r, createControlClient as t };
1610
1599
 
1611
- //# sourceMappingURL=client-EnAjSmZg.mjs.map
1600
+ //# sourceMappingURL=client-DL6KE_c0.mjs.map