fix(routes): repaint on every route snapshot
- commit
- 11bc196354f2751195358d42b43f70ae06234e58
- author
- brice · · 2026-08-11 08:30 UTC
- parent
- 3f78d59
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +16 -2
M internal/usecase/daemon/client_frame_routing.go +3 -2
| @@ -132,10 +132,11 @@ func (d *Daemon) handleAttachmentClientFrame(token attachmentConnectionToken, f | |||
| 132 | 132 | d.log.Warn("malformed recent route snapshot", "err", derr) | |
| 133 | 133 | break | |
| 134 | 134 | } | |
| 135 | - | if !token.ac.setRouteSnapshot(snapshot) { | |
| 135 | + | replayIdentity := token.ac.setRouteSnapshot(snapshot) | |
| 136 | + | d.invalidateRender(token.sess, token.ac, false, "client_frame_routing.go:route-snapshot") | |
| 137 | + | if !replayIdentity { | |
| 136 | 138 | break | |
| 137 | 139 | } | |
| 138 | - | d.invalidateRender(token.sess, token.ac, false, "client_frame_routing.go:route-snapshot") | |
| 139 | 140 | if err := d.sendCommittedRouteIdentityForAttachment(token); err != nil { | |
| 140 | 141 | d.detachOnAttachmentSendError(token, token.transport.transport) | |
| 141 | 142 | } | |
| @@ -132,10 +132,11 @@ func (d *Daemon) handleAttachmentClientFrame(token attachmentConnectionToken, f | |||||
| 132 | d.log.Warn("malformed recent route snapshot", "err", derr) | 132 | d.log.Warn("malformed recent route snapshot", "err", derr) | ||
| 133 | break | 133 | break | ||
| 134 | } | 134 | } | ||
| 135 | - | if !token.ac.setRouteSnapshot(snapshot) { | 135 | + | replayIdentity := token.ac.setRouteSnapshot(snapshot) |
| 136 | + | d.invalidateRender(token.sess, token.ac, false, "client_frame_routing.go:route-snapshot") | |||
| 137 | + | if !replayIdentity { | |||
| 136 | break | 138 | break | ||
| 137 | } | 139 | } | ||
| 138 | - | d.invalidateRender(token.sess, token.ac, false, "client_frame_routing.go:route-snapshot") | |||
| 139 | if err := d.sendCommittedRouteIdentityForAttachment(token); err != nil { | 140 | if err := d.sendCommittedRouteIdentityForAttachment(token); err != nil { | ||
| 140 | d.detachOnAttachmentSendError(token, token.transport.transport) | 141 | d.detachOnAttachmentSendError(token, token.transport.transport) | ||
| 141 | } | 142 | } | ||
M internal/usecase/daemon/recent_route_snapshot_test.go +13 -0
| @@ -62,6 +62,19 @@ func TestAttachmentStatusResolvesSubscribedRouteAttention(t *testing.T) { | |||
| 62 | 62 | } | |
| 63 | 63 | } | |
| 64 | 64 | ||
| 65 | + | func TestRecentRouteSnapshotRepaintsWithoutDeferredIdentity(t *testing.T) { | |
| 66 | + | d, sess, ac, sends := newManualSessionWithPTYs(t, nil) | |
| 67 | + | token := sess.attachmentToken(ac, ac.transport()) | |
| 68 | + | ac.publishAttachmentCapability(token) | |
| 69 | + | ac.setRouteSnapshot(ports.RecentRouteSnapshot{Generation: 1}) | |
| 70 | + | ||
| 71 | + | payload, err := ports.MarshalRecentRouteSnapshot(ports.RecentRouteSnapshot{Generation: 2}) | |
| 72 | + | require.NoError(t, err) | |
| 73 | + | require.False(t, d.handleAttachmentClientFrame(token, ports.Frame{Type: ports.MsgRecentRouteSnapshot, Payload: payload})) | |
| 74 | + | ||
| 75 | + | awaitFrame(t, sends, ports.MsgOutput) | |
| 76 | + | } | |
| 77 | + | ||
| 65 | 78 | func TestAttachmentRouteSnapshotCopiesPublishedEntries(t *testing.T) { | |
| 66 | 79 | _, _, ac, _ := newManualSessionWithPTYs(t, nil) | |
| 67 | 80 | entries := []ports.RecentRouteEntry{{Key: 1, Generation: 2, Name: "before", Kind: ports.RouteKindLocal}} | |
| @@ -62,6 +62,19 @@ func TestAttachmentStatusResolvesSubscribedRouteAttention(t *testing.T) { | |||||
| 62 | } | 62 | } | ||
| 63 | } | 63 | } | ||
| 64 | 64 | ||||
| 65 | + | func TestRecentRouteSnapshotRepaintsWithoutDeferredIdentity(t *testing.T) { | |||
| 66 | + | d, sess, ac, sends := newManualSessionWithPTYs(t, nil) | |||
| 67 | + | token := sess.attachmentToken(ac, ac.transport()) | |||
| 68 | + | ac.publishAttachmentCapability(token) | |||
| 69 | + | ac.setRouteSnapshot(ports.RecentRouteSnapshot{Generation: 1}) | |||
| 70 | + | ||||
| 71 | + | payload, err := ports.MarshalRecentRouteSnapshot(ports.RecentRouteSnapshot{Generation: 2}) | |||
| 72 | + | require.NoError(t, err) | |||
| 73 | + | require.False(t, d.handleAttachmentClientFrame(token, ports.Frame{Type: ports.MsgRecentRouteSnapshot, Payload: payload})) | |||
| 74 | + | ||||
| 75 | + | awaitFrame(t, sends, ports.MsgOutput) | |||
| 76 | + | } | |||
| 77 | + | ||||
| 65 | func TestAttachmentRouteSnapshotCopiesPublishedEntries(t *testing.T) { | 78 | func TestAttachmentRouteSnapshotCopiesPublishedEntries(t *testing.T) { | ||
| 66 | _, _, ac, _ := newManualSessionWithPTYs(t, nil) | 79 | _, _, ac, _ := newManualSessionWithPTYs(t, nil) | ||
| 67 | entries := []ports.RecentRouteEntry{{Key: 1, Generation: 2, Name: "before", Kind: ports.RouteKindLocal}} | 80 | entries := []ports.RecentRouteEntry{{Key: 1, Generation: 2, Name: "before", Kind: ports.RouteKindLocal}} | ||