Files
lbinyamin 0c06fe3759 fix(webhooks): parse deployed array in cx webhooks list (#162)
## Context
`cx webhooks list` returned an empty result even when outgoing webhooks
existed in the tenant. Other webhook commands (`types`, `get`) worked,
so this was a list-handler response-shape bug rather than missing data
or permissions. Same failure mode as the earlier integrations list bug:
`#[serde(default)]` silently turned a field-name mismatch into an empty
Vec.

## Linked Issues
- Linear: FORGE-466 / FORGE-122
- GitHub: https://github.com/coralogix/cx-cli/issues/135
- Prior fix for integrations (same class of bug):
https://github.com/coralogix/cx-cli/pull/146

## Design
`GET /mgmt/openapi/5/integrations/webhooks/v1` returns the list under
`deployed[]`. `ListWebhooksResponse` in `src/commands/webhooks/api.rs`
keeps the Rust field `webhooks` for the existing handlers in `mod.rs`,
and maps the JSON key with `#[serde(rename = "deployed")]`. Unit and
wiremock fixtures now use the real payload shape.

## Key Decisions
- Keep the Rust field name `webhooks` and only rename at the JSON
boundary, so list/render code in `mod.rs` does not need to change.
- Do not touch `integrations list` — already fixed and live via #146.

## Changes
- `cx webhooks list` now deserializes the API's `deployed` array and
returns the webhooks that exist.
- Unit and wiremock list fixtures updated from `"webhooks"` to
`"deployed"`.

## Testing
- `cargo test webhooks` (unit + wiremock; passed)
- Manual: `cargo run -- webhooks list -o json` against the default eu2
profile returned the Slack webhook instead of `[]`

## Risks & Rollout
Low risk — deserialization-only fix for the list response. If the API
ever returned a `webhooks` key instead of `deployed`, list would again
show empty; the live endpoint and fixtures both use `deployed`. Rollback
is a simple revert.

## Out of Scope / Follow-ups
- `integrations list` (already fixed in #146)
- Create/update webhook response shapes not re-verified against live API

Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 17:19:17 +00:00
..