diff --git a/packages/effect-readiness/src/AwaitCondition.schema.ts b/packages/effect-readiness/src/AwaitCondition.schema.ts index 24277c8..5131891 100644 --- a/packages/effect-readiness/src/AwaitCondition.schema.ts +++ b/packages/effect-readiness/src/AwaitCondition.schema.ts @@ -2,7 +2,9 @@ import { Schema } from 'effect' import { Condition } from './Condition.schema.js' import { ProbeTarget } from './ProbeTarget.schema.js' -export class AwaitCondition extends Schema.TaggedClass()('AwaitCondition', { - target: ProbeTarget, - condition: Condition, -}) {} +export class AwaitCondition + extends Schema.TaggedClass()('AwaitCondition', { + target: ProbeTarget, + condition: Condition, + }) +{} diff --git a/packages/effect-readiness/src/ProbeVerdict.schema.ts b/packages/effect-readiness/src/ProbeVerdict.schema.ts index 7ade186..60887f8 100644 --- a/packages/effect-readiness/src/ProbeVerdict.schema.ts +++ b/packages/effect-readiness/src/ProbeVerdict.schema.ts @@ -8,12 +8,12 @@ type ProbeVerdictTypeId = typeof ProbeVerdictTypeId * `awaitCondition` hands back when the wait ends. One class, so the per-pass decision's * success variant and the public result are the same value. */ -export class Satisfied extends Schema.TaggedClass()('Satisfied', {}) { +export class Satisfied extends Schema.TaggedClass()('Satisfied', {}) { readonly [ProbeVerdictTypeId] = ProbeVerdictTypeId } /** One pass's judgement that the condition does not hold yet; the shell polls again. */ -export class NotYet extends Schema.TaggedClass()('NotYet', {}) { +export class NotYet extends Schema.TaggedClass()('NotYet', {}) { readonly [ProbeVerdictTypeId] = ProbeVerdictTypeId } diff --git a/packages/effect-readiness/src/ReadinessError.schema.ts b/packages/effect-readiness/src/ReadinessError.schema.ts index 6913917..70b24de 100644 --- a/packages/effect-readiness/src/ReadinessError.schema.ts +++ b/packages/effect-readiness/src/ReadinessError.schema.ts @@ -1,18 +1,22 @@ import { Schema } from 'effect' -export class LogSourceError extends Schema.TaggedError()('LogSourceError', { - source: Schema.String, - cause: Schema.optional(Schema.Unknown), -}) { +export class LogSourceError + extends Schema.TaggedError()('LogSourceError', { + source: Schema.String, + cause: Schema.optional(Schema.Unknown), + }) +{ override get message(): string { return `log source "${this.source}" failed` } } /** A probe command failed to decode; the wait's own read built it, so this is a defect it surfaces. */ -export class ProbeInputInvalid extends Schema.TaggedError()('ProbeInputInvalid', { - issue: Schema.String, -}) { +export class ProbeInputInvalid + extends Schema.TaggedError()('ProbeInputInvalid', { + issue: Schema.String, + }) +{ override get message(): string { return `The probe command did not decode: ${this.issue}` } diff --git a/packages/effect-readiness/src/evaluate-probe.workflow.ts b/packages/effect-readiness/src/evaluate-probe.workflow.ts index 505278d..339ec1c 100644 --- a/packages/effect-readiness/src/evaluate-probe.workflow.ts +++ b/packages/effect-readiness/src/evaluate-probe.workflow.ts @@ -5,10 +5,12 @@ import { Condition } from './Condition.schema.js' import { ProbeEvidence } from './ProbeEvidence.schema.js' import { NotYet, ProbeVerdict, Satisfied } from './ProbeVerdict.schema.js' -export class EvaluateProbe extends Schema.TaggedClass()('EvaluateProbe', { - condition: Condition, - evidence: ProbeEvidence, -}) { +export class EvaluateProbe + extends Schema.TaggedClass()('EvaluateProbe', { + condition: Condition, + evidence: ProbeEvidence, + }) +{ static readonly [Workflow.InstrumentationBrand] = {} as const } diff --git a/packages/effect-readiness/src/resolve-probe.workflow.ts b/packages/effect-readiness/src/resolve-probe.workflow.ts index 4c5df7f..9be120a 100644 --- a/packages/effect-readiness/src/resolve-probe.workflow.ts +++ b/packages/effect-readiness/src/resolve-probe.workflow.ts @@ -9,17 +9,21 @@ const ProbePlanTypeId: unique symbol = Symbol.for('@systemfsoftware/effect-readi type ProbePlanTypeId = typeof ProbePlanTypeId /** The condition names a port with no binding behind it; no host probe runs. */ -export class ProbeAbsent extends Schema.TaggedClass()('ProbeAbsent', { guestPort: Schema.Int }) { +export class ProbeAbsent + extends Schema.TaggedClass()('ProbeAbsent', { guestPort: Schema.Int }) +{ readonly [ProbePlanTypeId] = ProbePlanTypeId } /** The condition dials the bound host socket. */ -export class ProbeTcp extends Schema.TaggedClass()('ProbeTcp', { binding: PortBinding }) { +export class ProbeTcp + extends Schema.TaggedClass()('ProbeTcp', { binding: PortBinding }) +{ readonly [ProbePlanTypeId] = ProbePlanTypeId } /** The condition exchanges an HTTP request over the bound host socket. */ -export class ProbeHttp extends Schema.TaggedClass()('ProbeHttp', { +export class ProbeHttp extends Schema.TaggedClass()('ProbeHttp', { binding: PortBinding, path: Schema.String, }) { @@ -27,7 +31,9 @@ export class ProbeHttp extends Schema.TaggedClass()('ProbeHttp', { } /** The condition reads the guest log stream for a pattern. */ -export class ProbeLog extends Schema.TaggedClass()('ProbeLog', { pattern: Schema.String }) { +export class ProbeLog + extends Schema.TaggedClass()('ProbeLog', { pattern: Schema.String }) +{ readonly [ProbePlanTypeId] = ProbePlanTypeId } @@ -35,10 +41,12 @@ export class ProbeLog extends Schema.TaggedClass()('ProbeLog', { patte export const ProbePlan = Schema.Union([ProbeAbsent, ProbeTcp, ProbeHttp, ProbeLog]) export type ProbePlan = typeof ProbePlan.Type -export class ResolveProbe extends Schema.TaggedClass()('ResolveProbe', { - target: ProbeTarget, - condition: Condition, -}) { +export class ResolveProbe + extends Schema.TaggedClass()('ResolveProbe', { + target: ProbeTarget, + condition: Condition, + }) +{ static readonly [Workflow.InstrumentationBrand] = {} as const } diff --git a/packages/effect-readiness/tests/__fixtures__/loopback-service.fixture.ts b/packages/effect-readiness/tests/__fixtures__/loopback-service.fixture.ts index 1e5633b..63a72d7 100644 --- a/packages/effect-readiness/tests/__fixtures__/loopback-service.fixture.ts +++ b/packages/effect-readiness/tests/__fixtures__/loopback-service.fixture.ts @@ -17,9 +17,11 @@ export interface LoopbackService { } /** The release probe fails with this when a stopped probe still holds a server connection. */ -export class ConnectionLeak extends Schema.TaggedError()('ConnectionLeak', { - open: Schema.Int, -}) {} +export class ConnectionLeak + extends Schema.TaggedError()('ConnectionLeak', { + open: Schema.Int, + }) +{} const zeroOpenConnections = (open: () => number): Effect.Effect => Effect.repeat(