| … | … | @@ -25,16 +25,22 @@ steps: |
| 25 | 25 | # Must overwrite keet-cli's version since rsync already copied it. |
| 26 | 26 | run: rm -rf node_modules/keet-daemon && cp -r /storage/projects/code/hypercore-kb/hyper-fleeky/packages/keet-daemon node_modules/keet-daemon |
| 27 | 27 | - name: patch-pear-runtime |
| 28 | | # Two patches to pear-runtime: |
| 28 | # Three patches to pear-runtime: |
| 29 | 29 | # 1. bare-sidecar has native prebuilds that break pear stage. Lazy-load it since we never call run(). |
| 30 | 30 | # 2. applyUpdate() sets this.applied=true BEFORE fsx.swap — if swap fails (Hyperdrive not fully |
| 31 | 31 | # 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). |
| 32 | 37 | run: | |
| 33 | 38 | sed -i "s/const Sidecar = require('bare-sidecar')/let Sidecar = null/" node_modules/pear-runtime/index.js |
| 34 | 39 | sed -i "/return new Sidecar/i\\ if (!Sidecar) Sidecar = require('bare-sidecar')" node_modules/pear-runtime/index.js |
| 35 | 40 | rm -rf node_modules/bare-sidecar node_modules/pear-runtime/node_modules/bare-sidecar |
| 36 | 41 | sed -i '/if (!this.updated || this.applied || !this.bundled) return/{n;/this.applied = true/d}' node_modules/pear-runtime/index.js |
| 37 | 42 | 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 |
| 38 | 44 | - name: verify-deps |
| 39 | 45 | # Prove all critical imports resolve before staging |
| 40 | 46 | run: | |