fix(monitor): keep failing publications visible outside the queue page
- The attention lane was derived from page 1 of the queue (limit 50, newest by updated_at), so failures ranked past 50 silently disappeared from "needs attention" as the completed backlog grew. - Fetch attention items with a dedicated request: the API now accepts a comma-separated processing_state list (failed,stalled) and the view prefers that result set over the paged queue. - Batch retry/cancel targets are computed from the same failure set instead of the visible page, so actions reach every failing item. - 全部任务 shows 已显示 N / 共 M plus 加载更多 so rows past 50 are reachable. - Fix pre-existing ui_settings integration test: strict JSON decoding rejects the legacy updated_by field (actor comes from the session). - Tests: view regression (attention item outside the page, load-more affordance) + handler multi-state filter + isolated-DB set filter.
This commit is contained in:
@@ -1725,8 +1725,8 @@ func getReleaseBatch(w http.ResponseWriter, r *http.Request, store Store) {
|
||||
|
||||
func listTestPublications(w http.ResponseWriter, r *http.Request, store Store) {
|
||||
filter := governance.TestPublicationFilter{ProcessingState: r.URL.Query().Get("processing_state"), TargetScope: r.URL.Query().Get("target_scope"), Limit: 50}
|
||||
if filter.ProcessingState != "" && !validProcessingState(filter.ProcessingState) {
|
||||
writeJSON(w, http.StatusBadRequest, map[string]string{"error": "processing_state must be planned, pending, processing, finalizing, completed, failed, or stalled"})
|
||||
if filter.ProcessingState != "" && !validProcessingStateFilter(filter.ProcessingState) {
|
||||
writeJSON(w, http.StatusBadRequest, map[string]string{"error": "processing_state must be a comma-separated list of planned, pending, processing, finalizing, completed, failed, stalled, or cancelled"})
|
||||
return
|
||||
}
|
||||
if filter.TargetScope != "" && filter.TargetScope != "internal" && filter.TargetScope != "external" {
|
||||
@@ -2032,6 +2032,18 @@ func validProcessingState(state string) bool {
|
||||
}
|
||||
}
|
||||
|
||||
// validProcessingStateFilter accepts a single state or a comma-separated list so
|
||||
// callers can ask for several lanes at once (e.g. the attention lane needs
|
||||
// failed+stalled in one query instead of paging the whole queue).
|
||||
func validProcessingStateFilter(filter string) bool {
|
||||
for _, state := range strings.Split(filter, ",") {
|
||||
if !validProcessingState(state) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func newID() (string, error) {
|
||||
var raw [16]byte
|
||||
if _, err := rand.Read(raw[:]); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user