chore(#47/#48): retry classification, missing failover tests, type-check tests#65
Merged
chore(#47/#48): retry classification, missing failover tests, type-check tests#65
Conversation
…check tests #47 follow-ups: - Make err.cause.code authoritative in isRetryableDownstreamError; keep "fetch failed" message-substring as a fallback. Adds explicit ECONNREFUSED/ECONNRESET/ENOTFOUND/EAI_AGAIN/ETIMEDOUT/EPIPE/UND_ERR_* coverage so the dispatcher does not depend on Node's exact error wording. - Tests: parameterized cause.code retryability, three-provider chain-order (a→b→c success on c), streaming headers-sent guard with a retryable mid-stream error (must NOT failover after bytes are sent — would corrupt SSE framing). - Enrich mux.failover_hop log: include from/to provider URLs and a richer reason field that surfaces cause.code on network errors. #48: - Add tsconfig.test.json that includes tests/**/*.ts; wire npm run check to run both. Surfaces existing fixture drift (RouteDecision missing providerId/fallbackProviderIds; Provider mocks missing protocols) — fixed in the same commit. Closes #47, #48 Note: prov.route.provider_id immutability + prov.effective.provider_id rename (item 3 in #47) intentionally deferred — needs coordination with the AgentWeave Routing tab (arniesaha/agentweave#164).
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.
Summary
Closes #47 and #48 in one PR (both touch the same testing/observability surface area introduced by #45/#46).
#47 — failover follow-ups
isRetryableDownstreamErrornow consultserr.cause.codeauthoritatively (undici wraps the real network error there) forECONNREFUSED,ECONNRESET,ENOTFOUND,EAI_AGAIN,ETIMEDOUT,EPIPE, andUND_ERR_*. The"fetch failed"message-substring check is kept as a fallback so we don't regress current behavior if Node ever stops attachingcause.cause.codeclassification (6 codes + AbortError + plain non-network error)a → b → c, primary and first fallback error, third succeeds, asserts call orderheadersSent), then errors withECONNRESET; dispatcher must not failover (would corrupt SSE), provider B is never calledmux.failover_hoplog: now includesfromUrl/toUrl(looked up fromconfig.providers) and areasonfield that surfacescause.codeon network errors (e.g.TypeError:ECONNRESET)#48 — type-check tests
tsconfig.test.jsonextends the base config withtests/**/*.tsincludednpm run checknow runstsc --noEmitagainst bothtsconfig.jsonandtsconfig.test.jsonroutefixture intests/downstream.test.tswas missingproviderId/fallbackProviderIds, and provider mocks intests/policy.test.tswere missingprotocolsDeferred from #47
Item 3 (rename
prov.route.provider_id→prov.effective.provider_idto keep the original route decision immutable) intentionally NOT in this PR — needs coordination with the AgentWeave Routing tab (arniesaha/agentweave#164) before flipping the schema.Testing
npm test→ 118/118 (was 107)npm run check→ clean (src + tests)