Skip to content

fix(node): wait for in-flight handled errors in flush (#851) - #860

Open
unjica wants to merge 1 commit into
developfrom
fix/tt-024-flush-waits-trackerror
Open

unjica wants to merge 1 commit into
developfrom
fix/tt-024-flush-waits-trackerror

Conversation

@unjica

@unjica unjica commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Base branch: develop

Summary

Refs #851 (TT-024). QA closes the issue after production verification.

trackError(error); await flush(); process.exit(1) previously exited before the handled error request completed. Core now tracks pending error promises in a Set, removes them on settlement, and waits for errors together with event batches for at most two seconds. Pending errors also count toward Node exit warnings. Fatal handler implementation and long-running batching are unchanged.

Bumps core 1.5.2 → 1.5.3 and node 1.4.2 → 1.4.3. Node retains workspace:*; the existing publisher rewrites it to the bumped core version. Updates the changelog, Node README, SDK guide and dashboard docs with the caught-error job example and timeout semantics.

How to test

  • pnpm install --frozen-lockfile: passed.
  • pnpm lint: passed.
  • pnpm test: 1,794 passed, 179 skipped, 0 failed (including 17 publish-guard tests).
  • pnpm build: passed, including API and dashboard production type checks.
  • Core and Node tsc --noEmit: passed.
  • Additional pnpm -r exec tsc --noEmit: failed with 112 errors in unchanged API test sources; production API build passes.
  • Delayed local mock ingest: handled error + awaited flush + process.exit(1) delivered 2/2. Core tests cover delayed error + batch delivery, deduplication, failed requests and two-second timeouts for both errors and batches. Existing fatal handler and long-running process tests pass.
  • git diff --check: passed.

Handoff limitation

The task runner explicitly prohibits build output in FILES_TO_COMMIT.txt. Generated tracked SDK dist changes therefore remain in the worktree but are excluded from that list. This repository's CI checks committed SDK dist against the build; that gate will need the tracked dist updates before this PR can be merge-ready. Do not merge on this handoff alone.

Checklist

  • Tests pass (DB integration tests retain their default skips; no API integration behavior changed)
  • Lint passes
  • Build succeeds
  • Changelog and documentation updated
  • No breaking API changes

Security / privacy

No ingest payload, authentication or privacy changes. No production requests made. No merge, release, tag, npm publication or deployment performed. Sanja publishes; QA must then run the published-package production acceptance check twice.

Track in-flight error requests alongside event batches and bound flush to two
seconds. Include pending errors in exit diagnostics, cover delayed delivery and
timeouts, and document the caught-error job pattern.

Bump core to 1.5.3 and node to 1.4.3 using existing workspace dependency handling.

Refs #851

This branch has not been deployed

No deployments
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