Skip to content

[fix] browser: retry a history command on a stale snapshot - #404

Closed
wtz2333 wants to merge 1 commit into
ThinkFlowLab:mainfrom
wtz2333:fix/browser-history-retry
Closed

wtz2333 wants to merge 1 commit into
ThinkFlowLab:mainfrom
wtz2333:fix/browser-history-retry

Conversation

@wtz2333

@wtz2333 wtz2333 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

What

tests/browser/created_node_focus.mjs occasionally failed on CI at the history.undo that follows canvas.hide:

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ 'rejected'
- 'applied'
    at tests/browser/created_node_focus.mjs:122:10

The suite was not failing on a history bug. It reads a project snapshot to build expectedVersions, then posts the command. The workspace autosaves on its own (creationProjection.ts, creationEditorSession.ts:106), so a save landing between that read and the command bumps a revision, and the server correctly rejects the command with status: "rejected" / issues[0].code = "revision_conflict" (HTTP 200, "This item changed since it was loaded. Reload it and try again.").

Fix

send() now waits for the "Saved on this device" indicator, re-reads the revisions, and retries up to three times when the receipt is a revision_conflict. Any other rejection, or three consecutive conflicts, still fails the suite.

Verification

  • Reproduced the rejection deterministically: posting history.undo with revision - 1 returns rejected + revision_conflict; re-reading and re-posting returns applied.
  • Injected an artificial stale revision into the hidden-copy harness: the helper refreshed, retried, and the suite still passed.
  • Ran the real suite 8 times against a local isolated service + vite (playwright-core 1.58.2, chromium headless shell): 8/8 pass.

The workspace autosaves while the suite reads a snapshot to build expectedVersions, so a save that lands between the read and the command makes the server reject it as revision_conflict. That is the documented reload-and-retry contract, so the suite now waits for the save indicator, re-reads the revisions and retries up to three times instead of failing on a stale snapshot.
@github-actions github-actions Bot added area:ci Continuous integration and checks type:ci Build, test and release automation labels Nov 19, 2026
@github-actions
github-actions Bot requested a review from wangtiance November 19, 2026 08:32
@wtz2333 wtz2333 closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci Continuous integration and checks type:ci Build, test and release automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant