feat: traced fetch target + error category attrs - #31
Merged
Conversation
vreshch
marked this pull request as ready for review
August 13, 2026 12:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two more flat fields on every error line, lifted in the shared
captureErrorpath, soExpress, Next and MCP emitters gain them with no call-site change.
category(always present)Root cause bucketed into
timeout/connectivity/db/logic- the first split onan error dashboard: is it them, or is it us. Classified from the ROOT cause via the
existing
rootCauseOf, so aTypeError: fetch failedwrapper never hides theENOTFOUNDunderneath.
dbis a SQLSTATE (/^[0-9A-Z]{5}$/, e.g.23505,42P01) checked AFTER thetimeout/connectivity sets, so five-char codes like
EPIPEare not misread as SQLSTATE.Anything unrecognised is
logic: our bug until proven otherwise.target(absent when unknown)What an outbound call was reaching for:
POST api.test:8443/v1/memories/:id. ComputedBEFORE the await (the rejection itself never says which call failed) and attached by
tracedFetchas a non-enumerablefetchTarget, samedefinePropertypattern ascallSite, skipped if already present.targetOffinds it through any wrapping causechain. Host keeps its port; query, hash and credentials never appear.
Notes for review
routeFromUrlfromspan-names.tsrather than duplicating therule, so a target and its fetch span name group identically. Its id regex is hex
{8,},not the
>=12in the brief - one templating rule across the kit beat the exactthreshold. Strictly a superset: it templates more, never less.
errorFrameFieldsOMITS absent keys rather than emitting empty strings. The brief askedto mirror how 0.13 handles absent, and 0.13 omits (
cause/frameare dropped by pinowhen undefined) - so
targetomits too.categoryis the exception: always set.categoryOf,targetOf,fetchTargetOf,type ErrorCategory.npm run verifygreen: type-check, lint, format, 217 tests, build, dist smoke (extendedwith the new exports).