@fern-api/fern-api-dev 5.23.3-1479-gdcb664ea5f7 → 5.23.3-1481-gfbd8c928ac9

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 (2) hide show
  1. package/cli.cjs +45 -10
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -573419,9 +573419,9 @@ var require_diff3 = __commonJS({
573419
573419
  }
573420
573420
  });
573421
573421
 
573422
- // ../../../node_modules/.pnpm/@fern-api+replay@0.19.1/node_modules/@fern-api/replay/dist/index.cjs
573422
+ // ../../../node_modules/.pnpm/@fern-api+replay@0.19.2/node_modules/@fern-api/replay/dist/index.cjs
573423
573423
  var require_dist24 = __commonJS({
573424
- "../../../node_modules/.pnpm/@fern-api+replay@0.19.1/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
573424
+ "../../../node_modules/.pnpm/@fern-api+replay@0.19.2/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
573425
573425
  "use strict";
573426
573426
  var __defProp5 = Object.defineProperty;
573427
573427
  var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
@@ -576659,7 +576659,9 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
576659
576659
  }
576660
576660
  async prepare(options2) {
576661
576661
  const preLock = this.service.lockManager.read();
576662
- const previousGenerationSha = preLock.current_generation ?? null;
576662
+ const previousGenerationSha = await this.service.resolveReachablePreviousGeneration(
576663
+ preLock.current_generation ?? null
576664
+ );
576663
576665
  let { patches: newPatches, revertedPatchIds } = await this.service.detector.detectNewPatches();
576664
576666
  const detectorWarnings = [...this.service.detector.warnings];
576665
576667
  const detectorDegraded = [...this.service.detector.degradedReasons];
@@ -576795,7 +576797,9 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
576795
576797
  }
576796
576798
  async prepare(options2) {
576797
576799
  const preLock = this.service.lockManager.read();
576798
- const previousGenerationSha = preLock.current_generation ?? null;
576800
+ const previousGenerationSha = await this.service.resolveReachablePreviousGeneration(
576801
+ preLock.current_generation ?? null
576802
+ );
576799
576803
  if (options2?.dryRun) {
576800
576804
  const existingPatches2 = this.service.lockManager.getPatches();
576801
576805
  const { patches: newPatches2, revertedPatchIds: dryRunReverted } = await this.service.detector.detectNewPatches();
@@ -577031,6 +577035,37 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
577031
577035
  this.committer = new ReplayCommitter(git, outputDir);
577032
577036
  this.fileOwnership = new FileOwnership(git);
577033
577037
  }
577038
+ /**
577039
+ * Resolve the previous-generation SHA to export on
577040
+ * `ReplayPreparation.previousGenerationSha`.
577041
+ *
577042
+ * `current_generation` is the SHA of a LOCALLY-created `[fern-generated]` commit.
577043
+ * generator-cli's signed-commit push (`pushSignedCommit`) recreates that commit under a
577044
+ * new remote SHA, and a squash-merge collapses it away, so the recorded value can be
577045
+ * unreachable in a later clone (org "Natural": autoVersion then diffed against a phantom
577046
+ * baseline and silently reported NO_CHANGE — or, pre-a38bbc6, shipped
577047
+ * `0.0.0-fern-placeholder`). Consumers (generator-cli's autoVersion) diff against this
577048
+ * baseline, so it MUST resolve to a real commit.
577049
+ *
577050
+ * Prefer the recorded SHA while it still resolves — the healthy case, and the pristine
577051
+ * prior `[fern-generated]` tree. Otherwise re-anchor on the most recent reachable
577052
+ * generation boundary in first-parent history: the SAME value the detector already
577053
+ * derives for its own scan boundary (`findPreviousGenerationFromHistory`, whose
577054
+ * `isGenerationBoundary` matches squash-merge subjects like `SDK Generation (#N)`). Fall
577055
+ * back to the recorded SHA only when no boundary is reachable at all — no worse than the
577056
+ * prior behavior. ADR 0002 (generator-cli) allows replay to expose this reconciled value;
577057
+ * the consumer stays independently resilient.
577058
+ *
577059
+ * MUST be called before the new `[fern-generated]` commit is created, while HEAD is still
577060
+ * the pre-generation (customer) state, so the walk anchors on the PREVIOUS generation.
577061
+ */
577062
+ async resolveReachablePreviousGeneration(recordedSha) {
577063
+ if (recordedSha != null && await this.git.commitExists(recordedSha)) {
577064
+ return recordedSha;
577065
+ }
577066
+ const derived = await this.detector.findPreviousGenerationFromHistory();
577067
+ return derived ?? recordedSha;
577068
+ }
577034
577069
  /**
577035
577070
  * Phase 1 of the two-phase replay flow. Runs preGenerationRebase (when applicable),
577036
577071
  * detects new patches, and creates the `[fern-generated]` commit. Leaves HEAD at
@@ -690982,7 +691017,7 @@ var AccessTokenPosthogManager = class {
690982
691017
  properties: {
690983
691018
  ...event,
690984
691019
  ...event.properties,
690985
- version: "5.23.3-1479-gdcb664ea5f7",
691020
+ version: "5.23.3-1481-gfbd8c928ac9",
690986
691021
  usingAccessToken: true,
690987
691022
  ...getRunIdProperties()
690988
691023
  }
@@ -691048,7 +691083,7 @@ var UserPosthogManager = class {
691048
691083
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
691049
691084
  event: "CLI",
691050
691085
  properties: {
691051
- version: "5.23.3-1479-gdcb664ea5f7",
691086
+ version: "5.23.3-1481-gfbd8c928ac9",
691052
691087
  ...event,
691053
691088
  ...event.properties,
691054
691089
  usingAccessToken: false,
@@ -872149,7 +872184,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
872149
872184
  var LOGS_FOLDER_NAME = "logs";
872150
872185
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
872151
872186
  function getCliSource() {
872152
- const version7 = "5.23.3-1479-gdcb664ea5f7";
872187
+ const version7 = "5.23.3-1481-gfbd8c928ac9";
872153
872188
  return `cli@${version7}`;
872154
872189
  }
872155
872190
  var DebugLogger = class {
@@ -904738,7 +904773,7 @@ var LegacyDocsPublisher = class {
904738
904773
  previewId,
904739
904774
  disableTemplates: void 0,
904740
904775
  skipUpload,
904741
- cliVersion: "5.23.3-1479-gdcb664ea5f7",
904776
+ cliVersion: "5.23.3-1481-gfbd8c928ac9",
904742
904777
  loginCommand: "fern auth login"
904743
904778
  });
904744
904779
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -971525,7 +971560,7 @@ function getAutomationContextFromEnv() {
971525
971560
  config_branch: process.env.FERN_CONFIG_BRANCH,
971526
971561
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
971527
971562
  trigger: process.env.GITHUB_EVENT_NAME,
971528
- cli_version: "5.23.3-1479-gdcb664ea5f7"
971563
+ cli_version: "5.23.3-1481-gfbd8c928ac9"
971529
971564
  };
971530
971565
  }
971531
971566
  function isAutomationMode() {
@@ -972357,7 +972392,7 @@ var CliContext = class _CliContext {
972357
972392
  if (false) {
972358
972393
  this.logger.error("CLI_VERSION is not defined");
972359
972394
  }
972360
- return "5.23.3-1479-gdcb664ea5f7";
972395
+ return "5.23.3-1481-gfbd8c928ac9";
972361
972396
  }
972362
972397
  getCliName() {
972363
972398
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.23.3-1479-gdcb664ea5f7",
2
+ "version": "5.23.3-1481-gfbd8c928ac9",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",