DATA & SECURITY

Useful evidence.
Explicit boundaries.

What Nestarc collects, how workspace access works, and the boundaries of the free beta.

01 / EVIDENCE DATA

A defined metadata allowlist.

Evidence describes delivery boundaries without carrying the business payload.

Included in evidence

  • Schema version and event ID
  • Opaque execution and operation references
  • Optional opaque tenant reference
  • Source stage, status, and occurrence time
  • Optional attempt, duration, and allowlisted error code
  • Collector receipt time, recorded separately

Excluded from evidence

  • Request and response payloads
  • Headers and raw URLs
  • SQL and stack traces
  • Email addresses and customer identifiers

Unknown fields and invalid stage, status, or error-code combinations are rejected.

References must be opaque values. Do not put names, emails, business identifiers, or other sensitive values inside them. A field allowlist does not make an arbitrary reference safe.

“Metadata only” describes evidence.

GitHub login separately processes account and session information. This includes an account email and stable GitHub ID; these are kept outside the evidence records.

02 / DATA FLOW

From delivery boundaries to a read-only view.

The supported path is HTTP request → PostgreSQL transaction and outbox → BullMQ worker → customer webhook.

  1. The source emits allowed metadata.

    You instrument the supported boundaries in your existing Node.js application, PostgreSQL outbox, BullMQ worker, and webhook receiver. The exporter is bounded, non-blocking, and best effort. Export failure must not fail the business operation, so evidence can be incomplete.

  2. The collector validates and stores evidence.

    A Cloudflare Worker hosts the Evidence API and built web pages. The API verifies a workspace-specific ingest credential and stores validated evidence in D1 under that workspace, with source and receipt times kept separate.

  3. Approved viewers read their workspace.

    The server checks the viewer’s session, current terms acceptance, and workspace membership before returning evidence. The dashboard presents the execution list, timeline, and allowed metadata.

Learn to interpret evidence

03 / ACCESS AND IDENTITY

Separate credentials.
Scoped access.

A machine sending evidence and a person reading it use different authorization paths.

Workspace ingest credentials

Each ingest credential is tied to one workspace. D1 stores its digest, expiry, and revocation information rather than the original credential. A rejected credential prevents evidence ingestion; it does not stop the source business operation.

GitHub login and server sessions

Login uses GitHub and a separate D1 store for accounts and sessions. The account record includes an internal ID, email, and stable GitHub ID. Provider access, refresh, and ID tokens are not retained in account records; stored sessions omit IP addresses and user agents.

Session tokens are stored in the authentication database and validated by the server. They have a fixed seven-day lifetime; logout or revocation removes the session. Session expiry does not guarantee physical deletion of every expired record.

Workspace membership

Logging in does not grant access to someone else’s evidence. Creating your own workspace grants its scoped read access; an operator approves viewer membership for an existing workspace. Server checks enforce that scope, and account or workspace changes clear previously displayed evidence.

Evaluation terms require a separate explicit acceptance. Personal viewer acceptance does not authorize an organization to provide customer metadata. Privacy information, support and rights guidance, logout, and account closure remain available without terms acceptance.

Creating a workspace separately requires authority to connect the system and instruct metadata processing. Its owner can create, replace, and revoke ingest credentials in Connect. A new credential is shown once after activation; save it in your server’s secret store. Designated operators manage viewer memberships. The dashboard has no business recovery controls.

04 / CURRENT SCOPE

An early evaluation, with limits made clear.

The free beta supports permitted metadata from an authorized application, subject to the current terms and collection limits.

Read-only business operations

Nestarc does not replay, retry, or remotely recover deliveries. Refreshing the dashboard repeats a read request. Missing evidence remains an unknown observation; it is not proof that an operation failed or never ran.

Retention, limits, and support

Review the current beta limits during setup and the versioned privacy notice for storage, cleanup, and account handling. Missing Evidence can result from a collection limit, delayed export, instrumentation loss, or expiry; a connection check alone does not prove collection or business success.

For deletion and other rights requests, use the current support guidance. Submitting a closure request and completing deletion are separate steps; a request is not proof that every retained copy has been removed.

The paid-plan retention windows on the pricing page remain proposals. Read the applicable versioned evaluation terms for the configured scope. Paid subscriptions are not open.

05 / VERIFICATION

Check the evidence behind the claims.

Dated tests show what worked in a defined environment. Start with a small trial in your own system.

Installed SDK → production collector → dashboard

On 3 October 2026 (KST), we installed the published Node SDK 0.3.0 outside the repository and ran its packaged example against the production collector. Separate API, outbox relay, worker and receiver processes used local PostgreSQL and Redis and an existing dedicated test account.

  • Complete delivery: 8 of 8 expected events received.
  • Worker failed: 5 of 5 expected events received.
  • Webhook response unknown: 6 of 6 expected events received.
  • Evidence interrupted: 4 of 4 expected events received.

All four classifications were checked, then the test credential was revoked. The inputs were synthetic. This verifies that release and test path; it does not establish a new account signup, a real customer installation, or guaranteed delivery.

Tested service source: 35cacc5. SDK archive and reviewable source: 0.3.0 release details. This is a historical check, separate from the local measurements below.

What did the SDK add in a local test?

On 2026-10-04 (KST), we compared the installed SDK 0.3.0 with the same small synthetic handler without the SDK. Each condition ran in 5 fresh Node.js processes with 100 calls each, paced at about 50 calls per second.

The SDK created and serialized a delivery context and started three observations per call. The handler never waited for exports. All 2,000 synthetic business computations completed.

Scroll the table sideways to see timing and received observation counts.

Handler time, including instrumentation. Median of five per-run percentiles.
Conditionp50p95Observations accepted
Without SDK0.082 ms0.333 msNone sent
SDK · immediate response0.454 ms1.677 ms1,500 / 1,500
SDK · response delayed 2.1 s0.292 ms1.170 ms70 / 1,500
SDK · connection reset0.488 ms2.323 ms0 / 1,500

Continuing business work does not guarantee complete evidence. The delayed collector filled the bounded queue; excess observations were dropped. The connection-reset condition returned no successful exports. These are local handler measurements, not HTTP request latency or a prediction for your workload.

Environment, variation, losses and memory

Apple M1 Pro; darwin 27.0.0 (arm64); Node.js v24.11.1; 16 GiB system memory. This was a shared development machine, not an isolated benchmark host. The dependency was zod 4.4.3.

p50 is the middle call; p95 includes 95% of calls in a run. The table below shows observed variation across five runs, not a confidence interval. Cold first calls are included. Startup and SDK import time are excluded from handler and CPU timings.

Scroll the table sideways to see all resource measurements.

Whole child-process resources during the approximately two-second workload.
Conditionp95 rangeCPU medianPeak RSS median
Without SDK0.059–0.468 ms42.59 ms54.31 MiB
SDK · immediate response0.541–4.696 ms380.56 ms115.8 MiB
SDK · response delayed 2.1 s0.260–2.297 ms91.16 ms72.94 MiB
SDK · connection reset0.799–2.712 ms448.52 ms100.41 MiB

CPU includes exporter and measurement callbacks but excludes the separate collector. RSS is sampled whole-process memory every 10 ms, not SDK allocation. The harness retains outcome promises; sampling can miss short peaks. We did not force garbage collection or measure long-running memory behavior. Export draining happens after business timing; its duration, CPU and final memory are recorded separately below.

  • SDK · immediate response: No lost observations in these runs.
  • SDK · response delayed 2.1 s: 1,415 capacity, 5 expired, 10 transport.
  • SDK · connection reset: 1,500 transport.

The reporter used one active send, 16 waiting observations, a five-second send timeout and a 30-second total observation lifetime. The example’s 128-context limit was retained. There were no retries or duplicate event IDs in the capture. A local 202 response does not certify production authorization or durable storage.

This test does not measure PostgreSQL, BullMQ, HTTPS, wide-area networks, new signup or customer installations. It is evidence of a bounded local behavior, not zero overhead or a guarantee for every application.

Inspect results and test method

The SDK was installed offline outside the repository. The measured archive SHA-256 is 4ffb06af8f2d5a4457238695e0010fd3fe6c79139579695b16e094e5166485c5. Compare it with the SDK release details.

The result’s sourceCommit records the repository HEAD at measurement time. The measurement script included uncommitted changes then; its separate SHA-256 identifies the exact method, rather than that commit alone.

Maintainer reproduction: npm run build --workspace=@nestarc/evidence && node scripts/sdk-overhead-benchmark.mjs. This requires the matching Nestarc source checkout; it is not a standalone customer command. The script below lets you inspect the method. It installs into a temporary directory, binds only to loopback and uses synthetic credentials. This page displays it as text and does not run it.

To try the published SDK in your own environment, follow the small staging trial and packaged local example.

Machine-readable results and individual runs
{
  "schemaVersion": "nestarc.sdk-benchmark.v1",
  "measuredAt": "2026-10-03T15:49:58.809Z",
  "scope": "local-synthetic-handler",
  "sourceCommit": "7877067fec92c21c0b653c6bb1617a1beb17b1bc",
  "sdk": {
    "version": "0.3.0",
    "archive": "nestarc-evidence-0.3.0.tgz",
    "sha256": "4ffb06af8f2d5a4457238695e0010fd3fe6c79139579695b16e094e5166485c5",
    "bytes": 30459,
    "zodVersion": "4.4.3",
    "separateOfflineInstall": true
  },
  "reproducibility": {
    "script": "scripts/sdk-overhead-benchmark.mjs",
    "scriptSha256": "b5243611aadd2eee379a822fb9ed591ccd428de8d378fe6a2057ab8cbe099894",
    "packagingScript": "scripts/sdk-package.mjs",
    "packagingScriptSha256": "07056fdf72951ed770ae5750fd6436b5b8a8246f2b77d66088aca3c6dec1568e",
    "command": "npm run build --workspace=@nestarc/evidence && node scripts/sdk-overhead-benchmark.mjs"
  },
  "environment": {
    "node": "v24.11.1",
    "os": "darwin",
    "osRelease": "27.0.0",
    "architecture": "arm64",
    "cpu": "Apple M1 Pro",
    "logicalCpus": 10,
    "systemMemoryGiB": 16,
    "dedicatedHost": false
  },
  "settings": {
    "repetitions": 5,
    "operationsPerRun": 100,
    "intervalMs": 20,
    "eventsPerOperation": 3,
    "slowResponseMs": 2100,
    "sampleIntervalMs": 10,
    "maxInFlight": 1,
    "maxPending": 16,
    "timeoutMs": 5000,
    "maxObservationLifetimeMs": 30000,
    "maxTrackedExecutions": 128,
    "executionTtlMs": 300000
  },
  "method": [
    "Five fresh child processes per condition; rotating condition order; no forced GC or warmup.",
    "100 calls per process, paced at 20 ms. Same opaque IDs and SHA-256 synthetic business work in each condition.",
    "SDK additionally creates/serializes delivery context and emits three observations. Handler timing never awaits exports.",
    "Normal returns local HTTP 202; slow waits 2100 ms; unavailable resets the local socket without a response.",
    "CPU covers the child workload including exporter and measurement callbacks, excludes collector process and startup/import. Drain CPU is separate.",
    "RSS/heap are whole child-process samples every 10 ms during workload. Initial and post-drain samples are retained; no GC control.",
    "Summaries are medians and observed min/max across five per-run values, not confidence intervals. First/cold call remains in each latency distribution."
  ],
  "limitations": [
    "Not HTTP API latency, database/BullMQ performance, HTTPS/WAN load or a customer benchmark.",
    "Slow collector intentionally saturates the finite queue; low handler time with lost observations is not full delivery performance.",
    "Import/startup latency, long-run memory, OS scheduling isolation and customer workload impact were not measured.",
    "Local 202 acceptance is not production authorization, durable storage or signup-to-first-Evidence proof. No zero-overhead claim."
  ],
  "summary": [
    {
      "mode": "baseline",
      "runs": 5,
      "operations": 500,
      "handlerP50Us": {
        "median": 82.209,
        "min": 34.208,
        "max": 112.25
      },
      "handlerP95Us": {
        "median": 333.042,
        "min": 59.5,
        "max": 468.041
      },
      "workloadCpuMs": {
        "median": 42.591,
        "min": 20.857,
        "max": 49.509
      },
      "sampledPeakRssMiB": {
        "median": 54.313,
        "min": 54.125,
        "max": 54.563
      },
      "accepted": 0,
      "losses": {}
    },
    {
      "mode": "normal",
      "runs": 5,
      "operations": 500,
      "handlerP50Us": {
        "median": 453.792,
        "min": 280.334,
        "max": 502.292
      },
      "handlerP95Us": {
        "median": 1677.209,
        "min": 540.959,
        "max": 4696.292
      },
      "workloadCpuMs": {
        "median": 380.556,
        "min": 268.902,
        "max": 429.976
      },
      "sampledPeakRssMiB": {
        "median": 115.797,
        "min": 115.172,
        "max": 117.672
      },
      "accepted": 1500,
      "losses": {}
    },
    {
      "mode": "slow",
      "runs": 5,
      "operations": 500,
      "handlerP50Us": {
        "median": 292.208,
        "min": 139.792,
        "max": 450.833
      },
      "handlerP95Us": {
        "median": 1170.292,
        "min": 259.625,
        "max": 2297.5
      },
      "workloadCpuMs": {
        "median": 91.155,
        "min": 58.095,
        "max": 112.53
      },
      "sampledPeakRssMiB": {
        "median": 72.938,
        "min": 72.828,
        "max": 73.078
      },
      "accepted": 70,
      "losses": {
        "capacity": 1415,
        "expired": 5,
        "transport": 10
      }
    },
    {
      "mode": "unavailable",
      "runs": 5,
      "operations": 500,
      "handlerP50Us": {
        "median": 488.459,
        "min": 393.917,
        "max": 551.667
      },
      "handlerP95Us": {
        "median": 2323.208,
        "min": 799,
        "max": 2711.875
      },
      "workloadCpuMs": {
        "median": 448.523,
        "min": 364.6,
        "max": 489.786
      },
      "sampledPeakRssMiB": {
        "median": 100.406,
        "min": 97.547,
        "max": 102.297
      },
      "accepted": 0,
      "losses": {
        "transport": 1500
      }
    }
  ],
  "runs": [
    {
      "repetition": 1,
      "mode": "baseline",
      "operations": 100,
      "workloadMs": 1979.163,
      "ratePerSecond": 50.526,
      "handlerUs": {
        "first": 141.083,
        "p50": 112.25,
        "p95": 468.041,
        "p99": 1145.042,
        "max": 1658.375
      },
      "workloadCpuMs": 49.509,
      "drainCpuMs": 0.009,
      "memoryMiB": {
        "initialRss": 53.234,
        "sampledPeakRss": 54.125,
        "workloadEndRss": 54.125,
        "afterDrainRss": 54.203,
        "initialHeap": 7.054,
        "sampledPeakHeap": 7.721
      },
      "queuePeak": {
        "active": 0,
        "waiting": 0,
        "pending": 0,
        "tracked": 0
      },
      "outstandingAtBusinessEnd": 0,
      "drainMs": 0.009,
      "events": {
        "attempted": 0,
        "accepted": 0,
        "losses": {},
        "transportFailures": {}
      },
      "collectorReceived": 0
    },
    {
      "repetition": 1,
      "mode": "normal",
      "operations": 100,
      "workloadMs": 1981.082,
      "ratePerSecond": 50.477,
      "handlerUs": {
        "first": 6129.625,
        "p50": 453.792,
        "p95": 1677.209,
        "p99": 5342.791,
        "max": 6129.625
      },
      "workloadCpuMs": 395.269,
      "drainCpuMs": 1.732,
      "memoryMiB": {
        "initialRss": 66.625,
        "sampledPeakRss": 116.281,
        "workloadEndRss": 116.297,
        "afterDrainRss": 116.328,
        "initialHeap": 10.735,
        "sampledPeakHeap": 19.832
      },
      "queuePeak": {
        "active": 1,
        "waiting": 2,
        "pending": 3,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 3,
      "drainMs": 2.41,
      "events": {
        "attempted": 300,
        "accepted": 300,
        "losses": {},
        "transportFailures": {
          "timeout": 0,
          "network": 0,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 300
    },
    {
      "repetition": 1,
      "mode": "slow",
      "operations": 100,
      "workloadMs": 1982.33,
      "ratePerSecond": 50.446,
      "handlerUs": {
        "first": 5832.041,
        "p50": 292.208,
        "p95": 940.209,
        "p99": 5832.041,
        "max": 6817.084
      },
      "workloadCpuMs": 91.155,
      "drainCpuMs": 161.036,
      "memoryMiB": {
        "initialRss": 66.578,
        "sampledPeakRss": 72.938,
        "workloadEndRss": 72.938,
        "afterDrainRss": 93.969,
        "initialHeap": 10.708,
        "sampledPeakHeap": 13.736
      },
      "queuePeak": {
        "active": 1,
        "waiting": 16,
        "pending": 17,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 17,
      "drainMs": 28118.599,
      "events": {
        "attempted": 300,
        "accepted": 14,
        "losses": {
          "capacity": 283,
          "expired": 1,
          "transport": 2
        },
        "transportFailures": {
          "timeout": 2,
          "network": 0,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 16
    },
    {
      "repetition": 1,
      "mode": "unavailable",
      "operations": 100,
      "workloadMs": 1979.316,
      "ratePerSecond": 50.522,
      "handlerUs": {
        "first": 5314.417,
        "p50": 393.917,
        "p95": 799,
        "p99": 5314.417,
        "max": 10409.541
      },
      "workloadCpuMs": 364.6,
      "drainCpuMs": 2.08,
      "memoryMiB": {
        "initialRss": 66.656,
        "sampledPeakRss": 98.375,
        "workloadEndRss": 98.375,
        "afterDrainRss": 98.734,
        "initialHeap": 10.713,
        "sampledPeakHeap": 24.861
      },
      "queuePeak": {
        "active": 1,
        "waiting": 2,
        "pending": 3,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 3,
      "drainMs": 2.578,
      "events": {
        "attempted": 300,
        "accepted": 0,
        "losses": {
          "transport": 300
        },
        "transportFailures": {
          "timeout": 0,
          "network": 300,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 300
    },
    {
      "repetition": 2,
      "mode": "normal",
      "operations": 100,
      "workloadMs": 1981.009,
      "ratePerSecond": 50.479,
      "handlerUs": {
        "first": 5514,
        "p50": 447.041,
        "p95": 1641.958,
        "p99": 3873.208,
        "max": 5514
      },
      "workloadCpuMs": 380.556,
      "drainCpuMs": 2.663,
      "memoryMiB": {
        "initialRss": 66.531,
        "sampledPeakRss": 115.797,
        "workloadEndRss": 115.797,
        "afterDrainRss": 115.844,
        "initialHeap": 10.739,
        "sampledPeakHeap": 19.728
      },
      "queuePeak": {
        "active": 1,
        "waiting": 2,
        "pending": 3,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 3,
      "drainMs": 3.792,
      "events": {
        "attempted": 300,
        "accepted": 300,
        "losses": {},
        "transportFailures": {
          "timeout": 0,
          "network": 0,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 300
    },
    {
      "repetition": 2,
      "mode": "slow",
      "operations": 100,
      "workloadMs": 1981.033,
      "ratePerSecond": 50.479,
      "handlerUs": {
        "first": 6094.417,
        "p50": 139.792,
        "p95": 259.625,
        "p99": 574.334,
        "max": 6094.417
      },
      "workloadCpuMs": 58.095,
      "drainCpuMs": 178.779,
      "memoryMiB": {
        "initialRss": 66.609,
        "sampledPeakRss": 72.828,
        "workloadEndRss": 72.828,
        "afterDrainRss": 93.219,
        "initialHeap": 10.718,
        "sampledPeakHeap": 13.707
      },
      "queuePeak": {
        "active": 1,
        "waiting": 16,
        "pending": 17,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 17,
      "drainMs": 28119.482,
      "events": {
        "attempted": 300,
        "accepted": 14,
        "losses": {
          "capacity": 283,
          "expired": 1,
          "transport": 2
        },
        "transportFailures": {
          "timeout": 2,
          "network": 0,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 16
    },
    {
      "repetition": 2,
      "mode": "unavailable",
      "operations": 100,
      "workloadMs": 1981.233,
      "ratePerSecond": 50.474,
      "handlerUs": {
        "first": 5689.291,
        "p50": 551.667,
        "p95": 2557.5,
        "p99": 5081.625,
        "max": 5689.291
      },
      "workloadCpuMs": 489.786,
      "drainCpuMs": 3.442,
      "memoryMiB": {
        "initialRss": 66.5,
        "sampledPeakRss": 102.297,
        "workloadEndRss": 102.297,
        "afterDrainRss": 102.688,
        "initialHeap": 10.775,
        "sampledPeakHeap": 28.159
      },
      "queuePeak": {
        "active": 1,
        "waiting": 2,
        "pending": 3,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 3,
      "drainMs": 4.295,
      "events": {
        "attempted": 300,
        "accepted": 0,
        "losses": {
          "transport": 300
        },
        "transportFailures": {
          "timeout": 0,
          "network": 300,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 300
    },
    {
      "repetition": 2,
      "mode": "baseline",
      "operations": 100,
      "workloadMs": 1981.167,
      "ratePerSecond": 50.475,
      "handlerUs": {
        "first": 167.583,
        "p50": 80.917,
        "p95": 333.042,
        "p99": 1567.625,
        "max": 3616.542
      },
      "workloadCpuMs": 42.591,
      "drainCpuMs": 0.024,
      "memoryMiB": {
        "initialRss": 53.391,
        "sampledPeakRss": 54.313,
        "workloadEndRss": 54.313,
        "afterDrainRss": 54.422,
        "initialHeap": 7.069,
        "sampledPeakHeap": 7.737
      },
      "queuePeak": {
        "active": 0,
        "waiting": 0,
        "pending": 0,
        "tracked": 0
      },
      "outstandingAtBusinessEnd": 0,
      "drainMs": 0.023,
      "events": {
        "attempted": 0,
        "accepted": 0,
        "losses": {},
        "transportFailures": {}
      },
      "collectorReceived": 0
    },
    {
      "repetition": 3,
      "mode": "slow",
      "operations": 100,
      "workloadMs": 1980.257,
      "ratePerSecond": 50.498,
      "handlerUs": {
        "first": 5385.917,
        "p50": 450.833,
        "p95": 2297.5,
        "p99": 4875.291,
        "max": 5385.917
      },
      "workloadCpuMs": 112.53,
      "drainCpuMs": 141.863,
      "memoryMiB": {
        "initialRss": 66.547,
        "sampledPeakRss": 72.938,
        "workloadEndRss": 72.938,
        "afterDrainRss": 92.813,
        "initialHeap": 10.741,
        "sampledPeakHeap": 13.738
      },
      "queuePeak": {
        "active": 1,
        "waiting": 16,
        "pending": 17,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 17,
      "drainMs": 28121.484,
      "events": {
        "attempted": 300,
        "accepted": 14,
        "losses": {
          "capacity": 283,
          "expired": 1,
          "transport": 2
        },
        "transportFailures": {
          "timeout": 2,
          "network": 0,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 16
    },
    {
      "repetition": 3,
      "mode": "unavailable",
      "operations": 100,
      "workloadMs": 1980.187,
      "ratePerSecond": 50.5,
      "handlerUs": {
        "first": 5637,
        "p50": 488.459,
        "p95": 2323.208,
        "p99": 5214.833,
        "max": 5637
      },
      "workloadCpuMs": 456.099,
      "drainCpuMs": 1.485,
      "memoryMiB": {
        "initialRss": 66.563,
        "sampledPeakRss": 102.094,
        "workloadEndRss": 102.109,
        "afterDrainRss": 102.531,
        "initialHeap": 10.717,
        "sampledPeakHeap": 28.141
      },
      "queuePeak": {
        "active": 1,
        "waiting": 2,
        "pending": 3,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 3,
      "drainMs": 1.991,
      "events": {
        "attempted": 300,
        "accepted": 0,
        "losses": {
          "transport": 300
        },
        "transportFailures": {
          "timeout": 0,
          "network": 300,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 300
    },
    {
      "repetition": 3,
      "mode": "baseline",
      "operations": 100,
      "workloadMs": 1980.034,
      "ratePerSecond": 50.504,
      "handlerUs": {
        "first": 147.708,
        "p50": 34.208,
        "p95": 59.5,
        "p99": 76.458,
        "max": 147.708
      },
      "workloadCpuMs": 20.857,
      "drainCpuMs": 0.01,
      "memoryMiB": {
        "initialRss": 53.672,
        "sampledPeakRss": 54.563,
        "workloadEndRss": 54.563,
        "afterDrainRss": 54.641,
        "initialHeap": 7.057,
        "sampledPeakHeap": 7.729
      },
      "queuePeak": {
        "active": 0,
        "waiting": 0,
        "pending": 0,
        "tracked": 0
      },
      "outstandingAtBusinessEnd": 0,
      "drainMs": 0.01,
      "events": {
        "attempted": 0,
        "accepted": 0,
        "losses": {},
        "transportFailures": {}
      },
      "collectorReceived": 0
    },
    {
      "repetition": 3,
      "mode": "normal",
      "operations": 100,
      "workloadMs": 1980.1,
      "ratePerSecond": 50.502,
      "handlerUs": {
        "first": 6167.5,
        "p50": 280.334,
        "p95": 540.959,
        "p99": 952.541,
        "max": 6167.5
      },
      "workloadCpuMs": 268.902,
      "drainCpuMs": 0.818,
      "memoryMiB": {
        "initialRss": 66.719,
        "sampledPeakRss": 115.703,
        "workloadEndRss": 115.703,
        "afterDrainRss": 115.766,
        "initialHeap": 10.637,
        "sampledPeakHeap": 19.822
      },
      "queuePeak": {
        "active": 1,
        "waiting": 2,
        "pending": 3,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 3,
      "drainMs": 1.208,
      "events": {
        "attempted": 300,
        "accepted": 300,
        "losses": {},
        "transportFailures": {
          "timeout": 0,
          "network": 0,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 300
    },
    {
      "repetition": 4,
      "mode": "unavailable",
      "operations": 100,
      "workloadMs": 1980.57,
      "ratePerSecond": 50.491,
      "handlerUs": {
        "first": 5794.5,
        "p50": 511.792,
        "p95": 2711.875,
        "p99": 5794.5,
        "max": 6465.167
      },
      "workloadCpuMs": 448.523,
      "drainCpuMs": 2.022,
      "memoryMiB": {
        "initialRss": 66.422,
        "sampledPeakRss": 100.406,
        "workloadEndRss": 100.406,
        "afterDrainRss": 100.797,
        "initialHeap": 10.681,
        "sampledPeakHeap": 27.89
      },
      "queuePeak": {
        "active": 1,
        "waiting": 2,
        "pending": 3,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 3,
      "drainMs": 3.11,
      "events": {
        "attempted": 300,
        "accepted": 0,
        "losses": {
          "transport": 300
        },
        "transportFailures": {
          "timeout": 0,
          "network": 300,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 300
    },
    {
      "repetition": 4,
      "mode": "baseline",
      "operations": 100,
      "workloadMs": 1980.751,
      "ratePerSecond": 50.486,
      "handlerUs": {
        "first": 142.959,
        "p50": 107.333,
        "p95": 428.833,
        "p99": 1224.209,
        "max": 2167.292
      },
      "workloadCpuMs": 46.755,
      "drainCpuMs": 0.029,
      "memoryMiB": {
        "initialRss": 53.719,
        "sampledPeakRss": 54.563,
        "workloadEndRss": 54.563,
        "afterDrainRss": 54.641,
        "initialHeap": 7.054,
        "sampledPeakHeap": 7.72
      },
      "queuePeak": {
        "active": 0,
        "waiting": 0,
        "pending": 0,
        "tracked": 0
      },
      "outstandingAtBusinessEnd": 0,
      "drainMs": 0.029,
      "events": {
        "attempted": 0,
        "accepted": 0,
        "losses": {},
        "transportFailures": {}
      },
      "collectorReceived": 0
    },
    {
      "repetition": 4,
      "mode": "normal",
      "operations": 100,
      "workloadMs": 1980.38,
      "ratePerSecond": 50.495,
      "handlerUs": {
        "first": 5875.25,
        "p50": 469.125,
        "p95": 4696.292,
        "p99": 6270.417,
        "max": 6918.917
      },
      "workloadCpuMs": 429.976,
      "drainCpuMs": 1.051,
      "memoryMiB": {
        "initialRss": 66.719,
        "sampledPeakRss": 117.672,
        "workloadEndRss": 117.672,
        "afterDrainRss": 117.719,
        "initialHeap": 10.712,
        "sampledPeakHeap": 19.794
      },
      "queuePeak": {
        "active": 1,
        "waiting": 2,
        "pending": 3,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 3,
      "drainMs": 1.359,
      "events": {
        "attempted": 300,
        "accepted": 300,
        "losses": {},
        "transportFailures": {
          "timeout": 0,
          "network": 0,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 300
    },
    {
      "repetition": 4,
      "mode": "slow",
      "operations": 100,
      "workloadMs": 1981.276,
      "ratePerSecond": 50.473,
      "handlerUs": {
        "first": 5762.875,
        "p50": 259.375,
        "p95": 1263.5,
        "p99": 5326.209,
        "max": 5762.875
      },
      "workloadCpuMs": 88.769,
      "drainCpuMs": 177.626,
      "memoryMiB": {
        "initialRss": 66.547,
        "sampledPeakRss": 73.078,
        "workloadEndRss": 73.078,
        "afterDrainRss": 89.938,
        "initialHeap": 10.733,
        "sampledPeakHeap": 13.717
      },
      "queuePeak": {
        "active": 1,
        "waiting": 16,
        "pending": 17,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 17,
      "drainMs": 28122.258,
      "events": {
        "attempted": 300,
        "accepted": 14,
        "losses": {
          "capacity": 283,
          "expired": 1,
          "transport": 2
        },
        "transportFailures": {
          "timeout": 2,
          "network": 0,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 16
    },
    {
      "repetition": 5,
      "mode": "baseline",
      "operations": 100,
      "workloadMs": 1979.406,
      "ratePerSecond": 50.52,
      "handlerUs": {
        "first": 161.959,
        "p50": 82.209,
        "p95": 216.25,
        "p99": 266.75,
        "max": 1731.208
      },
      "workloadCpuMs": 41.895,
      "drainCpuMs": 0.012,
      "memoryMiB": {
        "initialRss": 53.406,
        "sampledPeakRss": 54.281,
        "workloadEndRss": 54.281,
        "afterDrainRss": 54.375,
        "initialHeap": 7.015,
        "sampledPeakHeap": 7.684
      },
      "queuePeak": {
        "active": 0,
        "waiting": 0,
        "pending": 0,
        "tracked": 0
      },
      "outstandingAtBusinessEnd": 0,
      "drainMs": 0.012,
      "events": {
        "attempted": 0,
        "accepted": 0,
        "losses": {},
        "transportFailures": {}
      },
      "collectorReceived": 0
    },
    {
      "repetition": 5,
      "mode": "normal",
      "operations": 100,
      "workloadMs": 1981.33,
      "ratePerSecond": 50.471,
      "handlerUs": {
        "first": 5817.917,
        "p50": 502.292,
        "p95": 1696.916,
        "p99": 5817.917,
        "max": 6542.125
      },
      "workloadCpuMs": 375.77,
      "drainCpuMs": 6.656,
      "memoryMiB": {
        "initialRss": 66.531,
        "sampledPeakRss": 115.172,
        "workloadEndRss": 115.172,
        "afterDrainRss": 115.344,
        "initialHeap": 10.772,
        "sampledPeakHeap": 19.763
      },
      "queuePeak": {
        "active": 1,
        "waiting": 2,
        "pending": 3,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 3,
      "drainMs": 4.506,
      "events": {
        "attempted": 300,
        "accepted": 300,
        "losses": {},
        "transportFailures": {
          "timeout": 0,
          "network": 0,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 300
    },
    {
      "repetition": 5,
      "mode": "slow",
      "operations": 100,
      "workloadMs": 1980.607,
      "ratePerSecond": 50.49,
      "handlerUs": {
        "first": 5413.708,
        "p50": 346.75,
        "p95": 1170.292,
        "p99": 5413.708,
        "max": 5859.417
      },
      "workloadCpuMs": 104.048,
      "drainCpuMs": 199.783,
      "memoryMiB": {
        "initialRss": 66.438,
        "sampledPeakRss": 72.891,
        "workloadEndRss": 72.891,
        "afterDrainRss": 96.484,
        "initialHeap": 10.767,
        "sampledPeakHeap": 13.721
      },
      "queuePeak": {
        "active": 1,
        "waiting": 16,
        "pending": 17,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 17,
      "drainMs": 28121.962,
      "events": {
        "attempted": 300,
        "accepted": 14,
        "losses": {
          "capacity": 283,
          "expired": 1,
          "transport": 2
        },
        "transportFailures": {
          "timeout": 2,
          "network": 0,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 16
    },
    {
      "repetition": 5,
      "mode": "unavailable",
      "operations": 100,
      "workloadMs": 1980.311,
      "ratePerSecond": 50.497,
      "handlerUs": {
        "first": 5980.458,
        "p50": 438.042,
        "p95": 1253,
        "p99": 4320.375,
        "max": 5980.458
      },
      "workloadCpuMs": 386.59,
      "drainCpuMs": 2.918,
      "memoryMiB": {
        "initialRss": 66.406,
        "sampledPeakRss": 97.547,
        "workloadEndRss": 97.547,
        "afterDrainRss": 97.938,
        "initialHeap": 10.749,
        "sampledPeakHeap": 28.045
      },
      "queuePeak": {
        "active": 1,
        "waiting": 2,
        "pending": 3,
        "tracked": 100
      },
      "outstandingAtBusinessEnd": 3,
      "drainMs": 2.91,
      "events": {
        "attempted": 300,
        "accepted": 0,
        "losses": {
          "transport": 300
        },
        "transportFailures": {
          "timeout": 0,
          "network": 300,
          "responseCleanup": 0
        }
      },
      "collectorReceived": 300
    }
  ]
}
scripts/sdk-overhead-benchmark.mjs

SHA-256: b5243611aadd2eee379a822fb9ed591ccd428de8d378fe6a2057ab8cbe099894

import assert from 'node:assert/strict';
import { execFile } from 'node:child_process';
import { createHash, randomUUID } from 'node:crypto';
import { cp, mkdir, mkdtemp, readFile, realpath, rm, writeFile } from 'node:fs/promises';
import { createServer } from 'node:http';
import { arch, cpus, platform, release, tmpdir, totalmem } from 'node:os';
import path from 'node:path';
import { setTimeout as delay } from 'node:timers/promises';
import { fileURLToPath } from 'node:url';
import { promisify } from 'node:util';

// Local synthetic measurements only. No caller-supplied collector, credential,
// business data, external network, SDK override or concurrency override.
const execute = promisify(execFile);
const file = fileURLToPath(import.meta.url);
const root = path.resolve(path.dirname(file), '..');
const modes = ['baseline', 'normal', 'slow', 'unavailable'];
const settings = { repetitions: 5, operationsPerRun: 100, intervalMs: 20, eventsPerOperation: 3,
  slowResponseMs: 2100, sampleIntervalMs: 10, maxInFlight: 1, maxPending: 16,
  timeoutMs: 5000, maxObservationLifetimeMs: 30000, maxTrackedExecutions: 128, executionTtlMs: 300000 };
const round = (value, digits = 3) => Number(value.toFixed(digits));
const percentile = (values, p) => [...values].sort((a, b) => a - b)[Math.max(0, Math.ceil(values.length * p) - 1)];
const hash = value => createHash('sha256').update(value).digest('hex');
const businessInput = Buffer.from('local-synthetic-business-work:'.repeat(128));

async function worker() {
  const config = JSON.parse(process.env.NESTARC_BENCHMARK_CONFIG || 'null');
  assert(config && modes.includes(config.mode) && /^http:\/\/127\.0\.0\.1:\d+$/.test(config.origin));
  let reporter;
  if (config.mode !== 'baseline') {
    const { EvidenceReporter } = await import('@nestarc/evidence/node');
    reporter = new EvidenceReporter({ collectorUrl: config.origin, ingestToken: 'synthetic-benchmark-only',
      allowLoopback: true, maxTrackedExecutions: settings.maxTrackedExecutions });
  }
  const initialMemory = process.memoryUsage();
  const peak = { rss: initialMemory.rss, heapUsed: initialMemory.heapUsed,
    activeExports: 0, waitingExports: 0, pendingEmits: 0, trackedExecutions: 0 };
  function sample() {
    const memory = process.memoryUsage();
    peak.rss = Math.max(peak.rss, memory.rss); peak.heapUsed = Math.max(peak.heapUsed, memory.heapUsed);
    if (!reporter) return;
    const diagnostics = reporter.getDiagnostics(), queue = reporter.getQueueDiagnostics();
    for (const key of ['activeExports', 'pendingEmits', 'trackedExecutions']) peak[key] = Math.max(peak[key], diagnostics[key]);
    peak.waitingExports = Math.max(peak.waitingExports, queue.waitingExports);
    assert(diagnostics.activeExports <= 1 && diagnostics.pendingEmits <= 17 && queue.waitingExports <= 16);
    assert(diagnostics.trackedExecutions <= settings.maxTrackedExecutions);
  }
  const timer = setInterval(sample, settings.sampleIntervalMs);
  const calls = [], exports = [];
  const expected = hash(businessInput);
  let completed = 0;
  const cpuStart = process.cpuUsage(), started = performance.now();
  for (let index = 0; index < settings.operationsPerRun; index++) {
    const callStart = performance.now();
    // Baseline performs the same opaque-ID allocation and synthetic business
    // work. SDK mode additionally registers context, serializes its durable
    // representation and starts three best-effort observations, without await.
    const identity = { executionId: reporter ? reporter.createExecutionId() : randomUUID(),
      operationId: randomUUID(), tenantRef: randomUUID() };
    if (reporter) {
      JSON.stringify(reporter.createDeliveryContext(identity));
      exports.push(reporter.emit({ ...identity, stage: 'http.request', status: 'started' }));
    }
    const result = hash(businessInput);
    if (reporter) {
      exports.push(reporter.emit({ ...identity, stage: 'database.commit', status: 'succeeded' }));
      exports.push(reporter.emit({ ...identity, stage: 'outbox.write', status: 'succeeded' }));
    }
    calls.push((performance.now() - callStart) * 1000);
    assert.equal(result, expected); completed++;
    // Yield for local I/O, never for export completion. Absolute pacing avoids
    // hiding handler time by adding a full interval after a slow invocation.
    if (index + 1 < settings.operationsPerRun) await delay(Math.max(0, started + (index + 1) * settings.intervalMs - performance.now()));
  }
  const workloadMs = performance.now() - started, cpu = process.cpuUsage(cpuStart);
  sample(); clearInterval(timer);
  const endMemory = process.memoryUsage();
  const outstandingAtBusinessEnd = reporter?.getDiagnostics().pendingEmits ?? 0;
  const drainStart = performance.now(), drainCpuStart = process.cpuUsage();
  reporter?.close(); await reporter?.flush();
  const outcomes = await Promise.all(exports);
  const drainMs = performance.now() - drainStart, drainCpu = process.cpuUsage(drainCpuStart);
  const final = reporter?.getDiagnostics();
  if (reporter) assert(final.activeExports === 0 && final.pendingEmits === 0 && final.trackedExecutions === 0 && reporter.getQueueDiagnostics().waitingExports === 0);
  const losses = reporter?.getLossCounts() ?? {};
  const accepted = outcomes.filter(Boolean).length;
  assert.equal(accepted + Object.values(losses).reduce((sum, count) => sum + count, 0), exports.length);
  assert.equal(completed, settings.operationsPerRun);
  process.stdout.write(JSON.stringify({ mode: config.mode, operations: completed, workloadMs: round(workloadMs),
    ratePerSecond: round(completed * 1000 / workloadMs), handlerUs: { first: round(calls[0]), p50: round(percentile(calls, .5)),
      p95: round(percentile(calls, .95)), p99: round(percentile(calls, .99)), max: round(Math.max(...calls)) },
    workloadCpuMs: round((cpu.user + cpu.system) / 1000), drainCpuMs: round((drainCpu.user + drainCpu.system) / 1000),
    memoryMiB: { initialRss: round(initialMemory.rss / 2 ** 20), sampledPeakRss: round(peak.rss / 2 ** 20),
      workloadEndRss: round(endMemory.rss / 2 ** 20), afterDrainRss: round(process.memoryUsage().rss / 2 ** 20),
      initialHeap: round(initialMemory.heapUsed / 2 ** 20), sampledPeakHeap: round(peak.heapUsed / 2 ** 20) },
    queuePeak: { active: peak.activeExports, waiting: peak.waitingExports, pending: peak.pendingEmits, tracked: peak.trackedExecutions },
    outstandingAtBusinessEnd, drainMs: round(drainMs), events: { attempted: exports.length, accepted,
      losses: Object.fromEntries(Object.entries(losses).filter(([, count]) => count)),
      transportFailures: reporter?.getTransportFailureCounts() ?? {} } }));
}

async function collector(mode) {
  const counts = { received: 0, responseFinished: 0, duplicateIds: 0 };
  const ids = new Set(), timers = new Set();
  let invalid = false;
  const server = createServer((request, response) => {
    void (async () => {
      assert.equal(request.method, 'POST'); assert.equal(request.url, '/v1/evidence');
      assert.equal(request.headers.authorization, 'Bearer synthetic-benchmark-only');
      let bytes = 0; const chunks = [];
      for await (const chunk of request) { bytes += chunk.length; assert(bytes <= 8192); chunks.push(chunk); }
      const event = JSON.parse(Buffer.concat(chunks).toString('utf8'));
      const allowed = new Set(['schemaVersion', 'eventId', 'executionId', 'operationId', 'tenantRef', 'stage', 'status', 'occurredAt']);
      assert(Object.keys(event).every(key => allowed.has(key)));
      assert.equal(event.schemaVersion, 'nestarc.evidence.v1');
      assert(counts.received < settings.operationsPerRun * settings.eventsPerOperation);
      if (ids.has(event.eventId)) counts.duplicateIds++; ids.add(event.eventId); counts.received++;
      // A real socket reset, not a fake fetch promise. No response or persistence.
      if (mode === 'unavailable') { request.socket.destroy(); return; }
      response.on('finish', () => { counts.responseFinished++; });
      const send = () => { if (!response.destroyed) response.writeHead(202).end(); };
      if (mode === 'slow') {
        const timer = setTimeout(() => { timers.delete(timer); send(); }, settings.slowResponseMs);
        timers.add(timer); response.on('close', () => { clearTimeout(timer); timers.delete(timer); });
      } else send();
    })().catch(() => { invalid = true; response.destroy(); });
  });
  await new Promise((resolve, reject) => { server.once('error', reject); server.listen(0, '127.0.0.1', resolve); });
  return { origin: `http://127.0.0.1:${server.address().port}`, counts,
    close: async () => { for (const timer of timers) clearTimeout(timer); server.closeAllConnections();
      await new Promise(resolve => server.close(resolve)); assert.equal(invalid, false); } };
}

async function benchmark() {
  assert.equal(process.argv.length, 2, 'This local benchmark accepts no arguments');
  const { packageSdk } = await import('./sdk-package.mjs');
  const directory = await mkdtemp(path.join(tmpdir(), 'nestarc-sdk-overhead-'));
  try {
    const artifacts = path.join(directory, 'artifacts'), consumer = path.join(directory, 'consumer');
    await mkdir(consumer);
    const sdk = await packageSdk(artifacts);
    const releaseManifest = JSON.parse(await readFile(path.join(root, 'site/sdk-release.json'), 'utf8'));
    assert.equal(sdk.sha256, releaseManifest.archive.sha256, 'Measure the exact reviewed archive');
    const zodDirectory = path.dirname(fileURLToPath(import.meta.resolve('zod/package.json')));
    const zodVersion = JSON.parse(await readFile(path.join(zodDirectory, 'package.json'), 'utf8')).version;
    const cache = path.join(directory, 'cache');
    const { stdout: packed } = await execute('npm', ['pack', '--ignore-scripts', '--json', '--cache', cache, '--pack-destination', artifacts], { cwd: zodDirectory, timeout: 60000 });
    const [zod] = JSON.parse(packed);
    await writeFile(path.join(consumer, 'package.json'), JSON.stringify({ name: 'synthetic-sdk-benchmark', version: '1.0.0', private: true, type: 'module',
      dependencies: { '@nestarc/evidence': `file:${sdk.archive}`, zod: `file:${path.join(artifacts, zod.filename)}` } }));
    await execute('npm', ['install', '--offline', '--ignore-scripts', '--no-audit', '--no-fund', '--cache', cache], { cwd: consumer, timeout: 60000 });
    const installed = path.join(consumer, 'node_modules/@nestarc/evidence');
    assert(!(await realpath(installed)).startsWith(root));
    assert.equal(JSON.parse(await readFile(path.join(installed, 'package.json'), 'utf8')).version, '0.3.0');
    const child = path.join(consumer, 'benchmark.mjs'); await cp(file, child);
    const runs = [];
    for (let repetition = 0; repetition < settings.repetitions; repetition++) {
      // Rotate order to reduce a fixed baseline-first machine/time bias.
      for (let offset = 0; offset < modes.length; offset++) {
        const mode = modes[(repetition + offset) % modes.length], capture = await collector(mode);
        try {
          const { stdout } = await execute(process.execPath, [child, '--worker'], { cwd: consumer, timeout: 45000,
            env: { PATH: process.env.PATH, NESTARC_BENCHMARK_CONFIG: JSON.stringify({ mode, origin: capture.origin }) }, maxBuffer: 128 * 1024 });
          const run = JSON.parse(stdout);
          assert.equal(capture.counts.duplicateIds, 0);
          assert.equal(capture.counts.responseFinished, run.events.accepted);
          if (mode === 'baseline') assert.equal(capture.counts.received, 0);
          if (mode === 'normal') assert.equal(run.events.accepted, settings.operationsPerRun * settings.eventsPerOperation);
          if (mode === 'unavailable') assert.equal(run.events.accepted, 0);
          if (mode === 'slow') { assert(run.events.accepted > 0); assert(run.events.losses.capacity > 0); assert(run.outstandingAtBusinessEnd > 0); }
          runs.push({ repetition: repetition + 1, ...run, collectorReceived: capture.counts.received });
          process.stderr.write(`Synthetic SDK benchmark: ${mode} ${repetition + 1}/${settings.repetitions} completed\n`);
        } finally { await capture.close(); }
      }
    }
    const metric = (items, get) => { const values = items.map(get); return { median: round(percentile(values, .5)), min: round(Math.min(...values)), max: round(Math.max(...values)) }; };
    const summary = modes.map(mode => {
      const items = runs.filter(run => run.mode === mode);
      return { mode, runs: items.length, operations: items.reduce((sum, run) => sum + run.operations, 0),
        handlerP50Us: metric(items, run => run.handlerUs.p50), handlerP95Us: metric(items, run => run.handlerUs.p95),
        workloadCpuMs: metric(items, run => run.workloadCpuMs), sampledPeakRssMiB: metric(items, run => run.memoryMiB.sampledPeakRss),
        accepted: items.reduce((sum, run) => sum + run.events.accepted, 0),
        losses: items.reduce((all, run) => { for (const [key, count] of Object.entries(run.events.losses)) all[key] = (all[key] || 0) + count; return all; }, {}) };
    });
    const result = { schemaVersion: 'nestarc.sdk-benchmark.v1', measuredAt: new Date().toISOString(), scope: 'local-synthetic-handler',
      sourceCommit: (await execute('git', ['rev-parse', 'HEAD'], { cwd: root })).stdout.trim(),
      sdk: { version: '0.3.0', archive: sdk.filename, sha256: sdk.sha256, bytes: sdk.size, zodVersion, separateOfflineInstall: true },
      reproducibility: { script: 'scripts/sdk-overhead-benchmark.mjs', scriptSha256: hash(await readFile(file)),
        packagingScript: 'scripts/sdk-package.mjs', packagingScriptSha256: hash(await readFile(path.join(root, 'scripts/sdk-package.mjs'))),
        command: 'npm run build --workspace=@nestarc/evidence && node scripts/sdk-overhead-benchmark.mjs' },
      environment: { node: process.version, os: platform(), osRelease: release(), architecture: arch(), cpu: cpus()[0]?.model,
        logicalCpus: cpus().length, systemMemoryGiB: round(totalmem() / 2 ** 30), dedicatedHost: false },
      settings,
      method: ['Five fresh child processes per condition; rotating condition order; no forced GC or warmup.',
        '100 calls per process, paced at 20 ms. Same opaque IDs and SHA-256 synthetic business work in each condition.',
        'SDK additionally creates/serializes delivery context and emits three observations. Handler timing never awaits exports.',
        'Normal returns local HTTP 202; slow waits 2100 ms; unavailable resets the local socket without a response.',
        'CPU covers the child workload including exporter and measurement callbacks, excludes collector process and startup/import. Drain CPU is separate.',
        'RSS/heap are whole child-process samples every 10 ms during workload. Initial and post-drain samples are retained; no GC control.',
        'Summaries are medians and observed min/max across five per-run values, not confidence intervals. First/cold call remains in each latency distribution.'],
      limitations: ['Not HTTP API latency, database/BullMQ performance, HTTPS/WAN load or a customer benchmark.',
        'Slow collector intentionally saturates the finite queue; low handler time with lost observations is not full delivery performance.',
        'Import/startup latency, long-run memory, OS scheduling isolation and customer workload impact were not measured.',
        'Local 202 acceptance is not production authorization, durable storage or signup-to-first-Evidence proof. No zero-overhead claim.'],
      summary, runs };
    // Compact per-run records keep the public evidence small without discarding
    // sample counts, variation, acceptance or saturation losses.
    const lines = Object.entries(result).map(([key, value]) => `  ${JSON.stringify(key)}: ${['runs', 'summary'].includes(key)
      ? `[\n${value.map(item => `    ${JSON.stringify(item)}`).join(',\n')}\n  ]` : JSON.stringify(value)}`);
    await writeFile(path.join(root, 'site/sdk-benchmark.json'), `{\n${lines.join(',\n')}\n}\n`);
    process.stdout.write(JSON.stringify({ status: 'passed', output: 'site/sdk-benchmark.json', sha256: sdk.sha256, runs: runs.length, operations: runs.length * settings.operationsPerRun }) + '\n');
  } finally { await rm(directory, { recursive: true, force: true }); }
}

if (process.argv[2] === '--worker') await worker();
else await benchmark();
Plan a small staging trial