Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

RetryOrigin

Failure-aware retry ownership for distributed Node.js services.

RetryOrigin helps distributed services communicate retry decisions so upstream services can avoid repeating recovery attempts already exhausted downstream.

Project status

Version: 0.1.0

Development status: Early development. APIs and protocol may change before the first stable release.

Features

  • Typed retry ownership metadata.
  • Versioned HTTP header protocol.
  • Metadata validation and parsing.
  • Explicit trusted-source evaluation.
  • Native Node.js HTTP adapter.
  • Native Fetch adapter.
  • Zero required runtime dependencies.

Requirements

  • Node.js 24 or newer.

Installation

Install using npm:

npm install retryorigin

Basic usage

import { evaluateRetry, parseMetadata } from "retryorigin";

const result = parseMetadata({
  "retryorigin-version": "1",
  "retryorigin-owner": "payment-service",
  "retryorigin-decision": "exhausted",
  "retryorigin-operation": "charge-payment",
});

const metadata = result.valid ? result.metadata : null;

const decision = evaluateRetry(metadata, {
  trusted: true,
  operation: "charge-payment",
});

if (decision === "suppress") {
  console.log("Do not repeat this operation automatically.");
}

Only set trusted to true after your application has established that the metadata came from an authenticated, trusted internal service.

Never trust arbitrary client-provided RetryOrigin headers.

Protocol decisions

  • exhausted: The owner exhausted its retry responsibility.
  • not-retryable: The owner determined the operation must not be retried.
  • retryable: The failure may be retried by an explicitly authorized policy.

Safety

RetryOrigin does not provide exactly-once execution, automatic deduplication, distributed transactions, or guaranteed delivery.

It does not determine whether a request is safe to retry. Applications must implement appropriate idempotency and authentication safeguards.

Development

Run these commands from the project directory:

npm install
npm test
npm run typecheck
npm run build
npm run demo:failure

License

MIT

About

No description, website, or topics provided.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages