Feat/hypercore11 migration - #1246
Conversation
* chore: auto-open resources * chore: increase CI timeout
Co-authored-by: Andrew Chou <andrewchou@fastmail.com>
* chore: Delete typedoc and auto generated API docs * chore: remove typedoc from workflow and docs references --------- Co-authored-by: Mauve Signweaver <contact@mauve.moe>
17f675c to
4997b24
Compare
|
I used a bunch of tokens on Claude Fable (available until July 7th on the monthly usage plan) to review this on "xhigh", which includes confirmation of issues found. The issues marked CONFIRMED should have been tested and confirmed. "Plausible" could be wrong. Critical — sync correctness1. High — migration module crashes and misbehavior2. 3. Free-space check contradicts its own contract — 4. Broken published types for the new 5. Migration progress counts can disagree — 6. High — latent data-corruption and resource risks7. 8. File-descriptor cap removed with no replacement — Medium9. 10. Test-coverage regressions11–12. The two tests covering exactly the rewritten mechanisms were skipped — Cleanup13. Stale JSDoc: 14. 15. Leftover Six candidates were refuted in verification — among them "purgeCore leaves dangling references" (guarded by hypercore 11's closed-session checks) and "Downloader swallows legitimate cancellations" (the consumer already ignored those errors on main). The standouts are #1 (breaks the sync behavior this branch exists to preserve, with its test skipped) and the migration-module cluster (#2–#6), since that code runs exactly once per device with no second chance. Happy to fix any of these — say the word (or re-run with |
… retrievable from peer.core
|
|
|
…ypercore 11 peer.core is hypercore 11's internal Core object, which has no .length property, so bitfield.want(contig, undefined) yielded nothing and sendWants was a silent no-op. Same fix as cdf3eb6: use the session core's length. Adds a regression test that shares a sparse pre-existing bitfield without downloading (a download would fetch the bitfield natively and mask a broken helper).
….js exports hypercore-storage ships no types and our declarations for it in types/ are not published, so the emitted dist/migration.d.ts ended with a bare 'import CorestoreStorage from hypercore-storage' that gave consumers TS2307 (or silent any with skipLibCheck). Type the exported signatures with a subset of CorestoreStorage instead, making dist/migration.d.ts self-contained.
gmaclennan
left a comment
There was a problem hiding this comment.
I pushed two small commits to fix the exported types (which I think will be helpful for frontend implementation) and addresses an issue where the tests weren't actually testing the eager want-sending.
I think it would be good to explicitly add hypercore-storage as a dependency before merging - it's imported in the code, and only works because it's a transitive dependency
|
For the designs in Figma, https://www.figma.com/design/iUeC0Qzhb4H0unuPfxQAsM/-Mobile--CoMapeo?node-id=11371-4308&t=nKpXn1KBC1KIdSK8-0, we need a value for the amount of space needed. This will most likely help the user know how much space to free up... |
* test(core-manager): failing test for purged cores reopening in repair mode purgeCore deletes all tree nodes and blocks but leaves the core's head record (fork, length, root hash) in storage. When the same storage is re-opened - as happens when a device re-joins a project after leaving, which re-adds the same core keys - hypercore finds a header claiming length > 0 with no merkle roots and puts the core in repair mode: the replicator becomes push-only and never sends a Synchronize, so the core silently never syncs for the rest of the session. Peers waiting on that core's handshake wait forever. The new test purges a downloaded core, re-opens the same storage, and asserts a block can be re-downloaded. It times out on the current implementation. * fix(core-manager): delete the head record when purging a core purgeCore deletes all tree nodes and blocks but left the core's head record (fork, length, root hash) in storage. When the same storage was re-opened - a device re-joining a project after leaving re-adds the same core keys - hypercore found a header claiming length > 0 with no merkle roots and put the core in repair mode: push-only, never sending a Synchronize, so the core silently never synced for the rest of the session, and peers gating on its handshake waited forever. Delete the head record too, so a purged core re-opens as a normal empty core and re-syncs from peers.
Closes #1042