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:
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -1335,6 +1336,32 @@ func TestHandlerListsTestPublicationsSafeProjection(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandlerAcceptsMultiStateAttentionFilter(t *testing.T) {
|
||||
store := &fakeJobStore{}
|
||||
handler, err := NewHandler(Config{Store: store})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
response := httptest.NewRecorder()
|
||||
handler.ServeHTTP(response, httptest.NewRequest(http.MethodGet, "/api/v1/test-publications?processing_state=failed,stalled&limit=100", nil))
|
||||
if response.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d; body=%s", response.Code, response.Body.String())
|
||||
}
|
||||
if store.publicationFilter.ProcessingState != "failed,stalled" {
|
||||
t.Fatalf("filter = %#v", store.publicationFilter)
|
||||
}
|
||||
|
||||
// One bad entry anywhere in the list is still rejected.
|
||||
for _, value := range []string{"failed,bogus", "failed,", ",stalled"} {
|
||||
response = httptest.NewRecorder()
|
||||
handler.ServeHTTP(response, httptest.NewRequest(http.MethodGet, "/api/v1/test-publications?processing_state="+url.QueryEscape(value), nil))
|
||||
if response.Code != http.StatusBadRequest {
|
||||
t.Fatalf("processing_state=%q status = %d; want 400", value, response.Code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandlerConfirmsChangeSetItems(t *testing.T) {
|
||||
now := time.Date(2026, 9, 12, 5, 0, 0, 0, time.UTC)
|
||||
store := &fakeJobStore{confirmChangeSetResult: governance.ConfirmCatalogChangeSetResult{ChangeSetID: "cs-1", ConfirmedItems: 2, UploadsCreated: 2}}
|
||||
|
||||
Reference in New Issue
Block a user