@ricsam/r5d-worker 0.0.51 → 0.0.53

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "type": "commonjs"
5
5
  }
@@ -1150,6 +1150,32 @@ function baseResult(input, startingHead) {
1150
1150
  localChangesDiscarded: false
1151
1151
  };
1152
1152
  }
1153
+ function convergeRedundantInboundCandidate(input, result) {
1154
+ if (input.trigger.type !== "inbound_head" || !input.skipVisibleMirror || input.trigger.canonicalCheckoutOnly) return null;
1155
+ const remoteHead = revParse(input, `origin/${WORKSPACE_BRANCH}`);
1156
+ if (!remoteHead) return null;
1157
+ const stagedTree = runGit(input, input.shadowRoot, ["write-tree"], "write inbound workspace candidate tree");
1158
+ const remoteTree = runGit(
1159
+ input,
1160
+ input.shadowRoot,
1161
+ ["rev-parse", "--verify", `${remoteHead}^{tree}`],
1162
+ "resolve authoritative workspace tree"
1163
+ );
1164
+ if (stagedTree !== remoteTree) return null;
1165
+ const localHead = revParse(input, "HEAD");
1166
+ runGit(input, input.shadowRoot, ["reset", "--hard", remoteHead], "converge redundant inbound workspace candidate");
1167
+ runGit(input, input.shadowRoot, ["clean", "-fd"], "clean redundant inbound workspace candidate");
1168
+ mirrorShadowWorkspaceToVisible(input);
1169
+ return {
1170
+ ...result,
1171
+ outcome: localHead === remoteHead ? "no_change" : "updated",
1172
+ publishedHead: remoteHead,
1173
+ diffSizeBytes: 0,
1174
+ gitStatus: gitStatus(input),
1175
+ affectedProjects: [],
1176
+ affectedPaths: []
1177
+ };
1178
+ }
1153
1179
  async function synchronizeWorkspace(rawInput) {
1154
1180
  let input = { ...rawInput, attemptId: rawInput.attemptId ?? crypto.randomUUID() };
1155
1181
  try {
@@ -1183,6 +1209,8 @@ async function synchronizeWorkspace(rawInput) {
1183
1209
  const stagePathspecs = mirroredGitlinkProjection.opaqueRoots.flatMap((root) => [`:(exclude,literal)${root}`]);
1184
1210
  runGit(input, input.shadowRoot, ["add", "-A", "--", ".", ...stagePathspecs], "stage workspace changes");
1185
1211
  forceStageCanonicalCheckoutFiles(input, mirroredGitlinkProjection.entries, mirroredGitlinkProjection.opaqueRoots);
1212
+ const redundantInboundCandidate = convergeRedundantInboundCandidate(input, result);
1213
+ if (redundantInboundCandidate) return redundantInboundCandidate;
1186
1214
  const sampledCanonicalCheckoutTreeHash = sampleCanonicalCheckoutTree(input);
1187
1215
  const stagedWorkingPaths = stagedPaths(input);
1188
1216
  const baseRevision = candidateBaseRevision(input);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "type": "module"
5
5
  }
@@ -1103,6 +1103,32 @@ function baseResult(input, startingHead) {
1103
1103
  localChangesDiscarded: false
1104
1104
  };
1105
1105
  }
1106
+ function convergeRedundantInboundCandidate(input, result) {
1107
+ if (input.trigger.type !== "inbound_head" || !input.skipVisibleMirror || input.trigger.canonicalCheckoutOnly) return null;
1108
+ const remoteHead = revParse(input, `origin/${WORKSPACE_BRANCH}`);
1109
+ if (!remoteHead) return null;
1110
+ const stagedTree = runGit(input, input.shadowRoot, ["write-tree"], "write inbound workspace candidate tree");
1111
+ const remoteTree = runGit(
1112
+ input,
1113
+ input.shadowRoot,
1114
+ ["rev-parse", "--verify", `${remoteHead}^{tree}`],
1115
+ "resolve authoritative workspace tree"
1116
+ );
1117
+ if (stagedTree !== remoteTree) return null;
1118
+ const localHead = revParse(input, "HEAD");
1119
+ runGit(input, input.shadowRoot, ["reset", "--hard", remoteHead], "converge redundant inbound workspace candidate");
1120
+ runGit(input, input.shadowRoot, ["clean", "-fd"], "clean redundant inbound workspace candidate");
1121
+ mirrorShadowWorkspaceToVisible(input);
1122
+ return {
1123
+ ...result,
1124
+ outcome: localHead === remoteHead ? "no_change" : "updated",
1125
+ publishedHead: remoteHead,
1126
+ diffSizeBytes: 0,
1127
+ gitStatus: gitStatus(input),
1128
+ affectedProjects: [],
1129
+ affectedPaths: []
1130
+ };
1131
+ }
1106
1132
  async function synchronizeWorkspace(rawInput) {
1107
1133
  let input = { ...rawInput, attemptId: rawInput.attemptId ?? crypto.randomUUID() };
1108
1134
  try {
@@ -1136,6 +1162,8 @@ async function synchronizeWorkspace(rawInput) {
1136
1162
  const stagePathspecs = mirroredGitlinkProjection.opaqueRoots.flatMap((root) => [`:(exclude,literal)${root}`]);
1137
1163
  runGit(input, input.shadowRoot, ["add", "-A", "--", ".", ...stagePathspecs], "stage workspace changes");
1138
1164
  forceStageCanonicalCheckoutFiles(input, mirroredGitlinkProjection.entries, mirroredGitlinkProjection.opaqueRoots);
1165
+ const redundantInboundCandidate = convergeRedundantInboundCandidate(input, result);
1166
+ if (redundantInboundCandidate) return redundantInboundCandidate;
1139
1167
  const sampledCanonicalCheckoutTreeHash = sampleCanonicalCheckoutTree(input);
1140
1168
  const stagedWorkingPaths = stagedPaths(input);
1141
1169
  const baseRevision = candidateBaseRevision(input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",