Skip to content

refactor: remove old diffsync (DiffType_V2) support - #231

Open
cheggaaa wants to merge 3 commits into
files-v2from
remove-diffsync-v2
Open

refactor: remove old diffsync (DiffType_V2) support#231
cheggaaa wants to merge 3 commits into
files-v2from
remove-diffsync-v2

Conversation

@cheggaaa

Copy link
Copy Markdown
Member

Summary

Companion to anyproto/any-sync#728 — removes node-side support for the dead V2 diffsync. All connectable peers (compatible versions 12+) negotiate DiffType_V3, and the node's own v2→v3 diff migration had already overwritten stored old hashes with new ones, so V2 responses served no real data.

  • nodehead: single head per space — oldHashes map, GetOldHead, and the old-head parameter of SetHead removed
  • rpchandler: unsupported diff types are rejected up front, before the deep-sync fallback — a crafted non-V3 request can no longer force a full space load just to be rejected (review finding); a future V4 requester falls back to V3 on this error per the upgrade recipe in any-sync's diffmanager.go
  • nodestorage: single hash in SpaceUpdate/SpaceStatusEntry/index; the v2→v3 diff-hash migration machinery is deleted (it only backfilled the now-unread "oh" index key)
  • oldstorage: drop the never-called OnWriteOldHash hook

Stale-hash healing for very old space stores is unchanged: wrong/legacy nh values still self-correct via the hash-mismatch → deep-sync → FillDiffSetHash loop.

go.mod temporarily pins any-sync to the companion branch (pseudo-version); replace with a tagged release before merge.

Test plan

  • go test ./... green against the pinned any-sync
  • mixed-fleet/downgrade path covered by the transitional "oh" mirror in the any-sync PR

🤖 Generated with Claude Code

cheggaaa added 3 commits July 10, 2026 15:10
Companion to any-sync's V2 diffsync removal: all connectable peers
(compatible versions 12+) negotiate DiffType_V3, and the diff migration
had already overwritten old hashes with new ones, so nothing served
real V2 data anymore.

- nodehead: single head per space, drop oldHashes map and GetOldHead
- rpchandler: nodehead fast path answers only V3 head-sync requests
- nodestorage: single hash in SpaceUpdate/SpaceStatusEntry/index,
  drop the v2->v3 diff hash migration machinery
- oldstorage: drop unused OnWriteOldHash
Review follow-up for the diffsync-V2 removal: a crafted non-V3 HeadSync
request could bypass the removed nodehead fast path and force a full
space load only to be rejected by HandleRangeRequest. Reject unsupported
types up front (a future V4 requester falls back to V3 on this error,
see the upgrade recipe in any-sync's diffmanager.go).
Temporary pseudo-version so CI builds against the companion any-sync PR;
replace with a tagged release before merging into files-v2.
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgithub.com/​anyproto/​any-sync@​v0.13.0-alpha.5 ⏵ v0.13.0-alpha.5.0.20260710134112-4c9c2983a6637410010010070

View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant