Skip to content

feat(test-runs): undo an approval or rejection from its toast (U5) - #446

Merged
pashidlos merged 5 commits into
masterfrom
claude/undo-approve-reject
Nov 1, 2026
Merged

pashidlos merged 5 commits into
masterfrom
claude/undo-approve-reject

Conversation

@pashidlos

Copy link
Copy Markdown
Member

Adds Undo to the Approved/Rejected toasts (API-SYNC WP15, frontend item U5).

Merge after backend api-v6.0.0. Undo calls POST /test-runs/revert from Visual-Regression-Tracker/backend#443, which is not released yet (latest tag api-v5.7.0). Against an older API every Undo ends in a 404 toast.

What the reviewer gets

  • An Undo button, next to the dismiss button, on the toast after:
    • approve/reject of one run in the details dialog,
    • bulk approve/reject in the run list,
    • approve/reject in the matching-variations dialog.
  • The toast stays 6 s. Other dialog confirmations keep their 2 s.
  • A bulk action that partly failed offers Undo for the runs that went through. If every run failed, there is no Undo.
  • After a successful undo: "Undone" in the dialog, "N test runs restored." / "N variations restored." elsewhere. A refusal (409, all or nothing) shows the backend's message as an error toast.
  • The backend sends testRun_updated for each reverted run, which the socket context already applies. In the variations dialog, reverted runs are forgotten as "acted", so go-to-next visits them again.
  • Guests never see Undo: approve/reject is admin/editor only.

Notes

  • The Undo button disables after its first click, so a double click reverts once.
  • In the details dialog, an undo result shows through enqueueAside and does not close the toast of a newer approval.
  • The dismiss button moved to DismissNotificationButton, so an undo toast keeps it.
  • testRunService shares one POST-ids request between the bulk calls and revert.
  • Tests find Undo by text, not by role: an open MUI dialog marks the toasts aria-hidden. Keyboard access to toasts in the dialog is out of scope.
  • The functions coverage threshold goes from 86 to 87.

Tests

  • Vitest: revert in the service; undo in ApproveRejectButtons, BulkOperation and MatchingVariationsDialog (partial results, 409, double click, a late result next to a newer toast, go-to-next after undo).
  • Playwright: undo from the dialog and from the table, a refused undo, toast timing with page.clock. screens.spec.ts gets "project page after a bulk approval, with undo" in light and dark; the baselines were made in Docker and reviewed.
  • npm run lint (0 errors), typecheck, test (918), build, test:pw:docker (363) all pass locally.

Approved/Rejected toasts carry an Undo button for 6 s: one run in the
details dialog, bulk approve/reject in the run list, and the matching
variations dialog. When a bulk action partly fails, Undo reverts only the
runs that went through. Undo calls POST /test-runs/revert (WP15) and says
"Undone" / "N test runs restored."; a refusal (409) shows the backend's
message. Reverted runs drop out of the variations dialog's "acted" memory,
so go-to-next visits them again. The Undo button disables after its first
click so a double click reverts once.

The dismiss button moves to DismissNotificationButton so an undo toast
keeps it. testRunService shares one POST-ids request between the bulk
calls and revert. The functions coverage threshold goes up to 87.

Needs api-v6.0.0 (backend #443): older APIs answer 404 on revert.
… without an action

The undo toast's 6 s no longer overrides the dialog's 2 s by spread
order; a toast with an action keeps its own time, and a comment
confirmation is pinned to two seconds.
An undo that finished after the next approval closed that approval's
toast, and with it its Undo. Undo results now go through enqueueAside,
which shows a toast without replacing the current confirmation.
CPU throttling is relative to the machine, and a GitHub runner takes
270-600 ms where a laptop takes 130-180, so the 400 ms limit failed on
slower runners without any slowdown in the app. Local runs keep 400.
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@pashidlos
pashidlos merged commit b6bb7c2 into master Nov 1, 2026
5 checks passed
@pashidlos
pashidlos deleted the claude/undo-approve-reject branch November 1, 2026 21:16
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