Skip to content

serviceability: migrate processors to new_interfaces#3670

Merged
elitegreg merged 2 commits intomainfrom
gm/migrate-processors-to-new-interfaces
May 5, 2026
Merged

serviceability: migrate processors to new_interfaces#3670
elitegreg merged 2 commits intomainfrom
gm/migrate-processors-to-new-interfaces

Conversation

@elitegreg
Copy link
Copy Markdown
Contributor

Summary

  • Migrate device/interface/{create,update,activate,delete,reject,remove,unlink}, link/{accept,activate,closeaccount,create,delete,update}, and topology/backfill processors to read and mutate Device::new_interfaces directly, dropping all into_current_version() / into_v3() / find_interface_legacy() calls from processors/.
  • Device::push_interface now takes a NewInterface directly, avoiding a fallible TryFrom<&InterfaceV2> at the call site.
  • BackfillTopology no longer mirrors flex_algo_node_segments into the legacy in-memory interfaces vec — segments live only in new_interfaces and are intentionally dropped on the V2-projected on-disk legacy slot. The custom Device::BorshSerialize continues to project new_interfaces → V2 for byte-compatibility with older readers.
  • Device::find_interface_legacy is retained as scaffolding for CLI callers; no processors/ code calls it any more. CLI migration will follow in a separate change.

Part of the forward-compatible Device interfaces refactor — depends on #3666 and #3667. Closes #3658.

Testing Verification

  • New unit test test_flex_algo_segments_roundtrip_through_new_interfaces (in state/device.rs) seeds a Vpnv4 loopback with a populated flex_algo_node_segments, round-trips through borsh, and asserts segments survive in new_interfaces while the V2-projected legacy slot drops them.
  • Existing test_topology_backfill_populates_vpnv4_loopbacks integration test continues to pass — it already asserted on device.new_interfaces[0].flex_algo_node_segments, so removing the legacy in-memory mirror is invisible to it.
  • make rust-fmt, make rust-lint, and make rust-test all pass on this branch.
  • Sanity grep over processors/ for legacy paths returns only the out-of-scope migrate_interfaces.rs.

Move device/interface, link, and topology/backfill processors off
into_current_version() / into_v3() / find_interface_legacy() and onto
direct field access on &NewInterface via Device::new_interfaces. The
Device serializer projects new_interfaces to the V2-on-disk legacy
slot, so processors only mutate new_interfaces.

- Device::push_interface now takes a NewInterface directly
- BackfillTopology no longer mirrors flex_algo_node_segments into the
  in-memory legacy interfaces vec; segments live only in new_interfaces
- Add a Device serialize/deserialize round-trip test asserting that
  flex_algo_node_segments survive through new_interfaces while the
  V2-projected legacy slot intentionally drops them

device.interfaces is no longer touched in processors/. The
find_interface_legacy helper is retained for the CLI's staged
migration.

Issue: #3658
The NewInterface BorshSerialize derives the on-disk size from the
actual body bytes and ignores the struct's `size` field — pre-computing
it on the in-memory value before push_interface is a no-op. Drop the
call here and in the new round-trip test.

Per review feedback on #3670.
@elitegreg elitegreg marked this pull request as ready for review May 5, 2026 20:20
@elitegreg elitegreg enabled auto-merge (squash) May 5, 2026 20:23
@elitegreg elitegreg merged commit ec95c37 into main May 5, 2026
33 checks passed
@elitegreg elitegreg deleted the gm/migrate-processors-to-new-interfaces branch May 5, 2026 20:38
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.

serviceability: migrate processors to new_interfaces

2 participants