serviceability: migrate processors to new_interfaces#3670
Merged
Conversation
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
elitegreg
commented
May 5, 2026
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.
ben-dz
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
device/interface/{create,update,activate,delete,reject,remove,unlink},link/{accept,activate,closeaccount,create,delete,update}, andtopology/backfillprocessors to read and mutateDevice::new_interfacesdirectly, dropping allinto_current_version()/into_v3()/find_interface_legacy()calls fromprocessors/.Device::push_interfacenow takes aNewInterfacedirectly, avoiding a fallibleTryFrom<&InterfaceV2>at the call site.BackfillTopologyno longer mirrorsflex_algo_node_segmentsinto the legacy in-memoryinterfacesvec — segments live only innew_interfacesand are intentionally dropped on the V2-projected on-disk legacy slot. The customDevice::BorshSerializecontinues to projectnew_interfaces→ V2 for byte-compatibility with older readers.Device::find_interface_legacyis retained as scaffolding for CLI callers; noprocessors/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
test_flex_algo_segments_roundtrip_through_new_interfaces(instate/device.rs) seeds a Vpnv4 loopback with a populatedflex_algo_node_segments, round-trips through borsh, and asserts segments survive innew_interfaceswhile the V2-projected legacy slot drops them.test_topology_backfill_populates_vpnv4_loopbacksintegration test continues to pass — it already asserted ondevice.new_interfaces[0].flex_algo_node_segments, so removing the legacy in-memory mirror is invisible to it.make rust-fmt,make rust-lint, andmake rust-testall pass on this branch.processors/for legacy paths returns only the out-of-scopemigrate_interfaces.rs.