Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 15, 2026

Description

Fixes an issue where webhooks with x-fern-audiences were not showing up in docs when generating for matching audiences.

Requested by Catherine Deskur

Changes Made

  • Fixed the filterIrForAudiences method in AbstractSpecConverter.ts to correctly filter individual webhooks within each group, rather than filtering entire webhook groups by their group ID
  • Added webhook-audience test fixture to verify webhooks with x-fern-audiences are correctly parsed and processed
  • Added ir-to-jsonschema snapshots for the new fixture
  • Added Swift SDK snapshot for the new fixture
  • Added webhook-audience to Ruby SDK allowedFailures (Ruby SDK uses IR v61 which doesn't support the newer IR format)
  • Updated CLI versions.yml with changelog entry for version 3.42.2

Root Cause

The original code was comparing webhook group IDs (the map keys in ir.webhookGroups) against individual webhook IDs (stored in filteredWebhooks). These are different values, so the filter would never match, causing all webhooks with audiences to be filtered out.

The Fix

Changed from filtering groups by group ID:

Object.entries(ir.webhookGroups).filter(([webhookId]) => filteredWebhooks.has(webhookId))

To filtering individual webhooks within each group:

Object.entries(ir.webhookGroups).map(([webhookGroupId, webhookGroup]) => {
    const filteredWebhookGroup = webhookGroup.filter(
        (webhook) => webhook.id != null && filteredWebhooks.has(webhook.id)
    );
    return [webhookGroupId, filteredWebhookGroup];
})

This aligns with the correct implementation in filterIntermediateRepresentationForAudiences.ts (lines 52-70).

Testing

  • Lint checks pass
  • Added webhook-audience test fixture with webhooks using x-fern-audiences (public, private, and no audience)
  • Seed test passes for ts-sdk generator
  • ir-to-jsonschema snapshot tests pass
  • Swift SDK snapshot tests pass
  • Ruby SDK added to allowedFailures (expected - uses older IR version)

Human Review Checklist

  • Verify the fix aligns with the similar implementation in packages/commons/ir-utils/src/filtered-ir/filterIntermediateRepresentationForAudiences.ts
  • Note: The test fixture validates webhook parsing but seed tests run with audiences: { type: "all" }, so the filtering code path itself isn't directly exercised by the fixture

Link to Devin run

Co-Authored-By: Catherine Deskur <catherine@buildwithfern.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration bot changed the title fix: webhook audience filtering in OpenAPI v3 importer fix(openapi): webhook audience filtering in OpenAPI v3 importer Jan 15, 2026
devin-ai-integration bot and others added 4 commits January 15, 2026 00:39
Co-Authored-By: Catherine Deskur <catherine@buildwithfern.com>
…xture

Co-Authored-By: Catherine Deskur <catherine@buildwithfern.com>
Co-Authored-By: Catherine Deskur <catherine@buildwithfern.com>
Co-Authored-By: Catherine Deskur <catherine@buildwithfern.com>
@tjb9dc tjb9dc merged commit 663082e into main Jan 15, 2026
235 checks passed
@tjb9dc tjb9dc deleted the devin/1768435373-fix-webhook-audience-filtering branch January 15, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants