Commit 472230fba4
472230fba4156ecacfe1203513f47e8834dd734f
parent: ed734c0b70
Verified · cmc ci/build: success ci/test: success
cmc <hello@cleberg.net> · 2026-09-18 19:59 UTC
httpd: an unknown build status is never reported as success
Ref #222
internal/httpd/builds.go
+8 −1
| @@ -108,7 +108,9 @@ func combinedStatus(builds []control.BuildOut) string { |
| 108 | 108 | |
| 109 | 109 | // worstStatus is combinedStatus's ordering rule, factored out so the |
| 110 | 110 | // dashboard feed can apply the same worst-first precedence to a folded |
| 111 | | // build run (D04). |
| 111 | // build run (D04). A status outside runStatusPriority (a future state |
| 112 | // such as "skipped") is still not "success": it is returned unchanged |
| 113 | // rather than falling through and reading as green. |
| 112 | 114 | func worstStatus(statuses []string) string { |
| 113 | 115 | has := map[string]bool{} |
| 114 | 116 | for _, s := range statuses { |
| @@ -119,6 +121,11 @@ func worstStatus(statuses []string) string { |
| 119 | 121 | return s |
| 120 | 122 | } |
| 121 | 123 | } |
| 124 | for _, s := range statuses { |
| 125 | if s != "success" { |
| 126 | return s |
| 127 | } |
| 128 | } |
| 122 | 129 | return "success" |
| 123 | 130 | } |
| 124 | 131 | |
internal/httpd/builds_test.go
+4
| @@ -55,6 +55,10 @@ func TestGroupRunsCombinedStatusPriority(t *testing.T) { |
| 55 | 55 | {[]string{"running", "cancelled"}, "cancelled"}, |
| 56 | 56 | {[]string{"cancelled", "failure"}, "failure"}, |
| 57 | 57 | {[]string{"success", "success", "failure"}, "failure"}, |
| 58 | // A status outside runStatusPriority (a future state such as |
| 59 | // "skipped") is still not success: it must not fall through to |
| 60 | // the "success" default and read as green. |
| 61 | {[]string{"success", "skipped"}, "skipped"}, |
| 58 | 62 | } |
| 59 | 63 | for _, tc := range cases { |
| 60 | 64 | var builds []control.BuildOut |