ADORSYS-GIS / ADORSYS-GIS/converse-frontends

[Ticket]: A failed query renders as a confirmed-empty result

Đang mở
#346 1 bình luận 0 reaction 1 người được giao Được @stephane-segning nhận Xem trên GitHub
bug
Ngôn ngữ chính
TypeScript
Star
0
Fork
0
Merge trung bình
1 giờ 49 phút
Pull request đã merge (30 ngày)
253

Mô tả

## Type

Bug

## Summary

A list query that fails with `401` renders as a **confirmed-empty result**, not as a failure. Observed live on the deployed console at `https://console.ai.camer.digital` with the backend rejecting every RPC.

Expected result:
> A failed query is reported as a failure. "We asked and there are none" and "we could not ask" must not look identical.

## Intent

This is the same defect class Epic #260 was created to eliminate — conflating *zero* with *unknown* — surviving in the path nobody could exercise until the console was actually deployed against a real backend. Epic 1 fixed the cases where a **field** was fabricated; this is the case where the **whole query** failed and the empty state still asserted a fact.

It is worse than a cosmetic issue because the copy is actively reassuring. Overview states *"Project and key counts below are live."* directly above two zeros that came from a 401, and Manage states *"No projects in this account yet."* — a positive claim about the account, derived from a request that never succeeded.

## Source of truth (links)

- https://github.com/ADORSYS-GIS/converse-frontends/issues/260 (the epic whose principle this violates)
- https://github.com/ADORSYS-GIS/converse-frontends/blob/main/.claude/skills/console-ui/SKILL.md (§states)

## Current Behavior

Reproduced on the live deployment, signed in, with `POST /api/rpc/batch` returning `401 {"error":"invalid bearer token"}` from `lightbridge-authz`:

- **Overview** — `PROJECTS 0`, `API KEYS 0`, under the banner *"Project and key counts below are live."*
- **Manage** — *"No projects in this account yet."*, footer `0 of 0 projects`, `0 of 0` in the ledger, and the scope rail showing `Projects 0`.
- **Scope rail** — `Account —` with an empty account selector.

No error is surfaced anywhere on either screen. Nothing indicates the backend was unreachable.

Note this is **not** the `notificationProvider` gap (#323, merged): that surfaces failed *mutations*. These are failed *queries* on first paint, which never reach a mutation cache.

## Expected Behavior

When a list/count query errors:
- the count is not rendered as `0` — it renders as unknown, in the documented honest style;
- the "live" claim in the banner is withheld or inverted for the values that failed;
- the empty-state copy does not assert a fact about the account ("No projects in this account yet.") unless a query actually returned an empty set;
- a genuine `401`/backend failure is distinguishable from an unwired capability (#325's `PlaceholderNotice`) and from a real empty result.

## Acceptance Criteria

- [ ] Given the projects query returns `401`, when Overview renders, then `PROJECTS` does not display `0` and the banner does not claim the counts are live.
- [ ] Given the same, when Manage renders, then the ledger states the list could not be loaded rather than "No projects in this account yet."
- [ ] Given the projects query genuinely returns an empty array, then the existing empty copy is unchanged.
- [ ] Regression tests cover all three states — errored, empty, populated — for both screens.

## Out of Scope

- The audience-mapper misconfiguration that produced the `401` in this instance. That is a realm-config fix, and this ticket must be fixed regardless: any transient backend failure reproduces it.
- Mutation-failure surfacing (#323, already merged).

## Technical Context

`apps/console/src/containers/use-overview-screen.ts` (stat-card counts, and the `USAGE_PENDING_MESSAGE` "counts below are live" claim), `apps/console/src/containers/use-manage-screen.ts` + `project-rows.ts` (`manageTotals`, empty copy), `packages/ui-web/src/sections/manage-projects-ledger/`, `packages/ui-web/src/sections/overview-stat-row/`.

The refine `useList` error state is available at each call site and is currently unread on these paths.

## Human accountable owner

@stephane-segning

## AI Usage Declaration

Found by driving the live deployment in a browser after the first successful login; the `401` body was read directly from the page's own origin before this was filed.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Read apps/console/src/containers/use-overview-screen.ts and use-manage-screen.ts, then inspect project-rows.ts and the packages/ui-web sections for overview stats and the manage-projects ledger. Trace the refine useList states at these call sites and review existing screen tests. Done means errored, empty, and populated results are distinguishable on both screens, with regression coverage for all three.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
frontend, testing
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.