Skip to content

fix(providers): emit trimmed extra header names and document adapter precedence - #154

Merged
patrickbrandao merged 1 commit into
mainfrom
fix/105-extra-headers-nits
Oct 14, 2026
Merged

patrickbrandao merged 1 commit into
mainfrom
fix/105-extra-headers-nits

Conversation

@patrickbrandao

Copy link
Copy Markdown
Owner

Part of #105. Items 1 to 3 already landed in #107 (adapter headers win with a case-insensitive merge, invalid values rejected, accept/accept-encoding blocked); items 4 and 5 in #106. This PR does the optional backend nits from the #107 review.

What changed

  • mergeExtraHeaders compared caller header names after trimming but emitted the untrimmed key. It now emits the trimmed name, and skips a blank name. (No current caller passes padded keys; the Playground sanitizer already trims.)
  • ForwardOptions.extraHeaders documents that the adapter's headers win, with anthropic-beta appended instead.

The dashboard nits (shared validators, popover help text, live region reset, row warnings, <Index> regression test) are frontend.

Tests

  • npx jest src/routing/proxy/__tests__/extra-headers src/playground: 225 passed (3 new cases).
  • Full backend unit run: see comment below / results in the report.
  • eslint on changed files: clean.

qa-docker: not needed (no observable change for current callers).

🤖 Generated with Claude Code

…precedence

Optional nits from the #107 review:
- mergeExtraHeaders compared caller header names after trimming but emitted
  the untrimmed key; it now emits the trimmed name and skips blank names.
- Document on ForwardOptions.extraHeaders that the adapter's headers win.

Part of #105.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@patrickbrandao

Copy link
Copy Markdown
Owner Author

Full backend unit run (npx jest --maxWorkers=4): 9085/9087 passed; the 2 failures were timing-sensitive tests under machine load (score-request-advanced 1000-requests-in-500ms, secret-reencryption), unrelated to this diff, and pass in isolation (30/30).

@patrickbrandao

Copy link
Copy Markdown
Owner Author

Review: #154 fix(providers): emit trimmed extra header names and document adapter precedence

Reviewed git diff origin/main...7d8497c.

Blockers: none. Should-fix: none.

Checks

  • packages/backend/src/routing/proxy/extra-headers.ts:44,57: the forwarded name is now the trimmed one, which is the name it was deduplicated by. A blank name is dropped. The adapter's headers (including auth) still win in any casing or padding, and anthropic-beta is still appended. A padded ' Authorization ' cannot override the adapter's credential, because the comparison was already trimmed.
  • The change is on the proxy hot path and unit tests cover it (padding, case collision, blank name). It does not change error handling.
  • No changeset. Acceptable: callers that send correct names see no change.
  • CI on 7d8497c: all green. Docker build (linux/amd64) failed on an npm ECONNRESET and passed on rerun.
  • qa-docker: not needed (agreed).

Head revisado: 7d8497c
Veredito: aprovado

@patrickbrandao
patrickbrandao marked this pull request as ready for review October 14, 2026 13:14
@patrickbrandao
patrickbrandao merged commit 9cc3903 into main Oct 14, 2026
20 of 21 checks passed
@patrickbrandao
patrickbrandao deleted the fix/105-extra-headers-nits branch October 14, 2026 13:14
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