feat(ts): add real quality gates — Biome lint + effect-law ratchet + class inventory

- biome.json (2.4.16, linter-only) wired as "lint" in all six packages
- scripts/check-effect-laws.ts: Effect-native law enforcement encoding the
  adapted beep-effect effect-first/schema-first laws (no native JSON/switch/
  sort/fetch/timers, no process.env, no throw new, no Effect.run* outside
  boundaries, no Schema-suffixed constants, no node:fs/path, AST-based
  pure-data interface detection per law 38/39)
- ratcheting baseline allowlist (95 entries / 290 findings) that must shrink
  to documented exemptions only; stale counts fail the gate
- root lint chains turbo lint + law check + native-class inventory
- fix all 163 initial Biome findings: import-type style, templates, two `any`s,
  ten non-null assertions (librarian getService gate, A.matchRight in atoms,
  ensureNode returning nodes, main.tsx mount guard)

Gates: lint, check:tsgo, build, test (force, 11 tasks) all green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
elpresidank 2026-06-11 06:40:01 -05:00
parent cf12defcd8
commit 0746d7ffd5
109 changed files with 951 additions and 611 deletions

View file

@ -17,7 +17,8 @@
"build": "bunx --bun tsc",
"dev": "tsc --watch",
"clean": "rm -rf dist",
"test": "bunx --bun vitest run"
"test": "bunx --bun vitest run",
"lint": "bunx --bun biome check src"
},
"dependencies": {
"effect": "4.0.0-beta.78",

View file

@ -1,13 +1,12 @@
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import { Effect } from "effect";
import { makeConsumer, type ConsumerOptions, type FlowContext } from "../messaging/consumer.js";
import type { FlowContext } from "../messaging/consumer.js";
import { makeConsumer, } from "../messaging/consumer.js";
import type {
PubSubBackend,
BackendConsumer,
Message,
BackendProducer,
CreateProducerOptions,
CreateConsumerOptions,
} from "../backend/types.js";
import { tooManyRequestsError } from "../errors.js";
import type { Flow } from "../processor/flow.js";

View file

@ -1,6 +1,16 @@
import { describe, expect, it } from "@effect/vitest";
import { ConfigProvider, Effect, Fiber } from "effect";
import * as S from "effect/Schema";
import type {
BackendConsumer,
BackendProducer,
CreateConsumerOptions,
CreateProducerOptions,
EmbeddingsRequest,
EmbeddingsResponse,
Message,
PubSubBackend,
} from "../index.js";
import {
Embeddings,
EmbeddingsService,
@ -9,14 +19,6 @@ import {
embeddingsError,
runProcessorScoped,
topics,
type BackendConsumer,
type BackendProducer,
type CreateConsumerOptions,
type CreateProducerOptions,
type EmbeddingsRequest,
type EmbeddingsResponse,
type Message,
type PubSubBackend,
} from "../index.js";
class WaitForTimeout extends S.TaggedErrorClass<WaitForTimeout>()(

View file

@ -1,6 +1,15 @@
import { describe, expect, it } from "@effect/vitest";
import { ConfigProvider, Effect, Fiber } from "effect";
import * as S from "effect/Schema";
import type {
BackendConsumer,
BackendProducer,
CreateConsumerOptions,
CreateProducerOptions,
Message,
ProcessorConfig,
PubSubBackend,
} from "../index.js";
import {
FlowProcessor,
MessagingRuntimeLive,
@ -9,13 +18,6 @@ import {
runFlowProcessorDefinitionScoped,
runProcessorScoped,
topics,
type BackendConsumer,
type BackendProducer,
type CreateConsumerOptions,
type CreateProducerOptions,
type Message,
type ProcessorConfig,
type PubSubBackend,
} from "../index.js";
class WaitForTimeout extends S.TaggedErrorClass<WaitForTimeout>()(

View file

@ -2,6 +2,15 @@ import { describe, expect, it } from "@effect/vitest";
import { ConfigProvider, Duration, Effect, Fiber } from "effect";
import * as S from "effect/Schema";
import * as TestClock from "effect/testing/TestClock";
import type {
BackendConsumer,
BackendProducer,
CreateConsumerOptions,
CreateProducerOptions,
FlowContext,
Message,
PubSubBackend,
} from "../index.js";
import {
makeConsumerSpec,
Flow,
@ -10,13 +19,6 @@ import {
makeProducerSpec,
PubSub,
makeRequestResponseSpec,
type BackendConsumer,
type BackendProducer,
type CreateConsumerOptions,
type CreateProducerOptions,
type FlowContext,
type Message,
type PubSubBackend,
} from "../index.js";
function createMessage<T>(value: T, properties: Record<string, string> = {}): Message<T> {

View file

@ -1,6 +1,15 @@
import { describe, expect, it } from "@effect/vitest";
import { Duration, Effect, Fiber } from "effect";
import * as TestClock from "effect/testing/TestClock";
import type {
BackendConsumer,
BackendProducer,
CreateConsumerOptions,
CreateProducerOptions,
FlowContext,
Message,
PubSubBackend,
} from "../index.js";
import {
PubSub,
defaultMessagingRuntimeConfig,
@ -11,13 +20,6 @@ import {
runEffectProducerScoped,
runFlowScoped,
tooManyRequestsError,
type BackendConsumer,
type BackendProducer,
type CreateConsumerOptions,
type CreateProducerOptions,
type FlowContext,
type Message,
type PubSubBackend,
} from "../index.js";
import type { Flow } from "../processor/flow.js";
import { Flow as RuntimeFlow } from "../processor/flow.js";

View file

@ -1,13 +1,15 @@
import { describe, expect, it } from "vitest";
import { Effect } from "effect";
import type {
BackendConsumer,
BackendProducer,
CreateConsumerOptions,
CreateProducerOptions,
PubSubBackend,
} from "../index.js";
import {
makeProducer,
pubSubError,
type BackendConsumer,
type BackendProducer,
type CreateConsumerOptions,
type CreateProducerOptions,
type PubSubBackend,
} from "../index.js";
class ProducerBackend implements PubSubBackend {

View file

@ -1,13 +1,15 @@
import { describe, expect, it } from "vitest";
import { Effect } from "effect";
import type {
BackendConsumer,
BackendProducer,
CreateConsumerOptions,
CreateProducerOptions,
Message,
PubSubBackend,
} from "../index.js";
import {
makeRequestResponse,
type BackendConsumer,
type BackendProducer,
type CreateConsumerOptions,
type CreateProducerOptions,
type Message,
type PubSubBackend,
} from "../index.js";
function createMessage<T>(value: T, properties: Record<string, string> = {}): Message<T> {

View file

@ -1,18 +1,20 @@
import { describe, expect, it } from "@effect/vitest";
import { Effect } from "effect";
import * as S from "effect/Schema";
import type {
BackendConsumer,
BackendProducer,
CreateConsumerOptions,
CreateProducerOptions,
Message,
ProcessorConfig,
PubSubBackend,
} from "../index.js";
import {
PubSub,
makeAsyncProcessor,
pubSubError,
runProcessorScoped,
type BackendConsumer,
type BackendProducer,
type CreateConsumerOptions,
type CreateProducerOptions,
type Message,
type ProcessorConfig,
type PubSubBackend,
} from "../index.js";
class RuntimeServicesTestError extends S.TaggedErrorClass<RuntimeServicesTestError>()(

View file

@ -8,16 +8,18 @@
* Python reference: trustgraph-base/trustgraph/base/pulsar_backend.py
*/
import type {
NatsConnection,
JetStreamClient,
JetStreamManager,
Consumer as NatsJsConsumer,
JsMsg,
JetStreamPublishOptions,
} from "nats";
import {
connect,
ErrorCode,
type NatsConnection,
type JetStreamClient,
type JetStreamManager,
type Consumer as NatsJsConsumer,
headers,
type JsMsg,
type JetStreamPublishOptions,
NatsError,
StringCodec,
AckPolicy,
@ -36,7 +38,8 @@ import type {
CreateConsumerOptions,
Message,
} from "./types.js";
import { pubSubError, type PubSubError } from "../errors.js";
import type { PubSubError } from "../errors.js";
import { pubSubError, } from "../errors.js";
const sc = StringCodec();

View file

@ -7,20 +7,25 @@
import type { PubSubBackend } from "../backend/types.js";
import { PubSub } from "../backend/pubsub.js";
import type { Flow } from "../processor/flow.js";
import {
import type {
MessagingHandlerError,
MessagingLifecycleError,
} from "../errors.js";
import {
TooManyRequestsError,
messagingHandlerError,
messagingLifecycleError,
type MessagingLifecycleError,
} from "../errors.js";
import { Config as EffectConfig, Effect, Exit, Scope } from "effect";
import type { Config as EffectConfig, } from "effect";
import { Effect, Exit, Scope } from "effect";
import * as P from "effect/Predicate";
import * as S from "effect/Schema";
import { loadMessagingRuntimeConfig } from "../runtime/index.ts";
import type {
EffectConsumer,
} from "./runtime.js";
import {
makeEffectConsumerFromPubSub,
type EffectConsumer,
} from "./runtime.js";
export type MessageHandler<T> = (

View file

@ -8,11 +8,14 @@ import type { PubSubBackend } from "../backend/types.js";
import type { ProducerMetrics } from "../metrics/index.ts";
import { Effect, Exit, Scope } from "effect";
import { PubSub } from "../backend/pubsub.js";
import { makeEffectProducerFromPubSub, type EffectProducer } from "./runtime.js";
import type { EffectProducer } from "./runtime.js";
import { makeEffectProducerFromPubSub, } from "./runtime.js";
import type {
MessagingDeliveryError,
MessagingLifecycleError,
} from "../errors.js";
import {
messagingLifecycleError,
type MessagingDeliveryError,
type MessagingLifecycleError,
} from "../errors.js";
export interface Producer<T> {

View file

@ -7,21 +7,26 @@
* Python reference: trustgraph-base/trustgraph/base/request_response_spec.py
*/
import { Config as EffectConfig, Effect, Exit, Scope } from "effect";
import type { Config as EffectConfig, } from "effect";
import { Effect, Exit, Scope } from "effect";
import type { PubSubBackend } from "../backend/types.js";
import { PubSub } from "../backend/pubsub.js";
import type {
MessagingDeliveryError,
MessagingLifecycleError,
MessagingTimeoutError,
PubSubError,
} from "../errors.js";
import {
messagingLifecycleError,
type MessagingDeliveryError,
type MessagingLifecycleError,
type MessagingTimeoutError,
type PubSubError,
} from "../errors.js";
import { loadMessagingRuntimeConfig } from "../runtime/index.ts";
import type {
EffectRequestOptions,
EffectRequestResponse,
} from "./runtime.js";
import {
makeEffectRequestResponseFromPubSub,
type EffectRequestOptions,
type EffectRequestResponse,
} from "./runtime.js";
export interface RequestResponseOptions {

View file

@ -3,6 +3,9 @@
*/
import { randomUUID } from "node:crypto";
import type {
Scope,
} from "effect";
import {
Context,
Deferred,
@ -14,7 +17,6 @@ import {
Ref,
Result,
Schedule,
Scope,
Stream,
} from "effect";
import * as O from "effect/Option";
@ -26,7 +28,16 @@ import type {
CreateProducerOptions,
Message,
} from "../backend/types.js";
import { PubSub, type PubSubService } from "../backend/pubsub.js";
import type { PubSubService } from "../backend/pubsub.js";
import { PubSub, } from "../backend/pubsub.js";
import type {
FlowRuntimeError,
MessagingDeliveryError,
MessagingHandlerError,
MessagingLifecycleError,
MessagingTimeoutError,
PubSubError,
} from "../errors.js";
import {
flowRuntimeError,
messagingDeliveryError,
@ -34,20 +45,16 @@ import {
messagingLifecycleError,
messagingTimeoutError,
TooManyRequestsError,
type FlowRuntimeError,
type MessagingDeliveryError,
type MessagingHandlerError,
type MessagingLifecycleError,
type MessagingTimeoutError,
type PubSubError,
} from "../errors.js";
import type { ProducerMetrics } from "../metrics/index.js";
import type { FlowContext } from "./consumer.js";
import type { Flow } from "../processor/flow.js";
import type { SpecRuntimeRequirements } from "../spec/types.js";
import type {
MessagingRuntimeConfig,
} from "../runtime/messaging-config.js";
import {
loadMessagingRuntimeConfig,
type MessagingRuntimeConfig,
} from "../runtime/messaging-config.js";
const isTooManyRequestsError = S.is(TooManyRequestsError);

View file

@ -4,7 +4,8 @@
* Python reference: trustgraph-base/trustgraph/base/metrics.py
*/
import { Effect, Metric } from "effect";
import type { Effect, } from "effect";
import { Metric } from "effect";
import { PrometheusMetrics } from "effect/unstable/observability";
export const prometheusContentType = "text/plain; version=0.0.4; charset=utf-8";

View file

@ -8,8 +8,10 @@
import type { PubSubBackend } from "../backend/types.js";
import { makeNatsBackend, makeNatsBackendScoped } from "../backend/nats.js";
import { Cause, Config as EffectConfig, Context, Effect } from "effect";
import { processorLifecycleError, type ProcessorLifecycleError } from "../errors.js";
import type { Cause, Config as EffectConfig, } from "effect";
import { Context, Effect } from "effect";
import type { ProcessorLifecycleError } from "../errors.js";
import { processorLifecycleError, } from "../errors.js";
import { loadProcessorRuntimeConfig } from "../runtime/config.js";
export interface ProcessorConfig {

View file

@ -7,23 +7,28 @@
* Python reference: trustgraph-base/trustgraph/base/flow_processor.py
*/
import type {
AsyncProcessorRuntime,
EffectConfigHandler,
ProcessorRuntime,
ProcessorConfig,
} from "./async-processor.js";
import {
makeAsyncProcessor,
type AsyncProcessorRuntime,
type EffectConfigHandler,
type ProcessorRuntime,
type ProcessorConfig,
} from "./async-processor.js";
import type { Spec } from "../spec/types.js";
import type { BackendConsumer, PubSubBackend } from "../backend/types.js";
import { Flow, type FlowDefinition } from "./flow.js";
import type { FlowDefinition } from "./flow.js";
import { Flow, } from "./flow.js";
import { topics } from "../schema/topics.js";
import type {
FlowRuntimeError,
ProcessorLifecycleError,
PubSubError,
} from "../errors.js";
import {
errorMessage,
pubSubError,
type FlowRuntimeError,
type ProcessorLifecycleError,
type PubSubError,
} from "../errors.js";
import {
ConsumerFactory,
@ -37,7 +42,8 @@ import {
} from "../messaging/runtime.js";
import { makePubSubService, PubSub } from "../backend/pubsub.js";
import { loadMessagingRuntimeConfig } from "../runtime/index.ts";
import { Config as EffectConfig, Context, Duration, Effect, Exit, Scope } from "effect";
import type { Config as EffectConfig, Context, } from "effect";
import { Duration, Effect, Exit, Scope } from "effect";
import * as MutableHashMap from "effect/MutableHashMap";
import * as O from "effect/Option";
import * as S from "effect/Schema";

View file

@ -4,30 +4,35 @@
* Python reference: trustgraph-base/trustgraph/base/flow.py
*/
import { Config as EffectConfig, Context, Effect, Exit, Scope } from "effect";
import type { Config as EffectConfig, Context, } from "effect";
import { Effect, Exit, Scope } from "effect";
import * as MutableHashMap from "effect/MutableHashMap";
import * as O from "effect/Option";
import * as S from "effect/Schema";
import type { PubSubBackend } from "../backend/types.js";
import { makePubSubService } from "../backend/pubsub.js";
import type {
FlowParameterDecodeError,
FlowResourceNotFoundError,
MessagingDeliveryError,
MessagingLifecycleError,
MessagingTimeoutError,
PubSubError,
} from "../errors.js";
import {
flowParameterDecodeError,
flowResourceNotFoundError,
type FlowParameterDecodeError,
type FlowResourceNotFoundError,
type MessagingDeliveryError,
type MessagingLifecycleError,
type MessagingTimeoutError,
type PubSubError,
} from "../errors.js";
import type {
EffectConsumer,
EffectProducer,
EffectRequestOptions,
EffectRequestResponse,
} from "../messaging/runtime.js";
import {
ConsumerFactory,
ProducerFactory,
RequestResponseFactory,
type EffectConsumer,
type EffectProducer,
type EffectRequestOptions,
type EffectRequestResponse,
makeConsumerFactoryService,
makeProducerFactoryService,
makeRequestResponseFactoryService,

View file

@ -5,11 +5,12 @@
* executable path while the processor internals remain Promise-based.
*/
import { Config as EffectConfig, Effect, Layer } from "effect";
import {
type FlowRuntimeError,
type ProcessorLifecycleError,
type PubSubError,
import type { Config as EffectConfig, } from "effect";
import { Effect, Layer } from "effect";
import type {
FlowRuntimeError,
ProcessorLifecycleError,
PubSubError,
} from "../errors.js";
import { makeNatsBackendScoped } from "../backend/nats.js";
import { makePubSubService, PubSub } from "../backend/pubsub.js";
@ -23,9 +24,11 @@ import {
makeRequestResponseFactoryService,
runFlowRuntimeScoped,
} from "../messaging/runtime.js";
import type {
ProcessorRuntimeConfigOptions,
} from "../runtime/config.js";
import {
loadProcessorRuntimeConfig,
type ProcessorRuntimeConfigOptions,
} from "../runtime/config.js";
import { loadMessagingRuntimeConfig } from "../runtime/messaging-config.js";
import type {

View file

@ -5,11 +5,13 @@
*/
import { Context, Effect } from "effect";
import type {
EmbeddingsError,
FlowResourceNotFoundError,
MessagingDeliveryError,
} from "../errors.js";
import {
errorMessage,
type EmbeddingsError,
type FlowResourceNotFoundError,
type MessagingDeliveryError,
} from "../errors.js";
import type { FlowContext } from "../messaging/consumer.js";
import { makeFlowProcessor } from "../processor/index.ts";

View file

@ -6,10 +6,12 @@
import { Context, Effect, Stream } from "effect";
import * as S from "effect/Schema";
import type {
FlowResourceNotFoundError,
MessagingDeliveryError,
} from "../errors.js";
import {
errorMessage,
type FlowResourceNotFoundError,
type MessagingDeliveryError,
} from "../errors.js";
import type { FlowContext } from "../messaging/consumer.js";
import { makeFlowProcessor } from "../processor/index.ts";

View file

@ -8,12 +8,14 @@ import { Effect } from "effect";
import type { Spec } from "./types.js";
import type { SpecRuntimeRequirements } from "./types.js";
import type { Flow, FlowDefinition } from "../processor/flow.js";
import {
ConsumerFactory,
type EffectMessageHandler,
import type {
EffectMessageHandler,
} from "../messaging/runtime.js";
import {
type PubSubError,
ConsumerFactory,
} from "../messaging/runtime.js";
import type {
PubSubError,
} from "../errors.js";
declare const ConsumerSpecType: unique symbol;

View file

@ -7,13 +7,17 @@
import { Effect } from "effect";
import type { SpecRuntimeRequirements } from "./types.js";
import type { Flow, FlowDefinition } from "../processor/flow.js";
import {
flowResourceNotFoundError,
type FlowResourceNotFoundError,
type PubSubError,
import type {
FlowResourceNotFoundError,
PubSubError,
} from "../errors.js";
import {
type EffectProducer,
flowResourceNotFoundError,
} from "../errors.js";
import type {
EffectProducer,
} from "../messaging/runtime.js";
import {
ProducerFactory,
} from "../messaging/runtime.js";

View file

@ -10,13 +10,17 @@
import { Effect } from "effect";
import type { SpecRuntimeRequirements } from "./types.js";
import type { Flow, FlowDefinition } from "../processor/flow.js";
import {
flowResourceNotFoundError,
type FlowResourceNotFoundError,
type PubSubError,
import type {
FlowResourceNotFoundError,
PubSubError,
} from "../errors.js";
import {
type EffectRequestResponse,
flowResourceNotFoundError,
} from "../errors.js";
import type {
EffectRequestResponse,
} from "../messaging/runtime.js";
import {
RequestResponseFactory,
} from "../messaging/runtime.js";