@orkestrel/probe 0.0.4 → 0.0.6

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.
@@ -863,9 +863,12 @@ export declare interface ProbeErrorOptions {
863
863
  *
864
864
  * @remarks
865
865
  * `arm` fires when the boot control has reported red and the service will answer calls; a probe
866
- * arriving before it awaits that step rather than starting a second one. `expire` fires when the
867
- * coordinator's own deadline destroyed a stage and a replacement took its place, which is the only
868
- * way a synchronous infinite loop is ever reported.
866
+ * arriving before it awaits that step rather than starting a second one. An arming attempt that
867
+ * rejects fires `error` instead, as it rejects, so a host waiting on `arm` reads the refusal rather
868
+ * than waiting on a state no event describes. The rejected attempt is still retained for retry, and
869
+ * the next `prove` runs the boot controls again, so a workspace that cannot arm surfaces one `error`
870
+ * per attempt. `expire` fires when the coordinator's own deadline destroyed a stage and a
871
+ * replacement took its place, which is the only way a synchronous infinite loop is ever reported.
869
872
  *
870
873
  * @example
871
874
  * ```ts
@@ -879,7 +882,7 @@ export declare type ProbeEventMap = {
879
882
  readonly prove: readonly [verdict: Verdict];
880
883
  /** The coordinator's deadline fired at one stage and that stage was replaced before this event. */
881
884
  readonly expire: readonly [claim: Claim];
882
- /** A fault surfaced for observation. */
885
+ /** A fault surfaced for observation, once per fault, including a rejected arming attempt. */
883
886
  readonly error: readonly [error: unknown];
884
887
  };
885
888
 
@@ -863,9 +863,12 @@ export declare interface ProbeErrorOptions {
863
863
  *
864
864
  * @remarks
865
865
  * `arm` fires when the boot control has reported red and the service will answer calls; a probe
866
- * arriving before it awaits that step rather than starting a second one. `expire` fires when the
867
- * coordinator's own deadline destroyed a stage and a replacement took its place, which is the only
868
- * way a synchronous infinite loop is ever reported.
866
+ * arriving before it awaits that step rather than starting a second one. An arming attempt that
867
+ * rejects fires `error` instead, as it rejects, so a host waiting on `arm` reads the refusal rather
868
+ * than waiting on a state no event describes. The rejected attempt is still retained for retry, and
869
+ * the next `prove` runs the boot controls again, so a workspace that cannot arm surfaces one `error`
870
+ * per attempt. `expire` fires when the coordinator's own deadline destroyed a stage and a
871
+ * replacement took its place, which is the only way a synchronous infinite loop is ever reported.
869
872
  *
870
873
  * @example
871
874
  * ```ts
@@ -879,7 +882,7 @@ export declare type ProbeEventMap = {
879
882
  readonly prove: readonly [verdict: Verdict];
880
883
  /** The coordinator's deadline fired at one stage and that stage was replaced before this event. */
881
884
  readonly expire: readonly [claim: Claim];
882
- /** A fault surfaced for observation. */
885
+ /** A fault surfaced for observation, once per fault, including a rejected arming attempt. */
883
886
  readonly error: readonly [error: unknown];
884
887
  };
885
888
 
@@ -806,7 +806,7 @@ var Overlay = class {
806
806
  };
807
807
  //#endregion
808
808
  //#region package.json
809
- var version = "0.0.4";
809
+ var version = "0.0.6";
810
810
  var peerDependencies = {
811
811
  "oxlint": "^1.77.0",
812
812
  "typescript": "^6.0.0",
@@ -2180,6 +2180,7 @@ var Probe = class {
2180
2180
  #lintQueue;
2181
2181
  #runtimeQueue;
2182
2182
  #deadlines = /* @__PURE__ */ new WeakSet();
2183
+ #surfaced = /* @__PURE__ */ new WeakSet();
2183
2184
  #typeTail = Promise.resolve();
2184
2185
  #arming;
2185
2186
  #closing;
@@ -2261,7 +2262,7 @@ var Probe = class {
2261
2262
  this.#emitter.emit("prove", verdict);
2262
2263
  return verdict;
2263
2264
  } catch (error) {
2264
- this.#emitter.emit("error", error);
2265
+ if (!(error instanceof _src_core.ProbeError) || !this.#surfaced.has(error)) this.#emitter.emit("error", error);
2265
2266
  throw error;
2266
2267
  }
2267
2268
  }
@@ -2286,18 +2287,30 @@ var Probe = class {
2286
2287
  await this.#arming;
2287
2288
  }
2288
2289
  async #arm() {
2289
- const created = this.#workbench();
2290
+ let created;
2291
+ try {
2292
+ created = this.#workbench();
2293
+ } catch (error) {
2294
+ this.#surface(error);
2295
+ throw error;
2296
+ }
2290
2297
  try {
2291
2298
  await this.#boot(created);
2292
2299
  } catch (error) {
2293
- throw new _src_core.ProbeError(`The probe could not arm: ${describeUnknown(error)}`, {
2300
+ const failure = new _src_core.ProbeError(`The probe could not arm: ${describeUnknown(error)}`, {
2294
2301
  origin: "instrument",
2295
2302
  code: "malformed",
2296
2303
  cause: error
2297
2304
  });
2305
+ this.#surface(failure);
2306
+ throw failure;
2298
2307
  }
2299
2308
  this.#emitter.emit("arm", this.#toolchain);
2300
2309
  }
2310
+ #surface(error) {
2311
+ if (error instanceof _src_core.ProbeError) this.#surfaced.add(error);
2312
+ this.#emitter.emit("error", error);
2313
+ }
2301
2314
  #workbench() {
2302
2315
  const path = "tmp/probe";
2303
2316
  const directory = resolveWorkspaceFile(this.#workspace, path);