@percy/core 1.32.3-beta.1 → 1.32.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/api.js +20 -34
  2. package/package.json +10 -10
package/dist/api.js CHANGED
@@ -387,20 +387,19 @@ export function createPercyServer(percy, port) {
387
387
  .route('post', '/percy/comparison', async (req, res) => {
388
388
  let data;
389
389
  if (percy.syncMode(req.body)) {
390
- // percy.upload returns an async generator that must be drained for #snapshots.push to run.
390
+ // percy.upload() is the generatePromise-wrapped method: calling it drives the
391
+ // underlying async generator to completion (enqueuing #snapshots) and the sync
392
+ // queue resolves/rejects the attached callback. Do NOT `for await` the return
393
+ // value — it is a Promise, not an async iterable. The raw generator lives at
394
+ // percy.yield.upload() if direct iteration is ever needed. The trailing
395
+ // .catch(reject) surfaces generator errors that bypass the sync-queue callback
396
+ // (e.g. a throw before the queue task runs) instead of leaking an unhandled
397
+ // rejection and hanging the request.
391
398
  const snapshotPromise = new Promise((resolve, reject) => {
392
- const upload = percy.upload(req.body, {
399
+ percy.upload(req.body, {
393
400
  resolve,
394
401
  reject
395
- }, 'app');
396
- (async () => {
397
- // eslint-disable-next-line no-unused-vars
398
- try {
399
- for await (const _ of upload) {/* drain */}
400
- } catch (e) {
401
- reject(e);
402
- }
403
- })();
402
+ }, 'app').catch(reject);
404
403
  });
405
404
  data = await handleSyncJob(snapshotPromise, percy, 'comparison');
406
405
  } else {
@@ -952,21 +951,14 @@ export function createPercyServer(percy, port) {
952
951
  if (req.body.sync === true) payload.sync = true;
953
952
  let data;
954
953
  if (percy.syncMode(payload)) {
955
- // percy.upload returns an async generator that must be drained for #snapshots.push to run.
956
- // See docs/solutions/best-practices/2026-05-20-maestro-sync-promise-bug-investigation.md.
954
+ // See the /percy/comparison route: percy.upload() is the Promise-wrapped method;
955
+ // calling it drives the generator and the sync queue resolves/rejects the callback.
956
+ // The .catch(reject) surfaces generator errors that bypass that callback.
957
957
  const snapshotPromise = new Promise((resolve, reject) => {
958
- const upload = percy.upload(payload, {
958
+ percy.upload(payload, {
959
959
  resolve,
960
960
  reject
961
- }, 'app');
962
- (async () => {
963
- // eslint-disable-next-line no-unused-vars
964
- try {
965
- for await (const _ of upload) {/* drain */}
966
- } catch (e) {
967
- reject(e);
968
- }
969
- })();
961
+ }, 'app').catch(reject);
970
962
  });
971
963
  data = await handleSyncJob(snapshotPromise, percy, 'comparison');
972
964
  return res.json(200, {
@@ -1003,20 +995,14 @@ export function createPercyServer(percy, port) {
1003
995
  percyAutomateRequestHandler(req, percy);
1004
996
  let comparisonData = await WebdriverUtils.captureScreenshot(req.body);
1005
997
  if (percy.syncMode(comparisonData)) {
1006
- // percy.upload returns an async generator that must be drained for #snapshots.push to run.
998
+ // See the /percy/comparison route: percy.upload() is the Promise-wrapped method;
999
+ // calling it drives the generator and the sync queue resolves/rejects the callback.
1000
+ // The .catch(reject) surfaces generator errors that bypass that callback.
1007
1001
  const snapshotPromise = new Promise((resolve, reject) => {
1008
- const upload = percy.upload(comparisonData, {
1002
+ percy.upload(comparisonData, {
1009
1003
  resolve,
1010
1004
  reject
1011
- }, 'automate');
1012
- (async () => {
1013
- // eslint-disable-next-line no-unused-vars
1014
- try {
1015
- for await (const _ of upload) {/* drain */}
1016
- } catch (e) {
1017
- reject(e);
1018
- }
1019
- })();
1005
+ }, 'automate').catch(reject);
1020
1006
  });
1021
1007
  data = await handleSyncJob(snapshotPromise, percy, 'comparison');
1022
1008
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.32.3-beta.1",
3
+ "version": "1.32.3",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "beta"
12
+ "tag": "latest"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -46,12 +46,12 @@
46
46
  "dependencies": {
47
47
  "@grpc/grpc-js": "^1.14.3",
48
48
  "@grpc/proto-loader": "^0.8.0",
49
- "@percy/client": "1.32.3-beta.1",
50
- "@percy/config": "1.32.3-beta.1",
51
- "@percy/dom": "1.32.3-beta.1",
52
- "@percy/logger": "1.32.3-beta.1",
53
- "@percy/monitoring": "1.32.3-beta.1",
54
- "@percy/webdriver-utils": "1.32.3-beta.1",
49
+ "@percy/client": "1.32.3",
50
+ "@percy/config": "1.32.3",
51
+ "@percy/dom": "1.32.3",
52
+ "@percy/logger": "1.32.3",
53
+ "@percy/monitoring": "1.32.3",
54
+ "@percy/webdriver-utils": "1.32.3",
55
55
  "busboy": "^1.6.0",
56
56
  "content-disposition": "^0.5.4",
57
57
  "cross-spawn": "^7.0.3",
@@ -67,7 +67,7 @@
67
67
  "yaml": "^2.4.1"
68
68
  },
69
69
  "optionalDependencies": {
70
- "@percy/cli-doctor": "1.32.3-beta.1"
70
+ "@percy/cli-doctor": "1.32.3"
71
71
  },
72
- "gitHead": "92723d8feb00ce604c67dcd1e28c93b498c6996f"
72
+ "gitHead": "8d11a0c1d3eaf54c8944ed23ea51cf9710b5afdd"
73
73
  }