feat(apps): approve a refund from a mini-app widget through a typed Dewee approval

Open
#119 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
18/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
react, typescript
Domain
desktop, security

Research direction

Start with packages/app-core/src/features/apps/demo.ts at the refund preview and widgets/approval-card.tsx, which the issue assigns to the work lane; read the cited design matrix and plan for the intended states and ownership. The issue depends on private upstream approval, refund adapter, route, and orders work, plus #111 and #135, so wait for those interfaces before tracing the real route and host command. Done means a capability-gated slice wired to the real route, with the listed authority, recovery, hostile-frame and other tests, verified on staging once the route exists.

Written by the indexing model from the issue text.

Description

enhancement

Design: board 17 Official mini-app detail, row X11

The 'Approve refund' widget stays in scope. Dewee already has a typed refund human-interaction action kind with policy, amount and currency. Invariant: the widget never moves money itself. It shows an existing refund approval case and decides it through the approvals contract. The case is bound to its action, and the Gateway rechecks authority at the side effect.

Acceptance criteria

  • The widget renders only a refund approval case from the approvals projection (upstream, tracked privately): amount, currency, order reference, requester, expiry, and the policy citation when one applies.
  • Approve and Deny call the typed decide operation with an idempotency key. The widget shows the server's outcome, including unknown outcome with reconcile. There is no optimistic 'refunded'.
  • Only the decider sees the controls; others see a non-sensitive status. The private outcome goes to the requester.
  • An expired, superseded or already-decided case is refused with a human message.
  • Tests cover a non-decider, a double click, an expiry, authority revoked between render and decide, and unknown outcome.
  • Enable gate. widget-refund stays off until the refund continuation adapter (upstream, tracked privately) is merged and on, and the orders source is Google Sheets per the owner's decision (upstream, tracked privately). The decide route alone (upstream, tracked privately) never enables it.
  • Trusted host controls. Approve and Deny are rendered only by the trusted host UI, outside any mini-app or publisher frame. App content may only ask the host to show the case. It cannot render, trigger, focus or overlay the controls. A test covers a hostile frame that posts a decide message, overlays the card and spoofs it; all three fail.
  • Fixtures. The refund preview (packages/app-core/src/features/apps/demo.ts:203) moves under widget-refund and is used in tests only.
  • Wired, not fixtures. This issue closes only on a slice wired to the real route it depends on, behind its dark capability id (or its local switch for a client-only feature), and verified on staging once the route exists. A fixture-backed screen satisfies none of the boxes above.

Capability

Client id widget-refund; server group work, children approvals (upstream, tracked privately) and refund_adapter (upstream, tracked privately). Both must be on.

Denied, pending and recovery states

Denied: not the decider. Pending: waiting for a decision. Recovery: an unknown outcome reconciles before any retry.

Parity

Surface Evidence
Gateway API/RPC Approvals relay (upstream, tracked privately); existing refund interaction kind; a refund continuation adapter that checks the approved hash at execution is new (upstream, tracked privately)
CLI Exec approval parity (upstream, tracked privately)
MCP interactions_resolve (existing, approval-gated)
CCP / RGD / ACP CCP inbox decides the same case
Dewee client Widget, inbox and trusted approval card show one case
Conversation The agent raises the case in chat; the decider gets a secure handoff; the private outcome goes to the requester
Docs Approvals section of docs/UX.md
Traces The decision is traced on the case (upstream)

Dependencies

An upstream item (tracked privately) (refund continuation adapter), an upstream item (tracked privately) (decide), an upstream item (tracked privately) (Google Sheets orders), an upstream item (tracked privately) (exec approval parity), #111, #135. #102 has merged. Class: the case and decision exist (b); the binding at the side effect is new (c); the invariant applies (d). Work lane owns widgets/approval-card.tsx.

Rules for this issue

  • The owner kept this feature on 2026-12-02 (DECISIONS.md D23, recorded by the keep-all docs PR #132). Design rows and states are in plans/261202-0003-client-bootstrap/design-feature-matrix.md. The plan is plans/261202-0806-keep-all-design-features/plan.md.
  • Done means wired. This issue closes only with a slice wired to the real route it depends on: the relay route through the web BFF and the desktop host command, or, for a client-only feature, the real native or browser path. The slice runs behind its dark capability id and is verified on staging once the route exists. Fixtures are for tests only. A fixture-backed screen never closes this issue and is never listed in plans/EVIDENCE.md. Until the route merges, the feature renders its gated or dark state.
  • One relay integrator. Only the relay-integrator lane adds ClientMethod entries to CLIENT_METHODS in packages/core/src/protocol.ts, one route at a time in merge order, together with the BFF allowlist entry and the desktop host command. A feature lane does not edit protocol.ts or capabilities.ts. The desktop host's shared files (lib.rs, capabilities/default.json, Cargo.toml, Cargo.lock, build.rs, apps/desktop/src/desktop-session.ts) have one owner at a time, in the order the plan names; a lane puts its commands in its own module and adds only a registration line.
  • Ships dark. The client id below resolves from the server's capability read through the capability map (#135). A feature without both renders its gated or dark state, never sample data presented as real. Where the route belongs to a domain that still awaits server-side relay parity, its relay child flag stays off until that domain's upstream parity work lands (tracked privately).
  • Both hosts. Web/PWA and desktop, en/vi, light/dark, 390/768/1024/1440, keyboard-only.
  • Checks. Typecheck, Biome and focused tests. Tests cover flag off, denied, pending, revocation and recovery.
  • Review. An independent review runs before the PR leaves draft. No auto-merge.
Dominant language
No language data
Stars
1
Forks
2
Avg merge
1h 51m
Merged PRs (30d)
103

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextlevelbuilder/dewee-desktop-app

All issues in nextlevelbuilder/dewee-desktop-app

Similar issues

More Desktop Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.