OverviewFilesCommitsIssuesDocsReleasesPeers

godot-keet commits / 0f4967f

Fix OTA replication race: only update when remote version is strictly newer
On first launch, pear-runtime replicates the Hyperdrive from scratch in its own corestore. As entries arrive, 'append' fires at intermediate core lengths. checkout(oldLength) returns an old package.json version, triggering an update with incomplete by-arch data. The fsx.swap then destroys the install dir. Fix: patch version comparison from !== (any difference) to numeric > (strictly newer commit count). Prevents stale checkpoints from triggering false updates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0f4967fa8a8f49dec862b3ced26617b50da8aae3
by plankatron <fleeky@gmail.com> · 2026-02-22T01:51:53.000Z

Changed files (1) +7 -1

.pear-git/ci.yaml +7 -1
……@@ -25,16 +25,22 @@ steps:
2525 # Must overwrite keet-cli's version since rsync already copied it.
2626 run: rm -rf node_modules/keet-daemon && cp -r /storage/projects/code/hypercore-kb/hyper-fleeky/packages/keet-daemon node_modules/keet-daemon
2727 - name: patch-pear-runtime
28 # Two patches to pear-runtime:
28 # Three patches to pear-runtime:
2929 # 1. bare-sidecar has native prebuilds that break pear stage. Lazy-load it since we never call run().
3030 # 2. applyUpdate() sets this.applied=true BEFORE fsx.swap — if swap fails (Hyperdrive not fully
3131 # replicated), the retry on next 'updated' event is a no-op. Move flag after successful swap.
32 # 3. Version comparison: use numeric > instead of !== to prevent replication race.
33 # On first launch, pear-runtime replicates the Hyperdrive from scratch. As entries arrive,
34 # 'append' fires at intermediate lengths. checkout(oldLength).get('/package.json') returns
35 # an OLD version, triggering an update with incomplete by-arch data. The swap then destroys
36 # the install dir. Fix: only update when remote version is strictly NEWER (commit count).
3237 run: |
3338 sed -i "s/const Sidecar = require('bare-sidecar')/let Sidecar = null/" node_modules/pear-runtime/index.js
3439 sed -i "/return new Sidecar/i\\ if (!Sidecar) Sidecar = require('bare-sidecar')" node_modules/pear-runtime/index.js
3540 rm -rf node_modules/bare-sidecar node_modules/pear-runtime/node_modules/bare-sidecar
3641 sed -i '/if (!this.updated || this.applied || !this.bundled) return/{n;/this.applied = true/d}' node_modules/pear-runtime/index.js
3742 sed -i '/await fsx.swap/a\ this.applied = true' node_modules/pear-runtime/index.js
43 sed -i 's/JSON.parse(manifest).version === this.version/(() => { const rv = JSON.parse(manifest).version; const rn = parseInt((rv || "0").split(".")[1] || "0"); const ln = parseInt((String(this.version) || "0").split(".")[1] || "0"); return rn <= ln; })()/' node_modules/pear-runtime/index.js
3844 - name: verify-deps
3945 # Prove all critical imports resolve before staging
4046 run: |