ADORSYS-GIS / ADORSYS-GIS/converse-frontends

[Ticket]: A decided refill request vanishes from the Decided tab

オープン
#338 コメント 0 件 リアクション 0 件 担当者 1 名 @stephane-segning が担当を希望しています GitHub で見る
bug
主要言語
TypeScript
スター
0
フォーク
0
平均マージ
1時間 49分
マージ済み PR(30日)
253

説明

## Type

Bug

## Summary

After a successful approve/decline on `/admin`, the just-decided request disappears from **both** the Pending queue and the Decided tab, because the success handler invalidates a query whose endpoint is `pending_review`-scoped and which is also the only source the Decided tab reads from.

Expected result:
> A request decided in this session remains visible in the Decided tab until the operator navigates away.

## Intent

The reviewer is right that this is a real bug *surfaced* — not introduced — by #334. Before that PR, decided rows leaked into the Decided tab only because the wiremock fixtures incidentally contained `approved`/`denied` rows inside a list the schema scopes to `pending_review`. Now that #264 makes the status check correct, the accident that made the tab look populated is gone, and the underlying gap is visible: **there is no decided-requests source.** The operator loses the audit trail of the decision they just made, at exactly the moment they would want to confirm it.

## Source of truth (links)

- https://github.com/ADORSYS-GIS/converse-frontends/pull/334 (review comment, "Suggestions" item 4)
- https://github.com/ADORSYS-GIS/converse-frontends/blob/main/packages/authz-rpc/schema/authz.cstack
- https://github.com/ADORSYS-GIS/converse-frontends/issues/267 (the Decided-tab honesty ticket this follows on from)

## Current Behavior

`apps/console/src/containers/use-admin-screen.ts:40` defines `QUERY_KEY = ['budget', 'pendingAugmentationRequests', PAGE_SIZE]`, fetched at `:85`. On mutation success, `:123` calls `invalidateQueries({ queryKey: QUERY_KEY })`.

That endpoint is `listPendingAugmentationRequests`, which the schema scopes to `pending_review` (see its doc comment in `authz.cstack`, and `AugmentationRepo::list_pending_review`). The Decided tab is derived client-side from the same array by `requests.filter(request => !isPending(request))`. So once the decided request is correctly excluded server-side on refetch, it is gone from both derived lists.

#334 already ships a `sourceCaveat` line on `DecisionsLedger` disclosing that the tab is derived from a pending-scoped endpoint — so the console is *honest* about this today. It is not yet *correct*.

## Expected Behavior

Either:
- (a) the Decided tab reads a real decided-requests source rather than being derived from the pending list, or
- (b) the just-decided request is retained in the client cache for the remainder of the session and rendered as decided, with the `sourceCaveat` updated to say exactly that, or
- (c) the tab is removed until a real source exists.

Whichever is chosen, the choice is recorded — the console must not silently drop a decision the operator just made.

Note `listMyAugmentationRequests` returns a caller's own requests in **any** status, but is scoped to the caller and gated at `budget:read_own` — it is not a reviewer-facing decided-queue source. Confirm against the schema before assuming it can back this.

## Acceptance Criteria

- [ ] Given a pending request, when it is approved, then it remains visible in the Decided tab without a page reload.
- [ ] Given a pending request, when it is declined, then the same holds.
- [ ] Given whichever option is chosen, the `sourceCaveat` copy on `DecisionsLedger` accurately describes the actual source.
- [ ] Regression test covering the post-mutation state of both tabs.

## Out of Scope

- The decision-note contract mismatch (#322).
- The wiremock fixture rewrite (#314) — but note this bug was **masked** by those fixtures, so the fixture work and this ticket should not contradict each other.

## Technical Context

`apps/console/src/containers/use-admin-screen.ts:40,85,100-106,123`; `packages/ui-web/src/sections/decisions-ledger/component.tsx`.

Separately, and much smaller: `packages/ui-web/src/refine-mock/refine-admin-budget-review-screen.tsx:136` passes `shown: pending.length` to `DecisionsLedger`, which renders `decisions` — so the Storybook harness's "N of M" footer states a pending count as a decision count. Pre-existing, harness-only, no production impact. Fix it here or split it out.

## Human accountable owner

@stephane-segning

## AI Usage Declaration

Ticket drafted by AI from an automated review finding on #334; the mechanism was re-verified against merged `main` before filing.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。