Commit 1c125b9
authored
fix(export): make export clientId collision-safe to prevent concurrent lost-update (#10458)
## Problem
`export`'s `clientId` is both the pending-dir name **and** the
cross-client export lock — `export-validate`'s `waitIfNeeded` queue
sorts pending-dir names and lets only the first proceed to
validate+persist. It was generated as `Date.now().toString()`, which
isn't collision-safe.
When two exports hit the same remote within the same millisecond (e.g.
concurrent CI runners pushing the same lane), they get the **same
clientId**, share one pending-dir, collapse the queue to a single entry,
and both validate against the pre-persist state — silently losing one
runner's update (no divergence detected, no rebase).
This surfaced as an intermittently-failing e2e test
(`ci-commands.e2e.ts` → "concurrent runners snapping the SAME
component"): both runners exported cleanly and one snap was dropped from
the lane. The outcome depended purely on OS scheduling of the two
processes.
## Fix
Append a random suffix to the generated clientId so same-millisecond
exports can't collide. The timestamp prefix is kept so the sorted queue
still roughly preserves arrival order. `--resume` is unaffected (it
echoes back a user-supplied id; clientId is never parsed numerically).1 parent 86433a4 commit 1c125b9
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
678 | 679 | | |
679 | 680 | | |
680 | 681 | | |
681 | | - | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
682 | 692 | | |
683 | 693 | | |
684 | 694 | | |
| |||
0 commit comments