Skip to content

fix(sdk): bound the event queue and make the packages publishable - #5

Merged
macjayz merged 2 commits into
mainfrom
fix/sdk-delivery
Oct 29, 2026
Merged

macjayz merged 2 commits into
mainfrom
fix/sdk-delivery

Conversation

@macjayz

@macjayz macjayz commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Why

The README says a Heightproof outage cannot take down the monitored app. The SDK did not back that up:

  • HeightproofClient re-queued every failed batch with no limit, so an outage grew the host's memory without bound.
  • It also re-queued batches the server rejected (401, 400, 413). Re-queued at the head, a rejected batch blocked every later batch permanently.
  • Ingestion requests had no timeout.
  • @heightproof/web3 set request.auth.failed on every failed RPC call, adding auth_failure (+24) to ordinary RPC errors.

Changes

  • maxQueueSize (default 5000): oldest events dropped beyond it.
  • Retry only network errors, timeouts, 408, 429, 5xx; drop other 4xx.
  • requestTimeoutMs (default 5000) via AbortSignal.timeout.
  • onDrop(count, reason) and stats() so drops are visible to the host.
  • web3: only 401/403 count as auth failures.

Publishing readiness

@heightproof/shared, @heightproof/sdk-node, @heightproof/web3 now have descriptions, license, repository, exports, a files list (tarballs contain only dist, README, LICENSE), publishConfig.access: public, prepublishOnly build, and READMEs. express becomes an optional peer of sdk-node (it imports only Express types), so installing @heightproof/web3 no longer pulls in Express.

Verification

  • 4 new delivery tests (queue cap, retry on network/503/429, drop-and-continue on 401, request timeout); updated the web3 test that asserted the old auth flag. All suites pass; lint clean.
  • npm pack of all three, installed into an empty project outside the monorepo: 5 packages installed, no Express; 25 calls through the packed @heightproof/web3 all arrived in a running Heightproof.

HeightproofClient re-queued every failed batch with no limit, so a
Heightproof outage grew memory in the host application without bound, and
re-queued batches the server had rejected (401, 400, 413), which then sat at
the head of the queue and blocked every later batch for good. Requests also
had no timeout.

- Cap the in-memory queue (maxQueueSize, default 5000), dropping the oldest.
- Retry only network errors, timeouts, 408, 429 and 5xx; drop other 4xx.
- Abort ingestion requests after requestTimeoutMs (default 5000).
- Report drops through onDrop(count, reason) and stats().

@heightproof/web3 marked every failed RPC call as an auth failure, which
added the auth_failure signal (+24) to ordinary RPC errors. Only 401/403
count now.

Publishing: shared, sdk-node and web3 get descriptions, license, repository,
exports, a files list (dist, README, LICENSE only), publishConfig access
public, prepublishOnly build, and READMEs. express becomes an optional peer
of sdk-node, since it imports only Express types; installing
@heightproof/web3 no longer pulls in Express.
@macjayz
macjayz merged commit 49b3cdf into main Oct 29, 2026
8 checks passed
@macjayz
macjayz deleted the fix/sdk-delivery branch October 29, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant