Skip to content

✨ Billing: expose whitelisted AppError details (upgradeUrl, type) in the production error envelope #3958

Description

@PierreBrisorgueil

What — let API error responses carry a safe, whitelisted subset of AppError.details (e.g. upgradeUrl, type) in production.
Why — billing/quota errors (402) attach an upgrade URL and a machine-readable type to AppError.details, but responses.error only serializes details in non-production. In production, clients (CLIs, agents) receive a bare message and cannot offer the upgrade path or branch on the error type.

Scopelib/helpers/responses.js: introduce an explicit whitelist of production-safe detail keys (opt-in per key, e.g. upgradeUrl, type, retryAfter) serialized into the error envelope in all environments; everything else stays dev-only as today. Unit tests: whitelisted key passes in prod mode, non-whitelisted key stripped, dev behavior unchanged. A downstream consumer's MCP layer already forwards these details over JSON-RPC; this brings the REST envelope to parity.

Refs: none (downstream-neutral).
Created via /dev:issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions