@fern-api/replay 0.16.1 → 0.17.4

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/index.d.cts CHANGED
@@ -101,6 +101,17 @@ interface FileResult {
101
101
  * if needed. Empty/undefined when no such lines exist.
102
102
  */
103
103
  droppedContextLines?: string[];
104
+ /**
105
+ * INC-866 silent-loss signal. Set on a `new-file-both` result when BASE was
106
+ * null because the patch's base-generation tree is unreachable (shallow
107
+ * clone window too small / pruned history) rather than because the file is
108
+ * genuinely new. In that state an edited-existing-file customization can be
109
+ * dropped with no conflict and no error. Surfaced as a ReplayReport warning
110
+ * (`recordUnreachableBaseWarnings`) so callers/CLI learn the clone window
111
+ * was insufficient instead of losing the edit silently. Undefined/false in
112
+ * the benign case.
113
+ */
114
+ baseTreeUnreachable?: boolean;
104
115
  }
105
116
  interface ConflictRegion {
106
117
  startLine: number;
@@ -266,8 +277,9 @@ declare class ReplayDetector {
266
277
  private git;
267
278
  private lockManager;
268
279
  private sdkOutputDir;
280
+ private fernignorePatterns;
269
281
  readonly warnings: string[];
270
- constructor(git: GitClient, lockManager: LockfileManager, sdkOutputDir: string);
282
+ constructor(git: GitClient, lockManager: LockfileManager, sdkOutputDir: string, fernignorePatterns?: readonly string[]);
271
283
  /**
272
284
  * Derive the previous-generation SHA from git history instead of trusting
273
285
  * `lock.current_generation`.
@@ -737,6 +749,19 @@ declare class ReplayService {
737
749
  * `applyPreparedReplay` (e.g., `[fern-autoversion]`).
738
750
  */
739
751
  prepareReplay(options?: ReplayOptions): Promise<ReplayPreparation>;
752
+ /**
753
+ * ADR 0002 migration step. Strips `.fernignore`-matched entries from
754
+ * `patch.files`, `patch.theirs_snapshot` keys, and `diff --git` sections
755
+ * in `patch.patch_content` for every patch in the lockfile. Patches that
756
+ * end up with no surviving files are removed entirely.
757
+ *
758
+ * Idempotent: a second run is a no-op because the first run already
759
+ * matches the contract. Per-patch try/catch ensures one bad patch does
760
+ * not block the rest. Each affected patch emits a warning naming the
761
+ * stripped paths. `patch_content` is left untouched if no parseable
762
+ * `diff --git` headers are found (fail-safe for exotic legacy formats).
763
+ */
764
+ private cleanseLegacyFernignoreEntries;
740
765
  /**
741
766
  * Phase 2 of the two-phase replay flow. Applies patches, rebases them against
742
767
  * the generation, saves the lockfile, and commits `[fern-replay]` (or stages
@@ -871,6 +896,22 @@ declare class ReplayService {
871
896
  */
872
897
  /** @internal Used by Flow implementations in `src/flows/`. */
873
898
  recordDroppedContextLineWarnings(results: ReplayResult[]): void;
899
+ /**
900
+ * After applyPatches(), surface a warning for each (patch × file) where a
901
+ * customization's BASE could not be read because the patch's
902
+ * base-generation tree is unreachable in this clone (shallow-clone window
903
+ * too small / pruned history). In that state the merge pipeline falls
904
+ * through to `new-file-both` and the customer's edit can be dropped with NO
905
+ * conflict and NO error — the INC-866 silent-loss class. This converts that
906
+ * silence into an explicit, actionable warning naming the file and the
907
+ * likely cause (insufficient clone window).
908
+ *
909
+ * Mirrors `recordDroppedContextLineWarnings`'s "surface, never silently
910
+ * drop" contract. De-duplicated per file path so a single insufficient
911
+ * window doesn't spam one warning per touched file repeatedly.
912
+ */
913
+ /** @internal Used by Flow implementations in `src/flows/`. */
914
+ recordUnreachableBaseWarnings(results: ReplayResult[]): void;
874
915
  /**
875
916
  * After applyPatches(), strip conflict markers from conflicting files
876
917
  * so only clean content is committed. Keeps the Generated (OURS) side.
package/dist/index.d.ts CHANGED
@@ -101,6 +101,17 @@ interface FileResult {
101
101
  * if needed. Empty/undefined when no such lines exist.
102
102
  */
103
103
  droppedContextLines?: string[];
104
+ /**
105
+ * INC-866 silent-loss signal. Set on a `new-file-both` result when BASE was
106
+ * null because the patch's base-generation tree is unreachable (shallow
107
+ * clone window too small / pruned history) rather than because the file is
108
+ * genuinely new. In that state an edited-existing-file customization can be
109
+ * dropped with no conflict and no error. Surfaced as a ReplayReport warning
110
+ * (`recordUnreachableBaseWarnings`) so callers/CLI learn the clone window
111
+ * was insufficient instead of losing the edit silently. Undefined/false in
112
+ * the benign case.
113
+ */
114
+ baseTreeUnreachable?: boolean;
104
115
  }
105
116
  interface ConflictRegion {
106
117
  startLine: number;
@@ -266,8 +277,9 @@ declare class ReplayDetector {
266
277
  private git;
267
278
  private lockManager;
268
279
  private sdkOutputDir;
280
+ private fernignorePatterns;
269
281
  readonly warnings: string[];
270
- constructor(git: GitClient, lockManager: LockfileManager, sdkOutputDir: string);
282
+ constructor(git: GitClient, lockManager: LockfileManager, sdkOutputDir: string, fernignorePatterns?: readonly string[]);
271
283
  /**
272
284
  * Derive the previous-generation SHA from git history instead of trusting
273
285
  * `lock.current_generation`.
@@ -737,6 +749,19 @@ declare class ReplayService {
737
749
  * `applyPreparedReplay` (e.g., `[fern-autoversion]`).
738
750
  */
739
751
  prepareReplay(options?: ReplayOptions): Promise<ReplayPreparation>;
752
+ /**
753
+ * ADR 0002 migration step. Strips `.fernignore`-matched entries from
754
+ * `patch.files`, `patch.theirs_snapshot` keys, and `diff --git` sections
755
+ * in `patch.patch_content` for every patch in the lockfile. Patches that
756
+ * end up with no surviving files are removed entirely.
757
+ *
758
+ * Idempotent: a second run is a no-op because the first run already
759
+ * matches the contract. Per-patch try/catch ensures one bad patch does
760
+ * not block the rest. Each affected patch emits a warning naming the
761
+ * stripped paths. `patch_content` is left untouched if no parseable
762
+ * `diff --git` headers are found (fail-safe for exotic legacy formats).
763
+ */
764
+ private cleanseLegacyFernignoreEntries;
740
765
  /**
741
766
  * Phase 2 of the two-phase replay flow. Applies patches, rebases them against
742
767
  * the generation, saves the lockfile, and commits `[fern-replay]` (or stages
@@ -871,6 +896,22 @@ declare class ReplayService {
871
896
  */
872
897
  /** @internal Used by Flow implementations in `src/flows/`. */
873
898
  recordDroppedContextLineWarnings(results: ReplayResult[]): void;
899
+ /**
900
+ * After applyPatches(), surface a warning for each (patch × file) where a
901
+ * customization's BASE could not be read because the patch's
902
+ * base-generation tree is unreachable in this clone (shallow-clone window
903
+ * too small / pruned history). In that state the merge pipeline falls
904
+ * through to `new-file-both` and the customer's edit can be dropped with NO
905
+ * conflict and NO error — the INC-866 silent-loss class. This converts that
906
+ * silence into an explicit, actionable warning naming the file and the
907
+ * likely cause (insufficient clone window).
908
+ *
909
+ * Mirrors `recordDroppedContextLineWarnings`'s "surface, never silently
910
+ * drop" contract. De-duplicated per file path so a single insufficient
911
+ * window doesn't spam one warning per touched file repeatedly.
912
+ */
913
+ /** @internal Used by Flow implementations in `src/flows/`. */
914
+ recordUnreachableBaseWarnings(results: ReplayResult[]): void;
874
915
  /**
875
916
  * After applyPatches(), strip conflict markers from conflicting files
876
917
  * so only clean content is committed. Keeps the Generated (OURS) side.