@rljson/fs-agent 0.0.28 → 0.0.29

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/dist/fs-agent.js +9 -4
  2. package/package.json +1 -1
package/dist/fs-agent.js CHANGED
@@ -2198,6 +2198,13 @@ ${err.stack}` : String(err);
2198
2198
  const processRef = async (treeRef, recoveryAttempt = 0, predecessorRefs, isNewestFromSender = true) => {
2199
2199
  const maxAttempts = this._timeouts.processRefRetries + 1;
2200
2200
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
2201
+ if (!isNewestFromSender) {
2202
+ console.warn(
2203
+ `[FsAgent] ref=${treeRef.slice(0, 8)}… is not the newest its sender has advertised — ignoring it.`
2204
+ );
2205
+ connector.invalidateReceived(treeRef);
2206
+ return;
2207
+ }
2201
2208
  this._scanner.pauseWatch();
2202
2209
  this._remoteApplyInFlight = true;
2203
2210
  try {
@@ -2248,12 +2255,10 @@ ${err.stack}` : String(err);
2248
2255
  }
2249
2256
  const ancestryExpected = this._resolveConflicts;
2250
2257
  const declaresAncestry = (predecessorRefs?.length ?? 0) > 0;
2251
- const staleAdvertisement = !isNewestFromSender;
2252
- const withholdPrune = ancestryExpected && !declaresAncestry || staleAdvertisement;
2253
- const applyOptions = restoreOptions?.cleanTarget && withholdPrune ? { ...restoreOptions, cleanTarget: false } : restoreOptions;
2258
+ const applyOptions = restoreOptions?.cleanTarget && ancestryExpected && !declaresAncestry ? { ...restoreOptions, cleanTarget: false } : restoreOptions;
2254
2259
  if (applyOptions !== restoreOptions) {
2255
2260
  console.warn(
2256
- `[FsAgent] ref=${treeRef.slice(0, 8)}… ` + (staleAdvertisement ? "is not the newest its sender has advertised" : "declares no ancestry") + ` — applying additively, not pruning.`
2261
+ `[FsAgent] ref=${treeRef.slice(0, 8)}… declares no ancestry — applying additively, not pruning.`
2257
2262
  );
2258
2263
  }
2259
2264
  await FsAgent._withTimeout(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/fs-agent",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "Rljson fs-agent description",
5
5
  "homepage": "https://github.com/rljson/fs-agent",
6
6
  "bugs": "https://github.com/rljson/fs-agent/issues",