-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show full nodeID and executionID with --wide flag #4783
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -106,12 +106,18 @@ var ( | |||||||||||||||||||||||||||||||||||||||||
Value: func(e *models.Execution) string { return output.Elapsed(e.GetModifyTime()) }, | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
executionColumnID = output.TableColumn[*models.Execution]{ | ||||||||||||||||||||||||||||||||||||||||||
ColumnConfig: table.ColumnConfig{Name: "ID", WidthMax: 10, WidthMaxEnforcer: text.WrapText}, | ||||||||||||||||||||||||||||||||||||||||||
Value: func(e *models.Execution) string { return idgen.ShortUUID(e.ID) }, | ||||||||||||||||||||||||||||||||||||||||||
ColumnConfig: table.ColumnConfig{ | ||||||||||||||||||||||||||||||||||||||||||
Name: "ID", | ||||||||||||||||||||||||||||||||||||||||||
WidthMax: idgen.ShortIDLengthWithPrefix, | ||||||||||||||||||||||||||||||||||||||||||
WidthMaxEnforcer: func(col string, maxLen int) string { return idgen.ShortUUID(col) }}, | ||||||||||||||||||||||||||||||||||||||||||
Value: func(e *models.Execution) string { return e.ID }, | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
executionColumnNodeID = output.TableColumn[*models.Execution]{ | ||||||||||||||||||||||||||||||||||||||||||
ColumnConfig: table.ColumnConfig{Name: "Node ID", WidthMax: 10, WidthMaxEnforcer: text.WrapText}, | ||||||||||||||||||||||||||||||||||||||||||
Value: func(e *models.Execution) string { return idgen.ShortNodeID(e.NodeID) }, | ||||||||||||||||||||||||||||||||||||||||||
ColumnConfig: table.ColumnConfig{ | ||||||||||||||||||||||||||||||||||||||||||
Name: "Node ID", | ||||||||||||||||||||||||||||||||||||||||||
WidthMax: idgen.ShortIDLengthWithPrefix, | ||||||||||||||||||||||||||||||||||||||||||
WidthMaxEnforcer: func(col string, maxLen int) string { return idgen.ShortUUID(col) }}, | ||||||||||||||||||||||||||||||||||||||||||
Value: func(e *models.Execution) string { return e.NodeID }, | ||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+116
to
+120
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Implementation doesn't respect --wide flag for NodeID Similar to the ID column, the NodeID column's implementation doesn't fulfill the PR objective of showing full IDs with the --wide flag. Apply similar changes as suggested for the ID column: executionColumnNodeID = output.TableColumn[*models.Execution]{
ColumnConfig: table.ColumnConfig{
Name: "Node ID",
- WidthMax: idgen.ShortIDLengthWithPrefix,
- WidthMaxEnforcer: func(col string, maxLen int) string { return idgen.ShortUUID(col) }},
+ WidthMax: func(cmd *cobra.Command) int {
+ if cmd.Flags().Changed("wide") {
+ return 0 // No max width for full ID
+ }
+ return idgen.ShortIDLengthWithPrefix
+ },
+ WidthMaxEnforcer: func(col string, maxLen int) string {
+ if maxLen == 0 {
+ return col // Return full ID
+ }
+ return idgen.ShortUUID(col)
+ }},
Value: func(e *models.Execution) string { return e.NodeID }, 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
executionColumnRev = output.TableColumn[*models.Execution]{ | ||||||||||||||||||||||||||||||||||||||||||
ColumnConfig: table.ColumnConfig{Name: "Rev.", WidthMax: 4, WidthMaxEnforcer: text.WrapText}, | ||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,11 @@ import ( | |
|
||
var alwaysColumns = []output.TableColumn[*models.NodeState]{ | ||
{ | ||
ColumnConfig: table.ColumnConfig{Name: "id"}, | ||
Value: func(node *models.NodeState) string { return idgen.ShortNodeID(node.Info.ID()) }, | ||
ColumnConfig: table.ColumnConfig{ | ||
Name: "id", | ||
WidthMax: idgen.ShortIDLengthWithPrefix, | ||
WidthMaxEnforcer: func(col string, maxLen int) string { return idgen.ShortNodeID(col) }}, | ||
Value: func(node *models.NodeState) string { return node.Info.ID() }, | ||
Comment on lines
+20
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Based on the implementation of
The current implementation of
This creates an inconsistency where:
🔗 Analysis chainVerify the node ID display behavior The changes to show full node IDs align with the PR objectives. However:
Consider adding a comment explaining the relationship between these settings and the --wide flag behavior. Let me analyze the implementation of 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Check the implementation of ShortNodeID
ast-grep --pattern 'func ShortNodeID($id) { $$$ }'
# Check other usages of ShortNodeID
rg "ShortNodeID" --type go -A 2
Length of output: 2214 Script: #!/bin/bash
# Check the full implementation of ShortNodeID and ShortUUID
cat pkg/util/idgen/short_id.go
# Check if there's a --wide flag implementation that might affect this behavior
rg --type go "wide.*flag" -A 2
Length of output: 2111 |
||
}, | ||
{ | ||
ColumnConfig: table.ColumnConfig{Name: "type"}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Implementation doesn't respect --wide flag for showing full IDs
The current implementation doesn't fulfill the PR objective of showing full IDs with the --wide flag. The Value function returns the full ID but the WidthMaxEnforcer always shortens it, regardless of the --wide flag state.
Consider this implementation: