@fern-api/replay 0.15.1 → 0.15.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 +2 -64
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +2 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -10
- package/dist/index.d.ts +1 -10
- package/dist/index.js +2 -64
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -308,9 +308,7 @@ declare class ReplayDetector {
|
|
|
308
308
|
* within the current linear detection window, and are absent from
|
|
309
309
|
* HEAD at the end of the window.
|
|
310
310
|
*
|
|
311
|
-
* Rationale:
|
|
312
|
-
* firstParent..mergeCommit so net-zero files never enter the composite. On
|
|
313
|
-
* linear history each commit becomes its own patch, so a file that was
|
|
311
|
+
* Rationale: each commit becomes its own patch, so a file that was
|
|
314
312
|
* briefly added and later removed survives as a create+delete pair whose
|
|
315
313
|
* cumulative diff is empty. We drop such patches before they reach the
|
|
316
314
|
* lockfile.
|
|
@@ -341,13 +339,6 @@ declare class ReplayDetector {
|
|
|
341
339
|
* more aggressively. On typical SDK repos this is a single sub-10ms call.
|
|
342
340
|
*/
|
|
343
341
|
private listHeadFiles;
|
|
344
|
-
/**
|
|
345
|
-
* Create a single composite patch for a merge commit by diffing the merge
|
|
346
|
-
* commit against its first parent. This captures the net change of the
|
|
347
|
-
* entire merged branch as one patch, eliminating accumulator chaining and
|
|
348
|
-
* zero-net-change ghost conflicts.
|
|
349
|
-
*/
|
|
350
|
-
private createMergeCompositePatch;
|
|
351
342
|
/**
|
|
352
343
|
* Detect patches via tree diff for non-linear history. Returns a composite patch.
|
|
353
344
|
* Revert reconciliation is skipped here because tree-diff produces a single composite
|
package/dist/index.d.ts
CHANGED
|
@@ -308,9 +308,7 @@ declare class ReplayDetector {
|
|
|
308
308
|
* within the current linear detection window, and are absent from
|
|
309
309
|
* HEAD at the end of the window.
|
|
310
310
|
*
|
|
311
|
-
* Rationale:
|
|
312
|
-
* firstParent..mergeCommit so net-zero files never enter the composite. On
|
|
313
|
-
* linear history each commit becomes its own patch, so a file that was
|
|
311
|
+
* Rationale: each commit becomes its own patch, so a file that was
|
|
314
312
|
* briefly added and later removed survives as a create+delete pair whose
|
|
315
313
|
* cumulative diff is empty. We drop such patches before they reach the
|
|
316
314
|
* lockfile.
|
|
@@ -341,13 +339,6 @@ declare class ReplayDetector {
|
|
|
341
339
|
* more aggressively. On typical SDK repos this is a single sub-10ms call.
|
|
342
340
|
*/
|
|
343
341
|
private listHeadFiles;
|
|
344
|
-
/**
|
|
345
|
-
* Create a single composite patch for a merge commit by diffing the merge
|
|
346
|
-
* commit against its first parent. This captures the net change of the
|
|
347
|
-
* entire merged branch as one patch, eliminating accumulator chaining and
|
|
348
|
-
* zero-net-change ghost conflicts.
|
|
349
|
-
*/
|
|
350
|
-
private createMergeCompositePatch;
|
|
351
342
|
/**
|
|
352
343
|
* Detect patches via tree diff for non-linear history. Returns a composite patch.
|
|
353
344
|
* Revert reconciliation is skipped here because tree-diff produces a single composite
|
package/dist/index.js
CHANGED
|
@@ -896,7 +896,7 @@ var ReplayDetector = class {
|
|
|
896
896
|
async detectPatchesInRange(rangeStart, lastGen, lock) {
|
|
897
897
|
const log = await this.git.exec([
|
|
898
898
|
"log",
|
|
899
|
-
"--
|
|
899
|
+
"--no-merges",
|
|
900
900
|
"--format=%H%x00%an%x00%ae%x00%s",
|
|
901
901
|
`${rangeStart}..HEAD`,
|
|
902
902
|
"--",
|
|
@@ -916,18 +916,6 @@ var ReplayDetector = class {
|
|
|
916
916
|
continue;
|
|
917
917
|
}
|
|
918
918
|
const parents = await this.git.getCommitParents(commit.sha);
|
|
919
|
-
if (parents.length > 1) {
|
|
920
|
-
const compositePatch = await this.createMergeCompositePatch({
|
|
921
|
-
mergeCommit: commit,
|
|
922
|
-
firstParent: parents[0],
|
|
923
|
-
lastGen,
|
|
924
|
-
lock
|
|
925
|
-
});
|
|
926
|
-
if (compositePatch) {
|
|
927
|
-
newPatches.push(compositePatch);
|
|
928
|
-
}
|
|
929
|
-
continue;
|
|
930
|
-
}
|
|
931
919
|
let patchContent;
|
|
932
920
|
try {
|
|
933
921
|
patchContent = await this.git.formatPatch(commit.sha);
|
|
@@ -1065,9 +1053,7 @@ var ReplayDetector = class {
|
|
|
1065
1053
|
* within the current linear detection window, and are absent from
|
|
1066
1054
|
* HEAD at the end of the window.
|
|
1067
1055
|
*
|
|
1068
|
-
* Rationale:
|
|
1069
|
-
* firstParent..mergeCommit so net-zero files never enter the composite. On
|
|
1070
|
-
* linear history each commit becomes its own patch, so a file that was
|
|
1056
|
+
* Rationale: each commit becomes its own patch, so a file that was
|
|
1071
1057
|
* briefly added and later removed survives as a create+delete pair whose
|
|
1072
1058
|
* cumulative diff is empty. We drop such patches before they reach the
|
|
1073
1059
|
* lockfile.
|
|
@@ -1134,54 +1120,6 @@ var ReplayDetector = class {
|
|
|
1134
1120
|
return /* @__PURE__ */ new Set();
|
|
1135
1121
|
}
|
|
1136
1122
|
}
|
|
1137
|
-
/**
|
|
1138
|
-
* Create a single composite patch for a merge commit by diffing the merge
|
|
1139
|
-
* commit against its first parent. This captures the net change of the
|
|
1140
|
-
* entire merged branch as one patch, eliminating accumulator chaining and
|
|
1141
|
-
* zero-net-change ghost conflicts.
|
|
1142
|
-
*/
|
|
1143
|
-
async createMergeCompositePatch(input) {
|
|
1144
|
-
const { mergeCommit, firstParent, lastGen, lock } = input;
|
|
1145
|
-
const forgottenHashes = new Set(lock.forgotten_hashes ?? []);
|
|
1146
|
-
const filesOutput = await this.git.exec([
|
|
1147
|
-
"diff",
|
|
1148
|
-
"--name-only",
|
|
1149
|
-
firstParent,
|
|
1150
|
-
mergeCommit.sha
|
|
1151
|
-
]);
|
|
1152
|
-
const { files, sensitiveFiles } = filterInfrastructureAndSensitiveFiles(filesOutput);
|
|
1153
|
-
if (sensitiveFiles.length > 0) {
|
|
1154
|
-
this.warnings.push(
|
|
1155
|
-
`Sensitive file(s) excluded from merge patch for commit ${mergeCommit.sha.slice(0, 7)}: ${sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
|
|
1156
|
-
);
|
|
1157
|
-
}
|
|
1158
|
-
if (files.length === 0) return null;
|
|
1159
|
-
const diff = await this.git.exec([
|
|
1160
|
-
"diff",
|
|
1161
|
-
firstParent,
|
|
1162
|
-
mergeCommit.sha,
|
|
1163
|
-
"--",
|
|
1164
|
-
...files
|
|
1165
|
-
]);
|
|
1166
|
-
if (!diff.trim()) return null;
|
|
1167
|
-
const contentHash = this.computeContentHash(diff);
|
|
1168
|
-
if (lock.patches.some((p) => p.content_hash === contentHash) || forgottenHashes.has(contentHash)) {
|
|
1169
|
-
return null;
|
|
1170
|
-
}
|
|
1171
|
-
const theirsSnapshot = await capturePatchSnapshot(this.git, files, mergeCommit.sha);
|
|
1172
|
-
return {
|
|
1173
|
-
id: `patch-merge-${mergeCommit.sha.slice(0, 8)}`,
|
|
1174
|
-
content_hash: contentHash,
|
|
1175
|
-
original_commit: mergeCommit.sha,
|
|
1176
|
-
original_message: mergeCommit.message,
|
|
1177
|
-
original_author: `${mergeCommit.authorName} <${mergeCommit.authorEmail}>`,
|
|
1178
|
-
base_generation: lastGen.commit_sha,
|
|
1179
|
-
files,
|
|
1180
|
-
patch_content: diff,
|
|
1181
|
-
...Object.keys(theirsSnapshot).length > 0 ? { theirs_snapshot: theirsSnapshot } : {},
|
|
1182
|
-
...this.isCreationOnlyPatch(diff) ? { user_owned: true } : {}
|
|
1183
|
-
};
|
|
1184
|
-
}
|
|
1185
1123
|
/**
|
|
1186
1124
|
* Detect patches via tree diff for non-linear history. Returns a composite patch.
|
|
1187
1125
|
* Revert reconciliation is skipped here because tree-diff produces a single composite
|