Skip to content

Main convert - #388

Merged
JosephSamirL merged 9 commits into
mainfrom
main-convert
May 25, 2026
Merged

Main convert#388
JosephSamirL merged 9 commits into
mainfrom
main-convert

Conversation

@abbaseya

Copy link
Copy Markdown
Collaborator

No description provided.

abbaseya and others added 5 commits May 22, 2026 17:58
Update Serving API  - from backend PR #6633
Set the User-Agent header to ConvertAgent/1.0 on every outbound HTTP
request from HttpClient when running server-side. Browser path stays
untouched (browsers strip User-Agent per the W3C forbidden-header list,
and the browser's natural UA does not trigger isbot anyway).

Two branches updated:
- fetch path (server-with-fetch + browser): conditional on
  runtimeResult.runtime !== 'browser'
- old-nodejs path: unconditional (always server-side)

Why this matters: ApiManager's _trackingSource (network.source on the
wire) is customer-configurable and could be overridden via SDK config,
or via a CI VERSION-stamping pattern. Either could silently break the
metrics-endpoint's source-field bypass. The UA is now an SDK invariant:
applied at the lowest HTTP transport layer, after any caller-provided
headers, so neither config nor higher-layer headers can override it.

Matches the metrics-endpoint's isConvertAgentUA bypass that has been
in place since 2026-05-20. Source-field bypass at the metrics endpoint
stays in place as legacy fallback for already-deployed SDK versions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replaces the two hard-coded 'ConvertAgent/1.0' literals in the
http-client with a single named const declared near the imports, so
the value is named once and the two injection sites reference it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…r-agent

feat(utils): always announce as Convert SDK via ConvertAgent User-Agent
@abbaseya
abbaseya requested a review from a team May 25, 2026 14:10
@abbaseya abbaseya self-assigned this May 25, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors type definitions by removing redundant billing types and transitioning goal and trigger types from string literals to enums. It also updates the HttpClient to include a specific User-Agent header for server-side requests to identify SDK traffic. Feedback focuses on type incompatibilities introduced in the ConfigGoal union where specific subtypes use literals not present in the new enum, outdated documentation comments, and potential side effects in the HttpClient caused by mutating the caller's header object instead of cloning it.

Comment thread packages/types/src/config/types.gen.ts
Comment thread packages/types/src/config/types.gen.ts
Comment thread packages/types/src/config/types.gen.ts
Comment thread packages/utils/src/http-client.ts
Comment thread packages/utils/src/http-client.ts
@sonarqubecloud

Copy link
Copy Markdown

@JosephSamirL
JosephSamirL merged commit e8ce2c4 into main May 25, 2026
7 checks passed
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.

2 participants