npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@overengineered-solutions/observability

v0.2.0

Published

Observability doctrine wrappers — Zod-parse, first-call shape, iteration counts, daily smoke. Prevents the silent-zero failure mode.

Readme

@overengineered-solutions/observability

Observability-doctrine wrappers — Zod-parse, first-call shape, iteration counts. Prevents the silent-zero failure mode.

Encodes the doctrine from OES sibling repos' CLAUDE.md → "Observability doctrine — silent-zero is the failure mode" mechanically: every external API wrapper Zod-parses its responses, surfaces the response shape on first call, logs processed-vs-expected counts at iteration boundaries, and never silently coerces a payload of the wrong shape.

Install

pnpm add @overengineered-solutions/observability zod

zod >=3.22.0 is a required peer.

Usage

import { z } from 'zod';
import {
  parseExternal,
  logIteration,
  observeFirstCallShape,
  type EventSink,
} from '@overengineered-solutions/observability';

const RepoSchema = z.object({ id: z.number(), name: z.string() });

// 1) Zod-parse every external response. On mismatch: emits api_shape_mismatch
//    to the sink and throws — never returns a silently-coerced response.
const repo = parseExternal(RepoSchema, await res.json(), {
  integration: 'github',
  endpoint: '/repos/{owner}/{repo}',
  sink,
});

// 2) First-call shape observability. Auto-suppresses after first call per
//    (integration, endpoint) tuple. Safe to wire into prod request paths.
observeFirstCallShape({
  integration: 'github',
  endpoint: '/repos/{owner}/{repo}',
  payload: await res.json(),
  sink,
});

// 3) Iteration-boundary counts. severity='warn' when expected>0 && processed===0
//    (the silent-zero pattern this package guards against).
logIteration({
  integration: 'github',
  processed: rows.length,
  expected: total,
  sink,
});

httpFetch — resilient external fetch + timing telemetry

httpFetch(url, init?, opts?) is a thin fetch wrapper with an AbortController timeout and optional retry. It returns the Response unchanged, so it is a drop-in for fetch at the callsite.

import { httpFetch, type ApiTimingEvent } from '@overengineered-solutions/observability';

const res = await httpFetch(
  'https://api.vendor.com/v1/things',
  { method: 'POST', body, signal: callerSignal },
  {
    timeoutMs: 15_000,
    retries: 2,                 // default 0 — see backward-compat note below
    backoffMs: 500,             // base for exponential backoff
    integration: 'vendor',      // enables the api_timing event…
    endpoint: 'POST /v1/things',
    sink,                       // …when integration + endpoint + sink all present
    tenantId: 'oes-self',       // optional attribution
    client: 'conn-123',         // optional attribution
  },
);

Behavior (all additive over 0.1):

  • Retries. When retries > 0, transient statuses are retried with exponential backoff (backoffMs * 2^attempt + jitter). The retriable set defaults to [408, 429, 500, 502, 503, 504] and is overridable via retryOnStatus. Retriable network errors (the timeout AbortError and a fetch TypeError) are retried too. Non-transient 4xx are returned immediately — they don't recover by retrying. After the retry ceiling the last response is returned (or the last error thrown).
  • Backward-compatible default. retries defaults to 0, so existing 0.1 callers passing only { integration, endpoint, sink } (or nothing) make a single attempt and behave identically. retryOnStatus has no effect when retries is 0.
  • AbortSignal merging. A caller-supplied init.signal is merged with the internal timeout signal via AbortSignal.any(), so either source can abort the in-flight request. Where AbortSignal.any is unavailable, it falls back to the timeout signal alone.
  • api_timing telemetry. When integration + endpoint + sink are all present, exactly one best-effort ApiTimingEvent is emitted per call (attempts, totalMs, status, retried, ok, error_kind, plus client / tenantId). Emission is wrapped — a throwing sink never masks the request result or its error.

Attribution context

httpFetch, parseExternal, logIteration, and observeFirstCallShape all accept optional client? and tenantId? fields. When set, they are threaded onto the emitted event so downstream sinks can attribute observability events to a tenant / upstream connection. Omitting them is fully backward-compatible.

EventSink

Provide your own sink (any object with emit(event)) to forward observability events into your audit log / Sentry / supabase outbox / etc. The sink receives any ObservabilityEventapi_shape_mismatch, iteration_count, shape_observed, or api_timing. A tiny createMemorySink() factory is exported under @overengineered-solutions/observability/sinks/memory for tests.

License

MIT