A teammate’s pull request makes checkpoints cheaper. Trunk ports can carry hundreds of VLANs, and every checkpoint copied the whole allowed list; now the port records each change in a log, a checkpoint is just a position in it, and restore undoes the logged changes after that position. Nothing outside the port changed, which is the point of a memento. In staging an operator rolled back a window and the trunk lost VLAN 10, which it had carried all along.
A rollback that loses a VLAN the port always carried cuts off a whole network segment, during the window that was meant to make things safer. A rollback that cannot reach a checkpoint the history still shows leaves the operator with no way back.
Reproduce
Checkpoint the uplink, allow VLAN 10 (already allowed), roll back: the port shows allowed 20. Change its VLAN to 30 and then 40 and roll back: it shows vlan 30. Checkpoint “start”, change the VLAN to 30, checkpoint “step 2”, allow 40, roll back to “start” and then to “step 2”: it shows vlan 20.
Acceptance criteria
- Rolling back gives exactly the configuration at the checkpoint, including after changes that changed nothing (allowing a VLAN already allowed, removing one that was not).
- It does so after several changes to the same setting.
- Rolling back to any checkpoint the history keeps works, in any order, including a later one after an earlier one.
- Everything from the earlier levels still holds: live state stays live, learned addresses are cleared, the newest three are kept, a foreign checkpoint is refused.
Notes
- Each case starts the same two ports and an empty history, runs its steps and prints each show and failed rollback, joined by “ | ”.
- Keep the names of the port’s methods and fields and of the history’s methods. How a checkpoint is represented inside the port is yours to decide.