Skip to content

fix: surface 422 validation error messages from HEY API - #365

Open
AruneshDwivedi wants to merge 1 commit into
basecamp:mainfrom
AruneshDwivedi:fix-draft-validation-error
Open

fix: surface 422 validation error messages from HEY API#365
AruneshDwivedi wants to merge 1 commit into
basecamp:mainfrom
AruneshDwivedi:fix-draft-validation-error

Conversation

@AruneshDwivedi

@AruneshDwivedi AruneshDwivedi commented Aug 31, 2026

Copy link
Copy Markdown

When receives a 422 from HEY, the error message was always the generic "validation error" instead of the specific reasons from the response body. This made it impossible to diagnose why a draft failed to send.

Root cause: the hey-sdk and methods did not parse the JSON422 response body before calling , which returns a hardcoded "validation error" string for any 422.

Fix: parse and return the specific error messages joined together.

This required changes to the hey-sdk dependency. See fork at AruneshDwivedi/hey-sdk with commits:

  • 8f4139e: fix UpdateDraft JSON422 parsing
  • 7f51159: fix SendDraft JSON422 parsing

The SDK changes are necessary because the generated client already parses JSON422 into the response struct, but the service wrapper discarded it.


Summary by cubic

Surfaces the specific validation error messages from HEY's 422 responses so draft send failures now show the actual reason instead of a generic "validation error".

Dependencies

  • Adds a replace directive pointing github.com/basecamp/hey-sdk/go at a fork that parses 422 response bodies in UpdateDraft and SendDraft.
  • Remove the replace directive once the fix lands in the upstream SDK.

Written for commit 1aa7065. Summary will update on new commits.

Review in cubic

Depend on hey-sdk fork with fix-422-body branch to surface specific
validation error messages instead of generic 'validation error' on
hey draft send failures. Fixes basecamp#350.
Copilot AI balanced review requested due to automatic review settings August 31, 2026 01:54
@AruneshDwivedi
AruneshDwivedi requested a review from a team as a code owner August 31, 2026 01:54
@github-actions github-actions Bot added the deps label Aug 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the HEY SDK dependency to surface specific 422 draft validation errors.

Changes:

  • Redirects the SDK dependency to a fork containing draft error parsing.
  • Currently introduces an invalid go.mod directive and lacks regression coverage.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Suppressed comments (1)

go.mod:13

  • The dependency change alters user-visible draft edit/send failures, but no command-level regression test serves a JSON 422 and asserts that its errors text reaches the CLI. Add cases for both UpdateDraft and SendDraft to the existing draft lifecycle tests so a future SDK update cannot silently restore the generic message.
replace github.com/basecamp/hey-sdk/go => github.com/AruneshDwivedi/hey-sdk/go 7f51159f3c83

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread go.mod
github.com/basecamp/actioncable-go v0.0.0-20260824145920-822e6cf08655
github.com/basecamp/hey-sdk/go v0.28.1

replace github.com/basecamp/hey-sdk/go => github.com/AruneshDwivedi/hey-sdk/go 7f51159f3c83
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants