@fern-api/replay 0.19.1 → 0.19.2
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.
- package/dist/cli.cjs +37 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +37 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +37 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -17659,7 +17659,9 @@ var NoPatchesFlow = class {
|
|
|
17659
17659
|
}
|
|
17660
17660
|
async prepare(options) {
|
|
17661
17661
|
const preLock = this.service.lockManager.read();
|
|
17662
|
-
const previousGenerationSha =
|
|
17662
|
+
const previousGenerationSha = await this.service.resolveReachablePreviousGeneration(
|
|
17663
|
+
preLock.current_generation ?? null
|
|
17664
|
+
);
|
|
17663
17665
|
let { patches: newPatches, revertedPatchIds } = await this.service.detector.detectNewPatches();
|
|
17664
17666
|
const detectorWarnings = [...this.service.detector.warnings];
|
|
17665
17667
|
const detectorDegraded = [...this.service.detector.degradedReasons];
|
|
@@ -17797,7 +17799,9 @@ var NormalRegenerationFlow = class {
|
|
|
17797
17799
|
}
|
|
17798
17800
|
async prepare(options) {
|
|
17799
17801
|
const preLock = this.service.lockManager.read();
|
|
17800
|
-
const previousGenerationSha =
|
|
17802
|
+
const previousGenerationSha = await this.service.resolveReachablePreviousGeneration(
|
|
17803
|
+
preLock.current_generation ?? null
|
|
17804
|
+
);
|
|
17801
17805
|
if (options?.dryRun) {
|
|
17802
17806
|
const existingPatches2 = this.service.lockManager.getPatches();
|
|
17803
17807
|
const { patches: newPatches2, revertedPatchIds: dryRunReverted } = await this.service.detector.detectNewPatches();
|
|
@@ -18035,6 +18039,37 @@ var ReplayService = class {
|
|
|
18035
18039
|
this.committer = new ReplayCommitter(git, outputDir);
|
|
18036
18040
|
this.fileOwnership = new FileOwnership(git);
|
|
18037
18041
|
}
|
|
18042
|
+
/**
|
|
18043
|
+
* Resolve the previous-generation SHA to export on
|
|
18044
|
+
* `ReplayPreparation.previousGenerationSha`.
|
|
18045
|
+
*
|
|
18046
|
+
* `current_generation` is the SHA of a LOCALLY-created `[fern-generated]` commit.
|
|
18047
|
+
* generator-cli's signed-commit push (`pushSignedCommit`) recreates that commit under a
|
|
18048
|
+
* new remote SHA, and a squash-merge collapses it away, so the recorded value can be
|
|
18049
|
+
* unreachable in a later clone (org "Natural": autoVersion then diffed against a phantom
|
|
18050
|
+
* baseline and silently reported NO_CHANGE — or, pre-a38bbc6, shipped
|
|
18051
|
+
* `0.0.0-fern-placeholder`). Consumers (generator-cli's autoVersion) diff against this
|
|
18052
|
+
* baseline, so it MUST resolve to a real commit.
|
|
18053
|
+
*
|
|
18054
|
+
* Prefer the recorded SHA while it still resolves — the healthy case, and the pristine
|
|
18055
|
+
* prior `[fern-generated]` tree. Otherwise re-anchor on the most recent reachable
|
|
18056
|
+
* generation boundary in first-parent history: the SAME value the detector already
|
|
18057
|
+
* derives for its own scan boundary (`findPreviousGenerationFromHistory`, whose
|
|
18058
|
+
* `isGenerationBoundary` matches squash-merge subjects like `SDK Generation (#N)`). Fall
|
|
18059
|
+
* back to the recorded SHA only when no boundary is reachable at all — no worse than the
|
|
18060
|
+
* prior behavior. ADR 0002 (generator-cli) allows replay to expose this reconciled value;
|
|
18061
|
+
* the consumer stays independently resilient.
|
|
18062
|
+
*
|
|
18063
|
+
* MUST be called before the new `[fern-generated]` commit is created, while HEAD is still
|
|
18064
|
+
* the pre-generation (customer) state, so the walk anchors on the PREVIOUS generation.
|
|
18065
|
+
*/
|
|
18066
|
+
async resolveReachablePreviousGeneration(recordedSha) {
|
|
18067
|
+
if (recordedSha != null && await this.git.commitExists(recordedSha)) {
|
|
18068
|
+
return recordedSha;
|
|
18069
|
+
}
|
|
18070
|
+
const derived = await this.detector.findPreviousGenerationFromHistory();
|
|
18071
|
+
return derived ?? recordedSha;
|
|
18072
|
+
}
|
|
18038
18073
|
/**
|
|
18039
18074
|
* Phase 1 of the two-phase replay flow. Runs preGenerationRebase (when applicable),
|
|
18040
18075
|
* detects new patches, and creates the `[fern-generated]` commit. Leaves HEAD at
|