@elmeragroup/internal 0.2.0-canary.6 → 0.2.0-canary.7

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/release.mjs +34 -7
  2. package/package.json +4 -4
package/dist/release.mjs CHANGED
@@ -795,20 +795,47 @@ function shouldPromote(release, registry, isAncestor) {
795
795
  }
796
796
  //#endregion
797
797
  //#region ../release/dist/publication.js
798
- /** Each retry doubles `confirmationInterval`, capped so a slow packument gets minutes, not seconds. */
798
+ /**
799
+ * Live confirmation timing. npm processes a new version asynchronously ("may take a few minutes
800
+ * to become available") and has taken longer than four minutes, so the window allows ten.
801
+ */
802
+ const liveConfirmation = {
803
+ confirmationInterval: Duration.seconds(5),
804
+ confirmationWindow: Duration.minutes(10)
805
+ };
806
+ /** Caps the doubling delay so a long window polls npm every 30 seconds rather than hammering it. */
799
807
  const maxConfirmationDelay = Duration.seconds(30);
800
808
  const unverifiedPublication = "Publication could not be verified; retry the recorded release";
801
- function confirmationSchedule(interval) {
802
- const base = Duration.fromInputUnsafe(interval);
803
- return Schedule.recurs(9).pipe(Schedule.addDelay((metadata) => Effect.succeed(Duration.min(Duration.times(base, 2 ** metadata.output), maxConfirmationDelay))));
809
+ function confirmationDelay(interval, retry) {
810
+ return Duration.min(Duration.times(interval, 2 ** retry), maxConfirmationDelay);
811
+ }
812
+ /**
813
+ * The number of re-reads whose delays first cover `window`. Counting scheduled delays rather than
814
+ * wall-clock time keeps the read count independent of registry latency, so the slept total is at
815
+ * least the window and tests on a test clock see a deterministic schedule.
816
+ */
817
+ function confirmationRetries(interval, window) {
818
+ if (!Duration.isPositive(interval)) return 0;
819
+ let retries = 0;
820
+ let waited = Duration.zero;
821
+ while (Duration.isLessThan(waited, window)) {
822
+ waited = Duration.sum(waited, confirmationDelay(interval, retries));
823
+ retries += 1;
824
+ }
825
+ return retries;
826
+ }
827
+ function confirmationSchedule(deps) {
828
+ const interval = Duration.fromInputUnsafe(deps.confirmationInterval);
829
+ const window = Duration.fromInputUnsafe(deps.confirmationWindow);
830
+ return Schedule.recurs(confirmationRetries(interval, window)).pipe(Schedule.addDelay((metadata) => Effect.succeed(confirmationDelay(interval, metadata.output))));
804
831
  }
805
- /** Polls the registry until `isVisible` holds or `propagationAttempts` is exhausted. */
832
+ /** Polls the registry until `isVisible` holds or the confirmation window is spent. */
806
833
  function confirmRegistry(deps, isVisible) {
807
834
  return Effect.gen(function* () {
808
835
  const registry = yield* deps.readRegistry();
809
836
  return (yield* lift(() => isVisible(registry))) ? registry : void 0;
810
837
  }).pipe(Effect.repeat({
811
- schedule: confirmationSchedule(deps.confirmationInterval),
838
+ schedule: confirmationSchedule(deps),
812
839
  until: (registry) => registry !== void 0
813
840
  }));
814
841
  }
@@ -1252,7 +1279,7 @@ function liveReleaseDeps(pkg, environment) {
1252
1279
  store: createReleaseStore(createGitHubClient(environment), pkg.packageName),
1253
1280
  readRegistry: () => readRegistry(pkg.packageName, environment.fetch),
1254
1281
  npm: createNpmPublisher(pkg),
1255
- confirmationInterval: 5e3,
1282
+ ...liveConfirmation,
1256
1283
  verifyArchive: (intent, bytes) => verifyReleaseArchive(intent, bytes, pkg.packageName),
1257
1284
  log: (message) => {
1258
1285
  console.log(message);
package/package.json CHANGED
@@ -14,11 +14,11 @@
14
14
  "@elmeragroup/typescript-config": "0.0.0",
15
15
  "@elmeragroup/api-artifacts": "0.0.0",
16
16
  "@elmeragroup/api-extractor": "0.0.0",
17
- "@elmeragroup/oxlint-plugin": "0.0.0",
17
+ "@elmeragroup/release": "0.0.0",
18
18
  "@elmeragroup/oxlint-plugin-anti-slop": "0.0.0",
19
- "@elmeragroup/release": "0.0.0"
19
+ "@elmeragroup/oxlint-plugin": "0.0.0"
20
20
  },
21
- "version": "0.2.0-canary.6",
21
+ "version": "0.2.0-canary.7",
22
22
  "exports": {
23
23
  ".": {
24
24
  "types": "./dist/index.d.mts",
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "sideEffects": false,
71
71
  "elmeraRelease": {
72
- "commit": "cd971badfc723d1194fa8052c71978f6d490f397",
72
+ "commit": "b0aefdd03a29503079bb74c13f37ddd540794da4",
73
73
  "channel": "canary"
74
74
  },
75
75
  "scripts": {