@rljson/fs-agent 0.0.28 → 0.0.30

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 +15 -5
  2. package/package.json +9 -19
package/dist/fs-agent.js CHANGED
@@ -1925,7 +1925,6 @@ ${err.stack}` : String(err);
1925
1925
  );
1926
1926
  this._currentRef = ref;
1927
1927
  this._persistCurrentRef(ref);
1928
- this._persistCurrentRef(ref);
1929
1928
  if (ref === this._lastSentRef) {
1930
1929
  return;
1931
1930
  }
@@ -2198,6 +2197,19 @@ ${err.stack}` : String(err);
2198
2197
  const processRef = async (treeRef, recoveryAttempt = 0, predecessorRefs, isNewestFromSender = true) => {
2199
2198
  const maxAttempts = this._timeouts.processRefRetries + 1;
2200
2199
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
2200
+ if (treeRef === this._lastSentRef) {
2201
+ console.warn(
2202
+ `[FsAgent] ref=${treeRef.slice(0, 8)}… is this agent's own last advertisement echoed back — ignoring it.`
2203
+ );
2204
+ return;
2205
+ }
2206
+ if (!isNewestFromSender) {
2207
+ console.warn(
2208
+ `[FsAgent] ref=${treeRef.slice(0, 8)}… is not the newest its sender has advertised — ignoring it.`
2209
+ );
2210
+ connector.invalidateReceived(treeRef);
2211
+ return;
2212
+ }
2201
2213
  this._scanner.pauseWatch();
2202
2214
  this._remoteApplyInFlight = true;
2203
2215
  try {
@@ -2248,12 +2260,10 @@ ${err.stack}` : String(err);
2248
2260
  }
2249
2261
  const ancestryExpected = this._resolveConflicts;
2250
2262
  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;
2263
+ const applyOptions = restoreOptions?.cleanTarget && ancestryExpected && !declaresAncestry ? { ...restoreOptions, cleanTarget: false } : restoreOptions;
2254
2264
  if (applyOptions !== restoreOptions) {
2255
2265
  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.`
2266
+ `[FsAgent] ref=${treeRef.slice(0, 8)}… declares no ancestry — applying additively, not pruning.`
2257
2267
  );
2258
2268
  }
2259
2269
  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.30",
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",
@@ -19,14 +19,6 @@
19
19
  "dist"
20
20
  ],
21
21
  "type": "module",
22
- "scripts": {
23
- "build": "pnpm exec vite build && tsc && node scripts/copy-readme-to-dist.js",
24
- "test": "cross-env NODE_OPTIONS=--max-old-space-size=8192 pnpm exec vitest run --coverage && pnpm run lint",
25
- "prebuild": "npm run test",
26
- "prepublishOnly": "npm run build",
27
- "lint": "pnpm exec eslint .",
28
- "updateGoldens": "cross-env UPDATE_GOLDENS=true pnpm test"
29
- },
30
22
  "devDependencies": {
31
23
  "@rljson/server": "^0.0.43",
32
24
  "@types/node": "^25.3.1",
@@ -59,13 +51,11 @@
59
51
  "socket.io": "^4.8.3",
60
52
  "socket.io-client": "^4.8.3"
61
53
  },
62
- "pnpm": {
63
- "onlyBuiltDependencies": [
64
- "esbuild"
65
- ],
66
- "overrides": {
67
- "@rljson/rljson": "^0.0.78"
68
- }
69
- },
70
- "packageManager": "pnpm@10.11.0"
71
- }
54
+ "scripts": {
55
+ "build": "pnpm exec vite build && tsc && node scripts/copy-readme-to-dist.js",
56
+ "test": "cross-env NODE_OPTIONS=--max-old-space-size=8192 pnpm exec vitest run --coverage && pnpm run lint",
57
+ "prebuild": "npm run test",
58
+ "lint": "pnpm exec eslint .",
59
+ "updateGoldens": "cross-env UPDATE_GOLDENS=true pnpm test"
60
+ }
61
+ }