docs(protocol): clarify route frame allocations
- commit
- 032899ba89ac84dc0f045e3387092ba048a7f938
- author
- brice · · 2026-08-09 16:44 UTC
- parent
- 5884320
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +17 -11
M internal/ports/frame.go +12 -10
| @@ -41,16 +41,18 @@ const ( | |||
| 41 | 41 | MsgOutputResetRequest MsgType = 13 | |
| 42 | 42 | MsgRemotePreviewRequest MsgType = 15 | |
| 43 | 43 | ||
| 44 | - | MsgWelcome MsgType = 16 | |
| 45 | - | MsgError MsgType = 17 | |
| 46 | - | MsgOutput MsgType = 18 | |
| 47 | - | MsgDetached MsgType = 19 | |
| 48 | - | MsgPong MsgType = 20 | |
| 49 | - | MsgSessions MsgType = 21 | |
| 50 | - | MsgCommandResult MsgType = 22 | |
| 51 | - | MsgAttachTarget MsgType = 25 | |
| 52 | - | MsgRemotePreviewResponse MsgType = 26 | |
| 53 | - | MsgNavigationAction MsgType = 23 | |
| 44 | + | MsgWelcome MsgType = 16 | |
| 45 | + | MsgError MsgType = 17 | |
| 46 | + | MsgOutput MsgType = 18 | |
| 47 | + | MsgDetached MsgType = 19 | |
| 48 | + | MsgPong MsgType = 20 | |
| 49 | + | MsgSessions MsgType = 21 | |
| 50 | + | MsgCommandResult MsgType = 22 | |
| 51 | + | MsgNavigationAction MsgType = 23 | |
| 52 | + | MsgAttachTarget MsgType = 25 | |
| 53 | + | MsgRemotePreviewResponse MsgType = 26 | |
| 54 | + | // Route navigation metadata/control frames occupy the post-26 server range; | |
| 55 | + | // 14 and 24 remain reserved for compatibility with older peers. | |
| 54 | 56 | MsgCommittedRouteIdentity MsgType = 27 | |
| 55 | 57 | MsgRecentRouteSnapshot MsgType = 28 | |
| 56 | 58 | MsgNavigateRecentRoute MsgType = 29 | |
| @@ -41,16 +41,18 @@ const ( | |||||
| 41 | MsgOutputResetRequest MsgType = 13 | 41 | MsgOutputResetRequest MsgType = 13 | ||
| 42 | MsgRemotePreviewRequest MsgType = 15 | 42 | MsgRemotePreviewRequest MsgType = 15 | ||
| 43 | 43 | ||||
| 44 | - | MsgWelcome MsgType = 16 | 44 | + | MsgWelcome MsgType = 16 |
| 45 | - | MsgError MsgType = 17 | 45 | + | MsgError MsgType = 17 |
| 46 | - | MsgOutput MsgType = 18 | 46 | + | MsgOutput MsgType = 18 |
| 47 | - | MsgDetached MsgType = 19 | 47 | + | MsgDetached MsgType = 19 |
| 48 | - | MsgPong MsgType = 20 | 48 | + | MsgPong MsgType = 20 |
| 49 | - | MsgSessions MsgType = 21 | 49 | + | MsgSessions MsgType = 21 |
| 50 | - | MsgCommandResult MsgType = 22 | 50 | + | MsgCommandResult MsgType = 22 |
| 51 | - | MsgAttachTarget MsgType = 25 | 51 | + | MsgNavigationAction MsgType = 23 |
| 52 | - | MsgRemotePreviewResponse MsgType = 26 | 52 | + | MsgAttachTarget MsgType = 25 |
| 53 | - | MsgNavigationAction MsgType = 23 | 53 | + | MsgRemotePreviewResponse MsgType = 26 |
| 54 | + | // Route navigation metadata/control frames occupy the post-26 server range; | |||
| 55 | + | // 14 and 24 remain reserved for compatibility with older peers. | |||
| 54 | MsgCommittedRouteIdentity MsgType = 27 | 56 | MsgCommittedRouteIdentity MsgType = 27 | ||
| 55 | MsgRecentRouteSnapshot MsgType = 28 | 57 | MsgRecentRouteSnapshot MsgType = 28 | ||
| 56 | MsgNavigateRecentRoute MsgType = 29 | 58 | MsgNavigateRecentRoute MsgType = 29 | ||
M internal/ports/routes_wire.go +2 -0
| @@ -119,6 +119,8 @@ func marshalCommittedRouteIdentityFields(w *payloadWriter, identity CommittedRou | |||
| 119 | 119 | w.putBool(identity.Ephemeral) | |
| 120 | 120 | } | |
| 121 | 121 | ||
| 122 | + | // marshalCommittedIdentitySection shares the standalone identity body and | |
| 123 | + | // validates embedded identities before Welcome serialization. | |
| 122 | 124 | func marshalCommittedIdentitySection(w *payloadWriter, identity *CommittedRouteIdentity) bool { | |
| 123 | 125 | w.putBool(identity != nil) | |
| 124 | 126 | if identity == nil { | |
| @@ -119,6 +119,8 @@ func marshalCommittedRouteIdentityFields(w *payloadWriter, identity CommittedRou | |||||
| 119 | w.putBool(identity.Ephemeral) | 119 | w.putBool(identity.Ephemeral) | ||
| 120 | } | 120 | } | ||
| 121 | 121 | ||||
| 122 | + | // marshalCommittedIdentitySection shares the standalone identity body and | |||
| 123 | + | // validates embedded identities before Welcome serialization. | |||
| 122 | func marshalCommittedIdentitySection(w *payloadWriter, identity *CommittedRouteIdentity) bool { | 124 | func marshalCommittedIdentitySection(w *payloadWriter, identity *CommittedRouteIdentity) bool { | ||
| 123 | w.putBool(identity != nil) | 125 | w.putBool(identity != nil) | ||
| 124 | if identity == nil { | 126 | if identity == nil { | ||
M internal/usecase/daemon/client.go +3 -1
| @@ -217,7 +217,9 @@ func (ac *attachedClient) currentAttachmentSession() *session { | |||
| 217 | 217 | return ac.sess.Get() | |
| 218 | 218 | } | |
| 219 | 219 | ||
| 220 | - | // currentSession narrows the attachment to its owning local session. | |
| 220 | + | // currentSession is the legacy local-session shorthand used by input and | |
| 221 | + | // overlay paths; attachment-boundary code uses currentAttachmentSession to | |
| 222 | + | // make ownership checks explicit. | |
| 221 | 223 | func (ac *attachedClient) currentSession() *session { | |
| 222 | 224 | return ac.currentAttachmentSession() | |
| 223 | 225 | } | |
| @@ -217,7 +217,9 @@ func (ac *attachedClient) currentAttachmentSession() *session { | |||||
| 217 | return ac.sess.Get() | 217 | return ac.sess.Get() | ||
| 218 | } | 218 | } | ||
| 219 | 219 | ||||
| 220 | - | // currentSession narrows the attachment to its owning local session. | 220 | + | // currentSession is the legacy local-session shorthand used by input and |
| 221 | + | // overlay paths; attachment-boundary code uses currentAttachmentSession to | |||
| 222 | + | // make ownership checks explicit. | |||
| 221 | func (ac *attachedClient) currentSession() *session { | 223 | func (ac *attachedClient) currentSession() *session { | ||
| 222 | return ac.currentAttachmentSession() | 224 | return ac.currentAttachmentSession() | ||
| 223 | } | 225 | } | ||