fix: address Copilot review round 2
- Use rune count instead of byte length for attachment name truncation - Use styles.IconTreeBranch/IconTreeLast constants instead of hardcoded chars - Update comment from 'ASCII' to 'Unicode box-drawing' for tree structure - Update comments from 'debugging' to 'display in routes table' - Apply stripRegistryPrefix to attachment images for consistency
- commit
- 3a02f231403863db6deb0bc1f2fa8b2f1be12e71
- author
- brice · · 2026-01-17 14:51 UTC
- parent
- 494c50d
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +11 -10
M internal/adapters/in/cli/routes.go +7 -6
| @@ -170,18 +170,19 @@ func runRoutesListRemote(ctx context.Context, client *remote.Client) error { | |||
| 170 | 170 | rows = append(rows, []string{route.Domain, displayImage, displayNetwork, containerBadge, httpStatus}) | |
| 171 | 171 | ||
| 172 | 172 | for i, attachment := range route.Attachments { | |
| 173 | - | // ASCII tree structure for nested attachments | |
| 174 | - | prefix := "├─" | |
| 173 | + | // Unicode box-drawing tree structure for nested attachments | |
| 174 | + | prefix := styles.IconTreeBranch + styles.IconTreeLine | |
| 175 | 175 | if i == len(route.Attachments)-1 { | |
| 176 | - | prefix = "└─" | |
| 176 | + | prefix = styles.IconTreeLast + styles.IconTreeLine | |
| 177 | 177 | } | |
| 178 | 178 | attachmentName := prefix + " " + attachment.Name | |
| 179 | - | if len(attachmentName) > 25 { | |
| 180 | - | attachmentName = attachmentName[:22] + "..." | |
| 179 | + | runes := []rune(attachmentName) | |
| 180 | + | if len(runes) > 25 { | |
| 181 | + | attachmentName = string(runes[:22]) + "..." | |
| 181 | 182 | } | |
| 182 | 183 | attachmentStatus := components.ContainerStatusBadge(attachment.Status) | |
| 183 | 184 | attachmentImage := truncateImage(attachment.Image, imageColWidth) | |
| 184 | - | // Show attachment's actual network for debugging/verification | |
| 185 | + | // Display the attachment's actual network in the routes table | |
| 185 | 186 | attachmentNetwork := truncateNetwork(attachment.Network, networkColWidth) | |
| 186 | 187 | rows = append(rows, []string{attachmentName, attachmentImage, attachmentNetwork, attachmentStatus, "-"}) | |
| 187 | 188 | } | |
| @@ -170,18 +170,19 @@ func runRoutesListRemote(ctx context.Context, client *remote.Client) error { | |||||
| 170 | rows = append(rows, []string{route.Domain, displayImage, displayNetwork, containerBadge, httpStatus}) | 170 | rows = append(rows, []string{route.Domain, displayImage, displayNetwork, containerBadge, httpStatus}) | ||
| 171 | 171 | ||||
| 172 | for i, attachment := range route.Attachments { | 172 | for i, attachment := range route.Attachments { | ||
| 173 | - | // ASCII tree structure for nested attachments | 173 | + | // Unicode box-drawing tree structure for nested attachments |
| 174 | - | prefix := "├─" | 174 | + | prefix := styles.IconTreeBranch + styles.IconTreeLine |
| 175 | if i == len(route.Attachments)-1 { | 175 | if i == len(route.Attachments)-1 { | ||
| 176 | - | prefix = "└─" | 176 | + | prefix = styles.IconTreeLast + styles.IconTreeLine |
| 177 | } | 177 | } | ||
| 178 | attachmentName := prefix + " " + attachment.Name | 178 | attachmentName := prefix + " " + attachment.Name | ||
| 179 | - | if len(attachmentName) > 25 { | 179 | + | runes := []rune(attachmentName) |
| 180 | - | attachmentName = attachmentName[:22] + "..." | 180 | + | if len(runes) > 25 { |
| 181 | + | attachmentName = string(runes[:22]) + "..." | |||
| 181 | } | 182 | } | ||
| 182 | attachmentStatus := components.ContainerStatusBadge(attachment.Status) | 183 | attachmentStatus := components.ContainerStatusBadge(attachment.Status) | ||
| 183 | attachmentImage := truncateImage(attachment.Image, imageColWidth) | 184 | attachmentImage := truncateImage(attachment.Image, imageColWidth) | ||
| 184 | - | // Show attachment's actual network for debugging/verification | 185 | + | // Display the attachment's actual network in the routes table |
| 185 | attachmentNetwork := truncateNetwork(attachment.Network, networkColWidth) | 186 | attachmentNetwork := truncateNetwork(attachment.Network, networkColWidth) | ||
| 186 | rows = append(rows, []string{attachmentName, attachmentImage, attachmentNetwork, attachmentStatus, "-"}) | 187 | rows = append(rows, []string{attachmentName, attachmentImage, attachmentNetwork, attachmentStatus, "-"}) | ||
| 187 | } | 188 | } | ||
M internal/usecase/container/service.go +4 -4
| @@ -987,14 +987,14 @@ func (s *Service) getAllAttachments(ctx context.Context) map[string][]domain.Att | |||
| 987 | 987 | image = labelImage | |
| 988 | 988 | serviceName = extractServiceName(labelImage) | |
| 989 | 989 | } | |
| 990 | - | // Get the container's network for debugging/verification | |
| 990 | + | // Get the container's network for display in the routes table | |
| 991 | 991 | network := "" | |
| 992 | 992 | if networkName, err := s.runtime.GetContainerNetwork(ctx, container.ID); err == nil { | |
| 993 | 993 | network = networkName | |
| 994 | 994 | } | |
| 995 | 995 | attachment := domain.Attachment{ | |
| 996 | 996 | Name: serviceName, | |
| 997 | - | Image: image, | |
| 997 | + | Image: s.stripRegistryPrefix(image), | |
| 998 | 998 | ContainerID: container.ID, | |
| 999 | 999 | Status: container.Status, | |
| 1000 | 1000 | Network: network, | |
| @@ -1024,14 +1024,14 @@ func (s *Service) filterAttachments(ctx context.Context, containers []*domain.Co | |||
| 1024 | 1024 | image = labelImage | |
| 1025 | 1025 | serviceName = extractServiceName(labelImage) | |
| 1026 | 1026 | } | |
| 1027 | - | // Get the container's network for debugging/verification | |
| 1027 | + | // Get the container's network for display in the routes table | |
| 1028 | 1028 | network := "" | |
| 1029 | 1029 | if networkName, err := s.runtime.GetContainerNetwork(ctx, container.ID); err == nil { | |
| 1030 | 1030 | network = networkName | |
| 1031 | 1031 | } | |
| 1032 | 1032 | attachment := domain.Attachment{ | |
| 1033 | 1033 | Name: serviceName, | |
| 1034 | - | Image: image, | |
| 1034 | + | Image: s.stripRegistryPrefix(image), | |
| 1035 | 1035 | ContainerID: container.ID, | |
| 1036 | 1036 | Status: container.Status, | |
| 1037 | 1037 | Network: network, | |
| @@ -987,14 +987,14 @@ func (s *Service) getAllAttachments(ctx context.Context) map[string][]domain.Att | |||||
| 987 | image = labelImage | 987 | image = labelImage | ||
| 988 | serviceName = extractServiceName(labelImage) | 988 | serviceName = extractServiceName(labelImage) | ||
| 989 | } | 989 | } | ||
| 990 | - | // Get the container's network for debugging/verification | 990 | + | // Get the container's network for display in the routes table |
| 991 | network := "" | 991 | network := "" | ||
| 992 | if networkName, err := s.runtime.GetContainerNetwork(ctx, container.ID); err == nil { | 992 | if networkName, err := s.runtime.GetContainerNetwork(ctx, container.ID); err == nil { | ||
| 993 | network = networkName | 993 | network = networkName | ||
| 994 | } | 994 | } | ||
| 995 | attachment := domain.Attachment{ | 995 | attachment := domain.Attachment{ | ||
| 996 | Name: serviceName, | 996 | Name: serviceName, | ||
| 997 | - | Image: image, | 997 | + | Image: s.stripRegistryPrefix(image), |
| 998 | ContainerID: container.ID, | 998 | ContainerID: container.ID, | ||
| 999 | Status: container.Status, | 999 | Status: container.Status, | ||
| 1000 | Network: network, | 1000 | Network: network, | ||
| @@ -1024,14 +1024,14 @@ func (s *Service) filterAttachments(ctx context.Context, containers []*domain.Co | |||||
| 1024 | image = labelImage | 1024 | image = labelImage | ||
| 1025 | serviceName = extractServiceName(labelImage) | 1025 | serviceName = extractServiceName(labelImage) | ||
| 1026 | } | 1026 | } | ||
| 1027 | - | // Get the container's network for debugging/verification | 1027 | + | // Get the container's network for display in the routes table |
| 1028 | network := "" | 1028 | network := "" | ||
| 1029 | if networkName, err := s.runtime.GetContainerNetwork(ctx, container.ID); err == nil { | 1029 | if networkName, err := s.runtime.GetContainerNetwork(ctx, container.ID); err == nil { | ||
| 1030 | network = networkName | 1030 | network = networkName | ||
| 1031 | } | 1031 | } | ||
| 1032 | attachment := domain.Attachment{ | 1032 | attachment := domain.Attachment{ | ||
| 1033 | Name: serviceName, | 1033 | Name: serviceName, | ||
| 1034 | - | Image: image, | 1034 | + | Image: s.stripRegistryPrefix(image), |
| 1035 | ContainerID: container.ID, | 1035 | ContainerID: container.ID, | ||
| 1036 | Status: container.Status, | 1036 | Status: container.Status, | ||
| 1037 | Network: network, | 1037 | Network: network, | ||