Skip to content

fix(feedback): preserve API error messages - #5644

Draft
samrusani wants to merge 1 commit into
tinyhumansai:mainfrom
samrusani:fix/5440-feedback-api-errors
Draft

fix(feedback): preserve API error messages#5644
samrusani wants to merge 1 commit into
tinyhumansai:mainfrom
samrusani:fix/5440-feedback-api-errors

Conversation

@samrusani

Copy link
Copy Markdown
Contributor

Summary

  • Extract the feedback submit form's API-error parser into a shared frontend helper.
  • Preserve actionable string messages from plain { success: false, error } rejections across feedback loading, comments, and administration.
  • Keep blank, nested, or non-string rejection payloads behind the existing translated fallback copy.
  • Add helper edge-case coverage and a component regression for the user-visible failure path.

Problem

The feedback API client rejects unsuccessful responses as plain objects rather than Error instances. Several feedback surfaces only handled Error, so they discarded the server's actionable message and displayed generic failure copy.

Solution

messageForApiError accepts only a non-empty Error.message or a non-empty string error property. All other shapes use the caller-provided fallback, so raw or nested rejection payloads never reach the UI. The five existing feedback error paths now share this behavior without changing transport, request lifecycle, logging, or backend enforcement.

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
  • Diff coverage ≥ 80% — focused Vitest coverage reports 100% lines for the helper and 92.06%–100% for the changed production files.
  • Coverage matrix updated — N/A: behavior-only change; no feature row added, removed, or renamed.
  • All affected feature IDs from the matrix are listed in the PR description under ## Related — N/A: no coverage-matrix feature ID changes.
  • No new external network dependencies introduced (mock backend used per Testing Strategy)
  • Manual smoke checklist updated if this touches release-cut surfaces — N/A: focused frontend error-rendering change, not a release-cut surface.
  • Linked issue closed via Closes #NNN in the ## Related section

Impact

  • Feedback users now see a server-provided string reason when an API request is rejected.
  • No API, backend, persistence, migration, performance, or dependency change.
  • Non-string and nested payloads continue to fall back to translated generic copy.

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

Commit & Branch

  • Branch: fix/5440-feedback-api-errors
  • Commit SHA: 7be8d766ebe2dba5071a8bb85c0d80a21f0256b2

Validation Run

  • pnpm --filter openhuman-app format:check
  • pnpm typecheck
  • Focused tests: 5 Vitest files, 47 tests passed; the component regression failed on the parent commit before passing with this change.
  • Rust fmt/check (if changed): N/A — no Rust or Tauri files changed; formatting checks passed incidentally.
  • pnpm lint (0 errors; existing warnings only)

Validation Blocked

  • command: cargo clippy -p openhuman -- -D warnings
  • error: the isolated checkout does not contain the vendored tinyagents/Cargo.toml required by the workspace.
  • impact: no Rust or Tauri files changed. This prevented the repository-wide Rust clippy portion of the pre-push hook; the focused frontend tests, coverage, typecheck, lint, and formatting checks passed. The validation environment also emitted a Node engine warning because it was below the repository-declared Node 24 minimum; CI remains authoritative for the supported runtime.

Behavior Changes

  • Intended behavior change: preserve display-safe API error strings in all feedback rejection paths.
  • User-visible effect: actionable server messages replace generic feedback errors when available.

Parity Contract

  • Legacy behavior preserved: Error.message handling, translated fallbacks, request cancellation guards, pending/loading state, and logging are unchanged.
  • Guard/fallback/dispatch parity checks: blank, missing, nested, and non-string payloads fall back; plain string API errors and Error.message render; no raw payload stringification is introduced.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): None found in the final open-PR and path-overlap scan.
  • Canonical PR: This draft.
  • Resolution (closed/superseded/updated): N/A.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2e81fcaa-7db8-46d6-8b5e-783105558970

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

Share the apiClient error-message helper across the feedback surface

1 participant