fix: sort branch list by dataStateAt
Description
The list query command currently didn't sort by dateStateAt.
So, the homonym branch selection was practically non-deterministic (if there are multiple branches with the same name in different datasets)
Related issue
Examples
2025/11/21 10:15:38 runners.go:106: [DEBUG] Run(Local): "zfs list -H -t snapshot -S dblab:datastateat -o dle:branch,name -r test_dblab_pool/pg14 test_dblab_pool/pg15 | grep -v "^-" | cat"
2025/11/21 10:15:38 runners.go:151: [DEBUG] Run(Local): output "main test_dblab_pool/pg14@snapshot_20251121101224
main test_dblab_pool/pg15@snapshot_20251121100736"
2025/11/21 10:15:38 runners.go:106: [DEBUG] Run(Local): "zfs list -H -t snapshot -o dle:branch,name -r test_dblab_pool/pg14 | grep -v "^-" | cat"
2025/11/21 10:15:38 runners.go:151: [DEBUG] Run(Local): output "main test_dblab_pool/pg14@snapshot_20251121101224"
...
2025/11/21 10:16:54 runners.go:106: [DEBUG] Run(Local): "zfs snapshot test_dblab_pool/pg15@snapshot_20251121101524"
2025/11/21 10:16:54 runners.go:151: [DEBUG] Run(Local): output ""
2025/11/21 10:16:54 runners.go:106: [DEBUG] Run(Local): "zfs set dblab:datastateat="20251121101524" test_dblab_pool/pg15@snapshot_20251121101524"
2025/11/21 10:16:54 runners.go:151: [DEBUG] Run(Local): output ""
2025/11/21 10:16:54 zfs.go:460: [DEBUG] New snapshot: {test_dblab_pool/pg15@snapshot_20251121101524 2025-11-21 10:16:54.628494645 +0000 UTC m=+587.187839966 2025-11-21 10:15:24 +0000 UTC 0 0 test_dblab_pool/pg15 main }
...
2025/11/21 10:17:24 runners.go:106: [DEBUG] Run(Local): "zfs list -H -t snapshot -S dblab:datastateat -o dle:branch,name -r test_dblab_pool/pg14 test_dblab_pool/pg15 | grep -v "^-" | cat"
2025/11/21 10:17:24 runners.go:151: [DEBUG] Run(Local): output "main test_dblab_pool/pg15@snapshot_20251121101524
main test_dblab_pool/pg14@snapshot_20251121101224"
2025/11/21 10:17:24 runners.go:106: [DEBUG] Run(Local): "zfs list -H -t snapshot -o dle:branch,name -r test_dblab_pool/pg15 | grep -v "^-" | cat"
2025/11/21 10:17:24 runners.go:151: [DEBUG] Run(Local): output "main test_dblab_pool/pg15@snapshot_20251121101524"
2025/11/21 10:17:24 runners.go:106: [DEBUG] Run(Local): "zfs clone -p test_dblab_pool/pg15@snapshot_20251121101524 test_dblab_pool/pg15/branch/test002"
Checklist
-
MR description has been reviewed -
MR changes are functionally tested -
MR does NOT have API/CLI changes OR there are API/CLI changes and they have been reviewed & DOCS ARE ADJUSTED (reference doc, etc) -
MR does NOT have UI changes OR there are UI changes and they have been reviewed & UX IS REVIEWED
Edited by Artyom Kartasov