Skip to content

devops: publish npm packages in dependency order and wait for them to go live - #43933

Merged
Pavel Feldman (pavelfeldman) merged 2 commits into
microsoft:mainfrom
pavelfeldman:publish-wait-for-registry
Nov 5, 2026
Merged

Pavel Feldman (pavelfeldman) merged 2 commits into
microsoft:mainfrom
pavelfeldman:publish-wait-for-registry

Conversation

@pavelfeldman

@pavelfeldman Pavel Feldman (pavelfeldman) commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

npm publish exiting 0 only means the registry accepted the package: it is processed asynchronously ("Your package is being processed and may take a few minutes to become available") and may show up minutes later, or never. In the 1.65.0 release run, playwright-core@1.65.0 was accepted but never went live, while playwright, @playwright/test and the browser packages that pin it exactly were published and tagged @latest, so installs failed on the missing dependency. The workspace list also had playwright before playwright-core.

Changes

  • utils/workspace.js: --list-public-package-paths lists packages in dependency order (playwright-core first).
  • utils/publish_all_packages.sh: after publishing each package, wait until it is available on the registry (npm view <name>@<version>, polled every 15s for up to 15 minutes) before publishing the next one; fail the job if it never shows up.

With this, a package that never goes live fails the job before anything after it is published, so @latest never points at an uninstallable version. In the 1.65.0 run, packages took 55–188s to go live after being accepted, so runs get roughly 13 minutes slower.

Testing

Ran the publish loop against a stubbed npm that reports packages as available only after a few polls:

  • normal: all 9 packages published in dependency order, exit 0
  • playwright-core never available: only playwright-core published, exit 1
  • playwright-chromium never available: publishing stops after it, exit 1

… go live

`npm publish` exiting 0 only means the registry accepted the package; it
is processed asynchronously and may show up minutes later, or never.
playwright-core@1.65.0 was accepted but never went live, while
playwright@1.65.0 and the other packages that pin it were published and
tagged @latest, so installs failed on the missing dependency.

- List public packages in dependency order (playwright-core first).
- Before publishing a package, wait until the workspace packages it
  depends on are available on the registry.
- At the end, fail the job if any published package did not become
  available within 15 minutes.
Comment thread utils/publish_all_packages.sh Outdated
for package in ${PACKAGE_PATHS}; do
name=$(node -p "require('${package}/package.json').name")
# Never publish (and tag) a package until the workspace packages it depends on are installable.
for dep in $(node -p "Object.keys(require('${package}/package.json').dependencies || {}).join(' ')"); do

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just loop over packages and "publish + ensure" for each package, instead of checking the dependencies later on?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, done. It's slower, since we now wait out each package's processing time one after another (55–188 s each in the 1.65.0 run), but much simpler.

Comment thread utils/workspace.js
* Packages at the same depth keep their declaration order.
* @returns {PWPackage[]}
*/
publicPackagesInDependencyOrder() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be done in ~5 lines 😄

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 🙂

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit d29ee76 into microsoft:main Nov 5, 2026
23 of 24 checks passed
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

5194 passed, 616 skipped


Merge workflow run.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

Warning

The triggering workflow run ended with status cancelled. Results below may be incomplete — blob reports from cancelled or timed-out shards are missing, so passing/failing counts do not reflect the full test suite.

1 flaky ⚠️ [webkit-library] › library/trace-viewer.spec.ts:549 › TV-027 should filter network requests by resource type `@webkit-playwright-x64-ubuntu24-64-core-node22`

23522 passed, 705 skipped


Merge workflow run.

Comment thread utils/workspace.js
this._packages.filter(p => p.name === dep).forEach(visit);
ordered.add(pkg);
};
this._packages.forEach(visit);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for me to understand (hope it's not annoying), but why not filter out private packages before visiting them all? I'm sure I'm missing something here :)

Anyway love Playwright -- Thank you

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.

4 participants