diff --git a/tests/python/test_npm_release.py b/tests/python/test_npm_release.py index e566643..1af7079 100644 --- a/tests/python/test_npm_release.py +++ b/tests/python/test_npm_release.py @@ -162,42 +162,6 @@ def test_integrity_verification_waits_for_a_batch_concurrently( ) sleep.assert_called_once_with(3) - @mock.patch("tools.npm_release.wait_for_dist_tag") - @mock.patch("tools.npm_release.subprocess.run") - @mock.patch( - "tools.npm_release.npm_dist_tag", - return_value=npm_release.RUNTIME_VERSION, - ) - def test_matching_preview_latest_tag_is_removed( - self, - dist_tag: mock.Mock, - run: mock.Mock, - wait: mock.Mock, - ) -> None: - package = "@arcships/light-ocr-tiny" - - npm_release.remove_dist_tag_if_version( - "npm", package, "latest", npm_release.RUNTIME_VERSION - ) - - dist_tag.assert_called_once_with("npm", package, "latest") - command = run.call_args.args[0] - self.assertEqual(command[:5], ["npm", "dist-tag", "rm", package, "latest"]) - self.assertIn(f"--registry={npm_release.NPM_REGISTRY}", command) - wait.assert_called_once_with("npm", package, "latest", None) - - @mock.patch("tools.npm_release.subprocess.run") - @mock.patch("tools.npm_release.npm_dist_tag", return_value="0.0.9") - def test_existing_preview_latest_version_is_preserved( - self, dist_tag: mock.Mock, run: mock.Mock - ) -> None: - npm_release.remove_dist_tag_if_version( - "npm", "@arcships/light-ocr-tiny", "latest", "0.1.0" - ) - - dist_tag.assert_called_once() - run.assert_not_called() - def test_stages_and_packs_the_independently_versioned_release_set(self) -> None: npm = shutil.which("npm") if npm is None: diff --git a/tools/npm_release.py b/tools/npm_release.py index 958df10..8552937 100644 --- a/tools/npm_release.py +++ b/tools/npm_release.py @@ -1356,41 +1356,6 @@ def publish(arguments: argparse.Namespace) -> None: print(json.dumps({"package": specification, "status": "published"})) -def remove_dist_tag_if_version( - npm: str, package: str, tag: str, version: str -) -> None: - current = npm_dist_tag(npm, package, tag) - if current is None: - print(json.dumps({"package": package, "tag": tag, "status": "absent"})) - return - if current != version: - print( - json.dumps( - { - "package": package, - "tag": tag, - "status": "preserved", - "version": current, - } - ) - ) - return - subprocess.run( - [ - npm, - "dist-tag", - "rm", - package, - tag, - f"--registry={NPM_REGISTRY}", - ], - cwd=ROOT, - check=True, - ) - wait_for_dist_tag(npm, package, tag, None) - print(json.dumps({"package": package, "tag": tag, "status": "removed"})) - - def promote(arguments: argparse.Namespace) -> None: tarballs = arguments.tarball_dir.resolve() release = read_json(tarballs / "release-manifest.json") @@ -1400,26 +1365,12 @@ def promote(arguments: argparse.Namespace) -> None: ): raise RuntimeError("release manifest version does not match promotion request") records = {record["name"]: record for record in release["packages"]} - # npm may create `latest` for the first version of a new package even when - # it is published with `--tag next`. Keep preview-only tiers off `latest` - # without disturbing an independently promoted older version. - preview_names = sorted( - [ - FACADE_PACKAGES[tier]["name"] - for tier in ("tiny", "medium") - ] - + [ - MODEL_PACKAGES[tier]["name"] - for tier in ("tiny", "medium") - ] - ) - for name in preview_names: - remove_dist_tag_if_version( - arguments.npm, name, arguments.tag, records[name]["version"] - ) # Tiny and Medium intentionally stay on `next` until their G2 evidence is - # accepted. The stable closure is the native runtime, model-free JS runtime, - # and Small facade; Small continues to exact-pin the existing 0.3.4 model. + # accepted. npm requires every package document to retain a `latest` tag, so + # first-published preview-only package names also expose their only version + # there. Promotion deliberately leaves those registry-required tags untouched + # and only advances the native runtime, model-free JS runtime, and Small + # facade. Small continues to exact-pin the existing 0.3.4 model. names = ( sorted(platform["package"] for platform in PLATFORMS.values()) + [RUNTIME_PACKAGE, FACADE_PACKAGE]