Skip to content

fix(adapters): validate and coerce raw bounty status to known BountyStatus (#279) - #289

Open
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/adapt-bounty-status-validation-279
Open

fix(adapters): validate and coerce raw bounty status to known BountyStatus (#279)#289
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/adapt-bounty-status-validation-279

Conversation

@ghzhost

@ghzhost ghzhost commented Aug 21, 2026

Copy link
Copy Markdown

Summary

Fixes #279.

src/lib/adapters.ts#adaptBounty mapped raw.status directly without runtime validation against known BountyStatus values. If the backend sent an unrecognized, future, or invalid status enum value, it would flow directly into StatusBadge (producing unstyled badges) and IssueActions (producing zero action buttons).

Changes

  • Defined VALID_BOUNTY_STATUSES containing all 8 valid BountyStatus values.
  • Introduced coerceBountyStatus(status: unknown, fallback: BountyStatus = "open"): BountyStatus to validate incoming values at runtime and fall back safely to "open" on unrecognized or missing status strings.
  • Updated adaptBounty to pass raw.status through coerceBountyStatus.
  • Added unit tests in src/lib/adapters.test.ts verifying that valid statuses are preserved and unrecognized/malformed status strings are coerced safely to "open".

@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

adaptBounty passes an unrecognized backend status straight through with no validation, silently breaking both the status badge and every action button

1 participant