[anneal] Add playground frontend - #3541
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## Gzpgd7p6so5xn3tfstq45vnmycc7weotp #3541 +/- ##
==================================================================
Coverage 91.85% 91.85%
==================================================================
Files 20 20
Lines 6093 6093
==================================================================
Hits 5597 5597
Misses 496 496 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0bfeaf4 to
f10d929
Compare
ec5fa85 to
2794cad
Compare
f10d929 to
7250609
Compare
49a987a to
3abbf63
Compare
gherrit-pr-id: Gbja7ynjo5n4gf6rek56jhkaclymvo22y
3abbf63 to
7624240
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7624240a23
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const value = editor.getModel()?.getValue(); | ||
| if (value) { | ||
| onEditCode(value); |
There was a problem hiding this comment.
When the Monaco editor is selected and the user deletes all code, getValue() returns "", which fails this truthiness check, so Redux never receives the empty edit. The stored code remains the previous non-empty text, causing Run/Share or a later prop sync to use/restore stale code instead of the empty editor contents; call onEditCode whenever the model exists, including for empty strings.
Useful? React with 👍 / 👎.
| websocketError, | ||
| sequenceNumberMatches((state, payload) => { | ||
| state.error = payload.error; | ||
| }), |
There was a problem hiding this comment.
Finish WebSocket executions on server errors
When an execution sent over WebSocket fails before an wsExecuteEnd response, such as a bad execute request or a coordinator/Docker begin failure, the backend reports it as websocket/error with the request sequence number. This handler only stores the error and leaves requestsInProgress at 1, so the output pane continues to show an active run/stdin state indefinitely; handle this error as a terminal state by clearing the in-progress execution just like wsExecuteEnd.
Useful? React with 👍 / 👎.
| const killed = listenerApi | ||
| .delay(gracePeriod) | ||
| .then(() => listenerApi.dispatch(wsExecuteKill(undefined, sequenceNumber))); |
There was a problem hiding this comment.
Cancel the pending kill when long runs are allowed
For WebSocket executions that exceed the CPU-time threshold, choosing “Allow the process to continue” only wins the Promise.race; it does not cancel this delayed promise, so the .then() still dispatches wsExecuteKill after the grace period. This means long-running jobs such as Anneal verification are killed even after the user explicitly allowed them to continue; the scheduled kill needs to be abortable or gated after the allow/end path wins.
Useful? React with 👍 / 👎.
| export const reExecuteWithBacktrace = (): ThunkAction => (dispatch) => { | ||
| dispatch(changeBacktrace(Backtrace.Enabled)); | ||
| dispatch(performExecuteOnly()); |
There was a problem hiding this comment.
Rerun the selected action for backtraces
When the backtrace link appears after anything other than the plain Run action, this handler enables backtraces but then hard-codes performExecuteOnly(). For example, a panicking test run or Anneal verification that asks for RUST_BACKTRACE=1 will be retried as cargo run with a binary crate instead of rerunning tests or cargo anneal verify, often producing an unrelated “main function not found”/normal-run result; dispatch the current primary action after changing the backtrace setting.
Useful? React with 👍 / 👎.
| props.position, | ||
| useCallback((editor, _model, { line, column }) => { | ||
| editor.setPosition({ lineNumber: line, column }); | ||
| editor.focus(); | ||
| }, []), |
There was a problem hiding this comment.
Honor text selections in Monaco
The MIR/source-output links dispatch selectText(start, end), and both the simple and Ace editors consume props.selection, but the Monaco editor only reacts to props.position. With Monaco selected, clicking a MIR source span or any future range link updates Redux but never selects the requested range in the editor, so the navigation feature silently fails for that editor mode; add the same props.selection handling here.
Useful? React with 👍 / 👎.
| editor, | ||
| props.onEditCode, | ||
| useCallback((editor, _model, onEditCode) => { | ||
| editor.onDidChangeModelContent(() => { |
There was a problem hiding this comment.
Dispose Monaco change listeners
Because Editor passes a fresh onEditCode callback on each render, this effect is re-run after edits and other Redux updates, but the onDidChangeModelContent disposable is never returned. In Monaco mode, each edit accumulates another live listener, so later keystrokes dispatch duplicate editCode actions and repeated storage saves, causing progressively worse input latency; return the disposable/cleanup or stabilize the callback.
Useful? React with 👍 / 👎.
| socket.addEventListener('close', (event) => { | ||
| store.dispatch(websocketDisconnected()); | ||
|
|
There was a problem hiding this comment.
End active runs when the WebSocket closes
If the WebSocket closes while a run is in progress, the backend tears down that session and no wsExecuteEnd will arrive, but this close handler only flips the connection status. The execute slice keeps requestsInProgress set, leaving the loader/stdin UI stuck indefinitely after a network drop or server restart; dispatch a terminal execution error or otherwise clear the active sequence when the transport closes.
Useful? React with 👍 / 👎.
| .addCase(performFormat.rejected, (state) => { | ||
| state.requestsInProgress -= 1; |
There was a problem hiding this comment.
When the format request itself is rejected, such as a network failure, malformed server error response, or /format returning a JSON error, this branch only decrements the counter and discards action.error. Since the format pane then has no stdout/stderr/error to render, the user gets no indication that formatting failed; preserve the rejection message in state like the execute/gist paths do.
Useful? React with 👍 / 👎.
Latest Update: v12 — Compare vs v11
📚 Full Patch History
Links show the diff between the row version and the column version.
⬇️ Download this PR
Branch
git fetch origin refs/heads/Gbja7ynjo5n4gf6rek56jhkaclymvo22y && git checkout -b pr-Gbja7ynjo5n4gf6rek56jhkaclymvo22y FETCH_HEADCheckout
git fetch origin refs/heads/Gbja7ynjo5n4gf6rek56jhkaclymvo22y && git checkout FETCH_HEADCherry Pick
git fetch origin refs/heads/Gbja7ynjo5n4gf6rek56jhkaclymvo22y && git cherry-pick FETCH_HEADPull
Stacked PRs enabled by GHerrit.