Skip to content

Allow proposal submission on simulator server errors - #7

Merged
loothero merged 1 commit into
mainfrom
allow-proposal-submit-on-simulation-server-error
May 26, 2026
Merged

Allow proposal submission on simulator server errors#7
loothero merged 1 commit into
mainfrom
allow-proposal-submit-on-simulation-server-error

Conversation

@loothero

Copy link
Copy Markdown
Member

Summary

  • Treat simulator network failures and HTTP 5xx responses as service-unavailable errors
  • Allow proposal submission when the simulation service is unavailable
  • Keep failed simulations and non-server simulation request errors blocking submission

Verification

  • npm run build

Note: npm run lint still fails on existing unrelated lint errors across the UI.

Copilot AI review requested due to automatic review settings May 26, 2026 20:33
@vercel

vercel Bot commented May 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
governance Ready Ready Preview, Comment May 26, 2026 8:33pm

Request Review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces robust error handling for the simulation service, allowing users to submit proposals even when the simulation service is unavailable. It defines a custom SimulationServiceError class and handles network or server-side errors gracefully in the UI. The review feedback suggests a minor improvement to ensure informative error messages when response.statusText is empty, which is common in HTTP/2 environments.

Comment thread ui/src/lib/simulation.ts
);
}

throw new Error(`Simulation request failed: ${response.statusText}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

In HTTP/2 environments, response.statusText is often empty. To ensure the error message is informative when a non-5xx error (such as a 4xx client error) occurs, it is recommended to fall back to response.status if response.statusText is not available.

Suggested change
throw new Error(`Simulation request failed: ${response.statusText}`);
throw new Error(`Simulation request failed: ${response.statusText || response.status}`);

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the proposal simulation flow so that simulator network failures and HTTP 5xx responses are treated as “service unavailable”, and proposal submission is allowed in that case (while still blocking on actual simulation failures and non-server request errors).

Changes:

  • Add a SimulationServiceError type (and guard) to distinguish service-unavailable failures from other simulation errors.
  • Update simulateProposal to throw SimulationServiceError on fetch/network failures and HTTP 5xx responses.
  • Update the Create Proposal page to allow submission when the simulation service is unavailable, and surface that state in the UI.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
ui/src/pages/CreateProposal.tsx Tracks “simulation service unavailable” state, adjusts submit gating, and shows user messaging when the simulator is down.
ui/src/lib/simulation.ts Introduces a service-unavailable error type and classifies fetch/5xx failures accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -184,6 +191,7 @@ export function CreateProposal() {

setIsSimulating(true);
setSimulationResult(null);
@loothero
loothero merged commit fc71f20 into main May 26, 2026
3 checks passed
@loothero
loothero deleted the allow-proposal-submit-on-simulation-server-error branch May 26, 2026 21:04
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