@agent-relay/factory 0.1.71 → 0.1.73
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.
- package/dist/cli/diagnose.d.ts +13 -1
- package/dist/cli/diagnose.d.ts.map +1 -1
- package/dist/cli/diagnose.js +92 -1
- package/dist/cli/diagnose.js.map +1 -1
- package/dist/cli/fleet.d.ts.map +1 -1
- package/dist/cli/fleet.js +5 -0
- package/dist/cli/fleet.js.map +1 -1
- package/dist/fleet/control-plane-circuit.d.ts +10 -0
- package/dist/fleet/control-plane-circuit.d.ts.map +1 -1
- package/dist/fleet/control-plane-circuit.js +9 -1
- package/dist/fleet/control-plane-circuit.js.map +1 -1
- package/dist/fleet/relay-fleet-client.d.ts +21 -2
- package/dist/fleet/relay-fleet-client.d.ts.map +1 -1
- package/dist/fleet/relay-fleet-client.js +97 -17
- package/dist/fleet/relay-fleet-client.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/observability/events.d.ts +14 -14
- package/dist/orchestrator/dispatch-failure-reason.d.ts +60 -0
- package/dist/orchestrator/dispatch-failure-reason.d.ts.map +1 -0
- package/dist/orchestrator/dispatch-failure-reason.js +127 -0
- package/dist/orchestrator/dispatch-failure-reason.js.map +1 -0
- package/dist/orchestrator/factory.d.ts.map +1 -1
- package/dist/orchestrator/factory.js +253 -31
- package/dist/orchestrator/factory.js.map +1 -1
- package/dist/orchestrator/public-health.d.ts.map +1 -1
- package/dist/orchestrator/public-health.js +185 -0
- package/dist/orchestrator/public-health.js.map +1 -1
- package/dist/orchestrator/sweep-skip-reason.d.ts +45 -0
- package/dist/orchestrator/sweep-skip-reason.d.ts.map +1 -0
- package/dist/orchestrator/sweep-skip-reason.js +82 -0
- package/dist/orchestrator/sweep-skip-reason.js.map +1 -0
- package/dist/ports/fleet.d.ts +38 -0
- package/dist/ports/fleet.d.ts.map +1 -1
- package/dist/ports/index.d.ts +1 -1
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/types.d.ts +156 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1038,7 +1038,7 @@ export declare const FactoryCloudEventInputV1Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1038
1038
|
type: string;
|
|
1039
1039
|
id: string;
|
|
1040
1040
|
occurredAt: string;
|
|
1041
|
-
status?: "blocked" | "
|
|
1041
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
1042
1042
|
verification?: {
|
|
1043
1043
|
contract: "factory.verification.evidence.v1";
|
|
1044
1044
|
verdict: "pass" | "fail";
|
|
@@ -1155,7 +1155,7 @@ export declare const FactoryCloudEventInputV1Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1155
1155
|
type: string;
|
|
1156
1156
|
id: string;
|
|
1157
1157
|
occurredAt: string;
|
|
1158
|
-
status?: "blocked" | "
|
|
1158
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
1159
1159
|
verification?: {
|
|
1160
1160
|
contract: "factory.verification.evidence.v1";
|
|
1161
1161
|
verdict: "pass" | "fail";
|
|
@@ -1272,7 +1272,7 @@ export declare const FactoryCloudEventInputV1Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1272
1272
|
type: string;
|
|
1273
1273
|
id: string;
|
|
1274
1274
|
occurredAt: string;
|
|
1275
|
-
status?: "blocked" | "
|
|
1275
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
1276
1276
|
verification?: {
|
|
1277
1277
|
contract: "factory.verification.evidence.v1";
|
|
1278
1278
|
verdict: "pass" | "fail";
|
|
@@ -1389,7 +1389,7 @@ export declare const FactoryCloudEventInputV1Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1389
1389
|
type: string;
|
|
1390
1390
|
id: string;
|
|
1391
1391
|
occurredAt: string;
|
|
1392
|
-
status?: "blocked" | "
|
|
1392
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
1393
1393
|
verification?: {
|
|
1394
1394
|
contract: "factory.verification.evidence.v1";
|
|
1395
1395
|
verdict: "pass" | "fail";
|
|
@@ -2008,7 +2008,7 @@ export declare const FactoryCloudEventV1Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2008
2008
|
id: string;
|
|
2009
2009
|
occurredAt: string;
|
|
2010
2010
|
sequence: number;
|
|
2011
|
-
status?: "blocked" | "
|
|
2011
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
2012
2012
|
verification?: {
|
|
2013
2013
|
contract: "factory.verification.evidence.v1";
|
|
2014
2014
|
verdict: "pass" | "fail";
|
|
@@ -2126,7 +2126,7 @@ export declare const FactoryCloudEventV1Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2126
2126
|
id: string;
|
|
2127
2127
|
occurredAt: string;
|
|
2128
2128
|
sequence: number;
|
|
2129
|
-
status?: "blocked" | "
|
|
2129
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
2130
2130
|
verification?: {
|
|
2131
2131
|
contract: "factory.verification.evidence.v1";
|
|
2132
2132
|
verdict: "pass" | "fail";
|
|
@@ -2244,7 +2244,7 @@ export declare const FactoryCloudEventV1Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2244
2244
|
id: string;
|
|
2245
2245
|
occurredAt: string;
|
|
2246
2246
|
sequence: number;
|
|
2247
|
-
status?: "blocked" | "
|
|
2247
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
2248
2248
|
verification?: {
|
|
2249
2249
|
contract: "factory.verification.evidence.v1";
|
|
2250
2250
|
verdict: "pass" | "fail";
|
|
@@ -2362,7 +2362,7 @@ export declare const FactoryCloudEventV1Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2362
2362
|
id: string;
|
|
2363
2363
|
occurredAt: string;
|
|
2364
2364
|
sequence: number;
|
|
2365
|
-
status?: "blocked" | "
|
|
2365
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
2366
2366
|
verification?: {
|
|
2367
2367
|
contract: "factory.verification.evidence.v1";
|
|
2368
2368
|
verdict: "pass" | "fail";
|
|
@@ -3036,7 +3036,7 @@ export declare const FactoryCloudEventBatchV1Schema: z.ZodObject<{
|
|
|
3036
3036
|
id: string;
|
|
3037
3037
|
occurredAt: string;
|
|
3038
3038
|
sequence: number;
|
|
3039
|
-
status?: "blocked" | "
|
|
3039
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
3040
3040
|
verification?: {
|
|
3041
3041
|
contract: "factory.verification.evidence.v1";
|
|
3042
3042
|
verdict: "pass" | "fail";
|
|
@@ -3154,7 +3154,7 @@ export declare const FactoryCloudEventBatchV1Schema: z.ZodObject<{
|
|
|
3154
3154
|
id: string;
|
|
3155
3155
|
occurredAt: string;
|
|
3156
3156
|
sequence: number;
|
|
3157
|
-
status?: "blocked" | "
|
|
3157
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
3158
3158
|
verification?: {
|
|
3159
3159
|
contract: "factory.verification.evidence.v1";
|
|
3160
3160
|
verdict: "pass" | "fail";
|
|
@@ -3272,7 +3272,7 @@ export declare const FactoryCloudEventBatchV1Schema: z.ZodObject<{
|
|
|
3272
3272
|
id: string;
|
|
3273
3273
|
occurredAt: string;
|
|
3274
3274
|
sequence: number;
|
|
3275
|
-
status?: "blocked" | "
|
|
3275
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
3276
3276
|
verification?: {
|
|
3277
3277
|
contract: "factory.verification.evidence.v1";
|
|
3278
3278
|
verdict: "pass" | "fail";
|
|
@@ -3390,7 +3390,7 @@ export declare const FactoryCloudEventBatchV1Schema: z.ZodObject<{
|
|
|
3390
3390
|
id: string;
|
|
3391
3391
|
occurredAt: string;
|
|
3392
3392
|
sequence: number;
|
|
3393
|
-
status?: "blocked" | "
|
|
3393
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
3394
3394
|
verification?: {
|
|
3395
3395
|
contract: "factory.verification.evidence.v1";
|
|
3396
3396
|
verdict: "pass" | "fail";
|
|
@@ -3524,7 +3524,7 @@ export declare const FactoryCloudEventBatchV1Schema: z.ZodObject<{
|
|
|
3524
3524
|
id: string;
|
|
3525
3525
|
occurredAt: string;
|
|
3526
3526
|
sequence: number;
|
|
3527
|
-
status?: "blocked" | "
|
|
3527
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
3528
3528
|
verification?: {
|
|
3529
3529
|
contract: "factory.verification.evidence.v1";
|
|
3530
3530
|
verdict: "pass" | "fail";
|
|
@@ -3658,7 +3658,7 @@ export declare const FactoryCloudEventBatchV1Schema: z.ZodObject<{
|
|
|
3658
3658
|
id: string;
|
|
3659
3659
|
occurredAt: string;
|
|
3660
3660
|
sequence: number;
|
|
3661
|
-
status?: "blocked" | "
|
|
3661
|
+
status?: "blocked" | "failed" | "cancelled" | "queued" | "running" | "waiting" | "succeeded" | undefined;
|
|
3662
3662
|
verification?: {
|
|
3663
3663
|
contract: "factory.verification.evidence.v1";
|
|
3664
3664
|
verdict: "pass" | "fail";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a dispatch *attempt* failed, as a closed set (#355).
|
|
3
|
+
*
|
|
4
|
+
* `skipReasons` (#358) answers "why did the sweep decline this work unit", and
|
|
5
|
+
* on the live container it answers it with `dispatch-failed: 5` — every sweep,
|
|
6
|
+
* with the control-plane breaker closed, the fleet agent online and
|
|
7
|
+
* `readinessReconcile` healthy. That bucket is a *count*. It says the sweep got
|
|
8
|
+
* all the way to dispatching and dispatch threw; it does not say what threw,
|
|
9
|
+
* and the message that would say so goes to the daemon's stdout, which does not
|
|
10
|
+
* reach the deployed container's operator.
|
|
11
|
+
*
|
|
12
|
+
* So this is the second level of the same breakdown: `dispatchFailures` is the
|
|
13
|
+
* total (the same number `skipReasons['dispatch-failed']` carries), and
|
|
14
|
+
* `dispatchFailureReasons` splits it by cause. Same discipline as #358 —
|
|
15
|
+
* counts only, keys from this vocabulary rather than from the record, unknown
|
|
16
|
+
* codes folded into `other` rather than dropped so the parts still sum.
|
|
17
|
+
*
|
|
18
|
+
* As in #358 the code is recorded at the skip site alongside the free text,
|
|
19
|
+
* never derived from it: `perItemDispatchFailureCode` classifies a thrown value
|
|
20
|
+
* by type, and the two named-by-class-name entries below are the explicit
|
|
21
|
+
* exception, documented there.
|
|
22
|
+
*
|
|
23
|
+
* The three `unclassified-*` codes are not a failure of this vocabulary — they
|
|
24
|
+
* are its most useful answer when nothing named matches, because the *phase*
|
|
25
|
+
* that threw already names the owner. A pass that reaches dispatch and fails is
|
|
26
|
+
* a fleet problem; one that fails in triage never got near the fleet; one that
|
|
27
|
+
* fails in the gates ahead of triage failed reading durable state. Those are
|
|
28
|
+
* three different people's bugs, and separating them costs one variable.
|
|
29
|
+
*/
|
|
30
|
+
export declare const FACTORY_DISPATCH_FAILURE_REASON_CODES: readonly ["relayfile-overloaded", "live-state-changed", "late-placement-released", "lifecycle-terminal", "lifecycle-owned-elsewhere", "control-plane-open", "timed-out", "spawn-ack-timeout", "fleet-identity-read-only", "agent-registration-failed", "unclassified-gate", "unclassified-triage", "unclassified-dispatch", "other"];
|
|
31
|
+
export type FactoryDispatchFailureReasonCode = typeof FACTORY_DISPATCH_FAILURE_REASON_CODES[number];
|
|
32
|
+
/** The code an allowlisted error class name names, if this vocabulary knows one. */
|
|
33
|
+
export declare const factoryDispatchFailureReasonCodeForErrorClass: (errorClass: string) => FactoryDispatchFailureReasonCode | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Coerce an arbitrary value onto the vocabulary.
|
|
36
|
+
*
|
|
37
|
+
* Unrecognised codes collapse to `other` rather than being dropped, for the
|
|
38
|
+
* same reason #358 gives: a failure that vanished from the breakdown would make
|
|
39
|
+
* the parts stop summing to `dispatchFailures`, and a reader comparing the two
|
|
40
|
+
* would conclude the counter was broken rather than that the producer was newer.
|
|
41
|
+
*/
|
|
42
|
+
export declare const factoryDispatchFailureReasonCode: (value: unknown) => FactoryDispatchFailureReasonCode;
|
|
43
|
+
/**
|
|
44
|
+
* The per-cause breakdown of one sweep's failed dispatch attempts, counts only.
|
|
45
|
+
*
|
|
46
|
+
* Counts exactly the entries the sweep recorded as `dispatch-failed`, so the
|
|
47
|
+
* parts sum to `dispatchFailures` and to `skipReasons['dispatch-failed']` by
|
|
48
|
+
* construction. An entry whose producer recorded no `failureCode` folds into
|
|
49
|
+
* `other` for the same reason an unknown one does.
|
|
50
|
+
*
|
|
51
|
+
* Zero-count codes are omitted — the vocabulary is fixed and published, so an
|
|
52
|
+
* absent key reads as zero unambiguously. The total is carried separately by
|
|
53
|
+
* `dispatchFailures`, which is written whenever a sweep completes, so "ran and
|
|
54
|
+
* every dispatch succeeded" stays distinguishable from "never ran".
|
|
55
|
+
*/
|
|
56
|
+
export declare function factoryDispatchFailureReasonCounts(skipped: Iterable<{
|
|
57
|
+
code?: unknown;
|
|
58
|
+
failureCode?: unknown;
|
|
59
|
+
}> | undefined): Partial<Record<FactoryDispatchFailureReasonCode, number>>;
|
|
60
|
+
//# sourceMappingURL=dispatch-failure-reason.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch-failure-reason.d.ts","sourceRoot":"","sources":["../../src/orchestrator/dispatch-failure-reason.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,qCAAqC,sUA6BxC,CAAA;AAEV,MAAM,MAAM,gCAAgC,GAAG,OAAO,qCAAqC,CAAC,MAAM,CAAC,CAAA;AA6BnG,oFAAoF;AACpF,eAAO,MAAM,6CAA6C,GACxD,YAAY,MAAM,KACjB,gCAAgC,GAAG,SAGvB,CAAA;AAEf;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,GAAI,OAAO,OAAO,KAAG,gCAIrD,CAAA;AAEb;;;;;;;;;;;;GAYG;AACH,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,QAAQ,CAAC;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,SAAS,GACvE,OAAO,CAAC,MAAM,CAAC,gCAAgC,EAAE,MAAM,CAAC,CAAC,CAS3D"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a dispatch *attempt* failed, as a closed set (#355).
|
|
3
|
+
*
|
|
4
|
+
* `skipReasons` (#358) answers "why did the sweep decline this work unit", and
|
|
5
|
+
* on the live container it answers it with `dispatch-failed: 5` — every sweep,
|
|
6
|
+
* with the control-plane breaker closed, the fleet agent online and
|
|
7
|
+
* `readinessReconcile` healthy. That bucket is a *count*. It says the sweep got
|
|
8
|
+
* all the way to dispatching and dispatch threw; it does not say what threw,
|
|
9
|
+
* and the message that would say so goes to the daemon's stdout, which does not
|
|
10
|
+
* reach the deployed container's operator.
|
|
11
|
+
*
|
|
12
|
+
* So this is the second level of the same breakdown: `dispatchFailures` is the
|
|
13
|
+
* total (the same number `skipReasons['dispatch-failed']` carries), and
|
|
14
|
+
* `dispatchFailureReasons` splits it by cause. Same discipline as #358 —
|
|
15
|
+
* counts only, keys from this vocabulary rather than from the record, unknown
|
|
16
|
+
* codes folded into `other` rather than dropped so the parts still sum.
|
|
17
|
+
*
|
|
18
|
+
* As in #358 the code is recorded at the skip site alongside the free text,
|
|
19
|
+
* never derived from it: `perItemDispatchFailureCode` classifies a thrown value
|
|
20
|
+
* by type, and the two named-by-class-name entries below are the explicit
|
|
21
|
+
* exception, documented there.
|
|
22
|
+
*
|
|
23
|
+
* The three `unclassified-*` codes are not a failure of this vocabulary — they
|
|
24
|
+
* are its most useful answer when nothing named matches, because the *phase*
|
|
25
|
+
* that threw already names the owner. A pass that reaches dispatch and fails is
|
|
26
|
+
* a fleet problem; one that fails in triage never got near the fleet; one that
|
|
27
|
+
* fails in the gates ahead of triage failed reading durable state. Those are
|
|
28
|
+
* three different people's bugs, and separating them costs one variable.
|
|
29
|
+
*/
|
|
30
|
+
export const FACTORY_DISPATCH_FAILURE_REASON_CODES = [
|
|
31
|
+
/** Relayfile shed an operation this dispatch needed (#297). Clears on its own. */
|
|
32
|
+
'relayfile-overloaded',
|
|
33
|
+
/** Live provider state moved under the dispatch; the unit returns to the queue. */
|
|
34
|
+
'live-state-changed',
|
|
35
|
+
/** The never-placed deadline released the dispatch mid-spawn (#303). Self-healing. */
|
|
36
|
+
'late-placement-released',
|
|
37
|
+
/** The durable lifecycle record is terminal: this unit will not be retried. */
|
|
38
|
+
'lifecycle-terminal',
|
|
39
|
+
/** Another publisher holds the durable lifecycle lease. Clears on release. */
|
|
40
|
+
'lifecycle-owned-elsewhere',
|
|
41
|
+
/** The fleet control-plane circuit refused admission. Dispatch is globally paused. */
|
|
42
|
+
'control-plane-open',
|
|
43
|
+
/** Something in the attempt hit its own deadline — see the note on class names. */
|
|
44
|
+
'timed-out',
|
|
45
|
+
/** The fleet broker never acknowledged the spawn within its ack timeout. */
|
|
46
|
+
'spawn-ack-timeout',
|
|
47
|
+
/** The fleet client holds a read-only identity and cannot spawn at all. */
|
|
48
|
+
'fleet-identity-read-only',
|
|
49
|
+
/** Registering the spawned agent with the broker failed. */
|
|
50
|
+
'agent-registration-failed',
|
|
51
|
+
/** Threw in the gates ahead of triage: scope, orphan recovery, durable reads. */
|
|
52
|
+
'unclassified-gate',
|
|
53
|
+
/** Threw inside triage, before the fleet was ever asked for anything. */
|
|
54
|
+
'unclassified-triage',
|
|
55
|
+
/** Threw inside dispatch itself, and no code above matched it. */
|
|
56
|
+
'unclassified-dispatch',
|
|
57
|
+
/** Recorded by a producer this vocabulary does not know. */
|
|
58
|
+
'other',
|
|
59
|
+
];
|
|
60
|
+
/**
|
|
61
|
+
* Codes recognised by allowlisted error *class name* rather than by `instanceof`.
|
|
62
|
+
*
|
|
63
|
+
* The rule everywhere else is to classify by type, because a message is one
|
|
64
|
+
* rename away from collapsing a bucket. These five are the exception, for one
|
|
65
|
+
* reason: their classes live in `src/fleet/relay-fleet-client.ts`, and
|
|
66
|
+
* `factory.ts` does not import that module. Adding the edge to get five
|
|
67
|
+
* `instanceof` checks would pull the relay SDK into the orchestrator's module
|
|
68
|
+
* graph — a real cost — to buy precision over a *class name*, which is
|
|
69
|
+
* code-controlled and already the identifier `telemetryErrorClass` publishes
|
|
70
|
+
* everywhere else in this codebase. A rename here degrades one bucket to
|
|
71
|
+
* `unclassified-dispatch`; it cannot leak and it cannot break the sum.
|
|
72
|
+
*
|
|
73
|
+
* `TimeoutError` is deliberately generic: `FleetControlPlaneTimeoutError` sets
|
|
74
|
+
* that name on purpose, and so do `AbortSignal.timeout` and several SDK paths.
|
|
75
|
+
* Mapping it to the control plane specifically would be a guess; mapping it to
|
|
76
|
+
* "something in this attempt hit a deadline" is exactly true, and with 34-minute
|
|
77
|
+
* sweeps against 60-second attempts it is the answer worth being able to see.
|
|
78
|
+
*/
|
|
79
|
+
const DISPATCH_FAILURE_ERROR_CLASS_CODES = {
|
|
80
|
+
RelaySpawnAckTimeoutError: 'spawn-ack-timeout',
|
|
81
|
+
ReadOnlyFleetIdentityError: 'fleet-identity-read-only',
|
|
82
|
+
FactoryAgentRegistrationError: 'agent-registration-failed',
|
|
83
|
+
TimeoutError: 'timed-out',
|
|
84
|
+
AbortError: 'timed-out',
|
|
85
|
+
};
|
|
86
|
+
/** The code an allowlisted error class name names, if this vocabulary knows one. */
|
|
87
|
+
export const factoryDispatchFailureReasonCodeForErrorClass = (errorClass) => Object.hasOwn(DISPATCH_FAILURE_ERROR_CLASS_CODES, errorClass)
|
|
88
|
+
? DISPATCH_FAILURE_ERROR_CLASS_CODES[errorClass]
|
|
89
|
+
: undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Coerce an arbitrary value onto the vocabulary.
|
|
92
|
+
*
|
|
93
|
+
* Unrecognised codes collapse to `other` rather than being dropped, for the
|
|
94
|
+
* same reason #358 gives: a failure that vanished from the breakdown would make
|
|
95
|
+
* the parts stop summing to `dispatchFailures`, and a reader comparing the two
|
|
96
|
+
* would conclude the counter was broken rather than that the producer was newer.
|
|
97
|
+
*/
|
|
98
|
+
export const factoryDispatchFailureReasonCode = (value) => typeof value === 'string' &&
|
|
99
|
+
FACTORY_DISPATCH_FAILURE_REASON_CODES.includes(value)
|
|
100
|
+
? value
|
|
101
|
+
: 'other';
|
|
102
|
+
/**
|
|
103
|
+
* The per-cause breakdown of one sweep's failed dispatch attempts, counts only.
|
|
104
|
+
*
|
|
105
|
+
* Counts exactly the entries the sweep recorded as `dispatch-failed`, so the
|
|
106
|
+
* parts sum to `dispatchFailures` and to `skipReasons['dispatch-failed']` by
|
|
107
|
+
* construction. An entry whose producer recorded no `failureCode` folds into
|
|
108
|
+
* `other` for the same reason an unknown one does.
|
|
109
|
+
*
|
|
110
|
+
* Zero-count codes are omitted — the vocabulary is fixed and published, so an
|
|
111
|
+
* absent key reads as zero unambiguously. The total is carried separately by
|
|
112
|
+
* `dispatchFailures`, which is written whenever a sweep completes, so "ran and
|
|
113
|
+
* every dispatch succeeded" stays distinguishable from "never ran".
|
|
114
|
+
*/
|
|
115
|
+
export function factoryDispatchFailureReasonCounts(skipped) {
|
|
116
|
+
const counts = {};
|
|
117
|
+
if (!skipped)
|
|
118
|
+
return counts;
|
|
119
|
+
for (const entry of skipped) {
|
|
120
|
+
if (entry === null || typeof entry !== 'object' || entry.code !== 'dispatch-failed')
|
|
121
|
+
continue;
|
|
122
|
+
const code = factoryDispatchFailureReasonCode(entry.failureCode);
|
|
123
|
+
counts[code] = (counts[code] ?? 0) + 1;
|
|
124
|
+
}
|
|
125
|
+
return counts;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=dispatch-failure-reason.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch-failure-reason.js","sourceRoot":"","sources":["../../src/orchestrator/dispatch-failure-reason.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,kFAAkF;IAClF,sBAAsB;IACtB,mFAAmF;IACnF,oBAAoB;IACpB,sFAAsF;IACtF,yBAAyB;IACzB,+EAA+E;IAC/E,oBAAoB;IACpB,8EAA8E;IAC9E,2BAA2B;IAC3B,sFAAsF;IACtF,oBAAoB;IACpB,mFAAmF;IACnF,WAAW;IACX,4EAA4E;IAC5E,mBAAmB;IACnB,2EAA2E;IAC3E,0BAA0B;IAC1B,4DAA4D;IAC5D,2BAA2B;IAC3B,iFAAiF;IACjF,mBAAmB;IACnB,yEAAyE;IACzE,qBAAqB;IACrB,kEAAkE;IAClE,uBAAuB;IACvB,4DAA4D;IAC5D,OAAO;CACC,CAAA;AAIV;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,kCAAkC,GAA+D;IACrG,yBAAyB,EAAE,mBAAmB;IAC9C,0BAA0B,EAAE,0BAA0B;IACtD,6BAA6B,EAAE,2BAA2B;IAC1D,YAAY,EAAE,WAAW;IACzB,UAAU,EAAE,WAAW;CACxB,CAAA;AAED,oFAAoF;AACpF,MAAM,CAAC,MAAM,6CAA6C,GAAG,CAC3D,UAAkB,EAC4B,EAAE,CAChD,MAAM,CAAC,MAAM,CAAC,kCAAkC,EAAE,UAAU,CAAC;IAC3D,CAAC,CAAC,kCAAkC,CAAC,UAAU,CAAC;IAChD,CAAC,CAAC,SAAS,CAAA;AAEf;;;;;;;GAOG;AACH,MAAM,CAAC,MAA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