Skip to content

feat: allow chomp api service to handle unknown intents in response - #10609

Merged
Jwhiles merged 2 commits into
mainfrom
fix-intents-parsing
Sep 30, 2026
Merged

Jwhiles merged 2 commits into
mainfrom
fix-intents-parsing

Conversation

@Jwhiles

@Jwhiles Jwhiles commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

Currently the chomp API client can't handle unknown intents being returned by the chomp API. The way this is most likely to manifest is something like

  1. A new client version or API sets an intent for a user in chomp
  2. The user uses an old client version that hasn't updated it’s ChompIntentType enum to handle whatever new intent is now being used
  3. The chomp API client crashes when trying to parse the reponse from get intents

This PR loosens our validation of the API response, it initially parses the intents as strings and then filters out unknown values. This means that outdated clients simply won't see intents that they don't know about

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes intent visibility for outdated clients—they may not see newer intent types and could misjudge whether an intent already exists, though this replaces hard parse failures on mixed API responses.

Overview
Forward-compatible parsing when the CHOMP API returns intent types this package does not yet define. Previously, strict enums(CHOMP_INTENT_TYPES) validation caused the whole response to fail if the API added a new type before clients shipped an updated ChompIntentType list.

getIntentsByAddress now validates metadata.type as a string, then drops entries that are not in the local CHOMP_INTENT_TYPES list via isChompIntentType. Non-string types still fail validation.

getServiceDetails uses a coerce on each protocol's intentTypes: accept string arrays from the API and filter to known types instead of rejecting the entire payload.

Tests cover unknown string types (filtered), invalid non-string types (still throw), and service-details filtering. Changelog documents the fix under Unreleased.

Reviewed by Cursor Bugbot for commit b3df246. Bugbot is set up for automated code reviews on this repo. Configure here.

@Jwhiles
Jwhiles force-pushed the fix-intents-parsing branch from 7b6a0aa to ecca189 Compare September 30, 2026 08:55
@Jwhiles
Jwhiles marked this pull request as ready for review September 30, 2026 14:18
@Jwhiles
Jwhiles requested review from a team as code owners September 30, 2026 14:18
@Jwhiles
Jwhiles requested a review from a team as a code owner September 30, 2026 14:18
@Jwhiles
Jwhiles enabled auto-merge September 30, 2026 14:20
@Jwhiles
Jwhiles added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit 92a702c Sep 30, 2026
61 checks passed
@Jwhiles
Jwhiles deleted the fix-intents-parsing branch September 30, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants