Skip to content

feat: address migration gaps (WIP) - #9487

Draft
pjwerneck wants to merge 12 commits into
stephen/syft-client-migrationsfrom
pjwerneck/migration-gaps
Draft

feat: address migration gaps (WIP)#9487
pjwerneck wants to merge 12 commits into
stephen/syft-client-migrationsfrom
pjwerneck/migration-gaps

Conversation

@pjwerneck

Copy link
Copy Markdown
Collaborator

Summary

Closes most of the migration gaps that block safe upgrades: private Drive folders are adopted by rename, P2P folders are found regardless of the version in the name, and durable surfaces (checkpoints, rolling state, crypto keys, peers JSON, local caches) carry or refuse versions instead of failing silently.

Adds a per-protocol minimum-supported floor (shipped inert at "0"), stops refusing peers on client semver mismatch, and hardens release/CI (export → publish → tag → bump, client migration tests in CI, numeric version ordering). Job protocol skew delivery is covered end-to-end; dataset transport multi-copy (A1) and a few process/policy items remain open.

Note

The base branch is stephen/syft-client-migrations, not dev. This branch assumes that branch will be merged first.

Changes

Done

• A2a Private Drive folders: adopt highest older version by rename (_find_or_adopt_versioned_folder); personal / checkpoints / rolling-state all use it.
• A2b P2P folders: version-tolerant lookup (_find_p2p_folder_id); filter_patch_compatible deleted.
• A3 floor Per-package MIN_SUPPORTED
*_PROTOCOL_VERSION = "0", on-wire min_supported_version, enforced in negotiate_protocol_version (jobs + datasets).
• A3 peer gate Client-version INCOMPATIBLE no longer skips peers (get_peer_compatibility_status); force_ignore_protocol_version removed.
• A4 Dead ClientVersionMismatchError / ProtocolVersionMismatchError deleted (inert PROTOCOL_VERSION semver field stays).
• A5 Unknown-peer defaults documented; forced paths log warnings + test_unknown_peer_forced_path.py.
• B1 Checkpoints / rolling state refuse later version; local load reports failure instead of silent pass.
• B2 Crypto keys file stamped (CRYPTO_KEYS_VERSION); later version refused (no rebuild possible).
• B3 SYFT_peers.json version under _meta; unknown peer state log-and-skip (raw map rewrite keeps entries safe).
• B4 PersistedDict envelope {"version", "entries"}; old flat file = v0; later version resets empty.
• C1 Release order: export artifacts → publish → tag → bump; --dependents published; protocol_bump_missing.
• C2 Client migration tests in CI (just test-client-migrations + post-release).
• C3 case 1 Job protocol-0 skew delivery path covered (test_job_protocol_skew_delivery.py).
• D1 Numeric version ordering via _version_order (no more string "10" < "2").
• D2 VersionInfo additive field guard tests (test_version_info_fields.py).
• D3 Live peer-schema dict identity asserted in job + dataset negotiation tests (no typed holder).

Pending

• A1 Dataset collection transport still flat; metadata can point at v1/ the peer never gets; manager gets no peer schemas.
• A2c Two compatible private folders still hit _expect_one → manual delete on Drive.
• A3 policy Floor always "0" (inert); raise vs warn vs read-only undecided; login mismatch still deletes state.
• A3 residual target_protocol_versions_for_peers uses min without floor (dormant until A1).
• A4 residual Dead semver PROTOCOL_VERSION still required on the wire.
• B4 residual Cost of file_hashes reset (event replay) unmeasured.
• C1 residual One-time transition bump (dev still names published versions); 0.1.117 fixture not a true published dump.
• C1 accepted No provisional lock for unreleased protocol drift (by decision).
• C3 case 2 Dataset skew E2E (blocked on A1).
• C3 case 3 Upgrade-in-place + mixed peers E2E (blocked on A3 policy).
• C4 Migration guidance never walked end-to-end by a human.
• E1 Only VersionInfo has real object migrations; jobs/datasets still V1-only rehearsal gap.

Testing

  • Unit and migration tests for each gap

Asana task

https://app.asana.com/1/1185126988600652/project/1216249688888494/task/1217005273770094?focus=true

- Fix C2 item from migration gaps review
- Fix D1 item from migration gaps review
- Fix C1 item from migration gaps review
- Pin dependents to the published version, not the bumped one, so a package released later in the same run does not need a version  PyPI lacks
- Fix A2 item from migration gaps review, private folders only
- Code quality fixes
- Fix A3 item from migration gaps review, floor mechanism only
- Every floor starts at 0, so no peer is refused; protocol 1 has never shipped, so 0 is the only correct value today.
- Fix A3 item from migration gaps review, peer gate policy
- A peer with UNKNOWN version is still skipped, because nothing can be negotiated without its version
 - Fix A2b item from migration gaps review, completing A2
 - A folder this client owns is reused after an upgrade, becasuse a peer that has not upgraded still looks for the old name
 - Delete _filter_patch_compatible, which has no caller left.
- B2: version the crypto key file; refuse an unknown later version because a private key cannot be rebuilt
- B4: version the persisted caches; reset on an unknown later version, because the client rebuilds them. On-disk format becomes {"version", "entries"}
- D2: freeze the VersionInfo V1 field set; every field V2 adds needs a default.
- A4: delete the two unused version exception classes.
- Fix B3 item from migration gaps review
- Stamp the format version under a reserved _meta key, so older clients
  that treat every top-level key as a peer email skip it safely
- Log and skip an unknown peer state instead of dropping the peer in silence;
  the writer keeps other entries, so the record is not erased on Drive
- Fix B1 item from migration gaps review; A2a already fixed the folder half
- A later client can reshape a field while the object still parses, which gives a wrong restore silently. Ever load site already falls back to downloading all events, so refusing costs one slow cold start.
- Fix C3 case 1 from migration gaps review
- The existing tests assert the negotiated version only; removing the protocol-0 codec fails this test and leaves those passing
- Fix A5 item from migration gaps review; the entry named the wrong pair, the different is between the two dataset methods, not jobs vs datasets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant