Skip to content

fix(frontend): meaningful serverless metadata errors#5102

Merged
jog1t merged 1 commit into
mainfrom
05-26-fix_frontend_meaningful_serverless_metadata_errors
May 26, 2026
Merged

fix(frontend): meaningful serverless metadata errors#5102
jog1t merged 1 commit into
mainfrom
05-26-fix_frontend_meaningful_serverless_metadata_errors

Conversation

@jog1t
Copy link
Copy Markdown
Contributor

@jog1t jog1t commented May 26, 2026

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5102 May 26, 2026 20:19 Destroyed
@railway-app
Copy link
Copy Markdown

railway-app Bot commented May 26, 2026

🚅 Deployed to the rivet-pr-5102 environment in rivet-frontend

Service Status Web Updated (UTC)
kitchen-sink ❌ Build Failed (View Logs) Web May 26, 2026 at 10:24 pm
frontend-cloud 🕒 Building (View Logs) Web May 26, 2026 at 10:23 pm
ladle 🕒 Building (View Logs) Web May 26, 2026 at 10:23 pm
frontend-inspector 🕒 Building (View Logs) Web May 26, 2026 at 10:23 pm
website 😴 Sleeping (View Logs) Web May 26, 2026 at 8:32 pm
mcp-hub ✅ Success (View Logs) Web May 26, 2026 at 8:22 pm

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 26, 2026

Code Review

Summary: This PR correctly fixes the root cause. The old formatMetadataError was pattern-matching against camelCase TypeScript-generated discriminated-union keys (invalidRequest, nonSuccessStatus, etc.) while the actual wire format sends a message/details/metadata envelope with snake_case metadata.kind. Every variant silently fell through to 'Unknown error'. The new approach is more robust, surfaces the server human-readable message field directly, and degrades gracefully for unknown future variants.


1. Untruncated server body in UI error string (moderate)

serverless-health-error.ts L49 appends metadata.body for non_success_status (and falls back to it for invalid_response_json when parse_error is absent) without any length cap. When a WAF, CDN, or misbehaving upstream returns a full HTML page as the response body, the UI renders the entire raw HTML inline as the error string. The existing network-error path in extractErrorMessage already applies .slice(0, 200) for this reason; the same cap should apply to any externally-sourced field appended by formatServerlessMetadataError.

2. Redundant .partial() on an already-optional schema (minor)

serverless-health-error.ts L6-L17: all fields already carry .optional(), making the trailing .partial() call a no-op in Zod. Drop .partial() or the per-field .optional() calls to clarify intent.


Positive notes: schema-based parsing with z.unknown() is the right fix; the forward-compat design (unknown kind -> surface message -> humanise kind -> generic fallback) is well tested; stories provide a clear visual audit trail; extracting the formatter into its own file improves testability.

Copy link
Copy Markdown
Contributor Author

jog1t commented May 26, 2026

Merge activity

  • May 26, 10:23 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 26, 10:24 PM UTC: Graphite rebased this pull request as part of a merge.
  • May 26, 10:25 PM UTC: @jog1t merged this pull request with Graphite.

@jog1t jog1t force-pushed the 05-26-fix_frontend_meaningful_serverless_metadata_errors branch from b2367df to a6089de Compare May 26, 2026 22:23
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5102 May 26, 2026 22:23 Destroyed
@jog1t jog1t merged commit daa7941 into main May 26, 2026
10 of 17 checks passed
@jog1t jog1t deleted the 05-26-fix_frontend_meaningful_serverless_metadata_errors branch May 26, 2026 22:25
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.

1 participant